From 89f16552210049d11d626a8a484ec26ba5c5acac Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Wed, 11 Dec 2024 14:14:44 +0100 Subject: [PATCH] npm install ; npm run build:release --- package-lock.json | 21167 +++----- release/remotestorage.js | 67762 +------------------------ release/remotestorage.js.LICENSE.txt | 29 + release/remotestorage.js.map | 6 +- 4 files changed, 5975 insertions(+), 82989 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7577e0ed6..1dbb417cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "remotestoragejs", "version": "2.0.0-beta.7", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -39,7 +39,7 @@ "sinon": "^18.0.0", "ts-loader": "^8.4.0", "ts-node": "^10.9.2", - "typedoc": "^0.26.5", + "typedoc": "^0.27.4", "typedoc-plugin-markdown": "^4.2.3", "typedoc-vitepress-theme": "^1.0.1", "typescript": "^5.5.4", @@ -52,34 +52,34 @@ } }, "node_modules/@algolia/autocomplete-core": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.9.3.tgz", - "integrity": "sha512-009HdfugtGCdC4JdXUbVJClA0q0zh24yyePn+KUGk3rP7j8FEe/m5Yo/z65gn6nP/cM39PxpzqKrL7A6fP6PPw==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.17.7.tgz", + "integrity": "sha512-BjiPOW6ks90UKl7TwMv7oNQMnzU+t/wk9mgIDi6b1tXpUek7MW0lbNOUHpvam9pe3lVCf4xPFT+lK7s+e+fs7Q==", "dev": true, "dependencies": { - "@algolia/autocomplete-plugin-algolia-insights": "1.9.3", - "@algolia/autocomplete-shared": "1.9.3" + "@algolia/autocomplete-plugin-algolia-insights": "1.17.7", + "@algolia/autocomplete-shared": "1.17.7" } }, "node_modules/@algolia/autocomplete-plugin-algolia-insights": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.9.3.tgz", - "integrity": "sha512-a/yTUkcO/Vyy+JffmAnTWbr4/90cLzw+CC3bRbhnULr/EM0fGNvM13oQQ14f2moLMcVDyAx/leczLlAOovhSZg==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.17.7.tgz", + "integrity": "sha512-Jca5Ude6yUOuyzjnz57og7Et3aXjbwCSDf/8onLHSQgw1qW3ALl9mrMWaXb5FmPVkV3EtkD2F/+NkT6VHyPu9A==", "dev": true, "dependencies": { - "@algolia/autocomplete-shared": "1.9.3" + "@algolia/autocomplete-shared": "1.17.7" }, "peerDependencies": { "search-insights": ">= 1 < 3" } }, "node_modules/@algolia/autocomplete-preset-algolia": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.9.3.tgz", - "integrity": "sha512-d4qlt6YmrLMYy95n5TB52wtNDr6EgAIPH81dvvvW8UmuWRgxEtY0NJiPwl/h95JtG2vmRM804M0DSwMCNZlzRA==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.17.7.tgz", + "integrity": "sha512-ggOQ950+nwbWROq2MOCIL71RE0DdQZsceqrg32UqnhDz8FlO9rL8ONHNsI2R1MH0tkgVIDKI/D0sMiUchsFdWA==", "dev": true, "dependencies": { - "@algolia/autocomplete-shared": "1.9.3" + "@algolia/autocomplete-shared": "1.17.7" }, "peerDependencies": { "@algolia/client-search": ">= 4.9.1 < 6", @@ -87,264 +87,193 @@ } }, "node_modules/@algolia/autocomplete-shared": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.9.3.tgz", - "integrity": "sha512-Wnm9E4Ye6Rl6sTTqjoymD+l8DjSTHsHboVRYrKgEt8Q7UHm9nYbqhN/i0fhUYA3OAEH7WA8x3jfpnmJm3rKvaQ==", + "version": "1.17.7", + "resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.17.7.tgz", + "integrity": "sha512-o/1Vurr42U/qskRSuhBH+VKxMvkkUVTLU6WZQr+L5lGZZLYWyhdzWjW0iGXY7EkwRTjBqvN2EsR81yCTGV/kmg==", "dev": true, "peerDependencies": { "@algolia/client-search": ">= 4.9.1 < 6", "algoliasearch": ">= 4.9.1 < 6" } }, - "node_modules/@algolia/cache-browser-local-storage": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.24.0.tgz", - "integrity": "sha512-t63W9BnoXVrGy9iYHBgObNXqYXM3tYXCjDSHeNwnsc324r4o5UiVKUiAB4THQ5z9U5hTj6qUvwg/Ez43ZD85ww==", - "dev": true, - "dependencies": { - "@algolia/cache-common": "4.24.0" - } - }, - "node_modules/@algolia/cache-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.24.0.tgz", - "integrity": "sha512-emi+v+DmVLpMGhp0V9q9h5CdkURsNmFC+cOS6uK9ndeJm9J4TiqSvPYVu+THUP8P/S08rxf5x2P+p3CfID0Y4g==", - "dev": true - }, - "node_modules/@algolia/cache-in-memory": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.24.0.tgz", - "integrity": "sha512-gDrt2so19jW26jY3/MkFg5mEypFIPbPoXsQGQWAi6TrCPsNOSEYepBMPlucqWigsmEy/prp5ug2jy/N3PVG/8w==", - "dev": true, - "dependencies": { - "@algolia/cache-common": "4.24.0" - } - }, - "node_modules/@algolia/client-account": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.24.0.tgz", - "integrity": "sha512-adcvyJ3KjPZFDybxlqnf+5KgxJtBjwTPTeyG2aOyoJvx0Y8dUQAEOEVOJ/GBxX0WWNbmaSrhDURMhc+QeevDsA==", - "dev": true, - "dependencies": { - "@algolia/client-common": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "node_modules/@algolia/client-account/node_modules/@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", - "dev": true, - "dependencies": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "node_modules/@algolia/client-account/node_modules/@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", + "node_modules/@algolia/client-abtesting": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-abtesting/-/client-abtesting-5.17.0.tgz", + "integrity": "sha512-6+7hPdOEPfJqjWNYPRaVcttLLAtVqQyp1U7xBA1e1uSya1ivIr9FtS/GBr31mfvwk2N2yxV4W7itxuBtST8SWg==", "dev": true, "dependencies": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, "node_modules/@algolia/client-analytics": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.24.0.tgz", - "integrity": "sha512-y8jOZt1OjwWU4N2qr8G4AxXAzaa8DBvyHTWlHzX/7Me1LX8OayfgHexqrsL4vSBcoMmVw2XnVW9MhL+Y2ZDJXg==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-5.17.0.tgz", + "integrity": "sha512-nhJ+elL8h0Fts3xD9261zE2NvTs7nPMe9/SfAgMnWnbvxmuhJn7ZymnBsfm2VkTDb4Dy810ZAdBfzYEk7PjlAw==", "dev": true, "dependencies": { - "@algolia/client-common": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/@algolia/client-analytics/node_modules/@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", + "node_modules/@algolia/client-common": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.17.0.tgz", + "integrity": "sha512-9eC8i41/4xcQ/wI6fVM4LwC/ZGcDl3mToqjM0wTZzePWhXgRrdzOzqy/XgP+L1yYCDfkMFBZZsruNL5U8aEOag==", "dev": true, - "dependencies": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/@algolia/client-analytics/node_modules/@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", + "node_modules/@algolia/client-insights": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-insights/-/client-insights-5.17.0.tgz", + "integrity": "sha512-JL/vWNPUIuScsJubyC4aPHkpMftlK2qGqMiR2gy0rGvrh8v0w+ec6Ebq+efoFgE8wO55HJPTxiKeerE1DaQgvA==", "dev": true, "dependencies": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "node_modules/@algolia/client-common": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.1.0.tgz", - "integrity": "sha512-/PUtnEKpI9opioNfVKA5cBGQr0yulE3OWJCf9xWjJRFn+CvTAWkIecBWF9R+GpxeoaTqf3lWqDwYt8zEBXU11Q==", - "dev": true, - "peer": true, + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, "engines": { "node": ">= 14.0.0" } }, "node_modules/@algolia/client-personalization": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-4.24.0.tgz", - "integrity": "sha512-l5FRFm/yngztweU0HdUzz1rC4yoWCFo3IF+dVIVTfEPg906eZg5BOd1k0K6rZx5JzyyoP4LdmOikfkfGsKVE9w==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-5.17.0.tgz", + "integrity": "sha512-PkMUfww8QiRpyLkW4kzmc7IJDcW90sfUpnTgUOVlug5zEE2iv1ruHrJxdcNRTXkA0fgVpHu3oxXmCQL/ie2p7A==", "dev": true, "dependencies": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/@algolia/client-personalization/node_modules/@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", + "node_modules/@algolia/client-query-suggestions": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-query-suggestions/-/client-query-suggestions-5.17.0.tgz", + "integrity": "sha512-bokfgPN2whetLuiX9NB6C6d7Eke+dvHuASOPiB+jdI8Z6hacLHkcJjYeZY4Mppj0/oJ1KlyNivj+8WNpZeGhYA==", "dev": true, "dependencies": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, "node_modules/@algolia/client-search": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.1.0.tgz", - "integrity": "sha512-zPMO+iX+PnrQAX2tzW7ViletvkDNqLG1CI0k+9wXZtyVuQrPI6pxho/mANlC9QHmiMH3eR2KibQCOBMifOd61w==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.17.0.tgz", + "integrity": "sha512-alY3U79fiEvlR/0optgt1LZp9MfthXFnuEA4GYS81svozDOF61gdvxgBjt6SYtmskmTQQZDWVgakvUvvHrDzMw==", "dev": true, - "peer": true, "dependencies": { - "@algolia/client-common": "5.1.0", - "@algolia/requester-browser-xhr": "5.1.0", - "@algolia/requester-node-http": "5.1.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" }, "engines": { "node": ">= 14.0.0" } }, - "node_modules/@algolia/logger-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.24.0.tgz", - "integrity": "sha512-LLUNjkahj9KtKYrQhFKCzMx0BY3RnNP4FEtO+sBybCjJ73E8jNdaKJ/Dd8A/VA4imVHP5tADZ8pn5B8Ga/wTMA==", - "dev": true - }, - "node_modules/@algolia/logger-console": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.24.0.tgz", - "integrity": "sha512-X4C8IoHgHfiUROfoRCV+lzSy+LHMgkoEEU1BbKcsfnV0i0S20zyy0NLww9dwVHUWNfPPxdMU+/wKmLGYf96yTg==", - "dev": true, - "dependencies": { - "@algolia/logger-common": "4.24.0" - } - }, - "node_modules/@algolia/recommend": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-4.24.0.tgz", - "integrity": "sha512-P9kcgerfVBpfYHDfVZDvvdJv0lEoCvzNlOy2nykyt5bK8TyieYyiD0lguIJdRZZYGre03WIAFf14pgE+V+IBlw==", - "dev": true, - "dependencies": { - "@algolia/cache-browser-local-storage": "4.24.0", - "@algolia/cache-common": "4.24.0", - "@algolia/cache-in-memory": "4.24.0", - "@algolia/client-common": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/logger-common": "4.24.0", - "@algolia/logger-console": "4.24.0", - "@algolia/requester-browser-xhr": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/requester-node-http": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "node_modules/@algolia/recommend/node_modules/@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", - "dev": true, - "dependencies": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "node_modules/@algolia/recommend/node_modules/@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", + "node_modules/@algolia/ingestion": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@algolia/ingestion/-/ingestion-1.17.0.tgz", + "integrity": "sha512-9+mO+FbIpWz6izh1lXzON9BcenBKx4K3qVjSWiFFmL8nv+7b7zpGq++LXWr/Lxv/bZ9+D71Go6QVL6AZQhFOmg==", "dev": true, "dependencies": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/@algolia/recommend/node_modules/@algolia/requester-browser-xhr": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.24.0.tgz", - "integrity": "sha512-Z2NxZMb6+nVXSjF13YpjYTdvV3032YTBSGm2vnYvYPA6mMxzM3v5rsCiSspndn9rzIW4Qp1lPHBvuoKJV6jnAA==", + "node_modules/@algolia/monitoring": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@algolia/monitoring/-/monitoring-1.17.0.tgz", + "integrity": "sha512-Db7Qh51zVchmHa8d9nQFzTz2Ta6H2D4dpCnPj1giC/LE6UG/6e3iOnRxUzV+9ZR7etHKIrri2hbnkyNrvbqA9A==", "dev": true, "dependencies": { - "@algolia/requester-common": "4.24.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/@algolia/recommend/node_modules/@algolia/requester-node-http": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.24.0.tgz", - "integrity": "sha512-JF18yTjNOVYvU/L3UosRcvbPMGT9B+/GQWNWnenIImglzNVGpyzChkXLnrSf6uxwVNO6ESGu6oN8MqcGQcjQJw==", + "node_modules/@algolia/recommend": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-5.17.0.tgz", + "integrity": "sha512-7vM4+mfuLYbslj8+RNsP/ISwY7izu5HcQqQhA0l+q3EZRHF+PBeRaJXc3S1N0fTRxj8ystvwXWZPmjssB/xMLw==", "dev": true, "dependencies": { - "@algolia/requester-common": "4.24.0" + "@algolia/client-common": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, "node_modules/@algolia/requester-browser-xhr": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.1.0.tgz", - "integrity": "sha512-q2HpJBxVnvmk9UfphzjGgYSKDX/qXeuPmKlybYAX1dZ1/b8LBOt066JjS5L9CXuxW26Igi/PrdbzA9tL8jD3QQ==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.17.0.tgz", + "integrity": "sha512-bXSiPL2R08s4e9qvNZsJA0bXZeyWH2A5D4shS8kRT22b8GgjtnGTuoZmi6MxtKOEaN0lpHPbjvjXAO7UIOhDog==", "dev": true, - "peer": true, "dependencies": { - "@algolia/client-common": "5.1.0" + "@algolia/client-common": "5.17.0" }, "engines": { "node": ">= 14.0.0" } }, - "node_modules/@algolia/requester-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.24.0.tgz", - "integrity": "sha512-k3CXJ2OVnvgE3HMwcojpvY6d9kgKMPRxs/kVohrwF5WMr2fnqojnycZkxPoEg+bXm8fi5BBfFmOqgYztRtHsQA==", - "dev": true - }, - "node_modules/@algolia/requester-node-http": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.1.0.tgz", - "integrity": "sha512-P51ZDjoswq6OLVY+vES+EekkC0OPABKrJ9s4S1UKNTvggDIn38BoM9L25K7TEWEmjCG68EKDGSPUAt1q/dS0Uw==", + "node_modules/@algolia/requester-fetch": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-fetch/-/requester-fetch-5.17.0.tgz", + "integrity": "sha512-mjJ6Xv7TlDDoZ6RLKrEzH1ved3g2GAq3YJjb94bA639INfxK1HM8A/wCAFSZ8ye+QM/jppwauDXe1PENkuareQ==", "dev": true, - "peer": true, "dependencies": { - "@algolia/client-common": "5.1.0" + "@algolia/client-common": "5.17.0" }, "engines": { "node": ">= 14.0.0" } }, - "node_modules/@algolia/transporter": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.24.0.tgz", - "integrity": "sha512-86nI7w6NzWxd1Zp9q3413dRshDqAzSbsQjhcDhPIatEFiZrL1/TjnHL8S7jVKFePlIMzDsZWXAXwXzcok9c5oA==", + "node_modules/@algolia/requester-node-http": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.17.0.tgz", + "integrity": "sha512-Z2BXTR7BctlGPNig21k2wf/5nlH+96lU2UElzXTKiptyn2iM8lDU8zdO+dRll0AxQUxUGWEnkBysst9xL3S2cg==", "dev": true, "dependencies": { - "@algolia/cache-common": "4.24.0", - "@algolia/logger-common": "4.24.0", - "@algolia/requester-common": "4.24.0" + "@algolia/client-common": "5.17.0" + }, + "engines": { + "node": ">= 14.0.0" } }, "node_modules/@ampproject/remapping": { @@ -360,62 +289,44 @@ } }, "node_modules/@babel/code-frame": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", - "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", ->>>>>>> master + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, - "license": "MIT", "dependencies": { -<<<<<<< HEAD - "@babel/highlight": "^7.18.6" -======= - "@babel/highlight": "^7.24.7", + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", "picocolors": "^1.0.0" ->>>>>>> master }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { -<<<<<<< HEAD - "version": "7.19.3", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.0.tgz", - "integrity": "sha512-P4fwKI2mjEb3ZU5cnMJzvRsRKGBUcs8jvxIoRmr6ufAY9Xk2Bz7JubRTTivkw55c7WQJfTECeqYVa+HZ0FzREg==", ->>>>>>> master + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", + "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { -<<<<<<< HEAD - "version": "7.19.3", -======= - "version": "7.24.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.9.tgz", - "integrity": "sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg==", ->>>>>>> master + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", "dev": true, - "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.24.9", - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-module-transforms": "^7.24.9", - "@babel/helpers": "^7.24.8", - "@babel/parser": "^7.24.8", - "@babel/template": "^7.24.7", - "@babel/traverse": "^7.24.8", - "@babel/types": "^7.24.9", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -431,40 +342,26 @@ } }, "node_modules/@babel/generator": { -<<<<<<< HEAD - "version": "7.19.3", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.0.tgz", - "integrity": "sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw==", ->>>>>>> master + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.3.tgz", + "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", "dev": true, - "license": "MIT", "dependencies": { -<<<<<<< HEAD - "@babel/types": "^7.19.3", - "@jridgewell/gen-mapping": "^0.3.2", -======= - "@babel/types": "^7.25.0", + "@babel/parser": "^7.26.3", + "@babel/types": "^7.26.3", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", ->>>>>>> master - "jsesc": "^2.5.1" + "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { -<<<<<<< HEAD - "version": "0.3.2", -======= "version": "0.3.5", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", ->>>>>>> master "dev": true, - "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -475,54 +372,26 @@ } }, "node_modules/@babel/helper-annotate-as-pure": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz", - "integrity": "sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.24.7.tgz", - "integrity": "sha512-xZeCVVdwb4MsDBkkyZ64tReWYrLRHlMN72vP7Bdm3OUOuyFZExhsHUUnuWnm2/XOlAJzR0LfPpB56WXZn0X/lA==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz", + "integrity": "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-compilation-targets": { -<<<<<<< HEAD - "version": "7.19.3", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.8.tgz", - "integrity": "sha512-oU+UoqCHdp+nWVDkpldqIQL/i/bvAv53tRqLG/s+cOXxe66zOYLU7ar/Xs3LdmBihrUMEUhwu6dMZwbNOYDwvw==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", + "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.24.8", - "@babel/helper-validator-option": "^7.24.8", - "browserslist": "^4.23.1", + "@babel/compat-data": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" }, @@ -531,24 +400,17 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.8.tgz", - "integrity": "sha512-4f6Oqnmyp2PP3olgUMmOwC3akxSm5aBYraQ6YDdKy7NcAMkDECHWG0DEnV6M2UAkERgIBhYt8S27rURPg7SxWA==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.9.tgz", + "integrity": "sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-function-name": "^7.24.7", - "@babel/helper-member-expression-to-functions": "^7.24.8", - "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/helper-replace-supers": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/traverse": "^7.25.9", "semver": "^6.3.1" }, "engines": { @@ -559,18 +421,13 @@ } }, "node_modules/@babel/helper-create-regexp-features-plugin": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.25.0.tgz", - "integrity": "sha512-q0T+dknZS+L5LDazIP+02gEZITG5unzvb6yIjcmj5i0eFrs5ToBV2m2JGH4EsE/gtP8ygEGLGApBgRIZkTm7zg==", ->>>>>>> master + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.26.3.tgz", + "integrity": "sha512-G7ZRb40uUgdKOQqPLjfD12ZmGA54PzqDFUv2BKImnC9QIfGhIHKvVML0oN8IUiDq4iRqpq74ABpvOaerfWdong==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "regexpu-core": "^5.3.1", + "@babel/helper-annotate-as-pure": "^7.25.9", + "regexpu-core": "^6.2.0", "semver": "^6.3.1" }, "engines": { @@ -581,15 +438,10 @@ } }, "node_modules/@babel/helper-define-polyfill-provider": { -<<<<<<< HEAD - "version": "0.3.3", -======= - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.2.tgz", - "integrity": "sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ==", ->>>>>>> master + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.3.tgz", + "integrity": "sha512-HK7Bi+Hj6H+VTHA3ZvBis7V/6hu9QuTrnMXNybfUf2iiuU/N97I8VjB+KbhFF8Rld/Lx5MzoCwPCpPjfK+n8Cg==", "dev": true, - "license": "MIT", "dependencies": { "@babel/helper-compilation-targets": "^7.22.6", "@babel/helper-plugin-utils": "^7.22.5", @@ -601,116 +453,41 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/@babel/helper-environment-visitor": { -<<<<<<< HEAD - "version": "7.18.9", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-explode-assignable-expression": { - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", - "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", - "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { -<<<<<<< HEAD - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.18.6" -======= - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.7" ->>>>>>> master - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-member-expression-to-functions": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz", - "integrity": "sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz", + "integrity": "sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/traverse": "^7.24.8", - "@babel/types": "^7.24.8" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", - "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.0.tgz", - "integrity": "sha512-bIkOa2ZJYn7FHnepzr5iX9Kmz8FjIz4UKzJ9zhX3dnYuVW0xul9RuR3skBfoLu+FPTQw90EHW9rJsSZhyLQ3fQ==", ->>>>>>> master + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-simple-access": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "@babel/traverse": "^7.25.0" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -720,50 +497,35 @@ } }, "node_modules/@babel/helper-optimise-call-expression": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz", - "integrity": "sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz", + "integrity": "sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/types": "^7.24.7" + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", - "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-remap-async-to-generator": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.0.tgz", - "integrity": "sha512-NhavI2eWEIz/H9dbrG0TuOicDhNexze43i5z7lEqwYm0WEZVTwnPpA0EafUTP7+6/W79HWIP2cTe3Z5NiSTVpw==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.9.tgz", + "integrity": "sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-wrap-function": "^7.25.0", - "@babel/traverse": "^7.25.0" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-wrap-function": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -773,19 +535,14 @@ } }, "node_modules/@babel/helper-replace-supers": { -<<<<<<< HEAD - "version": "7.19.1", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.0.tgz", - "integrity": "sha512-q688zIvQVYtZu+i2PsdIu/uWGRpfxzr5WESsfpShfZECkO+d2o+WROWezCi/Q6kJ0tfPa5+pUGUlfx2HhrA3Bg==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.9.tgz", + "integrity": "sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-member-expression-to-functions": "^7.24.8", - "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/traverse": "^7.25.0" + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -794,171 +551,80 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/helper-simple-access": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", - "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-skip-transparent-expression-wrappers": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz", - "integrity": "sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", - "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz", + "integrity": "sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==", "dev": true, - "license": "MIT", "dependencies": { -<<<<<<< HEAD - "@babel/types": "^7.18.6" -======= - "@babel/types": "^7.24.7" ->>>>>>> master + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", - "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", - "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true, - "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-wrap-function": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.0.tgz", - "integrity": "sha512-s6Q1ebqutSiZnEjaofc/UKDyC4SbzV5n5SrA2Gq8UawLycr3i04f1dX4OzoQVnexm6aOCh37SQNYlJ/8Ku+PMQ==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.9.tgz", + "integrity": "sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/template": "^7.25.0", - "@babel/traverse": "^7.25.0", - "@babel/types": "^7.25.0" + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.8.tgz", - "integrity": "sha512-gV2265Nkcz7weJJfvDoAEVzC1e2OTDpkGbEsebse8koXUJUXPsCMi7sRo/+SPMuMZ9MtUPnGwITTnQnU5YjyaQ==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.8" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", - "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", ->>>>>>> master + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", + "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", "dev": true, - "license": "MIT", "dependencies": { -<<<<<<< HEAD - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" -======= - "@babel/helper-validator-identifier": "^7.24.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" ->>>>>>> master + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { -<<<<<<< HEAD - "version": "7.25.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz", - "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.0.tgz", - "integrity": "sha512-CzdIU9jdP0dg7HdyB+bHvDJGagUv+qtzZt5rYCWwW6tITNqV9odjp6Qu41gkG0ca5UfdDUWrKkiAnHHdGRnOrA==", ->>>>>>> master + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.3.tgz", + "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", "dev": true, "dependencies": { - "@babel/types": "^7.25.2" + "@babel/types": "^7.26.3" }, "bin": { "parser": "bin/babel-parser.js" @@ -967,20 +633,14 @@ "node": ">=6.0.0" } }, -<<<<<<< HEAD - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.18.6", -======= "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.0.tgz", - "integrity": "sha512-dG0aApncVQwAUJa8tP1VHTnmU67BeIQvKafd3raEx315H54FfkZSz3B/TT+33ZQAjatGJA79gZqTtqL5QZUKXw==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz", + "integrity": "sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.0" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -990,12 +650,12 @@ } }, "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.0.tgz", - "integrity": "sha512-Bm4bH2qsX880b/3ziJ8KD711LT7z4u8CFudmjqle65AZj/HNUFhEf90dqYv6O86buWvSBmeQDjv0Tn2aF/bIBA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.9.tgz", + "integrity": "sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1005,12 +665,12 @@ } }, "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.0.tgz", - "integrity": "sha512-lXwdNZtTmeVOOFtwM/WDe7yg1PL8sYhRk/XH0FzbR2HDQ0xC+EnQ/JHeoMYSavtU115tnUk0q9CDyq8si+LMAA==", + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.9.tgz", + "integrity": "sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1020,19 +680,14 @@ } }, "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.24.7.tgz", - "integrity": "sha512-+izXIbke1T33mY4MSNnrqhPXDz01WYhEf3yF5NbnUtkiNnm+XBZJl3kNfoK6NKmYlz/D07+l2GWVK/QfDkNCuQ==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/plugin-transform-optional-chaining": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1041,36 +696,41 @@ "@babel/core": "^7.13.0" } }, -<<<<<<< HEAD - "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.1", -======= "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.0.tgz", - "integrity": "sha512-tggFrk1AIShG/RUQbEwt2Tr/E+ObkfwrPjR6BjbRvsx24+PSjK8zrq0GWPNCjo8qpRx4DuJzlcvWJqlm+0h3kw==", ->>>>>>> master + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.9.tgz", + "integrity": "sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.0" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { -<<<<<<< HEAD + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.18.6", + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.26.0.tgz", + "integrity": "sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1079,44 +739,44 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-class-static-block": { - "version": "7.18.6", + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-class-static-block": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.12.0" + "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-dynamic-import": { + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.25.9.tgz", + "integrity": "sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1125,13 +785,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-json-strings": { - "version": "7.18.6", + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.9.tgz", + "integrity": "sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1140,13 +802,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.18.9", + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz", + "integrity": "sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1155,13 +819,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.25.9.tgz", + "integrity": "sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1170,13 +834,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.9.tgz", + "integrity": "sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1185,16 +849,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz", + "integrity": "sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1203,29 +865,34 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.26.0.tgz", + "integrity": "sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.12.0" } }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.18.9", + "node_modules/@babel/plugin-transform-classes": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz", + "integrity": "sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "globals": "^11.1.0" }, "engines": { "node": ">=6.9.0" @@ -1234,13 +901,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.18.6", + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.25.9.tgz", + "integrity": "sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/template": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1249,26 +917,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.18.6", + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz", + "integrity": "sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" }, -======= - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.21.0-placeholder-for-preset-env.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", - "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", - "dev": true, ->>>>>>> master "engines": { "node": ">=6.9.0" }, @@ -1276,94 +932,75 @@ "@babel/core": "^7.0.0-0" } }, -<<<<<<< HEAD - "node_modules/@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.25.9.tgz", + "integrity": "sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">=4" + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, -======= ->>>>>>> master - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.25.9.tgz", + "integrity": "sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", + "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.25.9.tgz", + "integrity": "sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-import-assertions": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.24.7.tgz", - "integrity": "sha512-Ec3NRUMoi8gskrkBe3fNmEQfxDvY8bgfQpz6jlk/41kX9eUjvpyqWU7PBP/pLAvMaSQjbMNKJmvX57jP+M6bPg==", ->>>>>>> master + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.26.3.tgz", + "integrity": "sha512-7CAHcQ58z2chuXPWblnn1K6rLDnDWieghSOEmqQsrBenH0P9InCUtOJYD89pvngljmZlJcz3fcmgYsXFNGa1ZQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1372,13 +1009,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-import-attributes": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.24.7.tgz", - "integrity": "sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A==", + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.25.9.tgz", + "integrity": "sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1387,101 +1024,76 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.25.9.tgz", + "integrity": "sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.9.tgz", + "integrity": "sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.25.9.tgz", + "integrity": "sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", + "node_modules/@babel/plugin-transform-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.9.tgz", + "integrity": "sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.25.9.tgz", + "integrity": "sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1490,12 +1102,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz", + "integrity": "sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1504,33 +1117,30 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-unicode-sets-regex": { - "version": "7.18.6", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", - "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", ->>>>>>> master + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.25.9.tgz", + "integrity": "sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.7.tgz", - "integrity": "sha512-Dt9LQs6iEY++gXUwY03DNFat5C2NbO48jj+j/bSAz6b3HgPs39qcPiYt77fDObIcFwj3/C2ICX9YMwGflUoSHQ==", + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.26.3.tgz", + "integrity": "sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1539,16 +1149,16 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-async-generator-functions": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.0.tgz", - "integrity": "sha512-uaIi2FdqzjpAMvVqvB51S42oC2JEVgh0LDsGfZVDysWE8LrJtQC2jvKmOqEYThKyB7bDEb7BP1GYWDm7tABA0Q==", + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.9.tgz", + "integrity": "sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-remap-async-to-generator": "^7.25.0", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/traverse": "^7.25.0" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1557,20 +1167,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-async-to-generator": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.24.7.tgz", - "integrity": "sha512-SQY01PcJfmQ+4Ash7NE+rpbLFbmqA2GPIgqzxfFTL4t1FKRq4zTms/7htKpoCUI9OcFYgzqfmCdH53s6/jn5fA==", ->>>>>>> master + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.25.9.tgz", + "integrity": "sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-remap-async-to-generator": "^7.24.7" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1579,38 +1183,29 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.24.7.tgz", - "integrity": "sha512-yO7RAz6EsVQDaBH18IDJcMB1HnrUn2FJ/Jslc/WtPPWcjhpUJXU/rjbwmluzp7v/ZzWcEhTMXELnnsz8djWDwQ==", ->>>>>>> master + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-transform-block-scoping": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.0.tgz", - "integrity": "sha512-yBQjYoOjXlFv9nlXb3f1casSHOZkWr29NX+zChVanLg5Nc157CrbEX9D7hxxtTpuFy7Q0YzmmWfJxzvps4kXrQ==", ->>>>>>> master + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.25.9.tgz", + "integrity": "sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1619,20 +1214,13 @@ "@babel/core": "^7.0.0-0" } }, -<<<<<<< HEAD - "node_modules/@babel/plugin-transform-classes": { - "version": "7.19.0", -======= - "node_modules/@babel/plugin-transform-class-properties": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.24.7.tgz", - "integrity": "sha512-vKbfawVYayKcSeSR5YYzzyXvsDFWU2mD8U5TFeXtbCPLFUqe7GyCgvO6XDHzje862ODrOwy6WCPmKeWHbCFJ4w==", ->>>>>>> master + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.25.9.tgz", + "integrity": "sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1641,35 +1229,30 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-class-static-block": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.24.7.tgz", - "integrity": "sha512-HMXK3WbBPpZQufbMG4B46A90PkuuhN9vBCb5T8+VAHqvAqvcLi+2cKoukcpmUYkszLhScU3l1iudhrks3DggRQ==", + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.25.9.tgz", + "integrity": "sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==", "dev": true, "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-class-static-block": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.12.0" + "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.0.tgz", - "integrity": "sha512-xyi6qjr/fYU304fiRwFbekzkqVJZ6A7hOjWZd+89FVcBqPV3S9Wuozz82xdpLspckeaafntbzglaW4pqpzvtSw==", + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.25.9.tgz", + "integrity": "sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==", "dev": true, "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-replace-supers": "^7.25.0", - "@babel/traverse": "^7.25.0", - "globals": "^11.1.0" + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1678,19 +1261,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-computed-properties": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.24.7.tgz", - "integrity": "sha512-25cS7v+707Gu6Ds2oY6tCkUwsJ9YIDbggd9+cu9jzzDgiNq7hR/8dkzxWfKWnTic26vsI3EsCXNd4iEB6e8esQ==", ->>>>>>> master + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz", + "integrity": "sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/template": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1699,18 +1277,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-destructuring": { -<<<<<<< HEAD - "version": "7.18.13", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.24.8.tgz", - "integrity": "sha512-36e87mfY8TnRxc7yc6M9g9gOB7rKgSahqkIKwLpz4Ppk2+zC2Cy1is0uwtuSG6AE4zlTOUa+7JGz9jCJGLqQFQ==", ->>>>>>> master + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz", + "integrity": "sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1719,19 +1292,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-dotall-regex": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.24.7.tgz", - "integrity": "sha512-ZOA3W+1RRTSWvyqcMJDLqbchh7U4NRGqwRfFSVbOLS/ePIP4vHB5e8T8eXcuqyN1QkgKyj5wuW0lcS85v4CrSw==", ->>>>>>> master + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1740,18 +1308,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-duplicate-keys": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.24.7.tgz", - "integrity": "sha512-JdYfXyCRihAe46jUIliuL2/s0x0wObgwwiGxw/UbgJBr20gQBThrokO4nYKgWkD7uBaqM7+9x5TU7NkExZJyzw==", ->>>>>>> master + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.25.9.tgz", + "integrity": "sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1760,30 +1323,31 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.0.tgz", - "integrity": "sha512-YLpb4LlYSc3sCUa35un84poXoraOiQucUTTu8X1j18JV+gNa8E0nyUf/CjZ171IRGr4jEguF+vzJU66QZhn29g==", + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.9.tgz", + "integrity": "sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==", "dev": true, "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.25.0", - "@babel/helper-plugin-utils": "^7.24.8" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-dynamic-import": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.24.7.tgz", - "integrity": "sha512-sc3X26PhZQDb3JhORmakcbvkeInvxz+A8oda99lj7J60QRuPZvNAk9wQlTBS1ZynelDrDmTU4pw1tyc5d5ZMUg==", + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.25.9.tgz", + "integrity": "sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1792,19 +1356,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.24.7.tgz", - "integrity": "sha512-Rqe/vSc9OYgDajNIK35u7ot+KeCoetqQYFXM4Epf7M7ez3lWlOjrDjrwMei6caCVhfdw+mIKD4cgdGNy5JQotQ==", ->>>>>>> master + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz", + "integrity": "sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1813,14 +1371,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-export-namespace-from": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.24.7.tgz", - "integrity": "sha512-v0K9uNYsPL3oXZ/7F9NNIbAj2jv1whUEtyA6aujhekLs56R++JDQuzRcP2/z4WX5Vg/c5lE9uWZA0/iUoFhLTA==", + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.25.9.tgz", + "integrity": "sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9", + "regenerator-transform": "^0.15.2" }, "engines": { "node": ">=6.9.0" @@ -1829,41 +1387,29 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-for-of": { -<<<<<<< HEAD - "version": "7.18.8", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.24.7.tgz", - "integrity": "sha512-wo9ogrDG1ITTTBsy46oGiN1dS9A7MROBTcYsfS8DtsImMkHk9JXJ3EWQM6X2SUw4x80uGPlwj0o00Uoc6nEE3g==", ->>>>>>> master + "node_modules/@babel/plugin-transform-regexp-modifiers": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.26.0.tgz", + "integrity": "sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-transform-function-name": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.0.tgz", - "integrity": "sha512-CQmfSnK14eYu82fu6GlCwRciHB7mp7oLN+DeyGDDwUr9cMwuSVviJKPXw/YcRYZdB1TdlLJWHHwXwnwD1WnCmQ==", ->>>>>>> master + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.25.9.tgz", + "integrity": "sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.0" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1872,14 +1418,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-json-strings": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.24.7.tgz", - "integrity": "sha512-2yFnBGDvRuxAaE/f0vfBKvtnvvqU8tGpMHqMNpTN2oWMKIR3NqFkjaAgGwawhqK/pIN2T3XdjGPdaG0vDhOBGw==", + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.25.9.tgz", + "integrity": "sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-json-strings": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1888,18 +1433,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-literals": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.24.7.tgz", - "integrity": "sha512-vcwCbb4HDH+hWi8Pqenwnjy+UiklO4Kt1vfspcQYFhJdpthSnW8XvWGyDZWKNVrVbVViI/S7K9PDJZiUmP2fYQ==", ->>>>>>> master + "node_modules/@babel/plugin-transform-spread": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.25.9.tgz", + "integrity": "sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1908,14 +1449,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-logical-assignment-operators": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.24.7.tgz", - "integrity": "sha512-4D2tpwlQ1odXmTEIFWy9ELJcZHqrStlzK/dAOWYyxX3zT0iXQB6banjgeOJQXzEc4S0E0a5A+hahxPaEFYftsw==", + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.25.9.tgz", + "integrity": "sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1924,18 +1464,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-member-expression-literals": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.24.7.tgz", - "integrity": "sha512-T/hRC1uqrzXMKLQ6UCwMT85S3EvqaBXDGf0FaMf4446Qx9vKwlghvee0+uuZcDUCZU5RuNi4781UQ7R308zzBw==", ->>>>>>> master + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.25.9.tgz", + "integrity": "sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1944,19 +1479,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-amd": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.24.7.tgz", - "integrity": "sha512-9+pB1qxV3vs/8Hdmz/CulFB8w2tuu6EB94JZFsjdqxQokwGa9Unap7Bo2gGBGIvPmDIVvQrom7r5m/TCDMURhg==", ->>>>>>> master + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.25.9.tgz", + "integrity": "sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1965,20 +1494,13 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-commonjs": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz", - "integrity": "sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==", ->>>>>>> master + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz", + "integrity": "sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-simple-access": "^7.24.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1987,21 +1509,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-systemjs": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.0.tgz", - "integrity": "sha512-YPJfjQPDXxyQWg/0+jHKj1llnY5f/R6a0p/vP4lPymxLu7Lvl4k2WMitqi08yxwQcCVUUdG9LCUj4TNEgAp3Jw==", ->>>>>>> master + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.25.9.tgz", + "integrity": "sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.25.0", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "@babel/traverse": "^7.25.0" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -2010,19 +1525,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-umd": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.24.7.tgz", - "integrity": "sha512-3aytQvqJ/h9z4g8AsKPLvD4Zqi2qT+L3j7XoFFu1XBlZWEl2/1kWnhmAbxpLgPrHSY0M6UA02jyTiwUVtiKR6A==", ->>>>>>> master + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.25.9.tgz", + "integrity": "sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -2031,19 +1541,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { -<<<<<<< HEAD - "version": "7.19.1", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.24.7.tgz", - "integrity": "sha512-/jr7h/EWeJtk1U/uz2jlsCioHkZk1JJZVcc8oQsJ1dUlaJD83f4/6Zeh2aHt9BIFokHIsSeDfhUmju0+1GPd6g==", ->>>>>>> master + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.9.tgz", + "integrity": "sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -2052,18 +1557,81 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-transform-new-target": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.24.7.tgz", - "integrity": "sha512-RNKwfRIXg4Ls/8mMTza5oPF5RkOW8Wy/WgMAp1/F1yZ8mMbtwXW+HDoJiOsagWrAhI5f57Vncrmr9XeT4CVapA==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "node_modules/@babel/preset-env": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.26.0.tgz", + "integrity": "sha512-H84Fxq0CQJNdPFT2DrfnylZ3cf5K43rGfWK4LJGPpjKHiZlk0/RzwEus3PDDZZg+/Er7lCA03MVacueUuXdzfw==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.9", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.9", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.9", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.25.9", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.9", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.26.0", + "@babel/plugin-syntax-import-attributes": "^7.26.0", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.25.9", + "@babel/plugin-transform-async-generator-functions": "^7.25.9", + "@babel/plugin-transform-async-to-generator": "^7.25.9", + "@babel/plugin-transform-block-scoped-functions": "^7.25.9", + "@babel/plugin-transform-block-scoping": "^7.25.9", + "@babel/plugin-transform-class-properties": "^7.25.9", + "@babel/plugin-transform-class-static-block": "^7.26.0", + "@babel/plugin-transform-classes": "^7.25.9", + "@babel/plugin-transform-computed-properties": "^7.25.9", + "@babel/plugin-transform-destructuring": "^7.25.9", + "@babel/plugin-transform-dotall-regex": "^7.25.9", + "@babel/plugin-transform-duplicate-keys": "^7.25.9", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-dynamic-import": "^7.25.9", + "@babel/plugin-transform-exponentiation-operator": "^7.25.9", + "@babel/plugin-transform-export-namespace-from": "^7.25.9", + "@babel/plugin-transform-for-of": "^7.25.9", + "@babel/plugin-transform-function-name": "^7.25.9", + "@babel/plugin-transform-json-strings": "^7.25.9", + "@babel/plugin-transform-literals": "^7.25.9", + "@babel/plugin-transform-logical-assignment-operators": "^7.25.9", + "@babel/plugin-transform-member-expression-literals": "^7.25.9", + "@babel/plugin-transform-modules-amd": "^7.25.9", + "@babel/plugin-transform-modules-commonjs": "^7.25.9", + "@babel/plugin-transform-modules-systemjs": "^7.25.9", + "@babel/plugin-transform-modules-umd": "^7.25.9", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-new-target": "^7.25.9", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.25.9", + "@babel/plugin-transform-numeric-separator": "^7.25.9", + "@babel/plugin-transform-object-rest-spread": "^7.25.9", + "@babel/plugin-transform-object-super": "^7.25.9", + "@babel/plugin-transform-optional-catch-binding": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9", + "@babel/plugin-transform-private-methods": "^7.25.9", + "@babel/plugin-transform-private-property-in-object": "^7.25.9", + "@babel/plugin-transform-property-literals": "^7.25.9", + "@babel/plugin-transform-regenerator": "^7.25.9", + "@babel/plugin-transform-regexp-modifiers": "^7.26.0", + "@babel/plugin-transform-reserved-words": "^7.25.9", + "@babel/plugin-transform-shorthand-properties": "^7.25.9", + "@babel/plugin-transform-spread": "^7.25.9", + "@babel/plugin-transform-sticky-regex": "^7.25.9", + "@babel/plugin-transform-template-literals": "^7.25.9", + "@babel/plugin-transform-typeof-symbol": "^7.25.9", + "@babel/plugin-transform-unicode-escapes": "^7.25.9", + "@babel/plugin-transform-unicode-property-regex": "^7.25.9", + "@babel/plugin-transform-unicode-regex": "^7.25.9", + "@babel/plugin-transform-unicode-sets-regex": "^7.25.9", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.10", + "babel-plugin-polyfill-corejs3": "^0.10.6", + "babel-plugin-polyfill-regenerator": "^0.6.1", + "core-js-compat": "^3.38.1", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -2072,4384 +1640,3979 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.7.tgz", - "integrity": "sha512-Ts7xQVk1OEocqzm8rHMXHlxvsfZ0cEF2yomUqpKENHWMF4zKk175Y4q8H5knJes6PgYad50uuRmt3UJuhBw8pQ==", + "node_modules/@babel/preset-modules": { + "version": "0.1.6-no-external-plugins", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/@babel/plugin-transform-numeric-separator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.24.7.tgz", - "integrity": "sha512-e6q1TiVUzvH9KRvicuxdBTUj4AdKSRwzIyFFnfnezpCfP2/7Qmbb8qbU2j7GODbl4JMkblitCQjKYUaX/qkkwA==", + "node_modules/@babel/runtime": { + "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": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.7.tgz", - "integrity": "sha512-4QrHAr0aXQCEFni2q4DqKLD31n2DL+RxcwnNjDFkSG0eNQ/xCavnRkfCUjsyqGC2OviNJvZOF/mQqZBw7i2C5Q==", + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "dev": true + }, + "node_modules/@babel/template": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", "dev": true, "dependencies": { - "@babel/helper-compilation-targets": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.24.7" + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-object-super": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.24.7.tgz", - "integrity": "sha512-A/vVLwN6lBrMFmMDmPPz0jnE6ZGx7Jq7d6sT/Ev4H65RER6pZ+kczlf1DthF5N0qaPHBsI7UXiE8Zy66nmAovg==", ->>>>>>> master + "node_modules/@babel/traverse": { + "version": "7.26.4", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", + "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-replace-supers": "^7.24.7" + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.3", + "@babel/parser": "^7.26.3", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.3", + "debug": "^4.3.1", + "globals": "^11.1.0" }, "engines": { "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-optional-catch-binding": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.24.7.tgz", - "integrity": "sha512-uLEndKqP5BfBbC/5jTwPxLh9kqPWWgzN/f8w6UwAIirAEqiIVJWWY312X72Eub09g5KF9+Zn7+hT7sDxmhRuKA==", + "node_modules/@babel/types": { + "version": "7.26.3", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.3.tgz", + "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-optional-chaining": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.8.tgz", - "integrity": "sha512-5cTOLSMs9eypEy8JUVvIKOu6NgvbJMnpG62VpIHrTmROdQ+L5mDAaI40g25k5vXti55JWNX5jCkq3HZxXBQANw==", + "node_modules/@bergos/jsonparse": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@bergos/jsonparse/-/jsonparse-1.4.2.tgz", + "integrity": "sha512-qUt0QNJjvg4s1zk+AuLM6s/zcsQ8MvGn7+1f0vPuxvpCYa08YtTryuDInngbEyW5fNGGYe2znKt61RMGd5HnXg==", + "engines": [ + "node >= 0.2.0" + ], + "dependencies": { + "buffer": "^6.0.3" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" + "@jridgewell/trace-mapping": "0.3.9" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=12" } }, - "node_modules/@babel/plugin-transform-parameters": { -<<<<<<< HEAD - "version": "7.18.8", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.24.7.tgz", - "integrity": "sha512-yGWW5Rr+sQOhK0Ot8hjDJuxU3XLRQGflvT4lhlSY0DFvdb3TwKaY26CJzHtYllU0vT9j58hc37ndFPsqT1SrzA==", ->>>>>>> master + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/@babel/plugin-transform-private-methods": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.24.7.tgz", - "integrity": "sha512-COTCOkG2hn4JKGEKBADkA8WNb35TGkkRbI5iT845dB+NyqgO8Hn+ajPbSnIQznneJTa3d30scb6iz/DhH8GsJQ==", + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.7", "dev": true, - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, + "license": "MIT", "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=10.0.0" } }, - "node_modules/@babel/plugin-transform-private-property-in-object": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.24.7.tgz", - "integrity": "sha512-9z76mxwnwFxMyxZWEgdgECQglF2Q7cFLm0kMf8pGwt+GSJsY0cONKj/UuO4bOH0w/uAel3ekS4ra5CEAyJRmDA==", + "node_modules/@docsearch/css": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.8.0.tgz", + "integrity": "sha512-pieeipSOW4sQ0+bE5UFC51AOZp9NGxg89wAlZ1BAQFaiRAGK1IKUaPQ0UGZeNctJXyqZ1UvBtOQh2HH+U5GtmA==", + "dev": true + }, + "node_modules/@docsearch/js": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.8.0.tgz", + "integrity": "sha512-PVuV629f5UcYRtBWqK7ID6vNL5647+2ADJypwTjfeBIrJfwPuHtzLy39hMGMfFK+0xgRyhTR0FZ83EkdEraBlg==", "dev": true, "dependencies": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@docsearch/react": "3.8.0", + "preact": "^10.0.0" } }, - "node_modules/@babel/plugin-transform-property-literals": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.24.7.tgz", - "integrity": "sha512-EMi4MLQSHfd2nrCqQEWxFdha2gBCqU4ZcCng4WBGZ5CJL4bBRW0ptdqqDdeirGZcpALazVVNJqRmsO8/+oNCBA==", ->>>>>>> master + "node_modules/@docsearch/react": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.8.0.tgz", + "integrity": "sha512-WnFK720+iwTVt94CxY3u+FgX6exb3BfN5kE9xUY6uuAH/9W/UFboBZFLlrw/zxFRHoHZCOXRtOylsXF+6LHI+Q==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" + "@algolia/autocomplete-core": "1.17.7", + "@algolia/autocomplete-preset-algolia": "1.17.7", + "@docsearch/css": "3.8.0", + "algoliasearch": "^5.12.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@types/react": ">= 16.8.0 < 19.0.0", + "react": ">= 16.8.0 < 19.0.0", + "react-dom": ">= 16.8.0 < 19.0.0", + "search-insights": ">= 1 < 3" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "search-insights": { + "optional": true + } } }, - "node_modules/@babel/plugin-transform-regenerator": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.7.tgz", - "integrity": "sha512-lq3fvXPdimDrlg6LWBoqj+r/DEWgONuwjuOuQCSYgRroXDH/IdM1C0IZf59fL5cHLpjEH/O6opIRBbqv7ELnuA==", ->>>>>>> master + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "regenerator-transform": "^0.15.2" - }, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=12" } }, - "node_modules/@babel/plugin-transform-reserved-words": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.24.7.tgz", - "integrity": "sha512-0DUq0pHcPKbjFZCfTss/pGkYMfy3vFWydkUBd9r0GHpIyfs2eCDENvqadMycRS9wZCXR41wucAfJHJmwA0UmoQ==", ->>>>>>> master + "node_modules/@eslint-community/eslint-utils": { + "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, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": ">=6.9.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, - "node_modules/@babel/plugin-transform-shorthand-properties": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.7.tgz", - "integrity": "sha512-KsDsevZMDsigzbA09+vacnLpmPH4aWjcZjXdyFKGzpplxhbeB4wYtury3vglQkg6KM/xEPKt73eCjPPf1PgXBA==", ->>>>>>> master + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@babel/plugin-transform-spread": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.24.7.tgz", - "integrity": "sha512-x96oO0I09dgMDxJaANcRyD4ellXFLLiWhuwDxKZX5g2rWP1bTPkBSwCYv96VDXVT1bD9aPj8tppr5ITIh8hBng==", ->>>>>>> master + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" }, "engines": { - "node": ">=6.9.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@babel/plugin-transform-sticky-regex": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.24.7.tgz", - "integrity": "sha512-kHPSIJc9v24zEml5geKg9Mjx5ULpfncj0wRpYtxbvKyTtHCYDkVE3aHQ03FrpEo4gEe2vrJJS1Y9CJTaThA52g==", ->>>>>>> master + "node_modules/@eslint/eslintrc/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/@babel/plugin-transform-template-literals": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.7.tgz", - "integrity": "sha512-AfDTQmClklHCOLxtGoP7HkeMw56k1/bTQjwsfhL6pppo/M4TOBSq+jjBUBLmV/4oeFg4GWMavIl44ZeCtmmZTw==", ->>>>>>> master + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" + "type-fest": "^0.20.2" }, "engines": { - "node": ">=6.9.0" + "node": ">=8" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@babel/plugin-transform-typeof-symbol": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.24.8.tgz", - "integrity": "sha512-adNTUpDCVnmAE58VEqKlAA6ZBlNkMnWD0ZcW76lyNFN3MJniyGFZfNwERVk8Ap56MCnXztmDr19T4mPTztcuaw==", ->>>>>>> master + "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.8" - }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@babel/plugin-transform-unicode-escapes": { -<<<<<<< HEAD - "version": "7.18.10", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.24.7.tgz", - "integrity": "sha512-U3ap1gm5+4edc2Q/P+9VrBNhGkfnf+8ZqppY71Bo/pzZmXhhLdqgaUl6cuB07O1+AQJtCLfaOmswiNbSQ9ivhw==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.7" - }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=14" } }, - "node_modules/@babel/plugin-transform-unicode-property-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.24.7.tgz", - "integrity": "sha512-uH2O4OV5M9FZYQrwc7NdVmMxQJOCCzFeYudlZSzUAHRFeOujQefa92E74TQDVskNHCzOXoigEuoyzHDhaEaK5w==", + "node_modules/@gerrit0/mini-shiki": { + "version": "1.24.3", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-1.24.3.tgz", + "integrity": "sha512-odxt2MTJvlT5NUmGOPXz5OW4D8SFL2+KeXBkmjVtdOXfA5aRZX6jgP/17jp6wu2r3KdW0wx3Bk5HDehgeV1Yng==", "dev": true, "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@shikijs/engine-oniguruma": "^1.24.2", + "@shikijs/types": "^1.24.2", + "@shikijs/vscode-textmate": "^9.3.0" } }, - "node_modules/@babel/plugin-transform-unicode-regex": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.24.7.tgz", - "integrity": "sha512-hlQ96MBZSAXUq7ltkjtu3FJCCSMx/j629ns3hA3pXnBXjanNP0LHi+JpPeA81zaWgVK1VGH95Xuy7u0RyQ8kMg==", ->>>>>>> master + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" }, "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" + "node": ">=10.10.0" } }, -<<<<<<< HEAD - "node_modules/@babel/preset-env": { - "version": "7.19.3", -======= - "node_modules/@babel/plugin-transform-unicode-sets-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.24.7.tgz", - "integrity": "sha512-2G8aAvF4wy1w/AGZkemprdGMRg5o6zPNhbHVImRz3lss55TYCBd6xStN19rt8XJHq20sqV0JbyWjOWwQRwV/wg==", ->>>>>>> master + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - }, + "license": "Apache-2.0", "engines": { - "node": ">=6.9.0" + "node": ">=12.22" }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@babel/preset-env": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.25.0.tgz", - "integrity": "sha512-vYAA8PrCOeZfG4D87hmw1KJ1BPubghXP1e2MacRFwECGNKL76dkA38JEwYllbvQCpf/kLxsTtir0b8MtxKoVCw==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.25.0", - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-validator-option": "^7.24.8", - "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.0", - "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.0", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.0", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.24.7", - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.0", - "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.24.7", - "@babel/plugin-syntax-import-attributes": "^7.24.7", - "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", - "@babel/plugin-transform-arrow-functions": "^7.24.7", - "@babel/plugin-transform-async-generator-functions": "^7.25.0", - "@babel/plugin-transform-async-to-generator": "^7.24.7", - "@babel/plugin-transform-block-scoped-functions": "^7.24.7", - "@babel/plugin-transform-block-scoping": "^7.25.0", - "@babel/plugin-transform-class-properties": "^7.24.7", - "@babel/plugin-transform-class-static-block": "^7.24.7", - "@babel/plugin-transform-classes": "^7.25.0", - "@babel/plugin-transform-computed-properties": "^7.24.7", - "@babel/plugin-transform-destructuring": "^7.24.8", - "@babel/plugin-transform-dotall-regex": "^7.24.7", - "@babel/plugin-transform-duplicate-keys": "^7.24.7", - "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.0", - "@babel/plugin-transform-dynamic-import": "^7.24.7", - "@babel/plugin-transform-exponentiation-operator": "^7.24.7", - "@babel/plugin-transform-export-namespace-from": "^7.24.7", - "@babel/plugin-transform-for-of": "^7.24.7", - "@babel/plugin-transform-function-name": "^7.25.0", - "@babel/plugin-transform-json-strings": "^7.24.7", - "@babel/plugin-transform-literals": "^7.24.7", - "@babel/plugin-transform-logical-assignment-operators": "^7.24.7", - "@babel/plugin-transform-member-expression-literals": "^7.24.7", - "@babel/plugin-transform-modules-amd": "^7.24.7", - "@babel/plugin-transform-modules-commonjs": "^7.24.8", - "@babel/plugin-transform-modules-systemjs": "^7.25.0", - "@babel/plugin-transform-modules-umd": "^7.24.7", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.24.7", - "@babel/plugin-transform-new-target": "^7.24.7", - "@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7", - "@babel/plugin-transform-numeric-separator": "^7.24.7", - "@babel/plugin-transform-object-rest-spread": "^7.24.7", - "@babel/plugin-transform-object-super": "^7.24.7", - "@babel/plugin-transform-optional-catch-binding": "^7.24.7", - "@babel/plugin-transform-optional-chaining": "^7.24.8", - "@babel/plugin-transform-parameters": "^7.24.7", - "@babel/plugin-transform-private-methods": "^7.24.7", - "@babel/plugin-transform-private-property-in-object": "^7.24.7", - "@babel/plugin-transform-property-literals": "^7.24.7", - "@babel/plugin-transform-regenerator": "^7.24.7", - "@babel/plugin-transform-reserved-words": "^7.24.7", - "@babel/plugin-transform-shorthand-properties": "^7.24.7", - "@babel/plugin-transform-spread": "^7.24.7", - "@babel/plugin-transform-sticky-regex": "^7.24.7", - "@babel/plugin-transform-template-literals": "^7.24.7", - "@babel/plugin-transform-typeof-symbol": "^7.24.8", - "@babel/plugin-transform-unicode-escapes": "^7.24.7", - "@babel/plugin-transform-unicode-property-regex": "^7.24.7", - "@babel/plugin-transform-unicode-regex": "^7.24.7", - "@babel/plugin-transform-unicode-sets-regex": "^7.24.7", - "@babel/preset-modules": "0.1.6-no-external-plugins", - "babel-plugin-polyfill-corejs2": "^0.4.10", - "babel-plugin-polyfill-corejs3": "^0.10.4", - "babel-plugin-polyfill-regenerator": "^0.6.1", - "core-js-compat": "^3.37.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true }, - "node_modules/@babel/preset-modules": { -<<<<<<< HEAD - "version": "0.1.5", -======= - "version": "0.1.6-no-external-plugins", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", - "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", ->>>>>>> master + "node_modules/@iconify-json/simple-icons": { + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@iconify-json/simple-icons/-/simple-icons-1.2.15.tgz", + "integrity": "sha512-4vxMQwkjsbjVIVGsPjKBnLMqAXu4wSlHmeN35KaJLK0UJNUj/ef6ES5c4bT/U4bSZjD2oZqOjOWTPD+HCrSUkg==", "dev": true, - "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + "@iconify/types": "*" } }, - "node_modules/@babel/regjsgen": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", - "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", + "node_modules/@iconify/types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", + "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", "dev": true }, - "node_modules/@babel/runtime": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.8.tgz", - "integrity": "sha512-5F7SDGs1T72ZczbRwbGO9lQi0NLjQxzl6i4lJxLxfW9U5UluCSyEJeniWvnhl3/euNiqQVbo8zruhsDfid0esA==", ->>>>>>> master - "dev": true, - "license": "MIT", + "node_modules/@inrupt/oidc-client": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/@inrupt/oidc-client/-/oidc-client-1.11.6.tgz", + "integrity": "sha512-1rCTk1T6pdm/7gKozutZutk7jwmYBADlnkGGoI5ypke099NOCa5KFXjkQpbjsps0PRkKZ+0EaR70XN5+xqmViA==", "dependencies": { - "regenerator-runtime": "^0.14.0" + "acorn": "^7.4.1", + "base64-js": "^1.5.1", + "core-js": "^3.8.3", + "crypto-js": "^4.0.0", + "serialize-javascript": "^4.0.0" + } + }, + "node_modules/@inrupt/oidc-client-ext": { + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/@inrupt/oidc-client-ext/-/oidc-client-ext-1.17.5.tgz", + "integrity": "sha512-vYnYbNW+EwDeAkzLzLF77PLXVeajhZ0IqocC5M2xM9aGc0JgRIy8lnrwxrV/VLf2AXRig9Aqlv/RmLY1VTz2eg==", + "dependencies": { + "@inrupt/oidc-client": "^1.11.6", + "@inrupt/solid-client-authn-core": "^1.17.5", + "@inrupt/universal-fetch": "^1.0.1", + "jose": "^4.15.4", + "uuid": "^9.0.1" + } + }, + "node_modules/@inrupt/oidc-client/node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "bin": { + "acorn": "bin/acorn" }, "engines": { - "node": ">=6.9.0" + "node": ">=0.4.0" } }, - "node_modules/@babel/runtime/node_modules/regenerator-runtime": { -<<<<<<< HEAD - "version": "0.13.9", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/template": { - "version": "7.18.10", -======= - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "dev": true + "node_modules/@inrupt/oidc-client/node_modules/core-js": { + "version": "3.39.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.39.0.tgz", + "integrity": "sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==", + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } }, - "node_modules/@babel/template": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", - "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", ->>>>>>> master - "dev": true, - "license": "MIT", + "node_modules/@inrupt/solid-client": { + "version": "1.30.2", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client/-/solid-client-1.30.2.tgz", + "integrity": "sha512-8Lwh0ZC1d9c939O+dAsT5oheSKIBX5A0uk7fhaJ0qDBFZGKT/jnIy6TrBpvn/nYZAvCA2XSvZHgBfEX7r0FCKw==", "dependencies": { -<<<<<<< HEAD - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" -======= - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.25.0", - "@babel/types": "^7.25.0" ->>>>>>> master + "@inrupt/universal-fetch": "^1.0.1", + "@rdfjs/dataset": "^1.1.0", + "@types/rdfjs__dataset": "^1.0.4", + "buffer": "^6.0.3", + "http-link-header": "^1.1.0", + "jsonld-context-parser": "^2.3.0", + "jsonld-streaming-parser": "^3.2.0", + "n3": "^1.10.0", + "uuid": "^9.0.0" }, "engines": { - "node": ">=6.9.0" + "node": "^16.0.0 || ^18.0.0 || ^20.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" } }, - "node_modules/@babel/traverse": { -<<<<<<< HEAD - "version": "7.19.3", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.0.tgz", - "integrity": "sha512-ubALThHQy4GCf6mbb+5ZRNmLLCI7bJ3f8Q6LHBSRlSKSWj5a7dSUzJBLv3VuIhFrFPgjF4IzPF567YG/HSCdZA==", ->>>>>>> master - "dev": true, - "license": "MIT", + "node_modules/@inrupt/solid-client-authn-browser": { + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-browser/-/solid-client-authn-browser-1.17.5.tgz", + "integrity": "sha512-zjyXPmKACp7syNsctQfkFhYCwEQ5QoTStLMbBFhtqJAsoWpo+d/awI1nljTDKxlJtYnvEoYjl2pM2aZMJ7mtew==", "dependencies": { -<<<<<<< HEAD - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.3", - "@babel/types": "^7.19.3", - "debug": "^4.1.0", -======= - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.25.0", - "@babel/parser": "^7.25.0", - "@babel/template": "^7.25.0", - "@babel/types": "^7.25.0", - "debug": "^4.3.1", ->>>>>>> master - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" + "@inrupt/oidc-client-ext": "^1.17.5", + "@inrupt/solid-client-authn-core": "^1.17.5", + "@inrupt/universal-fetch": "^1.0.2", + "events": "^3.3.0", + "jose": "^4.15.4", + "uuid": "^9.0.1" } }, - "node_modules/@babel/types": { -<<<<<<< HEAD - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.2.tgz", - "integrity": "sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.0.tgz", - "integrity": "sha512-LcnxQSsd9aXOIgmmSpvZ/1yo46ra2ESYyqLcryaBZOghxy5qqOBjvCWP5JfkI8yl9rlxRgdLTTMCQQRcN2hdCg==", ->>>>>>> master - "dev": true, + "node_modules/@inrupt/solid-client-authn-core": { + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/@inrupt/solid-client-authn-core/-/solid-client-authn-core-1.17.5.tgz", + "integrity": "sha512-g3WShcPAqGuarPYlw12vUCo+et4elQLI+WYcHkCHGLuQQFF73r2iTicuKpkydQdIrZ5AZgxhwr315jmkx/vcFQ==", "dependencies": { - "@babel/helper-string-parser": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" + "@inrupt/universal-fetch": "^1.0.1", + "events": "^3.3.0", + "jose": "^4.15.4", + "uuid": "^9.0.1" }, "engines": { - "node": ">=6.9.0" + "node": "^16.0.0 || ^18.0.0 || ^20.0.0" } }, - "node_modules/@bergos/jsonparse": { - "version": "1.4.1", - "engines": [ - "node >= 0.2.0" - ], - "license": "MIT", + "node_modules/@inrupt/universal-fetch": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@inrupt/universal-fetch/-/universal-fetch-1.0.3.tgz", + "integrity": "sha512-AP/nMOuuKvR2YoQkdS77ntuuq5ZYDGStI8Uirp1MCsyPSoBLyNnRjMLjlGqIlaC+5Xp7TYZJ9z/Kl2uUEpXUFw==", "dependencies": { - "buffer": "^6.0.3" + "node-fetch": "^2.6.7", + "undici": "^5.19.1" + }, + "engines": { + "node": "^14.17.0 || ^16.0.0 || ^18.0.0 || ^20.0.0" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", + "node_modules/@inrupt/vocab-common-rdf": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@inrupt/vocab-common-rdf/-/vocab-common-rdf-1.0.5.tgz", + "integrity": "sha512-onrehQte8m0XW83WwM6T4o5WgmYGzdYUCef6FDjMKfQCF64FnARFNn5fYhKodimBaAOFKhuJ3vw1NBZV/EYqJw==" + }, + "node_modules/@inrupt/vocab-solid": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@inrupt/vocab-solid/-/vocab-solid-1.0.4.tgz", + "integrity": "sha512-4Gp4wR3Eg1nrkd1EAwMMo/BNtEPKxM8RavrKSsc9ZYCvtouqFp+r4QEvhkiQarQgD+D3qFTE1RQ2RtC5fk6bKw==" + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.1.1", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10" }, "engines": { - "node": ">=12" + "node": ">=6.0.0" } }, - "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", "dev": true, "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", + "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", + "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" } }, - "node_modules/@discoveryjs/json-ext": { - "version": "0.5.7", + "node_modules/@jridgewell/source-map/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, - "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, "engines": { - "node": ">=10.0.0" + "node": ">=6.0.0" } }, - "node_modules/@docsearch/css": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.6.1.tgz", - "integrity": "sha512-VtVb5DS+0hRIprU2CO6ZQjK2Zg4QU5HrDM1+ix6rT0umsYvFvatMAnf97NHZlVWDaaLlx7GRfR/7FikANiM2Fg==", + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", "dev": true }, - "node_modules/@docsearch/js": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.6.1.tgz", - "integrity": "sha512-erI3RRZurDr1xES5hvYJ3Imp7jtrXj6f1xYIzDzxiS7nNBufYWPbJwrmMqWC5g9y165PmxEmN9pklGCdLi0Iqg==", + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "dependencies": { - "@docsearch/react": "3.6.1", - "preact": "^10.0.0" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@docsearch/react": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.6.1.tgz", - "integrity": "sha512-qXZkEPvybVhSXj0K7U3bXc233tk5e8PfhoZ6MhPOiik/qUQxYC+Dn9DnoS7CxHQQhHfCvTiN0eY9M12oRghEXw==", + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", "dev": true, + "license": "MIT", "dependencies": { - "@algolia/autocomplete-core": "1.9.3", - "@algolia/autocomplete-preset-algolia": "1.9.3", - "@docsearch/css": "3.6.1", - "algoliasearch": "^4.19.1" - }, - "peerDependencies": { - "@types/react": ">= 16.8.0 < 19.0.0", - "react": ">= 16.8.0 < 19.0.0", - "react-dom": ">= 16.8.0 < 19.0.0", - "search-insights": ">= 1 < 3" + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "react": { - "optional": true - }, - "react-dom": { - "optional": true - }, - "search-insights": { - "optional": true - } + "engines": { + "node": ">= 8" } }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", - "cpu": [ - "ppc64" - ], + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", "dev": true, - "optional": true, - "os": [ - "aix" - ], + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 8" } }, - "node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", - "cpu": [ - "arm" - ], + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", "dev": true, - "optional": true, - "os": [ - "android" - ], + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, "engines": { - "node": ">=12" + "node": ">= 8" } }, - "node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" + "node_modules/@rdfjs/data-model": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@rdfjs/data-model/-/data-model-1.3.4.tgz", + "integrity": "sha512-iKzNcKvJotgbFDdti7GTQDCYmL7GsGldkYStiP0K8EYtN7deJu5t7U11rKTz+nR7RtesUggT+lriZ7BakFv8QQ==", + "dependencies": { + "@rdfjs/types": ">=1.0.1" + }, + "bin": { + "rdfjs-data-model-test": "bin/test.js" } }, - "node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "node_modules/@rdfjs/dataset": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@rdfjs/dataset/-/dataset-1.1.1.tgz", + "integrity": "sha512-BNwCSvG0cz0srsG5esq6CQKJc1m8g/M0DZpLuiEp0MMpfwguXX7VeS8TCg4UUG3DV/DqEvhy83ZKSEjdsYseeA==", + "dependencies": { + "@rdfjs/data-model": "^1.2.0" + }, + "bin": { + "rdfjs-dataset-test": "bin/test.js" + } + }, + "node_modules/@rdfjs/types": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@rdfjs/types/-/types-1.1.2.tgz", + "integrity": "sha512-wqpOJK1QCbmsGNtyzYnojPU8gRDPid2JO0Q0kMtb4j65xhCK880cnKAfEOwC+dX85VJcCByQx5zOwyyfCjDJsg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@rollup/rollup-darwin-x64": { + "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" ], "dev": true, "optional": true, "os": [ - "android" - ], - "engines": { - "node": ">=12" - } + "darwin" + ] }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", - "cpu": [ - "arm64" - ], + "node_modules/@shikijs/core": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.24.2.tgz", + "integrity": "sha512-BpbNUSKIwbKrRRA+BQj0BEWSw+8kOPKDJevWeSE/xIqGX7K0xrCZQ9kK0nnEQyrzsUoka1l81ZtJ2mGaCA32HQ==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@shikijs/engine-javascript": "1.24.2", + "@shikijs/engine-oniguruma": "1.24.2", + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.3" } }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", - "cpu": [ - "x64" - ], + "node_modules/@shikijs/engine-javascript": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.24.2.tgz", + "integrity": "sha512-EqsmYBJdLEwEiO4H+oExz34a5GhhnVp+jH9Q/XjPjmBPc6TE/x4/gD0X3i0EbkKKNqXYHHJTJUpOLRQNkEzS9Q==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0", + "oniguruma-to-es": "0.7.0" } }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", - "cpu": [ - "arm64" - ], + "node_modules/@shikijs/engine-oniguruma": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.2.tgz", + "integrity": "sha512-ZN6k//aDNWRJs1uKB12pturKHh7GejKugowOFGAuG7TxDRLod1Bd5JhpOikOiFqPmKjKEPtEA6mRCf7q3ulDyQ==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0" } }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", - "cpu": [ - "x64" - ], + "node_modules/@shikijs/transformers": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-1.24.2.tgz", + "integrity": "sha512-cIwn8YSwO3bsWKJ+pezcXY1Vq0BVwvuLes1TZSC5+Awi6Tsfqhf3vBahOIqZK1rraMKOti2VEAEF/95oXMig1w==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" + "dependencies": { + "shiki": "1.24.2" } }, - "node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", - "cpu": [ - "arm" - ], + "node_modules/@shikijs/types": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.2.tgz", + "integrity": "sha512-bdeWZiDtajGLG9BudI0AHet0b6e7FbR0EsE4jpGaI0YwHm/XJunI9+3uZnzFtX65gsyJ6ngCIWUfA4NWRPnBkQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" } }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "node_modules/@shikijs/vscode-textmate": { + "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/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", - "cpu": [ - "ia32" - ], + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "dependencies": { + "type-detect": "4.0.8" } }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", - "cpu": [ - "loong64" - ], + "node_modules/@sinonjs/fake-timers": { + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", + "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@sinonjs/commons": "^3.0.0" } }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", - "cpu": [ - "mips64el" - ], + "node_modules/@sinonjs/samsam": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.2.tgz", + "integrity": "sha512-v46t/fwnhejRSFTGqbpn9u+LQ9xJDse10gNnPgAcxgdoCDMXj/G2asWAC/8Qs+BAZDicX+MNZouXT1A7c83kVw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@sinonjs/commons": "^3.0.1", + "lodash.get": "^4.4.2", + "type-detect": "^4.1.0" } }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", - "cpu": [ - "ppc64" - ], + "node_modules/@sinonjs/samsam/node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], "engines": { - "node": ">=12" + "node": ">=4" } }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", - "cpu": [ - "riscv64" - ], + "node_modules/@sinonjs/text-encoding": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.3.tgz", + "integrity": "sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==", + "dev": true + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", - "cpu": [ - "s390x" - ], + "node_modules/@tsconfig/node12": { + "version": "1.0.11", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", - "cpu": [ - "x64" - ], + "node_modules/@tsconfig/node14": { + "version": "1.0.3", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", - "cpu": [ - "x64" - ], + "node_modules/@tsconfig/node16": { + "version": "1.0.3", "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } + "license": "MIT" }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", - "cpu": [ - "x64" - ], + "node_modules/@types/eslint": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", + "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" } }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", - "cpu": [ - "x64" - ], + "node_modules/@types/eslint-scope": { + "version": "3.7.7", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", + "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" } }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", - "cpu": [ - "arm64" - ], + "node_modules/@types/estree": { + "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/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@types/unist": "*" } }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "node_modules/@types/http-link-header": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/http-link-header/-/http-link-header-1.0.7.tgz", + "integrity": "sha512-snm5oLckop0K3cTDAiBnZDy6ncx9DJ3mCRDvs42C884MbVYPP74Tiq2hFsSDRTyjK6RyDYDIulPiW23ge+g5Lw==", + "dependencies": { + "@types/node": "*" } }, - "node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", - "cpu": [ - "x64" - ], + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "dev": true + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", + "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" } }, - "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==", + "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": { - "eslint-visitor-keys": "^3.3.0" + "@types/unist": "*" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.14.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.0.tgz", + "integrity": "sha512-5cHBxFGJx6L4s56Bubp4fglrEpmyJypsqI6RgzMfBHWUJQGWAAi8cWcgetEbZXHYXo9C2Fa4EEds/uSyS4cxmA==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/rdfjs__dataset": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/rdfjs__dataset/-/rdfjs__dataset-1.0.5.tgz", + "integrity": "sha512-8OBC9Kr/ZSgNoUTe5mHTDPHaPt8Xen4XbYfqcbYv56d+4WdKliHXaFmFc0L4I5vsynE5JGu21Hvg2zWgX1Az6Q==", + "dependencies": { + "rdf-js": "^4.0.2" + } + }, + "node_modules/@types/readable-stream": { + "version": "2.3.15", + "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-2.3.15.tgz", + "integrity": "sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ==", + "dependencies": { + "@types/node": "*", + "safe-buffer": "~5.1.1" + } + }, + "node_modules/@types/tv4": { + "version": "1.2.33", + "resolved": "https://registry.npmjs.org/@types/tv4/-/tv4-1.2.33.tgz", + "integrity": "sha512-7phCVTXC6Bj50IV1iKOwqGkR4JONJyMbRZnKTSuujv1S/tO9rG5OdCt7BMSjytO+zJmYdn1/I4fd3SH0gtO99g==", + "dev": true + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true + }, + "node_modules/@types/web-bluetooth": { + "version": "0.0.20", + "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", + "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==", + "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==", + "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", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@eslint-community/regexpp": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", - "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", + "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==", "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", + "debug": "^4.3.4" + }, "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "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==", "dev": true, "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { - "url": "https://opencollective.com/eslint" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "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==", "dev": true, "dependencies": { - "type-fest": "^0.20.2" + "@typescript-eslint/typescript-estree": "7.18.0", + "@typescript-eslint/utils": "7.18.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": ">=8" + "node": "^18.18.0 || >=20.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "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==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@fastify/busboy": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=14" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", - "deprecated": "Use @eslint/config-array instead", + "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==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" + "@typescript-eslint/types": "7.18.0", + "@typescript-eslint/visitor-keys": "7.18.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" + "node": "^18.18.0 || >=20.0.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", - "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", - "deprecated": "Use @eslint/object-schema instead", - "dev": true - }, - "node_modules/@inrupt/oidc-client": { - "version": "1.11.6", - "license": "Apache-2.0", + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "dependencies": { - "acorn": "^7.4.1", - "base64-js": "^1.5.1", - "core-js": "^3.8.3", - "crypto-js": "^4.0.0", - "serialize-javascript": "^4.0.0" + "balanced-match": "^1.0.0" } }, - "node_modules/@inrupt/oidc-client-ext": { - "version": "1.17.5", - "license": "MIT", + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, "dependencies": { - "@inrupt/oidc-client": "^1.11.6", - "@inrupt/solid-client-authn-core": "^1.17.5", - "@inrupt/universal-fetch": "^1.0.1", - "jose": "^4.15.4", - "uuid": "^9.0.1" + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@inrupt/oidc-client/node_modules/acorn": { - "version": "7.4.1", - "license": "MIT", + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, "bin": { - "acorn": "bin/acorn" + "semver": "bin/semver.js" }, "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/@inrupt/oidc-client/node_modules/core-js": { - "version": "3.34.0", - "hasInstallScript": true, - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/@inrupt/oidc-client/node_modules/serialize-javascript": { - "version": "4.0.0", - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" + "node": ">=10" } }, - "node_modules/@inrupt/solid-client": { - "version": "1.30.2", - "license": "MIT", + "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==", + "dev": true, "dependencies": { - "@inrupt/universal-fetch": "^1.0.1", - "@rdfjs/dataset": "^1.1.0", - "@types/rdfjs__dataset": "^1.0.4", - "buffer": "^6.0.3", - "http-link-header": "^1.1.0", - "jsonld-context-parser": "^2.3.0", - "jsonld-streaming-parser": "^3.2.0", - "n3": "^1.10.0", - "uuid": "^9.0.0" + "@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" }, "engines": { - "node": "^16.0.0 || ^18.0.0 || ^20.0.0" + "node": "^18.18.0 || >=20.0.0" }, - "optionalDependencies": { - "fsevents": "^2.3.2" - } - }, - "node_modules/@inrupt/solid-client-authn-browser": { - "version": "1.17.5", - "license": "MIT", - "dependencies": { - "@inrupt/oidc-client-ext": "^1.17.5", - "@inrupt/solid-client-authn-core": "^1.17.5", - "@inrupt/universal-fetch": "^1.0.2", - "events": "^3.3.0", - "jose": "^4.15.4", - "uuid": "^9.0.1" - } - }, - "node_modules/@inrupt/solid-client-authn-core": { - "version": "1.17.5", - "license": "MIT", - "dependencies": { - "@inrupt/universal-fetch": "^1.0.1", - "events": "^3.3.0", - "jose": "^4.15.4", - "uuid": "^9.0.1" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, - "engines": { - "node": "^16.0.0 || ^18.0.0 || ^20.0.0" + "peerDependencies": { + "eslint": "^8.56.0" } }, - "node_modules/@inrupt/universal-fetch": { - "version": "1.0.3", - "license": "MIT", + "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==", + "dev": true, "dependencies": { - "node-fetch": "^2.6.7", - "undici": "^5.19.1" + "@typescript-eslint/types": "7.18.0", + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^14.17.0 || ^16.0.0 || ^18.0.0 || ^20.0.0" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@inrupt/vocab-common-rdf": { - "version": "1.0.5", - "license": "MIT" - }, - "node_modules/@inrupt/vocab-solid": { - "version": "1.0.4", - "license": "MIT" + "node_modules/@ungap/structured-clone": { + "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/@jridgewell/gen-mapping": { - "version": "0.1.1", + "node_modules/@vitejs/plugin-vue": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.2.1.tgz", + "integrity": "sha512-cxh314tzaWwOLqVes2gnnCtvBDcM1UMdn+iFR+UjAn411dPT3tOmqrJjbMd7koZpMAmBM/GqeV4n9ge7JSiJJQ==", "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" - }, "engines": { - "node": ">=6.0.0" + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "vite": "^5.0.0 || ^6.0.0", + "vue": "^3.2.25" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", + "node_modules/@vue/compiler-core": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.13.tgz", + "integrity": "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" + "dependencies": { + "@babel/parser": "^7.25.3", + "@vue/shared": "3.5.13", + "entities": "^4.5.0", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.0" } }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", + "node_modules/@vue/compiler-dom": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.13.tgz", + "integrity": "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" + "dependencies": { + "@vue/compiler-core": "3.5.13", + "@vue/shared": "3.5.13" } }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.6", + "node_modules/@vue/compiler-sfc": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.13.tgz", + "integrity": "sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==", "dev": true, - "license": "MIT", "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25" + "@babel/parser": "^7.25.3", + "@vue/compiler-core": "3.5.13", + "@vue/compiler-dom": "3.5.13", + "@vue/compiler-ssr": "3.5.13", + "@vue/shared": "3.5.13", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.11", + "postcss": "^8.4.48", + "source-map-js": "^1.2.0" } }, - "node_modules/@jridgewell/source-map/node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", + "node_modules/@vue/compiler-ssr": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.13.tgz", + "integrity": "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==", "dev": true, - "license": "MIT", "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" + "@vue/compiler-dom": "3.5.13", + "@vue/shared": "3.5.13" } }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", + "node_modules/@vue/devtools-api": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.6.8.tgz", + "integrity": "sha512-ma6dY/sZR36zALVsV1W7eC57c6IJPXsy8SNgZn1PLVWU4z4dPn5TIBmnF4stmdJ4sQcixqKaQ8pwjbMPzEZwiA==", "dev": true, - "license": "MIT", "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" + "@vue/devtools-kit": "^7.6.8" } }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "node_modules/@vue/devtools-kit": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.6.8.tgz", + "integrity": "sha512-JhJ8M3sPU+v0P2iZBF2DkdmR9L0dnT5RXJabJqX6o8KtFs3tebdvfoXV2Dm3BFuqeECuMJIfF1aCzSt+WQ4wrw==", "dev": true, "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" + "@vue/devtools-shared": "^7.6.8", + "birpc": "^0.2.19", + "hookable": "^5.5.3", + "mitt": "^3.0.1", + "perfect-debounce": "^1.0.0", + "speakingurl": "^14.0.1", + "superjson": "^2.2.1" } }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "node_modules/@vue/devtools-shared": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.6.8.tgz", + "integrity": "sha512-9MBPO5Z3X1nYGFqTJyohl6Gmf/J7UNN1oicHdyzBVZP4jnhZ4c20MgtaHDIzWmHDHCMYVS5bwKxT3jxh7gOOKA==", "dev": true, - "engines": { - "node": ">= 8" + "dependencies": { + "rfdc": "^1.4.1" } }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "node_modules/@vue/reactivity": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.13.tgz", + "integrity": "sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==", "dev": true, "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" + "@vue/shared": "3.5.13" } }, - "node_modules/@rdfjs/data-model": { - "version": "1.3.4", - "license": "MIT", + "node_modules/@vue/runtime-core": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.13.tgz", + "integrity": "sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==", + "dev": true, "dependencies": { - "@rdfjs/types": ">=1.0.1" - }, - "bin": { - "rdfjs-data-model-test": "bin/test.js" + "@vue/reactivity": "3.5.13", + "@vue/shared": "3.5.13" } }, - "node_modules/@rdfjs/dataset": { - "version": "1.1.1", - "license": "MIT", + "node_modules/@vue/runtime-dom": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.13.tgz", + "integrity": "sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==", + "dev": true, "dependencies": { - "@rdfjs/data-model": "^1.2.0" - }, - "bin": { - "rdfjs-dataset-test": "bin/test.js" + "@vue/reactivity": "3.5.13", + "@vue/runtime-core": "3.5.13", + "@vue/shared": "3.5.13", + "csstype": "^3.1.3" } }, - "node_modules/@rdfjs/types": { - "version": "1.1.0", - "license": "MIT", + "node_modules/@vue/server-renderer": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.13.tgz", + "integrity": "sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==", + "dev": true, "dependencies": { - "@types/node": "*" + "@vue/compiler-ssr": "3.5.13", + "@vue/shared": "3.5.13" + }, + "peerDependencies": { + "vue": "3.5.13" } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.0.tgz", - "integrity": "sha512-WTWD8PfoSAJ+qL87lE7votj3syLavxunWhzCnx3XFxFiI/BA/r3X7MUM8dVrH8rb2r4AiO8jJsr3ZjdaftmnfA==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.0.tgz", - "integrity": "sha512-a1sR2zSK1B4eYkiZu17ZUZhmUQcKjk2/j9Me2IDjk1GHW7LB5Z35LEzj9iJch6gtUfsnvZs1ZNyDW2oZSThrkA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.0.tgz", - "integrity": "sha512-zOnKWLgDld/svhKO5PD9ozmL6roy5OQ5T4ThvdYZLpiOhEGY+dp2NwUmxK0Ld91LrbjrvtNAE0ERBwjqhZTRAA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] + "node_modules/@vue/shared": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz", + "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", + "dev": true }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.0.tgz", - "integrity": "sha512-7doS8br0xAkg48SKE2QNtMSFPFUlRdw9+votl27MvT46vo44ATBmdZdGysOevNELmZlfd+NEa0UYOA8f01WSrg==", - "cpu": [ - "x64" - ], + "node_modules/@vueuse/core": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-11.3.0.tgz", + "integrity": "sha512-7OC4Rl1f9G8IT6rUfi9JrKiXy4bfmHhZ5x2Ceojy0jnd3mHNEvV4JaRygH362ror6/NZ+Nl+n13LPzGiPN8cKA==", "dev": true, - "optional": true, - "os": [ - "darwin" - ] + "dependencies": { + "@types/web-bluetooth": "^0.0.20", + "@vueuse/metadata": "11.3.0", + "@vueuse/shared": "11.3.0", + "vue-demi": ">=0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.0.tgz", - "integrity": "sha512-pWJsfQjNWNGsoCq53KjMtwdJDmh/6NubwQcz52aEwLEuvx08bzcy6tOUuawAOncPnxz/3siRtd8hiQ32G1y8VA==", - "cpu": [ - "arm" - ], + "node_modules/@vueuse/integrations": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@vueuse/integrations/-/integrations-11.3.0.tgz", + "integrity": "sha512-5fzRl0apQWrDezmobchoiGTkGw238VWESxZHazfhP3RM7pDSiyXy18QbfYkILoYNTd23HPAfQTJpkUc5QbkwTw==", "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.0.tgz", - "integrity": "sha512-efRIANsz3UHZrnZXuEvxS9LoCOWMGD1rweciD6uJQIx2myN3a8Im1FafZBzh7zk1RJ6oKcR16dU3UPldaKd83w==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.0.tgz", - "integrity": "sha512-ZrPhydkTVhyeGTW94WJ8pnl1uroqVHM3j3hjdquwAcWnmivjAwOYjTEAuEDeJvGX7xv3Z9GAvrBkEzCgHq9U1w==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.0.tgz", - "integrity": "sha512-cfaupqd+UEFeURmqNP2eEvXqgbSox/LHOyN9/d2pSdV8xTrjdg3NgOFJCtc1vQ/jEke1qD0IejbBfxleBPHnPw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] + "dependencies": { + "@vueuse/core": "11.3.0", + "@vueuse/shared": "11.3.0", + "vue-demi": ">=0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "async-validator": "^4", + "axios": "^1", + "change-case": "^5", + "drauu": "^0.4", + "focus-trap": "^7", + "fuse.js": "^7", + "idb-keyval": "^6", + "jwt-decode": "^4", + "nprogress": "^0.2", + "qrcode": "^1.5", + "sortablejs": "^1", + "universal-cookie": "^7" + }, + "peerDependenciesMeta": { + "async-validator": { + "optional": true + }, + "axios": { + "optional": true + }, + "change-case": { + "optional": true + }, + "drauu": { + "optional": true + }, + "focus-trap": { + "optional": true + }, + "fuse.js": { + "optional": true + }, + "idb-keyval": { + "optional": true + }, + "jwt-decode": { + "optional": true + }, + "nprogress": { + "optional": true + }, + "qrcode": { + "optional": true + }, + "sortablejs": { + "optional": true + }, + "universal-cookie": { + "optional": true + } + } }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.0.tgz", - "integrity": "sha512-ZKPan1/RvAhrUylwBXC9t7B2hXdpb/ufeu22pG2psV7RN8roOfGurEghw1ySmX/CmDDHNTDDjY3lo9hRlgtaHg==", - "cpu": [ - "ppc64" - ], + "node_modules/@vueuse/metadata": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-11.3.0.tgz", + "integrity": "sha512-pwDnDspTqtTo2HwfLw4Rp6yywuuBdYnPYDq+mO38ZYKGebCUQC/nVj/PXSiK9HX5otxLz8Fn7ECPbjiRz2CC3g==", "dev": true, - "optional": true, - "os": [ - "linux" - ] + "funding": { + "url": "https://github.com/sponsors/antfu" + } }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.0.tgz", - "integrity": "sha512-H1eRaCwd5E8eS8leiS+o/NqMdljkcb1d6r2h4fKSsCXQilLKArq6WS7XBLDu80Yz+nMqHVFDquwcVrQmGr28rg==", - "cpu": [ - "riscv64" - ], + "node_modules/@vueuse/shared": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-11.3.0.tgz", + "integrity": "sha512-P8gSSWQeucH5821ek2mn/ciCk+MS/zoRKqdQIM3bHq6p7GXDAJLmnRRKmF5F65sAVJIfzQlwR3aDzwCn10s8hA==", "dev": true, - "optional": true, - "os": [ - "linux" - ] + "dependencies": { + "vue-demi": ">=0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.0.tgz", - "integrity": "sha512-zJ4hA+3b5tu8u7L58CCSI0A9N1vkfwPhWd/puGXwtZlsB5bTkwDNW/+JCU84+3QYmKpLi+XvHdmrlwUwDA6kqw==", - "cpu": [ - "s390x" - ], + "node_modules/@webassemblyjs/ast": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", + "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ] + "dependencies": { + "@webassemblyjs/helper-numbers": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2" + } }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.0.tgz", - "integrity": "sha512-e2hrvElFIh6kW/UNBQK/kzqMNY5mO+67YtEh9OA65RM5IJXYTWiXjX6fjIiPaqOkBthYF1EqgiZ6OXKcQsM0hg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", + "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", + "dev": true }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.0.tgz", - "integrity": "sha512-1vvmgDdUSebVGXWX2lIcgRebqfQSff0hMEkLJyakQ9JQUbLDkEaMsPTLOmyccyC6IJ/l3FZuJbmrBw/u0A0uCQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", + "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", + "dev": true }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.0.tgz", - "integrity": "sha512-s5oFkZ/hFcrlAyBTONFY1TWndfyre1wOMwU+6KCpm/iatybvrRgmZVM+vCFwxmC5ZhdlgfE0N4XorsDpi7/4XQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", + "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", + "dev": true }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.0.tgz", - "integrity": "sha512-G9+TEqRnAA6nbpqyUqgTiopmnfgnMkR3kMukFBDsiyy23LZvUCpiUwjTRx6ezYCjJODXrh52rBR9oXvm+Fp5wg==", - "cpu": [ - "ia32" - ], + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", + "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", "dev": true, - "optional": true, - "os": [ - "win32" - ] + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.13.2", + "@webassemblyjs/helper-api-error": "1.13.2", + "@xtuc/long": "4.2.2" + } }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.0.tgz", - "integrity": "sha512-2jsCDZwtQvRhejHLfZ1JY6w6kEuEtfF9nzYsZxzSlNVKDX+DpsDJ+Rbjkm74nvg2rdx0gwBS+IMdvwJuq3S9pQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", + "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", + "dev": true }, - "node_modules/@shikijs/core": { + "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.14.1.tgz", - "integrity": "sha512-KyHIIpKNaT20FtFPFjCQB5WVSTpLR/n+jQXhWHWVUMm9MaOaG9BGOG0MSyt7yA4+Lm+4c9rTc03tt3nYzeYSfw==", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", + "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", "dev": true, "dependencies": { - "@types/hast": "^3.0.4" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/wasm-gen": "1.14.1" } }, - "node_modules/@shikijs/transformers": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-1.14.1.tgz", - "integrity": "sha512-JJqL8QBVCJh3L61jqqEXgFq1cTycwjcGj7aSmqOEsbxnETM9hRlaB74QuXvY/fVJNjbNt8nvWo0VwAXKvMSLRg==", + "node_modules/@webassemblyjs/ieee754": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", + "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", "dev": true, "dependencies": { - "shiki": "1.14.1" + "@xtuc/ieee754": "^1.2.0" } }, - "node_modules/@sinonjs/commons": { -<<<<<<< HEAD - "version": "1.8.3", -======= - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", - "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", ->>>>>>> master + "node_modules/@webassemblyjs/leb128": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", + "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { - "type-detect": "4.0.8" + "@xtuc/long": "4.2.2" } }, - "node_modules/@sinonjs/fake-timers": { -<<<<<<< HEAD - "version": "9.1.2", -======= - "version": "11.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", - "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", ->>>>>>> master + "node_modules/@webassemblyjs/utf8": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", + "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", + "dev": true + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", + "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^3.0.0" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/helper-wasm-section": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-opt": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1", + "@webassemblyjs/wast-printer": "1.14.1" } }, - "node_modules/@sinonjs/samsam": { -<<<<<<< HEAD - "version": "6.1.1", -======= - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz", - "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==", ->>>>>>> master + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", + "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^2.0.0", - "lodash.get": "^4.4.2", - "type-detect": "^4.0.8" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" } }, - "node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", + "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", "dev": true, "dependencies": { - "type-detect": "4.0.8" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-buffer": "1.14.1", + "@webassemblyjs/wasm-gen": "1.14.1", + "@webassemblyjs/wasm-parser": "1.14.1" } }, - "node_modules/@sinonjs/text-encoding": { - "version": "0.7.2", - "dev": true, - "license": "(Unlicense OR Apache-2.0)" - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, -<<<<<<< HEAD - "node_modules/@types/chai": { - "version": "4.3.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/chai-as-promised": { - "version": "7.1.5", + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", + "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", "dev": true, - "license": "MIT", "dependencies": { - "@types/chai": "*" + "@webassemblyjs/ast": "1.14.1", + "@webassemblyjs/helper-api-error": "1.13.2", + "@webassemblyjs/helper-wasm-bytecode": "1.13.2", + "@webassemblyjs/ieee754": "1.13.2", + "@webassemblyjs/leb128": "1.13.2", + "@webassemblyjs/utf8": "1.13.2" } }, -======= ->>>>>>> master - "node_modules/@types/eslint": { - "version": "8.56.10", + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", + "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", "dev": true, - "license": "MIT", "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" + "@webassemblyjs/ast": "1.14.1", + "@xtuc/long": "4.2.2" } }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", + "node_modules/@webpack-cli/configtest": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.1.1.tgz", + "integrity": "sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==", "dev": true, - "license": "MIT", - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, - "node_modules/@types/estree": { - "version": "1.0.5", + "node_modules/@webpack-cli/info": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.2.tgz", + "integrity": "sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==", "dev": true, - "license": "MIT" - }, - "node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dev": true, - "dependencies": { - "@types/unist": "*" + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, - "node_modules/@types/http-link-header": { - "version": "1.0.5", - "license": "MIT", - "dependencies": { - "@types/node": "*" + "node_modules/@webpack-cli/serve": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.5.tgz", + "integrity": "sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==", + "dev": true, + "engines": { + "node": ">=14.15.0" + }, + "peerDependencies": { + "webpack": "5.x.x", + "webpack-cli": "5.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } } }, - "node_modules/@types/json-schema": { - "version": "7.0.11", - "dev": true, - "license": "MIT" + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true }, - "node_modules/@types/linkify-it": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", - "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", "dev": true }, - "node_modules/@types/markdown-it": { - "version": "14.1.2", - "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", - "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", - "dev": true, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", "dependencies": { - "@types/linkify-it": "^5", - "@types/mdurl": "^2" + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" } }, - "node_modules/@types/mdurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", - "dev": true - }, -<<<<<<< HEAD - "node_modules/@types/mocha": { - "version": "9.1.1", + "node_modules/accepts": { + "version": "1.3.8", "dev": true, - "license": "MIT" - }, -======= ->>>>>>> master - "node_modules/@types/node": { - "version": "20.14.0", "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" } }, - "node_modules/@types/rdfjs__dataset": { - "version": "1.0.5", - "license": "MIT", - "dependencies": { - "rdf-js": "^4.0.2" + "node_modules/acorn": { + "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" + }, + "engines": { + "node": ">=0.4.0" } }, - "node_modules/@types/readable-stream": { - "version": "2.3.15", - "license": "MIT", - "dependencies": { - "@types/node": "*", - "safe-buffer": "~5.1.1" + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/@types/tv4": { -<<<<<<< HEAD - "version": "1.2.31", + "node_modules/acorn-to-esprima": { + "version": "2.0.8", "dev": true, "license": "MIT" -======= - "version": "1.2.33", - "resolved": "https://registry.npmjs.org/@types/tv4/-/tv4-1.2.33.tgz", - "integrity": "sha512-7phCVTXC6Bj50IV1iKOwqGkR4JONJyMbRZnKTSuujv1S/tO9rG5OdCt7BMSjytO+zJmYdn1/I4fd3SH0gtO99g==", - "dev": true ->>>>>>> master - }, - "node_modules/@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "dev": true }, - "node_modules/@types/web-bluetooth": { - "version": "0.0.20", - "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", - "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==", - "dev": true + "node_modules/acorn-walk": { + "version": "8.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } }, - "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==", + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "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", - "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" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" }, "peerDependencies": { - "@typescript-eslint/parser": "^7.0.0", - "eslint": "^8.56.0" + "ajv": "^8.0.0" }, "peerDependenciesMeta": { - "typescript": { + "ajv": { "optional": true } } }, - "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==", + "node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "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", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "fast-deep-equal": "^3.1.3" }, "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "ajv": "^8.8.2" } }, - "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==", + "node_modules/algoliasearch": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-5.17.0.tgz", + "integrity": "sha512-BpuFprDFc3Pe9a1ZXLzLeqZ+l8Ur37AfzBswkOB4LwikqnRPbIGdluT/nFc/Xk+u/QMxMzUlTN+izqQJVb5vYA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0" + "@algolia/client-abtesting": "5.17.0", + "@algolia/client-analytics": "5.17.0", + "@algolia/client-common": "5.17.0", + "@algolia/client-insights": "5.17.0", + "@algolia/client-personalization": "5.17.0", + "@algolia/client-query-suggestions": "5.17.0", + "@algolia/client-search": "5.17.0", + "@algolia/ingestion": "1.17.0", + "@algolia/monitoring": "1.17.0", + "@algolia/recommend": "5.17.0", + "@algolia/requester-browser-xhr": "5.17.0", + "@algolia/requester-fetch": "5.17.0", + "@algolia/requester-node-http": "5.17.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "node": ">= 14.0.0" } }, - "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==", + "node_modules/amdefine": { + "version": "1.0.1", "dev": true, - "dependencies": { - "@typescript-eslint/typescript-estree": "7.18.0", - "@typescript-eslint/utils": "7.18.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" - }, + "license": "BSD-3-Clause OR MIT", "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "node": ">=0.4.2" } }, - "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==", + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "node": ">=6" } }, - "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==", + "node_modules/ansi-regex": { + "version": "5.0.1", "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", "dependencies": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" }, "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "node": ">= 8" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "node_modules/arg": { + "version": "4.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" + "license": "Python-2.0" + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "node_modules/array-union": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "node_modules/assertion-error": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/babel-code-frame": { + "version": "6.26.0", "dev": true, + "license": "MIT", "dependencies": { - "brace-expansion": "^2.0.1" - }, + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + } + }, + "node_modules/babel-code-frame/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">=0.10.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "node_modules/babel-code-frame/node_modules/ansi-styles": { + "version": "2.2.1", "dev": true, - "bin": { - "semver": "bin/semver.js" - }, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=0.10.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==", + "node_modules/babel-code-frame/node_modules/chalk": { + "version": "1.1.3", "dev": true, + "license": "MIT", "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" + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.56.0" + "node": ">=0.10.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==", + "node_modules/babel-code-frame/node_modules/js-tokens": { + "version": "3.0.2", "dev": true, + "license": "MIT" + }, + "node_modules/babel-code-frame/node_modules/strip-ansi": { + "version": "3.0.1", + "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.18.0", - "eslint-visitor-keys": "^3.4.3" + "ansi-regex": "^2.0.0" }, "engines": { - "node": "^18.18.0 || >=20.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "node": ">=0.10.0" } }, - "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==", - "dev": true + "node_modules/babel-code-frame/node_modules/supports-color": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } }, - "node_modules/@vitejs/plugin-vue": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.1.2.tgz", - "integrity": "sha512-nY9IwH12qeiJqumTCLJLE7IiNx7HZ39cbHaysEUd+Myvbz9KAqd2yq+U01Kab1R/H1BmiyM2ShTYlNH32Fzo3A==", + "node_modules/babel-loader": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.2.1.tgz", + "integrity": "sha512-fqe8naHt46e0yIdkjUZYqddSXfej3AHajX+CSO5X7oy0EmPc6o5Xh+RClNoHjnieWz9AW4kZxW9yyFMhVB1QLA==", "dev": true, + "dependencies": { + "find-cache-dir": "^4.0.0", + "schema-utils": "^4.0.0" + }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": ">= 14.15.0" }, "peerDependencies": { - "vite": "^5.0.0", - "vue": "^3.2.25" + "@babel/core": "^7.12.0", + "webpack": ">=5" } }, - "node_modules/@vue/compiler-core": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.38.tgz", - "integrity": "sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==", + "node_modules/babel-messages": { + "version": "6.23.0", "dev": true, + "license": "MIT", "dependencies": { - "@babel/parser": "^7.24.7", - "@vue/shared": "3.4.38", - "entities": "^4.5.0", - "estree-walker": "^2.0.2", - "source-map-js": "^1.2.0" + "babel-runtime": "^6.22.0" } }, - "node_modules/@vue/compiler-dom": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.38.tgz", - "integrity": "sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==", + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.12.tgz", + "integrity": "sha512-CPWT6BwvhrTO2d8QVorhTCQw9Y43zOu7G9HigcfxvepOU6b8o3tcWad6oVgZIsZCTt42FFv97aA7ZJsbM4+8og==", "dev": true, "dependencies": { - "@vue/compiler-core": "3.4.38", - "@vue/shared": "3.4.38" + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.6.3", + "semver": "^6.3.1" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/@vue/compiler-sfc": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.38.tgz", - "integrity": "sha512-s5QfZ+9PzPh3T5H4hsQDJtI8x7zdJaew/dCGgqZ2630XdzaZ3AD8xGZfBqpT8oaD/p2eedd+pL8tD5vvt5ZYJQ==", + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.10.6", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", + "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", "dev": true, "dependencies": { - "@babel/parser": "^7.24.7", - "@vue/compiler-core": "3.4.38", - "@vue/compiler-dom": "3.4.38", - "@vue/compiler-ssr": "3.4.38", - "@vue/shared": "3.4.38", - "estree-walker": "^2.0.2", - "magic-string": "^0.30.10", - "postcss": "^8.4.40", - "source-map-js": "^1.2.0" + "@babel/helper-define-polyfill-provider": "^0.6.2", + "core-js-compat": "^3.38.0" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/@vue/compiler-ssr": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.38.tgz", - "integrity": "sha512-YXznKFQ8dxYpAz9zLuVvfcXhc31FSPFDcqr0kyujbOwNhlmaNvL2QfIy+RZeJgSn5Fk54CWoEUeW+NVBAogGaw==", + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.3.tgz", + "integrity": "sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q==", "dev": true, "dependencies": { - "@vue/compiler-dom": "3.4.38", - "@vue/shared": "3.4.38" + "@babel/helper-define-polyfill-provider": "^0.6.3" + }, + "peerDependencies": { + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/@vue/devtools-api": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.3.8.tgz", - "integrity": "sha512-NURFwmxz4WukFU54IHgyGI2KSejdgHG5JC4xTcWmTWEBIc8aelj9fBy4qsboObGHFp3JIdRxxANO9s2wZA/pVQ==", + "node_modules/babel-runtime": { + "version": "6.26.0", "dev": true, + "license": "MIT", "dependencies": { - "@vue/devtools-kit": "^7.3.8" + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" } }, - "node_modules/@vue/devtools-kit": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.3.8.tgz", - "integrity": "sha512-HYy3MQP1nZ6GbE4vrgJ/UB+MvZnhYmEwCa/UafrEpdpwa+jNCkz1ZdUrC5I7LpkH1ShREEV2/pZlAQdBj+ncLQ==", + "node_modules/babel-traverse": { + "version": "6.26.0", "dev": true, + "license": "MIT", "dependencies": { - "@vue/devtools-shared": "^7.3.8", - "birpc": "^0.2.17", - "hookable": "^5.5.3", - "mitt": "^3.0.1", - "perfect-debounce": "^1.0.0", - "speakingurl": "^14.0.1", - "superjson": "^2.2.1" + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" } }, - "node_modules/@vue/devtools-shared": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.3.8.tgz", - "integrity": "sha512-1NiJbn7Yp47nPDWhFZyEKpB2+5/+7JYv8IQnU0ccMrgslPR2dL7u1DIyI7mLqy4HN1ll36gQy0k8GqBYSFgZJw==", + "node_modules/babel-traverse/node_modules/debug": { + "version": "2.6.9", "dev": true, + "license": "MIT", "dependencies": { - "rfdc": "^1.4.1" + "ms": "2.0.0" } }, - "node_modules/@vue/reactivity": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.38.tgz", - "integrity": "sha512-4vl4wMMVniLsSYYeldAKzbk72+D3hUnkw9z8lDeJacTxAkXeDAP1uE9xr2+aKIN0ipOL8EG2GPouVTH6yF7Gnw==", + "node_modules/babel-traverse/node_modules/globals": { + "version": "9.18.0", "dev": true, - "dependencies": { - "@vue/shared": "3.4.38" + "license": "MIT", + "engines": { + "node": ">=0.10.0" } }, - "node_modules/@vue/runtime-core": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.38.tgz", - "integrity": "sha512-21z3wA99EABtuf+O3IhdxP0iHgkBs1vuoCAsCKLVJPEjpVqvblwBnTj42vzHRlWDCyxu9ptDm7sI2ZMcWrQqlA==", + "node_modules/babel-traverse/node_modules/ms": { + "version": "2.0.0", "dev": true, - "dependencies": { - "@vue/reactivity": "3.4.38", - "@vue/shared": "3.4.38" - } + "license": "MIT" }, - "node_modules/@vue/runtime-dom": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.38.tgz", - "integrity": "sha512-afZzmUreU7vKwKsV17H1NDThEEmdYI+GCAK/KY1U957Ig2NATPVjCROv61R19fjZNzMmiU03n79OMnXyJVN0UA==", + "node_modules/babel-types": { + "version": "6.26.0", "dev": true, + "license": "MIT", "dependencies": { - "@vue/reactivity": "3.4.38", - "@vue/runtime-core": "3.4.38", - "@vue/shared": "3.4.38", - "csstype": "^3.1.3" + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" } }, - "node_modules/@vue/server-renderer": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.38.tgz", - "integrity": "sha512-NggOTr82FbPEkkUvBm4fTGcwUY8UuTsnWC/L2YZBmvaQ4C4Jl/Ao4HHTB+l7WnFCt5M/dN3l0XLuyjzswGYVCA==", + "node_modules/babel-types/node_modules/to-fast-properties": { + "version": "1.0.3", "dev": true, - "dependencies": { - "@vue/compiler-ssr": "3.4.38", - "@vue/shared": "3.4.38" - }, - "peerDependencies": { - "vue": "3.4.38" + "license": "MIT", + "engines": { + "node": ">=0.10.0" } }, - "node_modules/@vue/shared": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.38.tgz", - "integrity": "sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==", - "dev": true - }, - "node_modules/@vueuse/core": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-11.0.1.tgz", - "integrity": "sha512-YTrekI18WwEyP3h168Fir94G/HNC27wvXJI21Alm0sPOwvhihfkrvHIe+5PNJq+MpgWdRcsjvE/38JaoKrgZhQ==", - "dev": true, - "dependencies": { - "@types/web-bluetooth": "^0.0.20", - "@vueuse/metadata": "11.0.1", - "@vueuse/shared": "11.0.1", - "vue-demi": ">=0.14.10" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/@vueuse/core/node_modules/vue-demi": { - "version": "0.14.10", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", - "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "node_modules/babylon": { + "version": "6.18.0", "dev": true, - "hasInstallScript": true, + "license": "MIT", "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } + "babylon": "bin/babylon.js" } }, - "node_modules/@vueuse/integrations": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/integrations/-/integrations-11.0.1.tgz", - "integrity": "sha512-V/FQTS/aiV6RTFXOj8cXgqhtNJBvxvbHeLElOUR7N7F3Kr0btS+dkymLB54mFd0Or6uEGpgwwb41cs/q2/rdOg==", + "node_modules/balanced-match": { + "version": "1.0.2", "dev": true, - "dependencies": { - "@vueuse/core": "11.0.1", - "@vueuse/shared": "11.0.1", - "vue-demi": ">=0.14.10" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "async-validator": "^4", - "axios": "^1", - "change-case": "^5", - "drauu": "^0.4", - "focus-trap": "^7", - "fuse.js": "^7", - "idb-keyval": "^6", - "jwt-decode": "^4", - "nprogress": "^0.2", - "qrcode": "^1.5", - "sortablejs": "^1", - "universal-cookie": "^7" - }, - "peerDependenciesMeta": { - "async-validator": { - "optional": true - }, - "axios": { - "optional": true - }, - "change-case": { - "optional": true - }, - "drauu": { - "optional": true - }, - "focus-trap": { - "optional": true - }, - "fuse.js": { - "optional": true - }, - "idb-keyval": { - "optional": true - }, - "jwt-decode": { - "optional": true - }, - "nprogress": { - "optional": true - }, - "qrcode": { - "optional": true + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" }, - "sortablejs": { - "optional": true + { + "type": "patreon", + "url": "https://www.patreon.com/feross" }, - "universal-cookie": { - "optional": true + { + "type": "consulting", + "url": "https://feross.org/support" } - } + ], + "license": "MIT" }, - "node_modules/@vueuse/integrations/node_modules/vue-demi": { - "version": "0.14.10", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", - "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "node_modules/big.js": { + "version": "5.2.2", "dev": true, - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, + "license": "MIT", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, - "node_modules/@vueuse/metadata": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-11.0.1.tgz", - "integrity": "sha512-dTFvuHFAjLYOiSd+t9Sk7xUiuL6jbfay/eX+g+jaipXXlwKur2VCqBCZX+jfu+2vROUGcUsdn3fJR9KkpadIOg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/antfu" + "node": "*" } }, - "node_modules/@vueuse/shared": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-11.0.1.tgz", - "integrity": "sha512-eAPf5CQB3HR0S76HqrhjBqFYstZfiHWZq8xF9EQmobGBkrhPfErJEhr8aMNQMqd6MkENIx2pblIEfJGlHpClug==", + "node_modules/binary-extensions": { + "version": "2.2.0", "dev": true, - "dependencies": { - "vue-demi": ">=0.14.10" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/@vueuse/shared/node_modules/vue-demi": { - "version": "0.14.10", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", - "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "node_modules/birpc": { + "version": "0.2.19", + "resolved": "https://registry.npmjs.org/birpc/-/birpc-0.2.19.tgz", + "integrity": "sha512-5WeXXAvTmitV1RqJFppT5QtUiz2p1mRSYU000Jkft5ZUCLJIk4uQriYNO50HknxKwM6jd8utNc66K1qGIwwWBQ==", "dev": true, - "hasInstallScript": true, - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, "funding": { "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, - "node_modules/@webassemblyjs/ast": { - "version": "1.12.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/helper-numbers": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6" } }, - "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.6", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.11.6", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.12.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-numbers": { - "version": "1.11.6", - "dev": true, - "license": "MIT", + "node_modules/blob": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.1.0.tgz", + "integrity": "sha512-k+GwK+4Rj+MPNT4qu+y6+kHp+mPmmNd+28zdrIo69QM9UvypK5Vhcw7jnRiY4KaOMAiOdn0NtPQGTb+Ox1Dtng==", "dependencies": { - "@webassemblyjs/floating-point-hex-parser": "1.11.6", - "@webassemblyjs/helper-api-error": "1.11.6", - "@xtuc/long": "4.2.2" + "esm": "^3.2.25" } }, - "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.6", + "node_modules/bluebird": { + "version": "3.7.2", "dev": true, "license": "MIT" }, - "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.12.1", + "node_modules/body-parser": { + "version": "1.20.0", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/wasm-gen": "1.12.1" + "bytes": "3.1.2", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.10.3", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/@webassemblyjs/ieee754": { - "version": "1.11.6", + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", "dev": true, "license": "MIT", "dependencies": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "node_modules/@webassemblyjs/leb128": { - "version": "1.11.6", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@xtuc/long": "4.2.2" + "ms": "2.0.0" } }, - "node_modules/@webassemblyjs/utf8": { - "version": "1.11.6", + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", "dev": true, "license": "MIT" }, - "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.12.1", + "node_modules/brace-expansion": { + "version": "1.1.11", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/helper-wasm-section": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-opt": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1", - "@webassemblyjs/wast-printer": "1.12.1" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.12.1", + "node_modules/braces": { + "version": "3.0.2", "dev": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" } }, - "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.12.1", + "node_modules/browser-stdout": { + "version": "1.3.1", "dev": true, - "license": "MIT", + "license": "ISC" + }, + "node_modules/browserslist": { + "version": "4.24.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1" + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.1" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.12.1", - "dev": true, - "license": "MIT", + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-api-error": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "node_modules/@webassemblyjs/wast-printer": { - "version": "1.12.1", + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/bufferutil": { + "version": "4.0.6", "dev": true, + "hasInstallScript": true, "license": "MIT", "dependencies": { - "@webassemblyjs/ast": "1.12.1", - "@xtuc/long": "4.2.2" + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" } }, - "node_modules/@webpack-cli/configtest": { - "version": "2.1.1", + "node_modules/bytes": { + "version": "3.1.2", "dev": true, "license": "MIT", "engines": { - "node": ">=14.15.0" - }, - "peerDependencies": { - "webpack": "5.x.x", - "webpack-cli": "5.x.x" + "node": ">= 0.8" } }, - "node_modules/@webpack-cli/info": { - "version": "2.0.2", + "node_modules/call-bind": { + "version": "1.0.2", "dev": true, "license": "MIT", - "engines": { - "node": ">=14.15.0" + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" }, - "peerDependencies": { - "webpack": "5.x.x", - "webpack-cli": "5.x.x" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/@webpack-cli/serve": { - "version": "2.0.5", + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", "dev": true, "license": "MIT", "engines": { - "node": ">=14.15.0" - }, - "peerDependencies": { - "webpack": "5.x.x", - "webpack-cli": "5.x.x" + "node": ">=10" }, - "peerDependenciesMeta": { - "webpack-dev-server": { - "optional": true - } + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@xtuc/ieee754": { - "version": "1.2.0", + "node_modules/caniuse-lite": { + "version": "1.0.30001687", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", + "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", "dev": true, - "license": "BSD-3-Clause" + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] }, - "node_modules/@xtuc/long": { - "version": "4.2.2", - "dev": true, - "license": "Apache-2.0" + "node_modules/canonicalize": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/canonicalize/-/canonicalize-1.0.8.tgz", + "integrity": "sha512-0CNTVCLZggSh7bc5VkX5WWPWO+cyZbNd07IHIsSXLia/eAq+r836hgk+8BKoEh7949Mda87VUOitx5OddVj64A==" }, - "node_modules/abort-controller": { - "version": "3.0.0", - "license": "MIT", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" + "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/accepts": { - "version": "1.3.8", + "node_modules/chai": { + "version": "4.3.6", "dev": true, "license": "MIT", "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" }, "engines": { - "node": ">= 0.6" + "node": ">=4" } }, - "node_modules/acorn": { - "version": "8.12.1", + "node_modules/chai-as-promised": { + "version": "7.1.1", "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" + "license": "WTFPL", + "dependencies": { + "check-error": "^1.0.2" }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-import-attributes": { - "version": "1.9.5", - "dev": true, - "license": "MIT", "peerDependencies": { - "acorn": "^8" + "chai": ">= 2.1.2 < 5" } }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "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, - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/acorn-to-esprima": { - "version": "2.0.8", + "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, - "license": "MIT" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } }, - "node_modules/acorn-walk": { - "version": "8.2.0", + "node_modules/check-error": { + "version": "1.0.2", "dev": true, "license": "MIT", "engines": { - "node": ">=0.4.0" + "node": "*" } }, - "node_modules/ajv": { - "version": "6.12.6", + "node_modules/chokidar": { + "version": "3.5.3", "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "dev": true, - "dependencies": { - "ajv": "^8.0.0" + "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" }, - "peerDependencies": { - "ajv": "^8.0.0" + "engines": { + "node": ">= 8.10.0" }, - "peerDependenciesMeta": { - "ajv": { - "optional": true - } + "optionalDependencies": { + "fsevents": "~2.3.2" } }, - "node_modules/ajv-formats/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", "dev": true, + "license": "ISC", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "is-glob": "^4.0.1" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">= 6" } }, - "node_modules/ajv-formats/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/ajv-keywords": { - "version": "3.5.2", + "node_modules/chrome-trace-event": { + "version": "1.0.3", "dev": true, "license": "MIT", - "peerDependencies": { - "ajv": "^6.9.1" + "engines": { + "node": ">=6.0" } }, - "node_modules/algoliasearch": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.24.0.tgz", - "integrity": "sha512-bf0QV/9jVejssFBmz2HQLxUadxk574t4iwjCKp5E7NBzwKkrDEhKPISIIjAU/p6K5qDx3qoeh4+26zWN1jmw3g==", + "node_modules/cliui": { + "version": "7.0.4", "dev": true, + "license": "ISC", "dependencies": { - "@algolia/cache-browser-local-storage": "4.24.0", - "@algolia/cache-common": "4.24.0", - "@algolia/cache-in-memory": "4.24.0", - "@algolia/client-account": "4.24.0", - "@algolia/client-analytics": "4.24.0", - "@algolia/client-common": "4.24.0", - "@algolia/client-personalization": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/logger-common": "4.24.0", - "@algolia/logger-console": "4.24.0", - "@algolia/recommend": "4.24.0", - "@algolia/requester-browser-xhr": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/requester-node-http": "4.24.0", - "@algolia/transporter": "4.24.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" } }, - "node_modules/algoliasearch/node_modules/@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", + "node_modules/clone-deep": { + "version": "4.0.1", "dev": true, + "license": "MIT", "dependencies": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "node_modules/algoliasearch/node_modules/@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", + "node_modules/colorette": { + "version": "2.0.19", "dev": true, - "dependencies": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } + "license": "MIT" }, - "node_modules/algoliasearch/node_modules/@algolia/requester-browser-xhr": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.24.0.tgz", - "integrity": "sha512-Z2NxZMb6+nVXSjF13YpjYTdvV3032YTBSGm2vnYvYPA6mMxzM3v5rsCiSspndn9rzIW4Qp1lPHBvuoKJV6jnAA==", + "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, - "dependencies": { - "@algolia/requester-common": "4.24.0" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/algoliasearch/node_modules/@algolia/requester-node-http": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.24.0.tgz", - "integrity": "sha512-JF18yTjNOVYvU/L3UosRcvbPMGT9B+/GQWNWnenIImglzNVGpyzChkXLnrSf6uxwVNO6ESGu6oN8MqcGQcjQJw==", + "node_modules/commander": { + "version": "2.20.3", "dev": true, - "dependencies": { - "@algolia/requester-common": "4.24.0" - } + "license": "MIT" }, - "node_modules/amdefine": { - "version": "1.0.1", + "node_modules/common-path-prefix": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", + "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", "dev": true, - "license": "BSD-3-Clause OR MIT", - "engines": { - "node": ">=0.4.2" - } + "license": "MIT" }, - "node_modules/ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "node_modules/content-disposition": { + "version": "0.5.4", "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, "engines": { - "node": ">=6" + "node": ">= 0.6" } }, - "node_modules/ansi-regex": { - "version": "5.0.1", + "node_modules/content-disposition/node_modules/safe-buffer": { + "version": "5.2.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/content-type": { + "version": "1.0.4", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 0.6" } }, - "node_modules/ansi-styles": { - "version": "3.2.1", + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/cookie": { + "version": "0.5.0", "dev": true, "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, "engines": { - "node": ">=4" + "node": ">= 0.6" } }, - "node_modules/anymatch": { - "version": "3.1.2", + "node_modules/cookie-signature": { + "version": "1.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/copy-anything": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", + "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", "dev": true, - "license": "ISC", "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" + "is-what": "^4.1.8" }, "engines": { - "node": ">= 8" + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" } }, - "node_modules/arg": { - "version": "4.1.3", + "node_modules/core-js": { + "version": "2.6.12", "dev": true, + "hasInstallScript": true, "license": "MIT" }, - "node_modules/argparse": { - "version": "2.0.1", + "node_modules/core-js-compat": { + "version": "3.39.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.39.0.tgz", + "integrity": "sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==", "dev": true, - "license": "Python-2.0" + "dependencies": { + "browserslist": "^4.24.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } }, - "node_modules/array-flatten": { - "version": "1.1.1", + "node_modules/core-util-is": { + "version": "1.0.3", "dev": true, "license": "MIT" }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "node_modules/create-require": { + "version": "1.1.1", "dev": true, - "engines": { - "node": ">=8" + "license": "MIT" + }, + "node_modules/cross-fetch": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dependencies": { + "node-fetch": "^2.6.12" } }, - "node_modules/assertion-error": { - "version": "1.1.0", + "node_modules/cross-spawn": { + "version": "7.0.3", "dev": true, "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, "engines": { - "node": "*" + "node": ">= 8" } }, - "node_modules/babel-code-frame": { - "version": "6.26.0", + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "dev": true + }, + "node_modules/d": { + "version": "1.0.1", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" + "es5-ext": "^0.10.50", + "type": "^1.0.1" } }, - "node_modules/babel-code-frame/node_modules/ansi-regex": { - "version": "2.1.1", + "node_modules/debug": { + "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, - "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/babel-code-frame/node_modules/ansi-styles": { - "version": "2.2.1", + "node_modules/decamelize": { + "version": "4.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/babel-code-frame/node_modules/chalk": { - "version": "1.1.3", + "node_modules/deep-eql": { + "version": "3.0.1", "dev": true, "license": "MIT", "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" + "type-detect": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=0.12" } }, - "node_modules/babel-code-frame/node_modules/js-tokens": { - "version": "3.0.2", - "dev": true, - "license": "MIT" + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true }, - "node_modules/babel-code-frame/node_modules/strip-ansi": { - "version": "3.0.1", + "node_modules/depd": { + "version": "2.0.0", "dev": true, "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.8" } }, - "node_modules/babel-code-frame/node_modules/supports-color": { - "version": "2.0.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, - "license": "MIT", "engines": { - "node": ">=0.8.0" + "node": ">=6" } }, - "node_modules/babel-loader": { -<<<<<<< HEAD - "version": "8.2.5", -======= - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", - "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", ->>>>>>> master + "node_modules/destroy": { + "version": "1.2.0", "dev": true, "license": "MIT", - "dependencies": { - "find-cache-dir": "^4.0.0", - "schema-utils": "^4.0.0" - }, "engines": { - "node": ">= 14.15.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0", - "webpack": ">=5" + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/babel-messages": { - "version": "6.23.0", + "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, - "license": "MIT", "dependencies": { - "babel-runtime": "^6.22.0" + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, -<<<<<<< HEAD - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", + "node_modules/diff": { + "version": "4.0.2", "dev": true, - "license": "MIT", - "dependencies": { - "object.assign": "^4.1.0" + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" } }, - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.3", -======= - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz", - "integrity": "sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q==", ->>>>>>> master + "node_modules/dir-glob": { + "version": "3.0.1", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.22.6", - "@babel/helper-define-polyfill-provider": "^0.6.2", - "semver": "^6.3.1" + "path-type": "^4.0.0" }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + "engines": { + "node": ">=8" } }, - "node_modules/babel-plugin-polyfill-corejs3": { -<<<<<<< HEAD - "version": "0.6.0", -======= - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.4.tgz", - "integrity": "sha512-25J6I8NGfa5YkCDogHRID3fVCadIR8/pGl1/spvCkzb6lVn6SR3ojpx9nOn9iEBcUsjY24AmdKm5khcfKdylcg==", ->>>>>>> master + "node_modules/disparity": { + "version": "3.2.0", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.1", - "core-js-compat": "^3.36.1" + "ansi-styles": "^4.2.1", + "diff": "^4.0.2" }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + "bin": { + "disparity": "bin/disparity" + }, + "engines": { + "node": ">=8" } }, - "node_modules/babel-plugin-polyfill-regenerator": { -<<<<<<< HEAD - "version": "0.4.1", -======= - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.2.tgz", - "integrity": "sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg==", ->>>>>>> master + "node_modules/disparity/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.2" + "color-convert": "^2.0.1" }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/babel-runtime": { - "version": "6.26.0", + "node_modules/disparity/node_modules/color-convert": { + "version": "2.0.1", "dev": true, "license": "MIT", "dependencies": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, - "node_modules/babel-traverse": { - "version": "6.26.0", + "node_modules/disparity/node_modules/color-name": { + "version": "1.1.4", "dev": true, - "license": "MIT", - "dependencies": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - } + "license": "MIT" }, - "node_modules/babel-traverse/node_modules/debug": { - "version": "2.6.9", + "node_modules/doctrine": { + "version": "3.0.0", "dev": true, - "license": "MIT", + "license": "Apache-2.0", "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/babel-traverse/node_modules/globals": { - "version": "9.18.0", - "dev": true, - "license": "MIT", + "esutils": "^2.0.2" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0.0" } }, - "node_modules/babel-traverse/node_modules/ms": { - "version": "2.0.0", + "node_modules/ee-first": { + "version": "1.1.1", "dev": true, "license": "MIT" }, - "node_modules/babel-types": { - "version": "6.26.0", + "node_modules/electron-to-chromium": { + "version": "1.5.72", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.72.tgz", + "integrity": "sha512-ZpSAUOZ2Izby7qnZluSrAlGgGQzucmFbN0n64dYzocYxnxV5ufurpj3VgEe4cUp7ir9LmeLxNYo8bVnlM8bQHw==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", "dev": true, - "license": "MIT", - "dependencies": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - } + "license": "MIT" }, - "node_modules/babel-types/node_modules/to-fast-properties": { - "version": "1.0.3", + "node_modules/emoji-regex-xs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex-xs/-/emoji-regex-xs-1.0.0.tgz", + "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==", + "dev": true + }, + "node_modules/emojis-list": { + "version": "3.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 4" } }, - "node_modules/babylon": { - "version": "6.18.0", + "node_modules/encodeurl": { + "version": "1.0.2", "dev": true, "license": "MIT", - "bin": { - "babylon": "bin/babylon.js" + "engines": { + "node": ">= 0.8" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/big.js": { - "version": "5.2.2", + "node_modules/enhanced-resolve": { + "version": "4.5.0", "dev": true, - "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + }, "engines": { - "node": "*" + "node": ">=6.9.0" } }, - "node_modules/binary-extensions": { - "version": "2.2.0", + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, - "license": "MIT", "engines": { - "node": ">=8" + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/birpc": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/birpc/-/birpc-0.2.17.tgz", - "integrity": "sha512-+hkTxhot+dWsLpp3gia5AkVHIsKlZybNT5gIYiDlNzJrmYPcTM9k5/w2uaj3IPpd7LlEYpmCj4Jj1nC41VhDFg==", + "node_modules/envinfo": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", + "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", "dev": true, - "funding": { - "url": "https://github.com/sponsors/antfu" + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" } }, - "node_modules/blob": { - "version": "0.1.0", + "node_modules/errno": { + "version": "0.1.8", + "dev": true, "license": "MIT", "dependencies": { - "esm": "^3.2.25" + "prr": "~1.0.1" + }, + "bin": { + "errno": "cli.js" } }, - "node_modules/bluebird": { - "version": "3.7.2", - "dev": true, - "license": "MIT" + "node_modules/es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "dev": true }, - "node_modules/body-parser": { -<<<<<<< HEAD - "version": "1.20.0", -======= - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", ->>>>>>> master + "node_modules/es5-ext": { + "version": "0.10.62", "dev": true, - "license": "MIT", + "hasInstallScript": true, + "license": "ISC", "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" }, "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": ">=0.10" } }, - "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", + "node_modules/es6-iterator": { + "version": "2.0.3", "dev": true, "license": "MIT", "dependencies": { - "ms": "2.0.0" + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" } }, - "node_modules/body-parser/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", + "node_modules/es6-symbol": { + "version": "3.1.3", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "d": "^1.0.1", + "ext": "^1.1.2" } }, - "node_modules/braces": { -<<<<<<< HEAD - "version": "3.0.2", -======= - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" } }, - "node_modules/browser-stdout": { - "version": "1.3.1", + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, - "license": "ISC" + "engines": { + "node": ">=6" + } }, - "node_modules/browserslist": { - "version": "4.23.2", + "node_modules/escape-html": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esformatter": { + "version": "0.11.3", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001640", - "electron-to-chromium": "^1.4.820", - "node-releases": "^2.0.14", - "update-browserslist-db": "^1.1.0" + "acorn-to-esprima": "^2.0.6", + "babel-traverse": "^6.4.5", + "debug": "^4.1.1", + "disparity": "^3.0.0", + "esformatter-parser": "^1.0.0", + "glob": "^7.1.6", + "minimatch": "^3.0.2", + "minimist": "^1.2.5", + "mout": "^1.2.2", + "npm-run": "^5.0.1", + "resolve": "^1.15.1", + "rocambole": ">=0.7 <2.0", + "rocambole-indent": "^2.0.4", + "rocambole-linebreak": "^1.0.2", + "rocambole-node": "~1.0", + "rocambole-token": "^1.1.2", + "rocambole-whitespace": "^1.0.0", + "stdin": "*", + "strip-json-comments": "^3.0.1", + "supports-color": "^7.1.0", + "user-home": "^2.0.0" }, "bin": { - "browserslist": "cli.js" + "esformatter": "bin/esformatter" }, "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + "node": ">=8" } }, - "node_modules/buffer": { - "version": "6.0.3", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/esformatter-parser": { + "version": "1.0.0", + "dev": true, "license": "MIT", "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "acorn-to-esprima": "^2.0.8", + "babel-traverse": "^6.9.0", + "babylon": "^6.8.0", + "rocambole": "^0.7.0" } }, - "node_modules/buffer-from": { - "version": "1.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/bufferutil": { - "version": "4.0.6", + "node_modules/esformatter/node_modules/supports-color": { + "version": "7.2.0", "dev": true, - "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-gyp-build": "^4.3.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" + "node": ">=8" } }, - "node_modules/call-bind": { - "version": "1.0.7", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", ->>>>>>> master + "node_modules/eslint": { + "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, - "license": "MIT", "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" }, "engines": { - "node": ">= 0.4" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/eslint" } }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, "engines": { - "node": ">=6" + "node": ">=8.0.0" } }, - "node_modules/camelcase": { - "version": "6.3.0", + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, - "license": "MIT", "engines": { - "node": ">=10" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/eslint" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001642", + "node_modules/eslint/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/canonicalize": { - "version": "1.0.8", - "license": "Apache-2.0" + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } }, - "node_modules/chai": { -<<<<<<< HEAD - "version": "4.3.6", -======= - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", - "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", ->>>>>>> master + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, "license": "MIT", "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.1.0" + "color-convert": "^2.0.1" }, "engines": { - "node": ">=4" - } - }, - "node_modules/chai-as-promised": { -<<<<<<< HEAD - "version": "7.1.1", -======= - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.2.tgz", - "integrity": "sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw==", ->>>>>>> master - "dev": true, - "license": "WTFPL", - "dependencies": { - "check-error": "^1.0.2" + "node": ">=8" }, - "peerDependencies": { - "chai": ">= 2.1.2 < 6" + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/chai/node_modules/type-detect": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", - "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, "engines": { - "node": ">=4" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk": { - "version": "2.4.2", + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", "dev": true, "license": "MIT", "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "color-name": "~1.1.4" }, "engines": { - "node": ">=4" + "node": ">=7.0.0" } }, - "node_modules/check-error": { -<<<<<<< HEAD - "version": "1.0.2", + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", "dev": true, "license": "MIT", -======= - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "dependencies": { - "get-func-name": "^2.0.2" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, ->>>>>>> master "engines": { - "node": "*" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/chokidar": { - "version": "3.5.3", + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "license": "MIT", "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" + "type-fest": "^0.20.2" }, "engines": { - "node": ">= 8.10.0" + "node": ">=8" }, - "optionalDependencies": { - "fsevents": "~2.3.2" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", + "node_modules/eslint/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", "dev": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "is-glob": "^4.0.1" + "has-flag": "^4.0.0" }, "engines": { - "node": ">= 6" + "node": ">=8" } }, - "node_modules/chrome-trace-event": { - "version": "1.0.3", - "dev": true, + "node_modules/esm": { + "version": "3.2.25", "license": "MIT", "engines": { - "node": ">=6.0" + "node": ">=6" } }, - "node_modules/cliui": { - "version": "7.0.4", + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, - "license": "ISC", "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/clone-deep": { - "version": "4.0.1", + "node_modules/esprima": { + "version": "2.7.3", "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" }, "engines": { - "node": ">=6" + "node": ">=0.10.0" } }, - "node_modules/color-convert": { - "version": "1.9.3", + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, - "license": "MIT", "dependencies": { - "color-name": "1.1.3" + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" } }, - "node_modules/color-name": { - "version": "1.1.3", + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "license": "MIT" + "engines": { + "node": ">=4.0" + } }, - "node_modules/colorette": { - "version": "2.0.19", + "node_modules/esrecurse": { + "version": "4.3.0", "dev": true, - "license": "MIT" + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } }, - "node_modules/commander": { - "version": "2.20.3", + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", "dev": true, - "license": "MIT" + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } }, -<<<<<<< HEAD - "node_modules/commondir": { - "version": "1.0.1", + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, - "license": "MIT" -======= - "node_modules/common-path-prefix": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", - "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "dev": true ->>>>>>> master }, - "node_modules/concat-map": { - "version": "0.0.1", + "node_modules/esutils": { + "version": "2.0.3", "dev": true, - "license": "MIT" + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } }, - "node_modules/content-disposition": { - "version": "0.5.4", + "node_modules/etag": { + "version": "1.8.1", "dev": true, "license": "MIT", - "dependencies": { - "safe-buffer": "5.2.1" - }, "engines": { "node": ">= 0.6" } }, - "node_modules/content-disposition/node_modules/safe-buffer": { - "version": "5.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } }, - "node_modules/content-type": { -<<<<<<< HEAD - "version": "1.0.4", -======= - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", ->>>>>>> master - "dev": true, + "node_modules/events": { + "version": "3.3.0", "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=0.8.x" } }, - "node_modules/convert-source-map": { -<<<<<<< HEAD - "version": "1.8.0", + "node_modules/express": { + "version": "4.18.1", "dev": true, "license": "MIT", "dependencies": { - "safe-buffer": "~5.1.1" - } - }, - "node_modules/cookie": { - "version": "0.5.0", -======= - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.0", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.5.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.2.0", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.10.3", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.18.0", + "serve-static": "1.15.0", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } }, - "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", ->>>>>>> master + "node_modules/express/node_modules/debug": { + "version": "2.6.9", "dev": true, "license": "MIT", - "engines": { - "node": ">= 0.6" + "dependencies": { + "ms": "2.0.0" } }, - "node_modules/cookie-signature": { - "version": "1.0.6", + "node_modules/express/node_modules/ms": { + "version": "2.0.0", "dev": true, "license": "MIT" }, - "node_modules/copy-anything": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", - "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", + "node_modules/express/node_modules/path-to-regexp": { + "version": "0.1.7", "dev": true, - "dependencies": { - "is-what": "^4.1.8" - }, - "engines": { - "node": ">=12.13" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } + "license": "MIT" }, - "node_modules/core-js": { - "version": "2.6.12", + "node_modules/express/node_modules/safe-buffer": { + "version": "5.2.1", "dev": true, - "hasInstallScript": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], "license": "MIT" }, - "node_modules/core-js-compat": { -<<<<<<< HEAD - "version": "3.25.3", -======= - "version": "3.37.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.37.1.tgz", - "integrity": "sha512-9TNiImhKvQqSUkOvk/mMRZzOANTiEVC7WaBNhHcKM7x+/5E1l5NvsysR19zuDQScE8k+kfQXWRN3AtS/eOSHpg==", ->>>>>>> master + "node_modules/ext": { + "version": "1.7.0", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "browserslist": "^4.23.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" + "type": "^2.7.2" } }, - "node_modules/core-util-is": { - "version": "1.0.3", + "node_modules/ext/node_modules/type": { + "version": "2.7.2", "dev": true, - "license": "MIT" + "license": "ISC" }, - "node_modules/create-require": { - "version": "1.1.1", + "node_modules/fast-deep-equal": { + "version": "3.1.3", "dev": true, "license": "MIT" }, - "node_modules/cross-fetch": { - "version": "3.1.8", + "node_modules/fast-glob": { + "version": "3.2.12", + "dev": true, "license": "MIT", "dependencies": { - "node-fetch": "^2.6.12" + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" } }, - "node_modules/cross-spawn": { - "version": "7.0.3", + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" + "is-glob": "^4.0.1" }, "engines": { - "node": ">= 8" + "node": ">= 6" } }, - "node_modules/crypto-js": { - "version": "4.2.0", - "license": "MIT" + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, - "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, - "node_modules/d": { - "version": "1.0.1", + "node_modules/fast-uri": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.3.tgz", + "integrity": "sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw==", + "dev": true + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fastq": { + "version": "1.13.0", "dev": true, "license": "ISC", "dependencies": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" + "reusify": "^1.0.4" } }, - "node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "node_modules/fetch-mock": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-10.1.1.tgz", + "integrity": "sha512-R6MwxuGwlUe0K6GzdLY1Wa9voX/GbUBDZjNHBsvlBhrpXurCYpQN4EW0iFCmtWddDTuS0ubR93OtFSgy9E/L2A==", "dev": true, "dependencies": { - "ms": "2.1.2" + "debug": "^4.1.1", + "dequal": "^2.0.3", + "globrex": "^0.1.2", + "is-subset": "^0.1.1", + "regexparam": "^3.0.0" }, "engines": { - "node": ">=6.0" + "node": ">=8.0.0" }, "peerDependenciesMeta": { - "supports-color": { + "node-fetch": { "optional": true } } }, - "node_modules/decamelize": { - "version": "4.0.0", + "node_modules/file-entry-cache": { + "version": "6.0.1", "dev": true, "license": "MIT", - "engines": { - "node": ">=10" + "dependencies": { + "flat-cache": "^3.0.4" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/deep-eql": { -<<<<<<< HEAD - "version": "3.0.1", -======= - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", - "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", ->>>>>>> master + "node_modules/fill-range": { + "version": "7.0.1", "dev": true, "license": "MIT", "dependencies": { - "type-detect": "^4.0.0" + "to-regex-range": "^5.0.1" }, "engines": { - "node": ">=6" + "node": ">=8" } }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "node_modules/define-data-property": { -<<<<<<< HEAD - "version": "1.1.4", + "node_modules/finalhandler": { + "version": "1.2.0", "dev": true, "license": "MIT", "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.8" } }, - "node_modules/define-properties": { - "version": "1.1.4", -======= - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", ->>>>>>> master + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", "dev": true, "license": "MIT", "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "ms": "2.0.0" } }, - "node_modules/depd": { + "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } + "license": "MIT" }, - "node_modules/dequal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", - "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "node_modules/find-cache-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", + "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", "dev": true, + "dependencies": { + "common-path-prefix": "^3.0.0", + "pkg-dir": "^7.0.0" + }, "engines": { - "node": ">=6" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/destroy": { - "version": "1.2.0", - "dev": true, - "license": "MIT", + "node_modules/find-cache-dir/node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/diff": { - "version": "4.0.2", + "node_modules/find-cache-dir/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", "dev": true, - "license": "BSD-3-Clause", + "dependencies": { + "p-locate": "^6.0.0" + }, "engines": { - "node": ">=0.3.1" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "node_modules/find-cache-dir/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", "dev": true, "dependencies": { - "path-type": "^4.0.0" + "yocto-queue": "^1.0.0" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/disparity": { - "version": "3.2.0", + "node_modules/find-cache-dir/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", "dev": true, - "license": "MIT", "dependencies": { - "ansi-styles": "^4.2.1", - "diff": "^4.0.2" + "p-limit": "^4.0.0" }, - "bin": { - "disparity": "bin/disparity" + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" } }, - "node_modules/disparity/node_modules/ansi-styles": { - "version": "4.3.0", + "node_modules/find-cache-dir/node_modules/pkg-dir": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", + "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", "dev": true, - "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "find-up": "^6.3.0" }, "engines": { - "node": ">=8" + "node": ">=14.16" }, "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/disparity/node_modules/color-convert": { - "version": "2.0.1", + "node_modules/find-cache-dir/node_modules/yocto-queue": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-up": { + "version": "5.0.0", "dev": true, "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=7.0.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/disparity/node_modules/color-name": { - "version": "1.1.4", + "node_modules/flat": { + "version": "5.0.2", "dev": true, - "license": "MIT" + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } }, - "node_modules/doctrine": { - "version": "3.0.0", + "node_modules/flat-cache": { + "version": "3.0.4", "dev": true, - "license": "Apache-2.0", + "license": "MIT", "dependencies": { - "esutils": "^2.0.2" + "flatted": "^3.1.0", + "rimraf": "^3.0.2" }, "engines": { - "node": ">=6.0.0" + "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/ee-first": { - "version": "1.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/electron-to-chromium": { - "version": "1.4.829", + "node_modules/flatted": { + "version": "3.2.7", "dev": true, "license": "ISC" }, - "node_modules/emoji-regex": { - "version": "8.0.0", + "node_modules/focus-trap": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.6.2.tgz", + "integrity": "sha512-9FhUxK1hVju2+AiQIDJ5Dd//9R2n2RAfJ0qfhF4IHGHgcoEUTMpbTeG/zbEuwaiYXfuAH6XE0/aCyxDdRM+W5w==", "dev": true, - "license": "MIT" + "dependencies": { + "tabbable": "^6.2.0" + } }, - "node_modules/emojis-list": { + "node_modules/foreachasync": { "version": "3.0.0", "dev": true, + "license": "Apache2" + }, + "node_modules/forwarded": { + "version": "0.2.0", + "dev": true, "license": "MIT", "engines": { - "node": ">= 4" + "node": ">= 0.6" } }, - "node_modules/encodeurl": { - "version": "1.0.2", + "node_modules/fresh": { + "version": "0.5.2", "dev": true, "license": "MIT", "engines": { - "node": ">= 0.8" + "node": ">= 0.6" } }, - "node_modules/enhanced-resolve": { -<<<<<<< HEAD - "version": "4.5.0", -======= - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", - "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", ->>>>>>> master + "node_modules/fs.realpath": { + "version": "1.0.0", "dev": true, - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=10.13.0" + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "node_modules/function-bind": { + "version": "1.1.1", "dev": true, - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } + "license": "MIT" }, - "node_modules/envinfo": { - "version": "7.13.0", + "node_modules/gensync": { + "version": "1.0.0-beta.2", "dev": true, "license": "MIT", - "bin": { - "envinfo": "dist/cli.js" - }, "engines": { - "node": ">=4" + "node": ">=6.9.0" } }, - "node_modules/errno": { - "version": "0.1.8", + "node_modules/get-caller-file": { + "version": "2.0.5", "dev": true, - "license": "MIT", - "dependencies": { - "prr": "~1.0.1" - }, - "bin": { - "errno": "cli.js" + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/es-define-property": { - "version": "1.0.0", -<<<<<<< HEAD + "node_modules/get-func-name": { + "version": "2.0.2", "dev": true, "license": "MIT", -======= - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dev": true, ->>>>>>> master - "dependencies": { - "get-intrinsic": "^1.2.4" - }, "engines": { - "node": ">= 0.4" + "node": "*" } }, - "node_modules/es-errors": { - "version": "1.3.0", -<<<<<<< HEAD + "node_modules/get-intrinsic": { + "version": "1.1.3", "dev": true, "license": "MIT", -======= - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "dev": true, ->>>>>>> master - "engines": { - "node": ">= 0.4" + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-module-lexer": { - "version": "1.5.4", - "dev": true, - "license": "MIT" - }, - "node_modules/es5-ext": { -<<<<<<< HEAD - "version": "0.10.62", -======= - "version": "0.10.64", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz", - "integrity": "sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==", ->>>>>>> master + "node_modules/glob": { + "version": "7.2.3", "dev": true, - "hasInstallScript": true, "license": "ISC", "dependencies": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "esniff": "^2.0.1", - "next-tick": "^1.1.0" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=0.10" + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/es6-iterator": { - "version": "2.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/es6-symbol": { - "version": "3.1.3", + "node_modules/glob-parent": { + "version": "6.0.2", "dev": true, "license": "ISC", "dependencies": { - "d": "^1.0.1", - "ext": "^1.1.2" + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" } }, - "node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" + "node": ">=4" } }, - "node_modules/escalade": { - "version": "3.1.2", + "node_modules/globby": { + "version": "11.1.0", "dev": true, "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, "engines": { - "node": ">=6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/escape-html": { - "version": "1.0.3", - "dev": true, - "license": "MIT" + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", "dev": true, "license": "MIT", + "dependencies": { + "function-bind": "^1.1.1" + }, "engines": { - "node": ">=0.8.0" + "node": ">= 0.4.0" } }, - "node_modules/esformatter": { - "version": "0.11.3", + "node_modules/has-ansi": { + "version": "2.0.0", "dev": true, "license": "MIT", "dependencies": { - "acorn-to-esprima": "^2.0.6", - "babel-traverse": "^6.4.5", - "debug": "^4.1.1", - "disparity": "^3.0.0", - "esformatter-parser": "^1.0.0", - "glob": "^7.1.6", - "minimatch": "^3.0.2", - "minimist": "^1.2.5", - "mout": "^1.2.2", - "npm-run": "^5.0.1", - "resolve": "^1.15.1", - "rocambole": ">=0.7 <2.0", - "rocambole-indent": "^2.0.4", - "rocambole-linebreak": "^1.0.2", - "rocambole-node": "~1.0", - "rocambole-token": "^1.1.2", - "rocambole-whitespace": "^1.0.0", - "stdin": "*", - "strip-json-comments": "^3.0.1", - "supports-color": "^7.1.0", - "user-home": "^2.0.0" - }, - "bin": { - "esformatter": "bin/esformatter" + "ansi-regex": "^2.0.0" }, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/esformatter-parser": { - "version": "1.0.0", + "node_modules/has-ansi/node_modules/ansi-regex": { + "version": "2.1.1", "dev": true, "license": "MIT", - "dependencies": { - "acorn-to-esprima": "^2.0.8", - "babel-traverse": "^6.9.0", - "babylon": "^6.8.0", - "rocambole": "^0.7.0" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/esformatter/node_modules/has-flag": { + "node_modules/has-flag": { "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/esformatter/node_modules/supports-color": { - "version": "7.2.0", + "node_modules/has-symbols": { + "version": "1.0.3", "dev": true, "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "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": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "@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": { - "url": "https://opencollective.com/eslint" + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", + "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, - "license": "BSD-2-Clause", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "@types/hast": "^3.0.0" }, - "engines": { - "node": ">=8.0.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "node_modules/he": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/hookable": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", + "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==", + "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, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "funding": { - "url": "https://opencollective.com/eslint" + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", + "node_modules/http-errors": { + "version": "2.0.0", "dev": true, "license": "MIT", "dependencies": { - "color-convert": "^2.0.1" + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">= 0.8" } }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, + "node_modules/http-link-header": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/http-link-header/-/http-link-header-1.1.3.tgz", + "integrity": "sha512-3cZ0SRL8fb9MUlU3mKM61FcQvPfXx2dBrZW3Vbg5CXa8jFlK8OaEpePenLe1oEXQduhz8b0QjsqfS59QP4AJDQ==", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": ">=6.0.0" } }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", + "node_modules/iconv-lite": { + "version": "0.4.24", "dev": true, "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { - "node": ">=7.0.0" + "node": ">=0.10.0" } }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" + "node_modules/ieee754": { + "version": "1.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" }, - "node_modules/eslint/node_modules/escape-string-regexp": { - "version": "4.0.0", + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, - "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 4" } }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=6" }, "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "node_modules/import-local": { + "version": "3.1.0", "dev": true, + "license": "MIT", "dependencies": { - "type-fest": "^0.20.2" + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" }, "engines": { "node": ">=8" @@ -6458,963 +5621,984 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", + "node_modules/imurmurhash": { + "version": "0.1.4", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">=0.8.19" } }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", + "node_modules/inflight": { + "version": "1.0.6", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" + "once": "^1.3.0", + "wrappy": "1" } }, - "node_modules/esm": { - "version": "3.2.25", - "license": "MIT", - "engines": { - "node": ">=6" - } + "node_modules/inherits": { + "version": "2.0.4", + "dev": true, + "license": "ISC" }, - "node_modules/esniff": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz", - "integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==", + "node_modules/interpret": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true, - "dependencies": { - "d": "^1.0.1", - "es5-ext": "^0.10.62", - "event-emitter": "^0.3.5", - "type": "^2.7.2" - }, "engines": { - "node": ">=0.10" + "node": ">=10.13.0" } }, - "node_modules/esniff/node_modules/type": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.3.tgz", - "integrity": "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==", - "dev": true - }, - "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "node_modules/invariant": { + "version": "2.2.4", "dev": true, + "license": "MIT", "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "loose-envify": "^1.0.0" } }, - "node_modules/esprima": { - "version": "2.7.3", + "node_modules/ipaddr.js": { + "version": "1.9.1", "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.10" } }, - "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "node_modules/is-binary-path": { + "version": "2.1.0", "dev": true, + "license": "MIT", "dependencies": { - "estraverse": "^5.1.0" + "binary-extensions": "^2.0.0" }, "engines": { - "node": ">=0.10" - } - }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" + "node": ">=8" } }, - "node_modules/esrecurse": { - "version": "4.3.0", + "node_modules/is-core-module": { + "version": "2.10.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "estraverse": "^5.2.0" + "has": "^1.0.3" }, - "engines": { - "node": ">=4.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", + "node_modules/is-extglob": { + "version": "2.1.1", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "engines": { - "node": ">=4.0" + "node": ">=0.10.0" } }, - "node_modules/estraverse": { - "version": "4.3.0", + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "engines": { - "node": ">=4.0" + "node": ">=8" } }, - "node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - }, - "node_modules/esutils": { - "version": "2.0.3", + "node_modules/is-glob": { + "version": "4.0.3", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, "engines": { "node": ">=0.10.0" } }, - "node_modules/etag": { - "version": "1.8.1", + "node_modules/is-number": { + "version": "7.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=0.12.0" } }, -<<<<<<< HEAD - "node_modules/event-target-shim": { - "version": "5.0.1", - "license": "MIT", - "engines": { - "node": ">=6" -======= - "node_modules/event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true, - "dependencies": { - "d": "1", - "es5-ext": "~0.10.14" ->>>>>>> master + "engines": { + "node": ">=8" } }, - "node_modules/events": { - "version": "3.3.0", + "node_modules/is-plain-obj": { + "version": "2.1.0", + "dev": true, "license": "MIT", "engines": { - "node": ">=0.8.x" + "node": ">=8" } }, - "node_modules/express": { -<<<<<<< HEAD - "version": "4.18.1", -======= - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", ->>>>>>> master + "node_modules/is-plain-object": { + "version": "2.0.4", "dev": true, "license": "MIT", "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.2", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.6.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" + "isobject": "^3.0.1" }, "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/express/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" + "node": ">=0.10.0" } }, - "node_modules/express/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/express/node_modules/path-to-regexp": { - "version": "0.1.7", - "dev": true, - "license": "MIT" - }, - "node_modules/express/node_modules/safe-buffer": { - "version": "5.2.1", + "node_modules/is-subset": { + "version": "0.1.1", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], "license": "MIT" }, - "node_modules/ext": { - "version": "1.7.0", - "dev": true, - "license": "ISC", - "dependencies": { - "type": "^2.7.2" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.7.2", - "dev": true, - "license": "ISC" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", + "node_modules/is-typedarray": { + "version": "1.0.0", "dev": true, "license": "MIT" }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "node_modules/is-unicode-supported": { + "version": "0.1.0", "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, + "license": "MIT", "engines": { - "node": ">=8.6.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fast-glob/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==", + "node_modules/is-what": { + "version": "4.1.16", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz", + "integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==", "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, "engines": { - "node": ">= 6" + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" } }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", + "node_modules/isarray": { + "version": "1.0.0", "dev": true, "license": "MIT" }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" }, - "node_modules/fast-uri": { + "node_modules/isobject": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", - "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", - "dev": true - }, - "node_modules/fastest-levenshtein": { - "version": "1.0.16", "dev": true, "license": "MIT", "engines": { - "node": ">= 4.9.1" + "node": ">=0.10.0" } }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "node_modules/jaribu": { + "version": "2.2.3", "dev": true, + "license": "GPL", "dependencies": { - "reusify": "^1.0.4" + "amdefine": "^1.0.1", + "bluebird": "^3.5.3", + "body-parser": "^1.18.3", + "express": "^4.16.4", + "node-fetch": "^2.6.1", + "requirejs": "^2.3.6", + "walk": "^2.3.14", + "websocket": "^1.0.28", + "whatwg-fetch": "^3.5.0" + }, + "bin": { + "jaribu": "bin/jaribu" } }, - "node_modules/fetch-mock": { -<<<<<<< HEAD - "version": "9.11.0", -======= - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-10.1.1.tgz", - "integrity": "sha512-R6MwxuGwlUe0K6GzdLY1Wa9voX/GbUBDZjNHBsvlBhrpXurCYpQN4EW0iFCmtWddDTuS0ubR93OtFSgy9E/L2A==", ->>>>>>> master + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, - "license": "MIT", "dependencies": { - "debug": "^4.1.1", - "dequal": "^2.0.3", - "globrex": "^0.1.2", - "is-subset": "^0.1.1", - "regexparam": "^3.0.0" + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" }, "engines": { - "node": ">=8.0.0" - }, - "peerDependenciesMeta": { - "node-fetch": { - "optional": true - } + "node": ">= 10.13.0" } }, -<<<<<<< HEAD - "node_modules/fetch-mock/node_modules/core-js": { - "version": "3.25.3", - "dev": true, - "hasInstallScript": true, - "license": "MIT", + "node_modules/jose": { + "version": "4.15.9", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz", + "integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==", "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" + "url": "https://github.com/sponsors/panva" } }, -======= ->>>>>>> master - "node_modules/file-entry-cache": { - "version": "6.0.1", + "node_modules/js-tokens": { + "version": "4.0.0", "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } + "license": "MIT" }, - "node_modules/fill-range": { -<<<<<<< HEAD - "version": "7.0.1", -======= - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", ->>>>>>> master + "node_modules/js-yaml": { + "version": "4.1.0", "dev": true, "license": "MIT", "dependencies": { - "to-regex-range": "^5.0.1" + "argparse": "^2.0.1" }, - "engines": { - "node": ">=8" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/finalhandler": { - "version": "1.2.0", + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" + "bin": { + "jsesc": "bin/jsesc" }, "engines": { - "node": ">= 0.8" + "node": ">=6" } }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", "dev": true, "license": "MIT" }, - "node_modules/find-cache-dir": { -<<<<<<< HEAD - "version": "3.3.2", -======= - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", - "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", ->>>>>>> master + "node_modules/json5": { + "version": "2.2.3", "dev": true, "license": "MIT", - "dependencies": { - "common-path-prefix": "^3.0.0", - "pkg-dir": "^7.0.0" + "bin": { + "json5": "lib/cli.js" }, "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=6" } }, - "node_modules/find-cache-dir/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, + "node_modules/jsonld-context-parser": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonld-context-parser/-/jsonld-context-parser-2.4.0.tgz", + "integrity": "sha512-ZYOfvh525SdPd9ReYY58dxB3E2RUEU4DJ6ZibO8AitcowPeBH4L5rCAitE2om5G1P+HMEgYEYEr4EZKbVN4tpA==", "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" + "@types/http-link-header": "^1.0.1", + "@types/node": "^18.0.0", + "cross-fetch": "^3.0.6", + "http-link-header": "^1.0.2", + "relative-to-absolute-iri": "^1.0.5" }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "bin": { + "jsonld-context-parse": "bin/jsonld-context-parse.js" + } + }, + "node_modules/jsonld-context-parser/node_modules/@types/node": { + "version": "18.19.68", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.68.tgz", + "integrity": "sha512-QGtpFH1vB99ZmTa63K4/FU8twThj4fuVSBkGddTp7uIL/cuoLWIUSL2RcOaigBhfR+hg5pgGkBnkoOxrTVBMKw==", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jsonld-streaming-parser": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jsonld-streaming-parser/-/jsonld-streaming-parser-3.4.0.tgz", + "integrity": "sha512-897CloyQgQidfkB04dLM5XaAXVX/cN9A2hvgHJo4y4jRhIpvg3KLMBBfcrswepV2N3T8c/Rp2JeFdWfVsbVZ7g==", + "dependencies": { + "@bergos/jsonparse": "^1.4.0", + "@rdfjs/types": "*", + "@types/http-link-header": "^1.0.1", + "@types/readable-stream": "^2.3.13", + "buffer": "^6.0.3", + "canonicalize": "^1.0.1", + "http-link-header": "^1.0.2", + "jsonld-context-parser": "^2.4.0", + "rdf-data-factory": "^1.1.0", + "readable-stream": "^4.0.0" + } + }, + "node_modules/jsonld-streaming-parser/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/find-cache-dir/node_modules/locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "node_modules/jsonld-streaming-parser/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/jsonld-streaming-parser/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/just-extend": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", + "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", + "dev": true + }, + "node_modules/kind-of": { + "version": "6.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, "dependencies": { - "p-locate": "^6.0.0" + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.8.0" } }, - "node_modules/find-cache-dir/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", "dev": true, "dependencies": { - "yocto-queue": "^1.0.0" - }, + "uc.micro": "^2.0.0" + } + }, + "node_modules/loader-runner": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", + "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "dev": true, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=6.11.5" + } + }, + "node_modules/loader-utils": { + "version": "2.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">=8.9.0" } }, - "node_modules/find-cache-dir/node_modules/p-locate": { + "node_modules/locate-path": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", "dev": true, + "license": "MIT", "dependencies": { - "p-limit": "^4.0.0" + "p-locate": "^5.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-cache-dir/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "node_modules/lodash": { + "version": "4.17.21", "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } + "license": "MIT" }, - "node_modules/find-cache-dir/node_modules/pkg-dir": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", - "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true + }, + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "dev": true, + "license": "MIT" + }, + "node_modules/log-symbols": { + "version": "4.1.0", "dev": true, + "license": "MIT", "dependencies": { - "find-up": "^6.3.0" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" }, "engines": { - "node": ">=14.16" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/find-cache-dir/node_modules/yocto-queue": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", - "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, "engines": { - "node": ">=12.20" + "node": ">=8" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/find-up": { - "version": "5.0.0", + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", "dev": true, "license": "MIT", "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "dev": true, - "license": "BSD-3-Clause", - "bin": { - "flat": "cli.js" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/flat-cache": { - "version": "3.0.4", + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", "dev": true, "license": "MIT", "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" + "color-name": "~1.1.4" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=7.0.0" } }, - "node_modules/flatted": { - "version": "3.2.7", + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", "dev": true, - "license": "ISC" + "license": "MIT" }, - "node_modules/focus-trap": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz", - "integrity": "sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==", + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", "dev": true, + "license": "MIT", "dependencies": { - "tabbable": "^6.2.0" + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/foreachasync": { - "version": "3.0.0", + "node_modules/loose-envify": { + "version": "1.4.0", "dev": true, - "license": "Apache2" + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } }, - "node_modules/forwarded": { - "version": "0.2.0", + "node_modules/loupe": { + "version": "2.3.4", "dev": true, "license": "MIT", - "engines": { - "node": ">= 0.6" + "dependencies": { + "get-func-name": "^2.0.0" } }, - "node_modules/fresh": { - "version": "0.5.2", + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" + "dependencies": { + "yallist": "^3.0.2" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", + "node_modules/lunr": { + "version": "2.3.9", "dev": true, - "license": "ISC" + "license": "MIT" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + "node_modules/magic-string": { + "version": "0.30.15", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.15.tgz", + "integrity": "sha512-zXeaYRgZ6ldS1RJJUrMrYgNJ4fdwnyI6tVqoiIhyCyv5IVTK9BU8Ic2l253GGETQHxI4HNUwhJ3fjDhKqEoaAw==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" } }, - "node_modules/function-bind": { - "version": "1.1.2", -<<<<<<< HEAD - "dev": true, - "license": "MIT", -======= - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "node_modules/make-error": { + "version": "1.3.6", "dev": true, ->>>>>>> master - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "ISC" }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", + "node_modules/mark.js": { + "version": "8.11.1", + "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", + "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==", + "dev": true + }, + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" } }, - "node_modules/get-caller-file": { - "version": "2.0.5", + "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, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" + "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/get-func-name": { + "node_modules/mdurl": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true + }, + "node_modules/media-typer": { + "version": "0.3.0", "dev": true, "license": "MIT", "engines": { - "node": "*" + "node": ">= 0.6" } }, - "node_modules/get-intrinsic": { - "version": "1.2.4", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", ->>>>>>> master + "node_modules/memory-fs": { + "version": "0.5.0", "dev": true, "license": "MIT", "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "errno": "^0.1.3", + "readable-stream": "^2.0.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=4.3.0 <5.0.0 || >=5.10" } }, - "node_modules/glob": { - "version": "7.2.3", + "node_modules/merge-descriptors": { + "version": "1.0.1", "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "license": "MIT" }, - "node_modules/glob-parent": { - "version": "6.0.2", + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, + "license": "MIT", "engines": { - "node": ">=10.13.0" + "node": ">= 8" } }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/globals": { - "version": "11.12.0", + "node_modules/methods": { + "version": "1.1.2", "dev": true, "license": "MIT", "engines": { - "node": ">=4" + "node": ">= 0.6" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" } }, -<<<<<<< HEAD - "node_modules/gopd": { - "version": "1.0.1", + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", "dev": true, - "license": "MIT", -======= - "node_modules/globrex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", - "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", - "dev": true + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", "dev": true, ->>>>>>> master + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" } }, - "node_modules/graceful-fs": { - "version": "4.2.11", + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", "dev": true, - "license": "ISC" + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true + "node_modules/micromark-util-types": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.1.tgz", + "integrity": "sha512-534m2WhVTddrcKVepwmVEVnUAmtrx9bfIjNoQHRqfnvdaHQiFytEhJoTgpWJvDEXCO5gLTQh3wYC1PgOJA4NSQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ] }, - "node_modules/has": { - "version": "1.0.3", + "node_modules/micromatch": { + "version": "4.0.5", "dev": true, "license": "MIT", "dependencies": { - "function-bind": "^1.1.1" + "braces": "^3.0.2", + "picomatch": "^2.3.1" }, "engines": { - "node": ">= 0.4.0" + "node": ">=8.6" } }, - "node_modules/has-ansi": { - "version": "2.0.0", + "node_modules/mime": { + "version": "1.6.0", "dev": true, "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" + "bin": { + "mime": "cli.js" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/has-ansi/node_modules/ansi-regex": { - "version": "2.1.1", + "node_modules/mime-db": { + "version": "1.52.0", "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.6" } }, - "node_modules/has-flag": { - "version": "3.0.0", + "node_modules/mime-types": { + "version": "2.1.35", "dev": true, "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, "engines": { - "node": ">=4" + "node": ">= 0.6" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", ->>>>>>> master + "node_modules/minimatch": { + "version": "3.1.2", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "es-define-property": "^1.0.0" -<<<<<<< HEAD -======= + "brace-expansion": "^1.1.7" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": "*" } }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "node_modules/minimist": { + "version": "1.2.6", "dev": true, - "engines": { - "node": ">= 0.4" ->>>>>>> master + "license": "MIT" + }, + "node_modules/minisearch": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-7.1.1.tgz", + "integrity": "sha512-b3YZEYCEH4EdCAtYP7OlDyx7FdPwNzuNwLQ34SfJpM9dlbBZzeXndGavTrC+VCiRWomL21SWfMc6SCKO/U2ZNw==", + "dev": true + }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "dev": true + }, + "node_modules/mocha": { + "version": "10.8.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", + "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", + "chokidar": "^3.5.3", + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/has-proto": { - "version": "1.0.3", + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/mocha/node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, -<<<<<<< HEAD - "node_modules/has-symbols": { - "version": "1.0.3", + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "license": "MIT", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, "engines": { - "node": ">= 0.4" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/hasown": { - "version": "2.0.2", - "dev": true, - "license": "MIT", -======= - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "node_modules/mocha/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, ->>>>>>> master "dependencies": { - "function-bind": "^1.1.2" + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">= 0.4" + "node": ">=10" } }, - "node_modules/he": { - "version": "1.2.0", + "node_modules/mocha/node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, - "license": "MIT", - "bin": { - "he": "bin/he" + "dependencies": { + "randombytes": "^2.1.0" } }, - "node_modules/hookable": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", - "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==", + "node_modules/mout": { + "version": "1.2.4", + "dev": true, + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, - "node_modules/http-errors": { - "version": "2.0.0", - "dev": true, - "license": "MIT", + "node_modules/n3": { + "version": "1.23.1", + "resolved": "https://registry.npmjs.org/n3/-/n3-1.23.1.tgz", + "integrity": "sha512-3f0IYJo+6+lXypothmlwPzm3wJNffsxUwnfONeFv2QqWq7RjTvyCMtkRXDUXW6XrZoOzaQX8xTTSYNlGjXcGtw==", "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" + "buffer": "^6.0.3", + "queue-microtask": "^1.1.2", + "readable-stream": "^4.0.0" }, "engines": { - "node": ">= 0.8" - } - }, - "node_modules/http-link-header": { - "version": "1.1.1", - "license": "MIT", - "engines": { - "node": ">=6.0.0" + "node": ">=12.0" } }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "dev": true, - "license": "MIT", + "node_modules/n3/node_modules/readable-stream": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", + "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" }, "engines": { - "node": ">=0.10.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/ieee754": { - "version": "1.2.1", + "node_modules/n3/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "funding": [ { "type": "github", @@ -7428,197 +6612,278 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "BSD-3-Clause" - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "engines": { - "node": ">= 4" - } + ] }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, + "node_modules/n3/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "safe-buffer": "~5.2.0" } }, - "node_modules/import-local": { - "version": "3.1.0", + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], "bin": { - "import-local-fixture": "fixtures/cli.js" + "nanoid": "bin/nanoid.cjs" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/imurmurhash": { - "version": "0.1.4", + "node_modules/natural-compare": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.3", "dev": true, "license": "MIT", "engines": { - "node": ">=0.8.19" + "node": ">= 0.6" } }, - "node_modules/inflight": { - "version": "1.0.6", - "dev": true, - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true }, - "node_modules/inherits": { - "version": "2.0.4", + "node_modules/next-tick": { + "version": "1.1.0", "dev": true, "license": "ISC" }, - "node_modules/interpret": { - "version": "3.1.1", + "node_modules/nise": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/nise/-/nise-6.1.1.tgz", + "integrity": "sha512-aMSAzLVY7LyeM60gvBS423nBmIPP+Wy7St7hsb+8/fc1HmeoHJfLO8CKse4u3BtOZvQLJghYPI2i/1WZrEj5/g==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.13.0" + "dependencies": { + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^13.0.1", + "@sinonjs/text-encoding": "^0.7.3", + "just-extend": "^6.2.0", + "path-to-regexp": "^8.1.0" } }, - "node_modules/invariant": { - "version": "2.2.4", + "node_modules/nise/node_modules/@sinonjs/fake-timers": { + "version": "13.0.5", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-13.0.5.tgz", + "integrity": "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw==", "dev": true, - "license": "MIT", "dependencies": { - "loose-envify": "^1.0.0" + "@sinonjs/commons": "^3.0.1" } }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "dev": true, - "license": "MIT", + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, "engines": { - "node": ">= 0.10" + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "dev": true, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "license": "MIT" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "license": "BSD-2-Clause" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", "license": "MIT", "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" } }, - "node_modules/is-core-module": { - "version": "2.10.0", + "node_modules/node-gyp-build": { + "version": "4.5.0", "dev": true, "license": "MIT", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" } }, - "node_modules/is-extglob": { - "version": "2.1.1", + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", + "node_modules/npm-path": { + "version": "2.0.4", "dev": true, "license": "MIT", + "dependencies": { + "which": "^1.2.10" + }, + "bin": { + "npm-path": "bin/npm-path" + }, "engines": { - "node": ">=8" + "node": ">=0.8" } }, - "node_modules/is-glob": { - "version": "4.0.3", + "node_modules/npm-path/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/npm-run": { + "version": "5.0.1", "dev": true, "license": "MIT", "dependencies": { - "is-extglob": "^2.1.1" + "minimist": "^1.2.0", + "npm-path": "^2.0.4", + "npm-which": "^3.0.1", + "serializerr": "^1.0.3" + }, + "bin": { + "npm-run": "bin/npm-run.js" }, "engines": { - "node": ">=0.10.0" + "node": ">=4.2.0" } }, - "node_modules/is-number": { - "version": "7.0.0", + "node_modules/npm-which": { + "version": "3.0.1", "dev": true, "license": "MIT", + "dependencies": { + "commander": "^2.9.0", + "npm-path": "^2.0.2", + "which": "^1.2.10" + }, + "bin": { + "npm-which": "bin/npm-which.js" + }, "engines": { - "node": ">=0.12.0" + "node": ">=4.2.0" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "node_modules/npm-which/node_modules/which": { + "version": "1.3.1", "dev": true, - "engines": { - "node": ">=8" + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" } }, - "node_modules/is-plain-obj": { - "version": "2.1.0", + "node_modules/object-inspect": { + "version": "1.12.2", "dev": true, "license": "MIT", - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-plain-object": { - "version": "2.0.4", + "node_modules/on-finished": { + "version": "2.4.1", "dev": true, "license": "MIT", "dependencies": { - "isobject": "^3.0.1" + "ee-first": "1.1.1" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.8" } }, - "node_modules/is-subset": { - "version": "0.1.1", + "node_modules/once": { + "version": "1.4.0", "dev": true, - "license": "MIT" + "license": "ISC", + "dependencies": { + "wrappy": "1" + } }, - "node_modules/is-typedarray": { - "version": "1.0.0", + "node_modules/oniguruma-to-es": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-0.7.0.tgz", + "integrity": "sha512-HRaRh09cE0gRS3+wi2zxekB+I5L8C/gN60S+vb11eADHUaB/q4u8wGGOX3GvwvitG8ixaeycZfeoyruKQzUgNg==", "dev": true, - "license": "MIT" + "dependencies": { + "emoji-regex-xs": "^1.0.0", + "regex": "^5.0.2", + "regex-recursion": "^4.3.0" + } }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", "dev": true, "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, "engines": { "node": ">=10" }, @@ -7626,69 +6891,49 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-what": { - "version": "4.1.16", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz", - "integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==", + "node_modules/p-locate": { + "version": "5.0.0", "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, "engines": { - "node": ">=12.13" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/mesqueeb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/isarray": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/isobject": { - "version": "3.0.1", + "node_modules/p-try": { + "version": "2.2.0", "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/jaribu": { - "version": "2.2.3", + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, - "license": "GPL", "dependencies": { - "amdefine": "^1.0.1", - "bluebird": "^3.5.3", - "body-parser": "^1.18.3", - "express": "^4.16.4", - "node-fetch": "^2.6.1", - "requirejs": "^2.3.6", - "walk": "^2.3.14", - "websocket": "^1.0.28", - "whatwg-fetch": "^3.5.0" + "callsites": "^3.0.0" }, - "bin": { - "jaribu": "bin/jaribu" + "engines": { + "node": ">=6" } }, - "node_modules/jest-worker": { - "version": "27.5.1", + "node_modules/parseurl": { + "version": "1.3.3", "dev": true, "license": "MIT", - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, "engines": { - "node": ">= 10.13.0" + "node": ">= 0.8" } }, - "node_modules/jest-worker/node_modules/has-flag": { + "node_modules/path-exists": { "version": "4.0.0", "dev": true, "license": "MIT", @@ -7696,724 +6941,728 @@ "node": ">=8" } }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", + "node_modules/path-is-absolute": { + "version": "1.0.1", "dev": true, "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "node": ">=0.10.0" } }, - "node_modules/jose": { - "version": "4.15.4", + "node_modules/path-key": { + "version": "3.1.1", + "dev": true, "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/panva" + "engines": { + "node": ">=8" } }, - "node_modules/js-tokens": { - "version": "4.0.0", + "node_modules/path-parse": { + "version": "1.0.7", "dev": true, "license": "MIT" }, - "node_modules/js-yaml": { - "version": "4.1.0", + "node_modules/path-to-regexp": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "engines": { + "node": ">=16" } }, - "node_modules/jsesc": { - "version": "2.5.2", + "node_modules/path-type": { + "version": "4.0.0", "dev": true, "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", + "node_modules/pathval": { + "version": "1.1.1", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": "*" + } }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "dev": true, - "license": "MIT" + "node_modules/perfect-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", + "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==", + "dev": true }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", + "node_modules/picocolors": { + "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": { + "version": "2.3.1", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } }, - "node_modules/json5": { - "version": "2.2.1", + "node_modules/pkg-dir": { + "version": "4.2.0", "dev": true, "license": "MIT", - "bin": { - "json5": "lib/cli.js" + "dependencies": { + "find-up": "^4.0.0" }, "engines": { - "node": ">=6" + "node": ">=8" } }, - "node_modules/jsonld-context-parser": { - "version": "2.4.0", + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "dev": true, "license": "MIT", "dependencies": { - "@types/http-link-header": "^1.0.1", - "@types/node": "^18.0.0", - "cross-fetch": "^3.0.6", - "http-link-header": "^1.0.2", - "relative-to-absolute-iri": "^1.0.5" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" }, - "bin": { - "jsonld-context-parse": "bin/jsonld-context-parse.js" + "engines": { + "node": ">=8" } }, - "node_modules/jsonld-context-parser/node_modules/@types/node": { - "version": "18.19.3", + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/jsonld-streaming-parser": { - "version": "3.3.0", + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "dev": true, "license": "MIT", "dependencies": { - "@bergos/jsonparse": "^1.4.0", - "@rdfjs/types": "*", - "@types/http-link-header": "^1.0.1", - "@types/readable-stream": "^2.3.13", - "buffer": "^6.0.3", - "canonicalize": "^1.0.1", - "http-link-header": "^1.0.2", - "jsonld-context-parser": "^2.4.0", - "rdf-data-factory": "^1.1.0", - "readable-stream": "^4.0.0" + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/jsonld-streaming-parser/node_modules/readable-stream": { - "version": "4.5.1", + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "dev": true, "license": "MIT", "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" + "p-limit": "^2.2.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=8" } }, - "node_modules/jsonld-streaming-parser/node_modules/safe-buffer": { - "version": "5.2.1", + "node_modules/postcss": { + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "dev": true, "funding": [ { - "type": "github", - "url": "https://github.com/sponsors/feross" + "type": "opencollective", + "url": "https://opencollective.com/postcss/" }, { - "type": "patreon", - "url": "https://www.patreon.com/feross" + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" }, { - "type": "consulting", - "url": "https://feross.org/support" + "type": "github", + "url": "https://github.com/sponsors/ai" } ], - "license": "MIT" - }, - "node_modules/jsonld-streaming-parser/node_modules/string_decoder": { - "version": "1.3.0", - "license": "MIT", "dependencies": { - "safe-buffer": "~5.2.0" + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" } }, - "node_modules/just-extend": { -<<<<<<< HEAD - "version": "4.2.1", + "node_modules/preact": { + "version": "10.25.1", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.25.1.tgz", + "integrity": "sha512-frxeZV2vhQSohQwJ7FvlqC40ze89+8friponWUFeVEkaCfhC6Eu4V0iND5C9CXz8JLndV07QRDeXzH1+Anz5Og==", "dev": true, - "license": "MIT" -======= - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", - "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", - "dev": true ->>>>>>> master + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } }, - "node_modules/kind-of": { - "version": "6.0.3", + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, - "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.8.0" } }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", "engines": { - "node": ">= 0.8.0" + "node": ">= 0.6.0" } }, - "node_modules/linkify-it": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", - "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "node_modules/process-nextick-args": { + "version": "2.0.1", "dev": true, - "dependencies": { - "uc.micro": "^2.0.0" - } + "license": "MIT" }, - "node_modules/loader-runner": { - "version": "4.3.0", + "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, - "license": "MIT", - "engines": { - "node": ">=6.11.5" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/loader-utils": { - "version": "2.0.2", + "node_modules/protochain": { + "version": "1.0.5", "dev": true, - "license": "MIT", - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "engines": { - "node": ">=8.9.0" - } + "license": "ISC" }, - "node_modules/locate-path": { - "version": "6.0.0", + "node_modules/proxy-addr": { + "version": "2.0.7", "dev": true, "license": "MIT", "dependencies": { - "p-locate": "^5.0.0" + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.10" } }, - "node_modules/lodash": { - "version": "4.17.21", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", + "node_modules/prr": { + "version": "1.0.1", "dev": true, "license": "MIT" }, - "node_modules/lodash.get": { - "version": "4.4.2", + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, - "license": "MIT" + "engines": { + "node": ">=6" + } }, -<<<<<<< HEAD - "node_modules/lodash.isequal": { - "version": "4.5.0", - "dev": true, - "license": "MIT" - }, -======= ->>>>>>> master - "node_modules/lodash.merge": { - "version": "4.6.2", - "dev": true, - "license": "MIT" - }, -<<<<<<< HEAD - "node_modules/lodash.sortby": { - "version": "4.7.0", + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", "dev": true, - "license": "MIT" + "engines": { + "node": ">=6" + } }, -======= ->>>>>>> master - "node_modules/log-symbols": { - "version": "4.1.0", + "node_modules/qs": { + "version": "6.10.3", "dev": true, - "license": "MIT", + "license": "BSD-3-Clause", "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" + "side-channel": "^1.0.4" }, "engines": { - "node": ">=10" + "node": ">=0.6" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/log-symbols/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", + "node_modules/queue-microtask": { + "version": "1.2.3", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "safe-buffer": "^5.1.0" } }, - "node_modules/log-symbols/node_modules/chalk": { - "version": "4.1.2", + "node_modules/range-parser": { + "version": "1.2.1", "dev": true, "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": ">= 0.6" } }, - "node_modules/log-symbols/node_modules/color-convert": { - "version": "2.0.1", + "node_modules/raw-body": { + "version": "2.5.1", "dev": true, "license": "MIT", "dependencies": { - "color-name": "~1.1.4" + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" }, "engines": { - "node": ">=7.0.0" + "node": ">= 0.8" } }, - "node_modules/log-symbols/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" + "node_modules/rdf-data-factory": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/rdf-data-factory/-/rdf-data-factory-1.1.2.tgz", + "integrity": "sha512-TfQD63Lokabd09ES1jAtKK8AA6rkr9rwyUBGo6olOt1CE0Um36CUQIqytyf0am2ouBPR0l7SaHxCiMcPGHkt1A==", + "dependencies": { + "@rdfjs/types": "*" + } }, - "node_modules/log-symbols/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" + "node_modules/rdf-js": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/rdf-js/-/rdf-js-4.0.2.tgz", + "integrity": "sha512-ApvlFa/WsQh8LpPK/6hctQwG06Z9ztQQGWVtrcrf9L6+sejHNXLPOqL+w7q3hF+iL0C4sv3AX1PUtGkLNzyZ0Q==", + "deprecated": "Use @types/rdf-js instead. See https://github.com/rdfjs/types?tab=readme-ov-file#what-about-typesrdf-js", + "dependencies": { + "@rdfjs/types": "*" } }, - "node_modules/log-symbols/node_modules/supports-color": { - "version": "7.2.0", + "node_modules/readable-stream": { + "version": "2.3.7", "dev": true, "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/loose-envify": { - "version": "1.4.0", + "node_modules/readdirp": { + "version": "3.6.0", "dev": true, "license": "MIT", "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" + "picomatch": "^2.2.1" }, - "bin": { - "loose-envify": "cli.js" + "engines": { + "node": ">=8.10.0" } }, - "node_modules/loupe": { -<<<<<<< HEAD - "version": "2.3.4", -======= - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", ->>>>>>> master + "node_modules/rechoir": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "dev": true, - "license": "MIT", "dependencies": { - "get-func-name": "^2.0.1" + "resolve": "^1.20.0" + }, + "engines": { + "node": ">= 10.13.0" } }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", "dev": true, "dependencies": { - "yallist": "^3.0.2" + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" } }, - "node_modules/lunr": { - "version": "2.3.9", + "node_modules/regenerator-runtime": { + "version": "0.11.1", "dev": true, "license": "MIT" }, - "node_modules/magic-string": { - "version": "0.30.11", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.11.tgz", - "integrity": "sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==", + "node_modules/regenerator-transform": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", "dev": true, "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" + "@babel/runtime": "^7.8.4" } }, -<<<<<<< HEAD - "node_modules/make-dir": { - "version": "3.1.0", + "node_modules/regex": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/regex/-/regex-5.0.2.tgz", + "integrity": "sha512-/pczGbKIQgfTMRV0XjABvc5RzLqQmwqxLHdQao2RTXPk+pmTXB2P0IaUHYdYyk412YLwUIkaeMd5T+RzVgTqnQ==", "dev": true, - "license": "MIT", "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "regex-utilities": "^2.3.0" } }, -======= ->>>>>>> master - "node_modules/make-error": { - "version": "1.3.6", - "dev": true, - "license": "ISC" - }, - "node_modules/mark.js": { - "version": "8.11.1", - "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", - "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==", - "dev": true - }, - "node_modules/markdown-it": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", - "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "node_modules/regex-recursion": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-4.3.0.tgz", + "integrity": "sha512-5LcLnizwjcQ2ALfOj95MjcatxyqF5RPySx9yT+PaXu3Gox2vyAtLDjHB8NTJLtMGkvyau6nI3CfpwFCjPUIs/A==", "dev": true, "dependencies": { - "argparse": "^2.0.1", - "entities": "^4.4.0", - "linkify-it": "^5.0.0", - "mdurl": "^2.0.0", - "punycode.js": "^2.3.1", - "uc.micro": "^2.1.0" - }, - "bin": { - "markdown-it": "bin/markdown-it.mjs" + "regex-utilities": "^2.3.0" } }, - "node_modules/mdurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", "dev": true }, - "node_modules/media-typer": { - "version": "0.3.0", + "node_modules/regexparam": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexparam/-/regexparam-3.0.0.tgz", + "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", "dev": true, - "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=8" } }, - "node_modules/memory-fs": { - "version": "0.5.0", + "node_modules/regexpu-core": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", "dev": true, - "license": "MIT", "dependencies": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.2.0", + "regjsgen": "^0.8.0", + "regjsparser": "^0.12.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.1.0" }, "engines": { - "node": ">=4.3.0 <5.0.0 || >=5.10" + "node": ">=4" } }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "dev": true, - "license": "MIT" + "node_modules/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", + "dev": true }, - "node_modules/merge-stream": { - "version": "2.0.0", + "node_modules/regjsparser": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", "dev": true, - "license": "MIT" + "dependencies": { + "jsesc": "~3.0.2" + }, + "bin": { + "regjsparser": "bin/parser" + } }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "node_modules/regjsparser/node_modules/jsesc": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, "engines": { - "node": ">= 8" + "node": ">=6" } }, - "node_modules/methods": { - "version": "1.1.2", + "node_modules/relative-to-absolute-iri": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/relative-to-absolute-iri/-/relative-to-absolute-iri-1.0.7.tgz", + "integrity": "sha512-Xjyl4HmIzg2jzK/Un2gELqbcE8Fxy85A/aLSHE6PE/3+OGsFwmKVA1vRyGaz6vLWSqLDMHA+5rjD/xbibSQN1Q==" + }, + "node_modules/repeat-string": { + "version": "1.6.1", "dev": true, "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=0.10" } }, - "node_modules/micromatch": { - "version": "4.0.5", + "node_modules/require-directory": { + "version": "2.1.1", "dev": true, "license": "MIT", - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, "engines": { - "node": ">=8.6" + "node": ">=0.10.0" } }, - "node_modules/mime": { - "version": "1.6.0", + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requirejs": { + "version": "2.3.6", "dev": true, "license": "MIT", "bin": { - "mime": "cli.js" + "r_js": "bin/r.js", + "r.js": "bin/r.js" }, "engines": { - "node": ">=4" + "node": ">=0.4.0" } }, - "node_modules/mime-db": { - "version": "1.52.0", + "node_modules/resolve": { + "version": "1.22.1", "dev": true, "license": "MIT", - "engines": { - "node": ">= 0.6" + "dependencies": { + "is-core-module": "^2.9.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mime-types": { - "version": "2.1.35", + "node_modules/resolve-cwd": { + "version": "3.0.0", "dev": true, "license": "MIT", "dependencies": { - "mime-db": "1.52.0" + "resolve-from": "^5.0.0" }, "engines": { - "node": ">= 0.6" + "node": ">=8" } }, - "node_modules/minimatch": { - "version": "3.1.2", + "node_modules/resolve-cwd/node_modules/resolve-from": { + "version": "5.0.0", "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, + "license": "MIT", "engines": { - "node": "*" + "node": ">=8" } }, - "node_modules/minimist": { - "version": "1.2.6", + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, - "license": "MIT" + "engines": { + "node": ">=4" + } }, - "node_modules/minisearch": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-7.1.0.tgz", - "integrity": "sha512-tv7c/uefWdEhcu6hvrfTihflgeEi2tN6VV7HJnCjK6VxM75QQJh4t9FwJCsA2EsRS8LCnu3W87CuGPWMocOLCA==", - "dev": true + "node_modules/reusify": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } }, - "node_modules/mitt": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", - "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", "dev": true }, - "node_modules/mocha": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz", - "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==", + "node_modules/rimraf": { + "version": "3.0.2", "dev": true, + "license": "ISC", "dependencies": { - "ansi-colors": "^4.1.3", - "browser-stdout": "^1.3.1", - "chokidar": "^3.5.3", - "debug": "^4.3.5", - "diff": "^5.2.0", - "escape-string-regexp": "^4.0.0", - "find-up": "^5.0.0", - "glob": "^8.1.0", - "he": "^1.2.0", - "js-yaml": "^4.1.0", - "log-symbols": "^4.1.0", - "minimatch": "^5.1.6", - "ms": "^2.1.3", - "serialize-javascript": "^6.0.2", - "strip-json-comments": "^3.1.1", - "supports-color": "^8.1.1", - "workerpool": "^6.5.1", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9", - "yargs-unparser": "^2.0.0" + "glob": "^7.1.3" }, "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" + "rimraf": "bin.js" }, - "engines": { - "node": ">= 14.0.0" + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "node_modules/rocambole": { + "version": "0.7.0", "dev": true, + "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0" + "esprima": "^2.1" } }, - "node_modules/mocha/node_modules/diff": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "node_modules/rocambole-indent": { + "version": "2.0.4", "dev": true, - "engines": { - "node": ">=0.3.1" + "license": "MIT", + "dependencies": { + "debug": "^2.1.3", + "mout": "^0.11.0", + "rocambole-token": "^1.2.1" } }, - "node_modules/mocha/node_modules/escape-string-regexp": { - "version": "4.0.0", + "node_modules/rocambole-indent/node_modules/debug": { + "version": "2.6.9", "dev": true, "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "dependencies": { + "ms": "2.0.0" } }, - "node_modules/mocha/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "node_modules/rocambole-indent/node_modules/mout": { + "version": "0.11.1", "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "license": "MIT" }, - "node_modules/mocha/node_modules/has-flag": { - "version": "4.0.0", + "node_modules/rocambole-indent/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/rocambole-linebreak": { + "version": "1.0.2", "dev": true, "license": "MIT", - "engines": { - "node": ">=8" + "dependencies": { + "debug": "^2.1.3", + "rocambole-token": "^1.2.1", + "semver": "^4.3.1" } }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "node_modules/rocambole-linebreak/node_modules/debug": { + "version": "2.6.9", "dev": true, + "license": "MIT", "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" + "ms": "2.0.0" } }, - "node_modules/mocha/node_modules/ms": { - "version": "2.1.3", + "node_modules/rocambole-linebreak/node_modules/ms": { + "version": "2.0.0", "dev": true, "license": "MIT" }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", + "node_modules/rocambole-linebreak/node_modules/semver": { + "version": "4.3.6", "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "license": "ISC", + "bin": { + "semver": "bin/semver" } }, - "node_modules/mout": { - "version": "1.2.4", + "node_modules/rocambole-node": { + "version": "1.0.0", "dev": true, "license": "MIT" }, - "node_modules/ms": { - "version": "2.1.2", + "node_modules/rocambole-token": { + "version": "1.2.1", "dev": true, "license": "MIT" }, - "node_modules/n3": { - "version": "1.17.2", + "node_modules/rocambole-whitespace": { + "version": "1.0.0", + "dev": true, "license": "MIT", "dependencies": { - "queue-microtask": "^1.1.2", - "readable-stream": "^4.0.0" - }, - "engines": { - "node": ">=12.0" + "debug": "^2.1.3", + "repeat-string": "^1.5.0", + "rocambole-token": "^1.2.1" } }, - "node_modules/n3/node_modules/readable-stream": { - "version": "4.5.1", + "node_modules/rocambole-whitespace/node_modules/debug": { + "version": "2.6.9", + "dev": true, "license": "MIT", "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "ms": "2.0.0" } }, - "node_modules/n3/node_modules/safe-buffer": { - "version": "5.2.1", + "node_modules/rocambole-whitespace/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/rollup": { + "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.6" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@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" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "dev": true, "funding": [ { "type": "github", @@ -8428,10088 +7677,1491 @@ "url": "https://feross.org/support" } ], - "license": "MIT" - }, - "node_modules/n3/node_modules/string_decoder": { - "version": "1.3.0", "license": "MIT", "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + "queue-microtask": "^1.2.2" } }, - "node_modules/natural-compare": { - "version": "1.4.0", - "dev": true, + "node_modules/safe-buffer": { + "version": "5.1.2", "license": "MIT" }, - "node_modules/negotiator": { - "version": "0.6.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/neo-async": { - "version": "2.6.2", + "node_modules/safer-buffer": { + "version": "2.1.2", "dev": true, "license": "MIT" }, - "node_modules/next-tick": { - "version": "1.1.0", - "dev": true, - "license": "ISC" - }, - "node_modules/nise": { -<<<<<<< HEAD - "version": "5.1.1", -======= - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/nise/-/nise-6.0.0.tgz", - "integrity": "sha512-K8ePqo9BFvN31HXwEtTNGzgrPpmvgciDsFz8aztFjt4LqKO/JeFD8tBOeuDiCMXrIl/m1YvfH8auSpxfaD09wg==", ->>>>>>> master + "node_modules/schema-utils": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", + "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { -<<<<<<< HEAD - "@sinonjs/commons": "^1.8.3", - "@sinonjs/fake-timers": ">=5", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "path-to-regexp": "^1.7.0" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "node_modules/nise/node_modules/isarray": { - "version": "0.0.1", + "node_modules/search-insights": { + "version": "2.17.3", + "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.17.3.tgz", + "integrity": "sha512-RQPdCYTa8A68uM2jwxoY842xDhvx3E5LFL1LxvxCNMev4o5mLuokczhzjAgGwUZBAmOKZknArSxLKmXtIi2AxQ==", "dev": true, - "license": "MIT" + "peer": true }, - "node_modules/nise/node_modules/path-to-regexp": { - "version": "1.8.0", + "node_modules/semver": { + "version": "6.3.1", "dev": true, - "license": "MIT", - "dependencies": { - "isarray": "0.0.1" -======= - "@sinonjs/commons": "^3.0.0", - "@sinonjs/fake-timers": "^11.2.2", - "@sinonjs/text-encoding": "^0.7.2", - "just-extend": "^6.2.0", - "path-to-regexp": "^6.2.1" ->>>>>>> master + "license": "ISC", + "bin": { + "semver": "bin/semver.js" } }, - "node_modules/node-fetch": { - "version": "2.7.0", + "node_modules/send": { + "version": "0.18.0", + "dev": true, "license": "MIT", "dependencies": { - "whatwg-url": "^5.0.0" + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" }, "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "license": "MIT" - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "license": "BSD-2-Clause" - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" + "node": ">= 0.8.0" } }, - "node_modules/node-gyp-build": { - "version": "4.5.0", + "node_modules/send/node_modules/debug": { + "version": "2.6.9", "dev": true, "license": "MIT", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" + "dependencies": { + "ms": "2.0.0" } }, - "node_modules/node-releases": { - "version": "2.0.17", + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", "dev": true, "license": "MIT" }, - "node_modules/normalize-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-path": { - "version": "2.0.4", - "dev": true, - "license": "MIT", + "node_modules/serialize-javascript": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", + "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", "dependencies": { - "which": "^1.2.10" - }, - "bin": { - "npm-path": "bin/npm-path" - }, - "engines": { - "node": ">=0.8" + "randombytes": "^2.1.0" } }, - "node_modules/npm-path/node_modules/which": { - "version": "1.3.1", + "node_modules/serializerr": { + "version": "1.0.3", "dev": true, "license": "ISC", "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" + "protochain": "^1.0.5" } }, - "node_modules/npm-run": { - "version": "5.0.1", + "node_modules/serve-static": { + "version": "1.15.0", "dev": true, "license": "MIT", "dependencies": { - "minimist": "^1.2.0", - "npm-path": "^2.0.4", - "npm-which": "^3.0.1", - "serializerr": "^1.0.3" - }, - "bin": { - "npm-run": "bin/npm-run.js" + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.18.0" }, "engines": { - "node": ">=4.2.0" + "node": ">= 0.8.0" } }, - "node_modules/npm-which": { + "node_modules/setprototypeof": { + "version": "1.2.0", + "dev": true, + "license": "ISC" + }, + "node_modules/shallow-clone": { "version": "3.0.1", "dev": true, "license": "MIT", "dependencies": { - "commander": "^2.9.0", - "npm-path": "^2.0.2", - "which": "^1.2.10" - }, - "bin": { - "npm-which": "bin/npm-which.js" + "kind-of": "^6.0.2" }, "engines": { - "node": ">=4.2.0" + "node": ">=8" } }, - "node_modules/npm-which/node_modules/which": { - "version": "1.3.1", + "node_modules/shebang-command": { + "version": "2.0.0", "dev": true, - "license": "ISC", + "license": "MIT", "dependencies": { - "isexe": "^2.0.0" + "shebang-regex": "^3.0.0" }, - "bin": { - "which": "bin/which" + "engines": { + "node": ">=8" } }, - "node_modules/object-inspect": { -<<<<<<< HEAD - "version": "1.12.2", + "node_modules/shebang-regex": { + "version": "3.0.0", "dev": true, "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=8" } }, - "node_modules/object-keys": { - "version": "1.1.1", + "node_modules/shiki": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.24.2.tgz", + "integrity": "sha512-TR1fi6mkRrzW+SKT5G6uKuc32Dj2EEa7Kj0k8kGqiBINb+C1TiflVOiT9ta6GqOJtC4fraxO5SLUaKBcSY38Fg==", "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" + "dependencies": { + "@shikijs/core": "1.24.2", + "@shikijs/engine-javascript": "1.24.2", + "@shikijs/engine-oniguruma": "1.24.2", + "@shikijs/types": "1.24.2", + "@shikijs/vscode-textmate": "^9.3.0", + "@types/hast": "^3.0.4" } }, - "node_modules/object.assign": { - "version": "4.1.4", + "node_modules/side-channel": { + "version": "1.0.4", "dev": true, "license": "MIT", "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - }, -======= - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", - "dev": true, ->>>>>>> master - "engines": { - "node": ">= 0.4" + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/on-finished": { - "version": "2.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "node_modules/sinon": { + "version": "18.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-18.0.1.tgz", + "integrity": "sha512-a2N2TDY1uGviajJ6r4D1CyRAkzE9NNVlYOV1wX5xQDuAk0ONgzgRl0EjCQuRCPxOwp13ghsMwt9Gdldujs39qw==", "dev": true, "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "11.2.2", + "@sinonjs/samsam": "^8.0.0", + "diff": "^5.2.0", + "nise": "^6.0.0", + "supports-color": "^7" }, - "engines": { - "node": ">= 0.8.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" } }, - "node_modules/os-homedir": { - "version": "1.0.2", + "node_modules/sinon/node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "dev": true, - "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=0.3.1" } }, - "node_modules/p-limit": { - "version": "3.1.0", + "node_modules/sinon/node_modules/supports-color": { + "version": "7.2.0", "dev": true, "license": "MIT", "dependencies": { - "yocto-queue": "^0.1.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/p-locate": { - "version": "5.0.0", + "node_modules/slash": { + "version": "3.0.0", "dev": true, "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/p-try": { - "version": "2.2.0", + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, - "license": "MIT", "engines": { - "node": ">=6" + "node": ">=0.10.0" } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, - "dependencies": { - "callsites": "^3.0.0" - }, "engines": { - "node": ">=6" + "node": ">=0.10.0" } }, - "node_modules/parseurl": { - "version": "1.3.3", + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, - "node_modules/path-exists": { - "version": "4.0.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, - "license": "MIT", - "engines": { - "node": ">=8" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", + "node_modules/speakingurl": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz", + "integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } }, - "node_modules/path-key": { - "version": "3.1.1", + "node_modules/statuses": { + "version": "2.0.1", "dev": true, "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 0.8" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "dev": true, - "license": "MIT" - }, - "node_modules/path-to-regexp": { -<<<<<<< HEAD - "version": "2.4.0", - "dev": true, - "license": "MIT" -======= - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", + "node_modules/stdin": { + "version": "0.0.1", "dev": true ->>>>>>> master - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } }, - "node_modules/pathval": { + "node_modules/string_decoder": { "version": "1.1.1", "dev": true, "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/perfect-debounce": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", - "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==", - "dev": true - }, - "node_modules/picocolors": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "dependencies": { + "safe-buffer": "~5.1.0" } }, - "node_modules/pkg-dir": { - "version": "4.2.0", + "node_modules/string-width": { + "version": "4.2.3", "dev": true, "license": "MIT", "dependencies": { - "find-up": "^4.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { "node": ">=8" } }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "4.1.0", + "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, - "license": "MIT", "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" }, - "engines": { - "node": ">=8" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "5.0.0", + "node_modules/strip-ansi": { + "version": "6.0.1", "dev": true, "license": "MIT", "dependencies": { - "p-locate": "^4.1.0" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" } }, - "node_modules/pkg-dir/node_modules/p-limit": { - "version": "2.3.0", + "node_modules/strip-json-comments": { + "version": "3.1.1", "dev": true, "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, "engines": { - "node": ">=6" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "4.1.0", + "node_modules/superjson": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.2.tgz", + "integrity": "sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q==", "dev": true, - "license": "MIT", "dependencies": { - "p-limit": "^2.2.0" + "copy-anything": "^3.0.2" }, "engines": { - "node": ">=8" + "node": ">=16" } }, - "node_modules/postcss": { - "version": "8.4.41", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.41.tgz", - "integrity": "sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==", + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" + "has-flag": "^4.0.0" }, "engines": { - "node": "^10 || ^12 || >=14" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/preact": { - "version": "10.23.2", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.23.2.tgz", - "integrity": "sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==", + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/preact" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "node_modules/tabbable": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", + "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==", + "dev": true + }, + "node_modules/tapable": { + "version": "1.1.3", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.8.0" + "node": ">=6" } }, - "node_modules/process": { - "version": "0.11.10", - "license": "MIT", + "node_modules/terser": { + "version": "5.37.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.37.0.tgz", + "integrity": "sha512-B8wRRkmre4ERucLM/uXx4MOV5cbnOlVAqUst+1+iLKPI0dOgFO28f84ptoQt9HEI537PMzfYa/d+GEPKTRXmYA==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, "engines": { - "node": ">= 0.6.0" + "node": ">=10" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/protochain": { - "version": "1.0.5", - "dev": true, - "license": "ISC" - }, - "node_modules/proxy-addr": { - "version": "2.0.7", + "node_modules/terser-webpack-plugin": { + "version": "5.3.10", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz", + "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==", "dev": true, - "license": "MIT", "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" + "@jridgewell/trace-mapping": "^0.3.20", + "jest-worker": "^27.4.5", + "schema-utils": "^3.1.1", + "serialize-javascript": "^6.0.1", + "terser": "^5.26.0" }, "engines": { - "node": ">= 0.10" + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } } }, - "node_modules/prr": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/punycode": { - "version": "2.1.1", + "node_modules/terser-webpack-plugin/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/punycode.js": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", - "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "dev": true, - "engines": { - "node": ">=6" + "peerDependencies": { + "ajv": "^6.9.1" } }, - "node_modules/qs": { -<<<<<<< HEAD - "version": "6.10.3", -======= - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", ->>>>>>> master + "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/terser-webpack-plugin/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" }, "engines": { - "node": ">=0.6" + "node": ">= 10.13.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, -<<<<<<< HEAD - "node_modules/querystring": { - "version": "0.2.1", + "node_modules/terser-webpack-plugin/node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.x" + "dependencies": { + "randombytes": "^2.1.0" } }, -======= ->>>>>>> master - "node_modules/queue-microtask": { - "version": "1.2.3", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/text-table": { + "version": "0.2.0", + "dev": true, "license": "MIT" }, - "node_modules/randombytes": { - "version": "2.1.0", + "node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, "license": "MIT", "dependencies": { - "safe-buffer": "^5.1.0" + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" } }, - "node_modules/range-parser": { - "version": "1.2.1", + "node_modules/toidentifier": { + "version": "1.0.1", "dev": true, "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=0.6" } }, - "node_modules/raw-body": { -<<<<<<< HEAD - "version": "2.5.1", -======= - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", ->>>>>>> master + "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, - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/rdf-data-factory": { - "version": "1.1.2", - "license": "MIT", - "dependencies": { - "@rdfjs/types": "*" + "node_modules/ts-api-utils": { + "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" + }, + "peerDependencies": { + "typescript": ">=4.2.0" } }, - "node_modules/rdf-js": { - "version": "4.0.2", + "node_modules/ts-loader": { + "version": "8.4.0", + "dev": true, "license": "MIT", "dependencies": { - "@rdfjs/types": "*" + "chalk": "^4.1.0", + "enhanced-resolve": "^4.0.0", + "loader-utils": "^2.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "*" } }, - "node_modules/readable-stream": { -<<<<<<< HEAD - "version": "2.3.7", -======= - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", ->>>>>>> master + "node_modules/ts-loader/node_modules/ansi-styles": { + "version": "4.3.0", "dev": true, "license": "MIT", "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/readdirp": { - "version": "3.6.0", + "node_modules/ts-loader/node_modules/chalk": { + "version": "4.1.2", "dev": true, "license": "MIT", "dependencies": { - "picomatch": "^2.2.1" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": ">=8.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/rechoir": { - "version": "0.8.0", + "node_modules/ts-loader/node_modules/color-convert": { + "version": "2.0.1", "dev": true, "license": "MIT", "dependencies": { - "resolve": "^1.20.0" + "color-name": "~1.1.4" }, "engines": { - "node": ">= 10.13.0" + "node": ">=7.0.0" } }, - "node_modules/regenerate": { - "version": "1.4.2", + "node_modules/ts-loader/node_modules/color-name": { + "version": "1.1.4", "dev": true, "license": "MIT" }, - "node_modules/regenerate-unicode-properties": { -<<<<<<< HEAD - "version": "10.1.0", -======= - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz", - "integrity": "sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==", ->>>>>>> master + "node_modules/ts-loader/node_modules/lru-cache": { + "version": "6.0.0", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "regenerate": "^1.4.2" + "yallist": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=10" } }, - "node_modules/regenerator-runtime": { - "version": "0.11.1", - "dev": true, - "license": "MIT" - }, - "node_modules/regenerator-transform": { -<<<<<<< HEAD - "version": "0.15.0", -======= - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", - "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", ->>>>>>> master + "node_modules/ts-loader/node_modules/semver": { + "version": "7.5.4", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "@babel/runtime": "^7.8.4" - } - }, - "node_modules/regexparam": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/regexparam/-/regexparam-3.0.0.tgz", - "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", - "dev": true, + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, "engines": { - "node": ">=8" + "node": ">=10" } }, - "node_modules/regexpu-core": { -<<<<<<< HEAD - "version": "5.2.1", -======= - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", - "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", ->>>>>>> master + "node_modules/ts-loader/node_modules/supports-color": { + "version": "7.2.0", "dev": true, "license": "MIT", "dependencies": { - "@babel/regjsgen": "^0.8.0", - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.1.0" + "has-flag": "^4.0.0" }, "engines": { - "node": ">=4" + "node": ">=8" } }, -<<<<<<< HEAD - "node_modules/regjsgen": { - "version": "0.7.1", + "node_modules/ts-loader/node_modules/yallist": { + "version": "4.0.0", "dev": true, - "license": "MIT" + "license": "ISC" }, -======= ->>>>>>> master - "node_modules/regjsparser": { - "version": "0.9.1", + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, - "license": "BSD-2-Clause", "dependencies": { - "jsesc": "~0.5.0" + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" }, "bin": { - "regjsparser": "bin/parser" + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } } }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" + "node_modules/tv4": { + "version": "1.3.0", + "license": [ + { + "type": "Public Domain", + "url": "http://geraintluff.github.io/tv4/LICENSE.txt" + }, + { + "type": "MIT", + "url": "http://jsonary.com/LICENSE.txt" + } + ], + "engines": { + "node": ">= 0.8.0" } }, - "node_modules/relative-to-absolute-iri": { - "version": "1.0.7", - "license": "MIT" + "node_modules/type": { + "version": "1.2.0", + "dev": true, + "license": "ISC" }, - "node_modules/repeat-string": { - "version": "1.6.1", + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, - "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, "engines": { - "node": ">=0.10" + "node": ">= 0.8.0" } }, - "node_modules/require-directory": { - "version": "2.1.1", + "node_modules/type-detect": { + "version": "4.0.8", "dev": true, "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/requirejs": { -<<<<<<< HEAD - "version": "2.3.6", -======= - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.7.tgz", - "integrity": "sha512-DouTG8T1WanGok6Qjg2SXuCMzszOo0eHeH9hDZ5Y4x8Je+9JB38HdTLT4/VA8OaUhBa0JPVHJ0pyBkM1z+pDsw==", ->>>>>>> master + "node_modules/type-is": { + "version": "1.6.18", "dev": true, "license": "MIT", - "bin": { - "r_js": "bin/r.js", - "r.js": "bin/r.js" + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" }, "engines": { - "node": ">=0.4.0" + "node": ">= 0.6" } }, - "node_modules/resolve": { - "version": "1.22.1", + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", "dev": true, "license": "MIT", "dependencies": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "is-typedarray": "^1.0.0" } }, - "node_modules/resolve-cwd": { - "version": "3.0.0", + "node_modules/typedoc": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.27.4.tgz", + "integrity": "sha512-wXPQs1AYC2Crk+1XFpNuutLIkNWleokZf1UNf/X8w9KsMnirkvT+LzxTXDvfF6ug3TSLf3Xu5ZXRKGfoXPX7IA==", "dev": true, - "license": "MIT", "dependencies": { - "resolve-from": "^5.0.0" + "@gerrit0/mini-shiki": "^1.24.0", + "lunr": "^2.3.9", + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "yaml": "^2.6.1" + }, + "bin": { + "typedoc": "bin/typedoc" }, "engines": { - "node": ">=8" + "node": ">= 18" + }, + "peerDependencies": { + "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/resolve-cwd/node_modules/resolve-from": { - "version": "5.0.0", + "node_modules/typedoc-plugin-markdown": { + "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, - "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 18" + }, + "peerDependencies": { + "typedoc": "0.27.x" } }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "node_modules/typedoc-vitepress-theme": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/typedoc-vitepress-theme/-/typedoc-vitepress-theme-1.1.1.tgz", + "integrity": "sha512-1UbhZdQIkGKLkIZCbw8putrel+Vo7KKFfd8RhQRSBgetUZGUJkum89kIyF3+Kzy+1nqE56/MLKVxpPgQYubYYg==", "dev": true, - "engines": { - "node": ">=4" + "peerDependencies": { + "typedoc-plugin-markdown": ">=4.3.0" } }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "node_modules/typedoc/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" + "dependencies": { + "balanced-match": "^1.0.0" } }, - "node_modules/rfdc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", - "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", - "dev": true - }, - "node_modules/rimraf": { - "version": "3.0.2", + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, - "license": "ISC", "dependencies": { - "glob": "^7.1.3" + "brace-expansion": "^2.0.1" }, - "bin": { - "rimraf": "bin.js" + "engines": { + "node": ">=16 || 14 >=14.17" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rocambole": { - "version": "0.7.0", + "node_modules/typescript": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, - "license": "MIT", - "dependencies": { - "esprima": "^2.1" + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" } }, - "node_modules/rocambole-indent": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^2.1.3", - "mout": "^0.11.0", - "rocambole-token": "^1.2.1" - } + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true }, - "node_modules/rocambole-indent/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", "dependencies": { - "ms": "2.0.0" + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" } }, - "node_modules/rocambole-indent/node_modules/mout": { - "version": "0.11.1", - "dev": true, - "license": "MIT" - }, - "node_modules/rocambole-indent/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, - "node_modules/rocambole-linebreak": { - "version": "1.0.2", + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^2.1.3", - "rocambole-token": "^1.2.1", - "semver": "^4.3.1" + "engines": { + "node": ">=4" } }, - "node_modules/rocambole-linebreak/node_modules/debug": { - "version": "2.6.9", + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", "dev": true, - "license": "MIT", "dependencies": { - "ms": "2.0.0" + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" } }, - "node_modules/rocambole-linebreak/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/rocambole-linebreak/node_modules/semver": { - "version": "4.3.6", + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" + "engines": { + "node": ">=4" } }, - "node_modules/rocambole-node": { - "version": "1.0.0", + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", "dev": true, - "license": "MIT" + "engines": { + "node": ">=4" + } }, - "node_modules/rocambole-token": { - "version": "1.2.1", + "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, - "license": "MIT" + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } }, - "node_modules/rocambole-whitespace": { - "version": "1.0.0", + "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, - "license": "MIT", "dependencies": { - "debug": "^2.1.3", - "repeat-string": "^1.5.0", - "rocambole-token": "^1.2.1" + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/rocambole-whitespace/node_modules/debug": { - "version": "2.6.9", + "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, - "license": "MIT", "dependencies": { - "ms": "2.0.0" + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/rocambole-whitespace/node_modules/ms": { - "version": "2.0.0", + "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, - "license": "MIT" + "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/rollup": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.0.tgz", - "integrity": "sha512-vo+S/lfA2lMS7rZ2Qoubi6I5hwZwzXeUIctILZLbHI+laNtvhhOIon2S1JksA5UEDQ7l3vberd0fxK44lTYjbQ==", + "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/estree": "1.0.5" - }, - "bin": { - "rollup": "dist/bin/rollup" + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "dev": true, + "license": "MIT", "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.21.0", - "@rollup/rollup-android-arm64": "4.21.0", - "@rollup/rollup-darwin-arm64": "4.21.0", - "@rollup/rollup-darwin-x64": "4.21.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.21.0", - "@rollup/rollup-linux-arm-musleabihf": "4.21.0", - "@rollup/rollup-linux-arm64-gnu": "4.21.0", - "@rollup/rollup-linux-arm64-musl": "4.21.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.21.0", - "@rollup/rollup-linux-riscv64-gnu": "4.21.0", - "@rollup/rollup-linux-s390x-gnu": "4.21.0", - "@rollup/rollup-linux-x64-gnu": "4.21.0", - "@rollup/rollup-linux-x64-musl": "4.21.0", - "@rollup/rollup-win32-arm64-msvc": "4.21.0", - "@rollup/rollup-win32-ia32-msvc": "4.21.0", - "@rollup/rollup-win32-x64-msvc": "4.21.0", - "fsevents": "~2.3.2" + "node": ">= 0.8" } }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "node_modules/update-browserslist-db": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", "dev": true, "funding": [ { - "type": "github", - "url": "https://github.com/sponsors/feross" + "type": "opencollective", + "url": "https://opencollective.com/browserslist" }, { - "type": "patreon", - "url": "https://www.patreon.com/feross" + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" }, { - "type": "consulting", - "url": "https://feross.org/support" + "type": "github", + "url": "https://github.com/sponsors/ai" } ], "dependencies": { - "queue-microtask": "^1.2.2" + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" } }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "license": "MIT" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, - "license": "MIT" + "dependencies": { + "punycode": "^2.1.0" + } }, - "node_modules/schema-utils": { -<<<<<<< HEAD - "version": "2.7.1", -======= - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", - "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", ->>>>>>> master + "node_modules/user-home": { + "version": "2.0.0", "dev": true, "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" + "os-homedir": "^1.0.0" }, "engines": { - "node": ">= 12.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "node": ">=0.10.0" } }, - "node_modules/schema-utils/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "node_modules/utf-8-validate": { + "version": "5.0.9", "dev": true, + "hasInstallScript": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "node-gyp-build": "^4.3.0" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">=6.14.2" } }, - "node_modules/schema-utils/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "node_modules/util-deprecate": { + "version": "1.0.2", "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" } }, - "node_modules/schema-utils/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } }, - "node_modules/search-insights": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.16.3.tgz", - "integrity": "sha512-hSHy/s4Zk2xibhj9XTCACB+1PqS+CaJxepGNBhKc/OsHRpqvHAUAm5+uZ6kJJbGXn0pb3XqekHjg6JAqPExzqg==", + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", "dev": true, - "peer": true + "license": "MIT" }, - "node_modules/semver": { - "version": "6.3.0", + "node_modules/vary": { + "version": "1.1.2", "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" + "license": "MIT", + "engines": { + "node": ">= 0.8" } }, - "node_modules/send": { - "version": "0.18.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, - "license": "MIT", "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" }, - "engines": { - "node": ">= 0.8.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", + "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, - "license": "MIT", "dependencies": { - "ms": "2.0.0" + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "node_modules/vite": { + "version": "5.4.11", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", + "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", "dev": true, "dependencies": { - "randombytes": "^2.1.0" + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } } }, - "node_modules/serializerr": { - "version": "1.0.3", + "node_modules/vitepress": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.5.0.tgz", + "integrity": "sha512-q4Q/G2zjvynvizdB3/bupdYkCJe2umSAMv9Ju4d92E6/NXJ59z70xB0q5p/4lpRyAwflDsbwy1mLV9Q5+nlB+g==", "dev": true, - "license": "ISC", "dependencies": { - "protochain": "^1.0.5" + "@docsearch/css": "^3.6.2", + "@docsearch/js": "^3.6.2", + "@iconify-json/simple-icons": "^1.2.10", + "@shikijs/core": "^1.22.2", + "@shikijs/transformers": "^1.22.2", + "@shikijs/types": "^1.22.2", + "@types/markdown-it": "^14.1.2", + "@vitejs/plugin-vue": "^5.1.4", + "@vue/devtools-api": "^7.5.4", + "@vue/shared": "^3.5.12", + "@vueuse/core": "^11.1.0", + "@vueuse/integrations": "^11.1.0", + "focus-trap": "^7.6.0", + "mark.js": "8.11.1", + "minisearch": "^7.1.0", + "shiki": "^1.22.2", + "vite": "^5.4.10", + "vue": "^3.5.12" + }, + "bin": { + "vitepress": "bin/vitepress.js" + }, + "peerDependencies": { + "markdown-it-mathjax3": "^4", + "postcss": "^8" + }, + "peerDependenciesMeta": { + "markdown-it-mathjax3": { + "optional": true + }, + "postcss": { + "optional": true + } } }, - "node_modules/serve-static": { - "version": "1.15.0", + "node_modules/vue": { + "version": "3.5.13", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.13.tgz", + "integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==", "dev": true, - "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" + "@vue/compiler-dom": "3.5.13", + "@vue/compiler-sfc": "3.5.13", + "@vue/runtime-dom": "3.5.13", + "@vue/server-renderer": "3.5.13", + "@vue/shared": "3.5.13" }, - "engines": { - "node": ">= 0.8.0" + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/set-function-length": { - "version": "1.2.2", -<<<<<<< HEAD - "dev": true, - "license": "MIT", -======= - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "node_modules/vue-demi": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", "dev": true, ->>>>>>> master - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" }, "engines": { - "node": ">= 0.4" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } } }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "dev": true, - "license": "ISC" - }, - "node_modules/shallow-clone": { - "version": "3.0.1", + "node_modules/walk": { + "version": "2.3.15", "dev": true, - "license": "MIT", + "license": "(MIT OR Apache-2.0)", "dependencies": { - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=8" + "foreachasync": "^3.0.0" } }, - "node_modules/shebang-command": { - "version": "2.0.0", + "node_modules/watchpack": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", + "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", "dev": true, - "license": "MIT", "dependencies": { - "shebang-regex": "^3.0.0" + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" }, "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" + "node": ">=10.13.0" } }, - "node_modules/shiki": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.14.1.tgz", - "integrity": "sha512-FujAN40NEejeXdzPt+3sZ3F2dx1U24BY2XTY01+MG8mbxCiA2XukXdcbyMyLAHJ/1AUUnQd1tZlvIjefWWEJeA==", - "dev": true, + "node_modules/webfinger.js": { + "version": "2.7.1", + "license": "AGPL", "dependencies": { - "@shikijs/core": "1.14.1", - "@types/hast": "^3.0.4" + "xhr2": "0.2.1" } }, - "node_modules/side-channel": { -<<<<<<< HEAD - "version": "1.0.4", -======= - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.7", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "node_modules/webpack": { + "version": "5.97.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.97.1.tgz", + "integrity": "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==", + "dev": true, + "dependencies": { + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.6", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.14.0", + "browserslist": "^4.24.0", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.1", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.2.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.3.10", + "watchpack": "^2.4.1", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" }, "engines": { - "node": ">= 0.4" + "node": ">=10.13.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } } }, - "node_modules/sinon": { -<<<<<<< HEAD - "version": "14.0.0", -======= - "version": "18.0.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-18.0.0.tgz", - "integrity": "sha512-+dXDXzD1sBO6HlmZDd7mXZCR/y5ECiEiGCBSGuFD/kZ0bDTofPYc6JaeGmPSF+1j1MejGUWkORbYOLDyvqCWpA==", ->>>>>>> master + "node_modules/webpack-cli": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.1.4.tgz", + "integrity": "sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==", "dev": true, - "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^3.0.1", - "@sinonjs/fake-timers": "^11.2.2", - "@sinonjs/samsam": "^8.0.0", - "diff": "^5.2.0", - "nise": "^6.0.0", - "supports-color": "^7" + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^2.1.1", + "@webpack-cli/info": "^2.0.2", + "@webpack-cli/serve": "^2.0.5", + "colorette": "^2.0.14", + "commander": "^10.0.1", + "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=14.15.0" }, "funding": { "type": "opencollective", - "url": "https://opencollective.com/sinon" + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } } }, - "node_modules/sinon/node_modules/diff": { -<<<<<<< HEAD - "version": "5.1.0", -======= - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", ->>>>>>> master + "node_modules/webpack-cli/node_modules/commander": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", + "integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==", "dev": true, - "license": "BSD-3-Clause", "engines": { - "node": ">=0.3.1" + "node": ">=14" } }, - "node_modules/sinon/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/sinon/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/speakingurl": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz", - "integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/stdin": { - "version": "0.0.1", - "dev": true - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/superjson": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.1.tgz", - "integrity": "sha512-8iGv75BYOa0xRJHK5vRLEjE2H/i4lulTjzpUXic3Eg8akftYjkmQDa8JARQ42rlczXyFR3IeRoeFCc7RxHsYZA==", - "dev": true, - "dependencies": { - "copy-anything": "^3.0.2" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/tabbable": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", - "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==", - "dev": true - }, - "node_modules/tapable": { -<<<<<<< HEAD - "version": "1.1.3", -======= - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", ->>>>>>> master - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/terser": { - "version": "5.31.3", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/terser-webpack-plugin": { - "version": "5.3.10", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.20", - "jest-worker": "^27.4.5", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.1", - "terser": "^5.26.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "uglify-js": { - "optional": true - } - } - }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", + "node_modules/webpack-merge": { + "version": "5.8.0", "dev": true, "license": "MIT", "dependencies": { - "is-number": "^7.0.0" + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" }, "engines": { - "node": ">=8.0" + "node": ">=10.0.0" } }, - "node_modules/toidentifier": { - "version": "1.0.1", + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", "dev": true, - "license": "MIT", "engines": { - "node": ">=0.6" - } - }, -<<<<<<< HEAD - "node_modules/tr46": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "^2.1.0" - } - }, -======= ->>>>>>> master - "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==", - "dev": true, - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "typescript": ">=4.2.0" - } - }, - "node_modules/ts-loader": { - "version": "8.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^4.0.0", - "loader-utils": "^2.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4" - }, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "*" - } - }, - "node_modules/ts-loader/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/ts-loader/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/ts-loader/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/ts-loader/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/ts-loader/node_modules/enhanced-resolve": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.5.0.tgz", - "integrity": "sha512-Nv9m36S/vxpsI+Hc4/ZGRs0n9mXqSWGGq49zxb/cJfPAQMbUtttJAlNPS4AQzaBdw/pKskw5bMbekT/Y7W/Wlg==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.5.0", - "tapable": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/ts-loader/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ts-loader/node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/ts-loader/node_modules/semver": { - "version": "7.3.7", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/ts-loader/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ts-loader/node_modules/tapable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", - "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/ts-loader/node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/tv4": { - "version": "1.3.0", - "license": [ - { - "type": "Public Domain", - "url": "http://geraintluff.github.io/tv4/LICENSE.txt" - }, - { - "type": "MIT", - "url": "http://jsonary.com/LICENSE.txt" - } - ], - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type": { - "version": "1.2.0", - "dev": true, - "license": "ISC" - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "dev": true, - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, - "node_modules/typedoc": { - "version": "0.26.6", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.6.tgz", - "integrity": "sha512-SfEU3SH3wHNaxhFPjaZE2kNl/NFtLNW5c1oHsg7mti7GjmUj1Roq6osBQeMd+F4kL0BoRBBr8gQAuqBlfFu8LA==", - "dev": true, - "dependencies": { - "lunr": "^2.3.9", - "markdown-it": "^14.1.0", - "minimatch": "^9.0.5", - "shiki": "^1.9.1", - "yaml": "^2.4.5" - }, - "bin": { - "typedoc": "bin/typedoc" - }, - "engines": { - "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" - } - }, - "node_modules/typedoc-plugin-markdown": { -<<<<<<< HEAD - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.2.5.tgz", - "integrity": "sha512-ZWIfc0OqwEtQfuaqbmM1kesMi/Fhc++W+5f3TDEm1Tsi28pHSoZk4WCOm4lNuN30WtEImwAHhhXC4DIWki1DiA==", -======= - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.2.3.tgz", - "integrity": "sha512-esucQj79SFYOv0f5XVha7QWdLUH5C5HRlDf7Z8CXzHedmVPn7jox6Gt7FdoBXN8AFxyHpa3Lbuxu65Dobwt+4Q==", ->>>>>>> master - "dev": true, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "typedoc": "0.26.x" - } - }, - "node_modules/typedoc-vitepress-theme": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typedoc-vitepress-theme/-/typedoc-vitepress-theme-1.0.1.tgz", - "integrity": "sha512-pnpgzSQRaR9QLMl3it/tjq7vlV+eeUzKa22w/xF6ZUdAcYdmeag13kuA6EKfU7/kkIkJ/qsu1GPd3OcIC36Hlw==", - "dev": true, - "peerDependencies": { - "typedoc-plugin-markdown": ">=4.1.0" - } - }, - "node_modules/typedoc/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/typedoc/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/uc.micro": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", - "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", - "dev": true - }, - "node_modules/undici": { - "version": "5.28.2", - "license": "MIT", - "dependencies": { - "@fastify/busboy": "^2.0.0" - }, - "engines": { - "node": ">=14.0" - } - }, - "node_modules/undici-types": { - "version": "5.26.5", - "license": "MIT" - }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { -<<<<<<< HEAD - "version": "2.0.0", -======= - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", - "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", ->>>>>>> master - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.1.0", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.1.2", - "picocolors": "^1.0.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/user-home": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "os-homedir": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/utf-8-validate": { - "version": "5.0.9", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/uuid": { - "version": "9.0.1", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/vary": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/vite": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.2.tgz", - "integrity": "sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==", - "dev": true, - "dependencies": { - "esbuild": "^0.21.3", - "postcss": "^8.4.41", - "rollup": "^4.20.0" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.4.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - } - } - }, - "node_modules/vitepress": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.3.3.tgz", - "integrity": "sha512-6UzEw/wZ41S/CATby7ea7UlffvRER/uekxgN6hbEvSys9ukmLOKsz87Ehq9yOx1Rwiw+Sj97yjpivP8w1sUmng==", - "dev": true, - "dependencies": { - "@docsearch/css": "^3.6.1", - "@docsearch/js": "^3.6.1", - "@shikijs/core": "^1.13.0", - "@shikijs/transformers": "^1.13.0", - "@types/markdown-it": "^14.1.2", - "@vitejs/plugin-vue": "^5.1.2", - "@vue/devtools-api": "^7.3.8", - "@vue/shared": "^3.4.38", - "@vueuse/core": "^11.0.0", - "@vueuse/integrations": "^11.0.0", - "focus-trap": "^7.5.4", - "mark.js": "8.11.1", - "minisearch": "^7.1.0", - "shiki": "^1.13.0", - "vite": "^5.4.1", - "vue": "^3.4.38" - }, - "bin": { - "vitepress": "bin/vitepress.js" - }, - "peerDependencies": { - "markdown-it-mathjax3": "^4", - "postcss": "^8" - }, - "peerDependenciesMeta": { - "markdown-it-mathjax3": { - "optional": true - }, - "postcss": { - "optional": true - } - } - }, - "node_modules/vue": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.38.tgz", - "integrity": "sha512-f0ZgN+mZ5KFgVv9wz0f4OgVKukoXtS3nwET4c2vLBGQR50aI8G0cqbFtLlX9Yiyg3LFGBitruPHt2PxwTduJEw==", - "dev": true, - "dependencies": { - "@vue/compiler-dom": "3.4.38", - "@vue/compiler-sfc": "3.4.38", - "@vue/runtime-dom": "3.4.38", - "@vue/server-renderer": "3.4.38", - "@vue/shared": "3.4.38" - }, - "peerDependencies": { - "typescript": "*" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/walk": { - "version": "2.3.15", - "dev": true, - "license": "(MIT OR Apache-2.0)", - "dependencies": { - "foreachasync": "^3.0.0" - } - }, - "node_modules/watchpack": { - "version": "2.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/webfinger.js": { - "version": "2.7.1", - "license": "AGPL", - "dependencies": { - "xhr2": "0.2.1" - } - }, -<<<<<<< HEAD - "node_modules/webidl-conversions": { - "version": "4.0.2", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/webpack": { - "version": "5.93.0", -======= - "node_modules/webpack": { - "version": "5.93.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.93.0.tgz", - "integrity": "sha512-Y0m5oEY1LRuwly578VqluorkXbvXKh7U3rLoQCEO04M97ScRr44afGVkI0FQFsXzysk5OgFAxjZAb9rsGQVihA==", ->>>>>>> master - "dev": true, - "license": "MIT", - "dependencies": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.5", - "@webassemblyjs/ast": "^1.12.1", - "@webassemblyjs/wasm-edit": "^1.12.1", - "@webassemblyjs/wasm-parser": "^1.12.1", - "acorn": "^8.7.1", - "acorn-import-attributes": "^1.9.5", - "browserslist": "^4.21.10", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.0", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.11", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.10", - "watchpack": "^2.4.1", - "webpack-sources": "^3.2.3" - }, - "bin": { - "webpack": "bin/webpack.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } - } - }, - "node_modules/webpack-cli": { - "version": "5.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^2.1.1", - "@webpack-cli/info": "^2.0.2", - "@webpack-cli/serve": "^2.0.5", - "colorette": "^2.0.14", - "commander": "^10.0.1", - "cross-spawn": "^7.0.3", - "envinfo": "^7.7.3", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^3.1.1", - "rechoir": "^0.8.0", - "webpack-merge": "^5.7.3" - }, - "bin": { - "webpack-cli": "bin/cli.js" - }, - "engines": { - "node": ">=14.15.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "5.x.x" - }, - "peerDependenciesMeta": { - "@webpack-cli/generators": { - "optional": true - }, - "webpack-bundle-analyzer": { - "optional": true - }, - "webpack-dev-server": { - "optional": true - } - } - }, - "node_modules/webpack-cli/node_modules/commander": { - "version": "10.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - } - }, - "node_modules/webpack-merge": { - "version": "5.8.0", - "dev": true, - "license": "MIT", - "dependencies": { - "clone-deep": "^4.0.1", - "wildcard": "^2.0.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/webpack-sources": { - "version": "3.2.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, -<<<<<<< HEAD - "node_modules/webpack/node_modules/enhanced-resolve": { - "version": "5.17.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, -======= ->>>>>>> master - "node_modules/webpack/node_modules/schema-utils": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, -<<<<<<< HEAD - "node_modules/webpack/node_modules/tapable": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, -======= ->>>>>>> master - "node_modules/websocket": { - "version": "1.0.34", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "bufferutil": "^4.0.1", - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "typedarray-to-buffer": "^3.1.5", - "utf-8-validate": "^5.0.2", - "yaeti": "^0.0.6" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/websocket/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/websocket/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/whatwg-fetch": { - "version": "3.6.2", - "dev": true, - "license": "MIT" - }, -<<<<<<< HEAD - "node_modules/whatwg-url": { - "version": "6.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, -======= ->>>>>>> master - "node_modules/which": { - "version": "2.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wildcard": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/workerpool": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", - "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/wrappy": { - "version": "1.0.2", - "dev": true, - "license": "ISC" - }, - "node_modules/xhr2": { - "version": "0.2.1", - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/yaeti": { - "version": "0.0.6", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.32" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, - "node_modules/yaml": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", - "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", - "dev": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/yargs": { - "version": "16.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/y18n": { - "version": "5.0.8", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - }, - "dependencies": { - "@algolia/autocomplete-core": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-core/-/autocomplete-core-1.9.3.tgz", - "integrity": "sha512-009HdfugtGCdC4JdXUbVJClA0q0zh24yyePn+KUGk3rP7j8FEe/m5Yo/z65gn6nP/cM39PxpzqKrL7A6fP6PPw==", - "dev": true, - "requires": { - "@algolia/autocomplete-plugin-algolia-insights": "1.9.3", - "@algolia/autocomplete-shared": "1.9.3" - } - }, - "@algolia/autocomplete-plugin-algolia-insights": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-plugin-algolia-insights/-/autocomplete-plugin-algolia-insights-1.9.3.tgz", - "integrity": "sha512-a/yTUkcO/Vyy+JffmAnTWbr4/90cLzw+CC3bRbhnULr/EM0fGNvM13oQQ14f2moLMcVDyAx/leczLlAOovhSZg==", - "dev": true, - "requires": { - "@algolia/autocomplete-shared": "1.9.3" - } - }, - "@algolia/autocomplete-preset-algolia": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-preset-algolia/-/autocomplete-preset-algolia-1.9.3.tgz", - "integrity": "sha512-d4qlt6YmrLMYy95n5TB52wtNDr6EgAIPH81dvvvW8UmuWRgxEtY0NJiPwl/h95JtG2vmRM804M0DSwMCNZlzRA==", - "dev": true, - "requires": { - "@algolia/autocomplete-shared": "1.9.3" - } - }, - "@algolia/autocomplete-shared": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/@algolia/autocomplete-shared/-/autocomplete-shared-1.9.3.tgz", - "integrity": "sha512-Wnm9E4Ye6Rl6sTTqjoymD+l8DjSTHsHboVRYrKgEt8Q7UHm9nYbqhN/i0fhUYA3OAEH7WA8x3jfpnmJm3rKvaQ==", - "dev": true, - "requires": {} - }, - "@algolia/cache-browser-local-storage": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.24.0.tgz", - "integrity": "sha512-t63W9BnoXVrGy9iYHBgObNXqYXM3tYXCjDSHeNwnsc324r4o5UiVKUiAB4THQ5z9U5hTj6qUvwg/Ez43ZD85ww==", - "dev": true, - "requires": { - "@algolia/cache-common": "4.24.0" - } - }, - "@algolia/cache-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.24.0.tgz", - "integrity": "sha512-emi+v+DmVLpMGhp0V9q9h5CdkURsNmFC+cOS6uK9ndeJm9J4TiqSvPYVu+THUP8P/S08rxf5x2P+p3CfID0Y4g==", - "dev": true - }, - "@algolia/cache-in-memory": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.24.0.tgz", - "integrity": "sha512-gDrt2so19jW26jY3/MkFg5mEypFIPbPoXsQGQWAi6TrCPsNOSEYepBMPlucqWigsmEy/prp5ug2jy/N3PVG/8w==", - "dev": true, - "requires": { - "@algolia/cache-common": "4.24.0" - } - }, - "@algolia/client-account": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.24.0.tgz", - "integrity": "sha512-adcvyJ3KjPZFDybxlqnf+5KgxJtBjwTPTeyG2aOyoJvx0Y8dUQAEOEVOJ/GBxX0WWNbmaSrhDURMhc+QeevDsA==", - "dev": true, - "requires": { - "@algolia/client-common": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/transporter": "4.24.0" - }, - "dependencies": { - "@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", - "dev": true, - "requires": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - } - } - }, - "@algolia/client-analytics": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.24.0.tgz", - "integrity": "sha512-y8jOZt1OjwWU4N2qr8G4AxXAzaa8DBvyHTWlHzX/7Me1LX8OayfgHexqrsL4vSBcoMmVw2XnVW9MhL+Y2ZDJXg==", - "dev": true, - "requires": { - "@algolia/client-common": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - }, - "dependencies": { - "@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", - "dev": true, - "requires": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - } - } - }, - "@algolia/client-common": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-5.1.0.tgz", - "integrity": "sha512-/PUtnEKpI9opioNfVKA5cBGQr0yulE3OWJCf9xWjJRFn+CvTAWkIecBWF9R+GpxeoaTqf3lWqDwYt8zEBXU11Q==", - "dev": true, - "peer": true - }, - "@algolia/client-personalization": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-personalization/-/client-personalization-4.24.0.tgz", - "integrity": "sha512-l5FRFm/yngztweU0HdUzz1rC4yoWCFo3IF+dVIVTfEPg906eZg5BOd1k0K6rZx5JzyyoP4LdmOikfkfGsKVE9w==", - "dev": true, - "requires": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - }, - "dependencies": { - "@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - } - } - }, - "@algolia/client-search": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-5.1.0.tgz", - "integrity": "sha512-zPMO+iX+PnrQAX2tzW7ViletvkDNqLG1CI0k+9wXZtyVuQrPI6pxho/mANlC9QHmiMH3eR2KibQCOBMifOd61w==", - "dev": true, - "peer": true, - "requires": { - "@algolia/client-common": "5.1.0", - "@algolia/requester-browser-xhr": "5.1.0", - "@algolia/requester-node-http": "5.1.0" - } - }, - "@algolia/logger-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.24.0.tgz", - "integrity": "sha512-LLUNjkahj9KtKYrQhFKCzMx0BY3RnNP4FEtO+sBybCjJ73E8jNdaKJ/Dd8A/VA4imVHP5tADZ8pn5B8Ga/wTMA==", - "dev": true - }, - "@algolia/logger-console": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.24.0.tgz", - "integrity": "sha512-X4C8IoHgHfiUROfoRCV+lzSy+LHMgkoEEU1BbKcsfnV0i0S20zyy0NLww9dwVHUWNfPPxdMU+/wKmLGYf96yTg==", - "dev": true, - "requires": { - "@algolia/logger-common": "4.24.0" - } - }, - "@algolia/recommend": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/recommend/-/recommend-4.24.0.tgz", - "integrity": "sha512-P9kcgerfVBpfYHDfVZDvvdJv0lEoCvzNlOy2nykyt5bK8TyieYyiD0lguIJdRZZYGre03WIAFf14pgE+V+IBlw==", - "dev": true, - "requires": { - "@algolia/cache-browser-local-storage": "4.24.0", - "@algolia/cache-common": "4.24.0", - "@algolia/cache-in-memory": "4.24.0", - "@algolia/client-common": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/logger-common": "4.24.0", - "@algolia/logger-console": "4.24.0", - "@algolia/requester-browser-xhr": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/requester-node-http": "4.24.0", - "@algolia/transporter": "4.24.0" - }, - "dependencies": { - "@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", - "dev": true, - "requires": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "@algolia/requester-browser-xhr": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.24.0.tgz", - "integrity": "sha512-Z2NxZMb6+nVXSjF13YpjYTdvV3032YTBSGm2vnYvYPA6mMxzM3v5rsCiSspndn9rzIW4Qp1lPHBvuoKJV6jnAA==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0" - } - }, - "@algolia/requester-node-http": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.24.0.tgz", - "integrity": "sha512-JF18yTjNOVYvU/L3UosRcvbPMGT9B+/GQWNWnenIImglzNVGpyzChkXLnrSf6uxwVNO6ESGu6oN8MqcGQcjQJw==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0" - } - } - } - }, - "@algolia/requester-browser-xhr": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-5.1.0.tgz", - "integrity": "sha512-q2HpJBxVnvmk9UfphzjGgYSKDX/qXeuPmKlybYAX1dZ1/b8LBOt066JjS5L9CXuxW26Igi/PrdbzA9tL8jD3QQ==", - "dev": true, - "peer": true, - "requires": { - "@algolia/client-common": "5.1.0" - } - }, - "@algolia/requester-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.24.0.tgz", - "integrity": "sha512-k3CXJ2OVnvgE3HMwcojpvY6d9kgKMPRxs/kVohrwF5WMr2fnqojnycZkxPoEg+bXm8fi5BBfFmOqgYztRtHsQA==", - "dev": true - }, - "@algolia/requester-node-http": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-5.1.0.tgz", - "integrity": "sha512-P51ZDjoswq6OLVY+vES+EekkC0OPABKrJ9s4S1UKNTvggDIn38BoM9L25K7TEWEmjCG68EKDGSPUAt1q/dS0Uw==", - "dev": true, - "peer": true, - "requires": { - "@algolia/client-common": "5.1.0" - } - }, - "@algolia/transporter": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.24.0.tgz", - "integrity": "sha512-86nI7w6NzWxd1Zp9q3413dRshDqAzSbsQjhcDhPIatEFiZrL1/TjnHL8S7jVKFePlIMzDsZWXAXwXzcok9c5oA==", - "dev": true, - "requires": { - "@algolia/cache-common": "4.24.0", - "@algolia/logger-common": "4.24.0", - "@algolia/requester-common": "4.24.0" - } - }, - "@ampproject/remapping": { - "version": "2.2.0", - "dev": true, - "requires": { - "@jridgewell/gen-mapping": "^0.1.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "@babel/code-frame": { -<<<<<<< HEAD - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/highlight": "^7.18.6" - } - }, - "@babel/compat-data": { - "version": "7.19.3", - "dev": true - }, - "@babel/core": { - "version": "7.19.3", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", - "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", - "dev": true, - "requires": { - "@babel/highlight": "^7.24.7", - "picocolors": "^1.0.0" - } - }, - "@babel/compat-data": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.0.tgz", - "integrity": "sha512-P4fwKI2mjEb3ZU5cnMJzvRsRKGBUcs8jvxIoRmr6ufAY9Xk2Bz7JubRTTivkw55c7WQJfTECeqYVa+HZ0FzREg==", - "dev": true - }, - "@babel/core": { - "version": "7.24.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.9.tgz", - "integrity": "sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg==", ->>>>>>> master - "dev": true, - "requires": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.24.9", - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-module-transforms": "^7.24.9", - "@babel/helpers": "^7.24.8", - "@babel/parser": "^7.24.8", - "@babel/template": "^7.24.7", - "@babel/traverse": "^7.24.8", - "@babel/types": "^7.24.9", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - } - }, - "@babel/generator": { -<<<<<<< HEAD - "version": "7.19.3", - "dev": true, - "requires": { - "@babel/types": "^7.19.3", - "@jridgewell/gen-mapping": "^0.3.2", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.0.tgz", - "integrity": "sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw==", - "dev": true, - "requires": { - "@babel/types": "^7.25.0", - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25", ->>>>>>> master - "jsesc": "^2.5.1" - }, - "dependencies": { - "@jridgewell/gen-mapping": { -<<<<<<< HEAD - "version": "0.3.2", -======= - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", ->>>>>>> master - "dev": true, - "requires": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - } - } - } - }, - "@babel/helper-annotate-as-pure": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz", - "integrity": "sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.24.7.tgz", - "integrity": "sha512-xZeCVVdwb4MsDBkkyZ64tReWYrLRHlMN72vP7Bdm3OUOuyFZExhsHUUnuWnm2/XOlAJzR0LfPpB56WXZn0X/lA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-compilation-targets": { -<<<<<<< HEAD - "version": "7.19.3", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.8.tgz", - "integrity": "sha512-oU+UoqCHdp+nWVDkpldqIQL/i/bvAv53tRqLG/s+cOXxe66zOYLU7ar/Xs3LdmBihrUMEUhwu6dMZwbNOYDwvw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/compat-data": "^7.24.8", - "@babel/helper-validator-option": "^7.24.8", - "browserslist": "^4.23.1", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - } - }, - "@babel/helper-create-class-features-plugin": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.8.tgz", - "integrity": "sha512-4f6Oqnmyp2PP3olgUMmOwC3akxSm5aBYraQ6YDdKy7NcAMkDECHWG0DEnV6M2UAkERgIBhYt8S27rURPg7SxWA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-environment-visitor": "^7.24.7", - "@babel/helper-function-name": "^7.24.7", - "@babel/helper-member-expression-to-functions": "^7.24.8", - "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/helper-replace-supers": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/helper-split-export-declaration": "^7.24.7", - "semver": "^6.3.1" - } - }, - "@babel/helper-create-regexp-features-plugin": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.25.0.tgz", - "integrity": "sha512-q0T+dknZS+L5LDazIP+02gEZITG5unzvb6yIjcmj5i0eFrs5ToBV2m2JGH4EsE/gtP8ygEGLGApBgRIZkTm7zg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "regexpu-core": "^5.3.1", - "semver": "^6.3.1" - } - }, - "@babel/helper-define-polyfill-provider": { -<<<<<<< HEAD - "version": "0.3.3", -======= - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.2.tgz", - "integrity": "sha512-LV76g+C502biUK6AyZ3LK10vDpDyCzZnhZFXkH1L75zHPj68+qc8Zfpx2th+gzwA2MzyK+1g/3EPl62yFnVttQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-compilation-targets": "^7.22.6", - "@babel/helper-plugin-utils": "^7.22.5", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2" - } - }, - "@babel/helper-environment-visitor": { -<<<<<<< HEAD - "version": "7.18.9", - "dev": true - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", - "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-function-name": { -<<<<<<< HEAD - "version": "7.19.0", - "dev": true, - "requires": { - "@babel/template": "^7.18.10", - "@babel/types": "^7.19.0" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", - "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", - "dev": true, - "requires": { - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz", - "integrity": "sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/traverse": "^7.24.8", - "@babel/types": "^7.24.8" - } - }, - "@babel/helper-module-imports": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", - "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-module-transforms": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.0.tgz", - "integrity": "sha512-bIkOa2ZJYn7FHnepzr5iX9Kmz8FjIz4UKzJ9zhX3dnYuVW0xul9RuR3skBfoLu+FPTQw90EHW9rJsSZhyLQ3fQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-simple-access": "^7.24.7", - "@babel/helper-validator-identifier": "^7.24.7", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/helper-optimise-call-expression": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz", - "integrity": "sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-plugin-utils": { -<<<<<<< HEAD - "version": "7.19.0", - "dev": true - }, - "@babel/helper-remap-async-to-generator": { - "version": "7.18.9", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", - "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", - "dev": true - }, - "@babel/helper-remap-async-to-generator": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.0.tgz", - "integrity": "sha512-NhavI2eWEIz/H9dbrG0TuOicDhNexze43i5z7lEqwYm0WEZVTwnPpA0EafUTP7+6/W79HWIP2cTe3Z5NiSTVpw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-wrap-function": "^7.25.0", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/helper-replace-supers": { -<<<<<<< HEAD - "version": "7.19.1", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.0.tgz", - "integrity": "sha512-q688zIvQVYtZu+i2PsdIu/uWGRpfxzr5WESsfpShfZECkO+d2o+WROWezCi/Q6kJ0tfPa5+pUGUlfx2HhrA3Bg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-member-expression-to-functions": "^7.24.8", - "@babel/helper-optimise-call-expression": "^7.24.7", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/helper-simple-access": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", - "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-skip-transparent-expression-wrappers": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz", - "integrity": "sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/traverse": "^7.24.7", - "@babel/types": "^7.24.7" - } - }, - "@babel/helper-split-export-declaration": { -<<<<<<< HEAD - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/types": "^7.18.6" -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", - "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", - "dev": true, - "requires": { - "@babel/types": "^7.24.7" ->>>>>>> master - } - }, - "@babel/helper-string-parser": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", - "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", - "dev": true - }, - "@babel/helper-validator-identifier": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", - "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", - "dev": true - }, - "@babel/helper-validator-option": { -<<<<<<< HEAD - "version": "7.18.6", - "dev": true - }, - "@babel/helper-wrap-function": { - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", - "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", - "dev": true - }, - "@babel/helper-wrap-function": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.0.tgz", - "integrity": "sha512-s6Q1ebqutSiZnEjaofc/UKDyC4SbzV5n5SrA2Gq8UawLycr3i04f1dX4OzoQVnexm6aOCh37SQNYlJ/8Ku+PMQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/template": "^7.25.0", - "@babel/traverse": "^7.25.0", - "@babel/types": "^7.25.0" - } - }, - "@babel/helpers": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.8.tgz", - "integrity": "sha512-gV2265Nkcz7weJJfvDoAEVzC1e2OTDpkGbEsebse8koXUJUXPsCMi7sRo/+SPMuMZ9MtUPnGwITTnQnU5YjyaQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/template": "^7.24.7", - "@babel/types": "^7.24.8" - } - }, - "@babel/highlight": { -<<<<<<< HEAD - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.25.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.3.tgz", - "integrity": "sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw==", - "dev": true, - "requires": { - "@babel/types": "^7.25.2" - } - }, - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", - "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.24.7", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - } - }, - "@babel/parser": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.0.tgz", - "integrity": "sha512-CzdIU9jdP0dg7HdyB+bHvDJGagUv+qtzZt5rYCWwW6tITNqV9odjp6Qu41gkG0ca5UfdDUWrKkiAnHHdGRnOrA==", - "dev": true - }, - "@babel/plugin-bugfix-firefox-class-in-computed-class-key": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.0.tgz", - "integrity": "sha512-dG0aApncVQwAUJa8tP1VHTnmU67BeIQvKafd3raEx315H54FfkZSz3B/TT+33ZQAjatGJA79gZqTtqL5QZUKXw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/plugin-bugfix-safari-class-field-initializer-scope": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.0.tgz", - "integrity": "sha512-Bm4bH2qsX880b/3ziJ8KD711LT7z4u8CFudmjqle65AZj/HNUFhEf90dqYv6O86buWvSBmeQDjv0Tn2aF/bIBA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8" - } - }, - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.0.tgz", - "integrity": "sha512-lXwdNZtTmeVOOFtwM/WDe7yg1PL8sYhRk/XH0FzbR2HDQ0xC+EnQ/JHeoMYSavtU115tnUk0q9CDyq8si+LMAA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8" - } - }, - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.24.7.tgz", - "integrity": "sha512-+izXIbke1T33mY4MSNnrqhPXDz01WYhEf3yF5NbnUtkiNnm+XBZJl3kNfoK6NKmYlz/D07+l2GWVK/QfDkNCuQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/plugin-transform-optional-chaining": "^7.24.7" - } - }, -<<<<<<< HEAD - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.1", - "dev": true, - "requires": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-remap-async-to-generator": "^7.18.9", - "@babel/plugin-syntax-async-generators": "^7.8.4" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-proposal-class-static-block": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - } - }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - } - }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.18.9", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - } - }, - "@babel/plugin-proposal-json-strings": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-json-strings": "^7.8.3" - } - }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.18.9", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - } - }, - "@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "dev": true, - "requires": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" - } - }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - } - }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.18.9", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.18.9", - "@babel/helper-skip-transparent-expression-wrappers": "^7.18.9", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, - "@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-proposal-private-property-in-object": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - } - }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.18.6", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } -======= - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.0.tgz", - "integrity": "sha512-tggFrk1AIShG/RUQbEwt2Tr/E+ObkfwrPjR6BjbRvsx24+PSjK8zrq0GWPNCjo8qpRx4DuJzlcvWJqlm+0h3kw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/plugin-proposal-private-property-in-object": { - "version": "7.21.0-placeholder-for-preset-env.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", - "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", - "dev": true, - "requires": {} ->>>>>>> master - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.12.13" - } - }, - "@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.3" - } - }, - "@babel/plugin-syntax-import-assertions": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.24.7.tgz", - "integrity": "sha512-Ec3NRUMoi8gskrkBe3fNmEQfxDvY8bgfQpz6jlk/41kX9eUjvpyqWU7PBP/pLAvMaSQjbMNKJmvX57jP+M6bPg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-syntax-import-attributes": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.24.7.tgz", - "integrity": "sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-unicode-sets-regex": { - "version": "7.18.6", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", - "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - } - }, - "@babel/plugin-transform-arrow-functions": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.24.7.tgz", - "integrity": "sha512-Dt9LQs6iEY++gXUwY03DNFat5C2NbO48jj+j/bSAz6b3HgPs39qcPiYt77fDObIcFwj3/C2ICX9YMwGflUoSHQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-async-generator-functions": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.0.tgz", - "integrity": "sha512-uaIi2FdqzjpAMvVqvB51S42oC2JEVgh0LDsGfZVDysWE8LrJtQC2jvKmOqEYThKyB7bDEb7BP1GYWDm7tABA0Q==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-remap-async-to-generator": "^7.25.0", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/plugin-transform-async-to-generator": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.24.7.tgz", - "integrity": "sha512-SQY01PcJfmQ+4Ash7NE+rpbLFbmqA2GPIgqzxfFTL4t1FKRq4zTms/7htKpoCUI9OcFYgzqfmCdH53s6/jn5fA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-remap-async-to-generator": "^7.24.7" - } - }, - "@babel/plugin-transform-block-scoped-functions": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.24.7.tgz", - "integrity": "sha512-yO7RAz6EsVQDaBH18IDJcMB1HnrUn2FJ/Jslc/WtPPWcjhpUJXU/rjbwmluzp7v/ZzWcEhTMXELnnsz8djWDwQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-block-scoping": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.0.tgz", - "integrity": "sha512-yBQjYoOjXlFv9nlXb3f1casSHOZkWr29NX+zChVanLg5Nc157CrbEX9D7hxxtTpuFy7Q0YzmmWfJxzvps4kXrQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8" - } - }, - "@babel/plugin-transform-class-properties": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.24.7.tgz", - "integrity": "sha512-vKbfawVYayKcSeSR5YYzzyXvsDFWU2mD8U5TFeXtbCPLFUqe7GyCgvO6XDHzje862ODrOwy6WCPmKeWHbCFJ4w==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-class-static-block": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.24.7.tgz", - "integrity": "sha512-HMXK3WbBPpZQufbMG4B46A90PkuuhN9vBCb5T8+VAHqvAqvcLi+2cKoukcpmUYkszLhScU3l1iudhrks3DggRQ==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - } - }, - "@babel/plugin-transform-classes": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.0.tgz", - "integrity": "sha512-xyi6qjr/fYU304fiRwFbekzkqVJZ6A7hOjWZd+89FVcBqPV3S9Wuozz82xdpLspckeaafntbzglaW4pqpzvtSw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-replace-supers": "^7.25.0", - "@babel/traverse": "^7.25.0", - "globals": "^11.1.0" - } - }, - "@babel/plugin-transform-computed-properties": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.24.7.tgz", - "integrity": "sha512-25cS7v+707Gu6Ds2oY6tCkUwsJ9YIDbggd9+cu9jzzDgiNq7hR/8dkzxWfKWnTic26vsI3EsCXNd4iEB6e8esQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/template": "^7.24.7" - } - }, - "@babel/plugin-transform-destructuring": { -<<<<<<< HEAD - "version": "7.18.13", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.24.8.tgz", - "integrity": "sha512-36e87mfY8TnRxc7yc6M9g9gOB7rKgSahqkIKwLpz4Ppk2+zC2Cy1is0uwtuSG6AE4zlTOUa+7JGz9jCJGLqQFQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8" - } - }, - "@babel/plugin-transform-dotall-regex": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.24.7.tgz", - "integrity": "sha512-ZOA3W+1RRTSWvyqcMJDLqbchh7U4NRGqwRfFSVbOLS/ePIP4vHB5e8T8eXcuqyN1QkgKyj5wuW0lcS85v4CrSw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-duplicate-keys": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.24.7.tgz", - "integrity": "sha512-JdYfXyCRihAe46jUIliuL2/s0x0wObgwwiGxw/UbgJBr20gQBThrokO4nYKgWkD7uBaqM7+9x5TU7NkExZJyzw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-duplicate-named-capturing-groups-regex": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.0.tgz", - "integrity": "sha512-YLpb4LlYSc3sCUa35un84poXoraOiQucUTTu8X1j18JV+gNa8E0nyUf/CjZ171IRGr4jEguF+vzJU66QZhn29g==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.25.0", - "@babel/helper-plugin-utils": "^7.24.8" - } - }, - "@babel/plugin-transform-dynamic-import": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.24.7.tgz", - "integrity": "sha512-sc3X26PhZQDb3JhORmakcbvkeInvxz+A8oda99lj7J60QRuPZvNAk9wQlTBS1ZynelDrDmTU4pw1tyc5d5ZMUg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - } - }, - "@babel/plugin-transform-exponentiation-operator": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.24.7.tgz", - "integrity": "sha512-Rqe/vSc9OYgDajNIK35u7ot+KeCoetqQYFXM4Epf7M7ez3lWlOjrDjrwMei6caCVhfdw+mIKD4cgdGNy5JQotQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-export-namespace-from": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.24.7.tgz", - "integrity": "sha512-v0K9uNYsPL3oXZ/7F9NNIbAj2jv1whUEtyA6aujhekLs56R++JDQuzRcP2/z4WX5Vg/c5lE9uWZA0/iUoFhLTA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - } - }, - "@babel/plugin-transform-for-of": { -<<<<<<< HEAD - "version": "7.18.8", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.24.7.tgz", - "integrity": "sha512-wo9ogrDG1ITTTBsy46oGiN1dS9A7MROBTcYsfS8DtsImMkHk9JXJ3EWQM6X2SUw4x80uGPlwj0o00Uoc6nEE3g==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" - } - }, - "@babel/plugin-transform-function-name": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.0.tgz", - "integrity": "sha512-CQmfSnK14eYu82fu6GlCwRciHB7mp7oLN+DeyGDDwUr9cMwuSVviJKPXw/YcRYZdB1TdlLJWHHwXwnwD1WnCmQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/plugin-transform-json-strings": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.24.7.tgz", - "integrity": "sha512-2yFnBGDvRuxAaE/f0vfBKvtnvvqU8tGpMHqMNpTN2oWMKIR3NqFkjaAgGwawhqK/pIN2T3XdjGPdaG0vDhOBGw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-json-strings": "^7.8.3" - } - }, - "@babel/plugin-transform-literals": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.24.7.tgz", - "integrity": "sha512-vcwCbb4HDH+hWi8Pqenwnjy+UiklO4Kt1vfspcQYFhJdpthSnW8XvWGyDZWKNVrVbVViI/S7K9PDJZiUmP2fYQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-logical-assignment-operators": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.24.7.tgz", - "integrity": "sha512-4D2tpwlQ1odXmTEIFWy9ELJcZHqrStlzK/dAOWYyxX3zT0iXQB6banjgeOJQXzEc4S0E0a5A+hahxPaEFYftsw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-transform-member-expression-literals": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.24.7.tgz", - "integrity": "sha512-T/hRC1uqrzXMKLQ6UCwMT85S3EvqaBXDGf0FaMf4446Qx9vKwlghvee0+uuZcDUCZU5RuNi4781UQ7R308zzBw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-modules-amd": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.24.7.tgz", - "integrity": "sha512-9+pB1qxV3vs/8Hdmz/CulFB8w2tuu6EB94JZFsjdqxQokwGa9Unap7Bo2gGBGIvPmDIVvQrom7r5m/TCDMURhg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-modules-commonjs": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz", - "integrity": "sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-simple-access": "^7.24.7" - } - }, - "@babel/plugin-transform-modules-systemjs": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.0.tgz", - "integrity": "sha512-YPJfjQPDXxyQWg/0+jHKj1llnY5f/R6a0p/vP4lPymxLu7Lvl4k2WMitqi08yxwQcCVUUdG9LCUj4TNEgAp3Jw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.25.0", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "@babel/traverse": "^7.25.0" - } - }, - "@babel/plugin-transform-modules-umd": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.24.7.tgz", - "integrity": "sha512-3aytQvqJ/h9z4g8AsKPLvD4Zqi2qT+L3j7XoFFu1XBlZWEl2/1kWnhmAbxpLgPrHSY0M6UA02jyTiwUVtiKR6A==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-named-capturing-groups-regex": { -<<<<<<< HEAD - "version": "7.19.1", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.24.7.tgz", - "integrity": "sha512-/jr7h/EWeJtk1U/uz2jlsCioHkZk1JJZVcc8oQsJ1dUlaJD83f4/6Zeh2aHt9BIFokHIsSeDfhUmju0+1GPd6g==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-new-target": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.24.7.tgz", - "integrity": "sha512-RNKwfRIXg4Ls/8mMTza5oPF5RkOW8Wy/WgMAp1/F1yZ8mMbtwXW+HDoJiOsagWrAhI5f57Vncrmr9XeT4CVapA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-nullish-coalescing-operator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.7.tgz", - "integrity": "sha512-Ts7xQVk1OEocqzm8rHMXHlxvsfZ0cEF2yomUqpKENHWMF4zKk175Y4q8H5knJes6PgYad50uuRmt3UJuhBw8pQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - } - }, - "@babel/plugin-transform-numeric-separator": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.24.7.tgz", - "integrity": "sha512-e6q1TiVUzvH9KRvicuxdBTUj4AdKSRwzIyFFnfnezpCfP2/7Qmbb8qbU2j7GODbl4JMkblitCQjKYUaX/qkkwA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - } - }, - "@babel/plugin-transform-object-rest-spread": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.7.tgz", - "integrity": "sha512-4QrHAr0aXQCEFni2q4DqKLD31n2DL+RxcwnNjDFkSG0eNQ/xCavnRkfCUjsyqGC2OviNJvZOF/mQqZBw7i2C5Q==", - "dev": true, - "requires": { - "@babel/helper-compilation-targets": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.24.7" - } - }, - "@babel/plugin-transform-object-super": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.24.7.tgz", - "integrity": "sha512-A/vVLwN6lBrMFmMDmPPz0jnE6ZGx7Jq7d6sT/Ev4H65RER6pZ+kczlf1DthF5N0qaPHBsI7UXiE8Zy66nmAovg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-replace-supers": "^7.24.7" - } - }, - "@babel/plugin-transform-optional-catch-binding": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.24.7.tgz", - "integrity": "sha512-uLEndKqP5BfBbC/5jTwPxLh9kqPWWgzN/f8w6UwAIirAEqiIVJWWY312X72Eub09g5KF9+Zn7+hT7sDxmhRuKA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - } - }, - "@babel/plugin-transform-optional-chaining": { - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.24.8.tgz", - "integrity": "sha512-5cTOLSMs9eypEy8JUVvIKOu6NgvbJMnpG62VpIHrTmROdQ+L5mDAaI40g25k5vXti55JWNX5jCkq3HZxXBQANw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, - "@babel/plugin-transform-parameters": { -<<<<<<< HEAD - "version": "7.18.8", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.24.7.tgz", - "integrity": "sha512-yGWW5Rr+sQOhK0Ot8hjDJuxU3XLRQGflvT4lhlSY0DFvdb3TwKaY26CJzHtYllU0vT9j58hc37ndFPsqT1SrzA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-private-methods": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.24.7.tgz", - "integrity": "sha512-COTCOkG2hn4JKGEKBADkA8WNb35TGkkRbI5iT845dB+NyqgO8Hn+ajPbSnIQznneJTa3d30scb6iz/DhH8GsJQ==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-private-property-in-object": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.24.7.tgz", - "integrity": "sha512-9z76mxwnwFxMyxZWEgdgECQglF2Q7cFLm0kMf8pGwt+GSJsY0cONKj/UuO4bOH0w/uAel3ekS4ra5CEAyJRmDA==", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.24.7", - "@babel/helper-create-class-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - } - }, - "@babel/plugin-transform-property-literals": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.24.7.tgz", - "integrity": "sha512-EMi4MLQSHfd2nrCqQEWxFdha2gBCqU4ZcCng4WBGZ5CJL4bBRW0ptdqqDdeirGZcpALazVVNJqRmsO8/+oNCBA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-regenerator": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.7.tgz", - "integrity": "sha512-lq3fvXPdimDrlg6LWBoqj+r/DEWgONuwjuOuQCSYgRroXDH/IdM1C0IZf59fL5cHLpjEH/O6opIRBbqv7ELnuA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "regenerator-transform": "^0.15.2" - } - }, - "@babel/plugin-transform-reserved-words": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.24.7.tgz", - "integrity": "sha512-0DUq0pHcPKbjFZCfTss/pGkYMfy3vFWydkUBd9r0GHpIyfs2eCDENvqadMycRS9wZCXR41wucAfJHJmwA0UmoQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-shorthand-properties": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.7.tgz", - "integrity": "sha512-KsDsevZMDsigzbA09+vacnLpmPH4aWjcZjXdyFKGzpplxhbeB4wYtury3vglQkg6KM/xEPKt73eCjPPf1PgXBA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-spread": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.24.7.tgz", - "integrity": "sha512-x96oO0I09dgMDxJaANcRyD4ellXFLLiWhuwDxKZX5g2rWP1bTPkBSwCYv96VDXVT1bD9aPj8tppr5ITIh8hBng==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7" - } - }, - "@babel/plugin-transform-sticky-regex": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.24.7.tgz", - "integrity": "sha512-kHPSIJc9v24zEml5geKg9Mjx5ULpfncj0wRpYtxbvKyTtHCYDkVE3aHQ03FrpEo4gEe2vrJJS1Y9CJTaThA52g==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-template-literals": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.24.7.tgz", - "integrity": "sha512-AfDTQmClklHCOLxtGoP7HkeMw56k1/bTQjwsfhL6pppo/M4TOBSq+jjBUBLmV/4oeFg4GWMavIl44ZeCtmmZTw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-typeof-symbol": { -<<<<<<< HEAD - "version": "7.18.9", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.24.8.tgz", - "integrity": "sha512-adNTUpDCVnmAE58VEqKlAA6ZBlNkMnWD0ZcW76lyNFN3MJniyGFZfNwERVk8Ap56MCnXztmDr19T4mPTztcuaw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.8" - } - }, - "@babel/plugin-transform-unicode-escapes": { -<<<<<<< HEAD - "version": "7.18.10", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.24.7.tgz", - "integrity": "sha512-U3ap1gm5+4edc2Q/P+9VrBNhGkfnf+8ZqppY71Bo/pzZmXhhLdqgaUl6cuB07O1+AQJtCLfaOmswiNbSQ9ivhw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-unicode-property-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.24.7.tgz", - "integrity": "sha512-uH2O4OV5M9FZYQrwc7NdVmMxQJOCCzFeYudlZSzUAHRFeOujQefa92E74TQDVskNHCzOXoigEuoyzHDhaEaK5w==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-unicode-regex": { -<<<<<<< HEAD - "version": "7.18.6", -======= - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.24.7.tgz", - "integrity": "sha512-hlQ96MBZSAXUq7ltkjtu3FJCCSMx/j629ns3hA3pXnBXjanNP0LHi+JpPeA81zaWgVK1VGH95Xuy7u0RyQ8kMg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/plugin-transform-unicode-sets-regex": { - "version": "7.24.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.24.7.tgz", - "integrity": "sha512-2G8aAvF4wy1w/AGZkemprdGMRg5o6zPNhbHVImRz3lss55TYCBd6xStN19rt8XJHq20sqV0JbyWjOWwQRwV/wg==", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.24.7", - "@babel/helper-plugin-utils": "^7.24.7" - } - }, - "@babel/preset-env": { -<<<<<<< HEAD - "version": "7.19.3", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.25.0.tgz", - "integrity": "sha512-vYAA8PrCOeZfG4D87hmw1KJ1BPubghXP1e2MacRFwECGNKL76dkA38JEwYllbvQCpf/kLxsTtir0b8MtxKoVCw==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/compat-data": "^7.25.0", - "@babel/helper-compilation-targets": "^7.24.8", - "@babel/helper-plugin-utils": "^7.24.8", - "@babel/helper-validator-option": "^7.24.8", - "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.0", - "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.0", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.0", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.24.7", - "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.0", - "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.24.7", - "@babel/plugin-syntax-import-attributes": "^7.24.7", - "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", - "@babel/plugin-transform-arrow-functions": "^7.24.7", - "@babel/plugin-transform-async-generator-functions": "^7.25.0", - "@babel/plugin-transform-async-to-generator": "^7.24.7", - "@babel/plugin-transform-block-scoped-functions": "^7.24.7", - "@babel/plugin-transform-block-scoping": "^7.25.0", - "@babel/plugin-transform-class-properties": "^7.24.7", - "@babel/plugin-transform-class-static-block": "^7.24.7", - "@babel/plugin-transform-classes": "^7.25.0", - "@babel/plugin-transform-computed-properties": "^7.24.7", - "@babel/plugin-transform-destructuring": "^7.24.8", - "@babel/plugin-transform-dotall-regex": "^7.24.7", - "@babel/plugin-transform-duplicate-keys": "^7.24.7", - "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.0", - "@babel/plugin-transform-dynamic-import": "^7.24.7", - "@babel/plugin-transform-exponentiation-operator": "^7.24.7", - "@babel/plugin-transform-export-namespace-from": "^7.24.7", - "@babel/plugin-transform-for-of": "^7.24.7", - "@babel/plugin-transform-function-name": "^7.25.0", - "@babel/plugin-transform-json-strings": "^7.24.7", - "@babel/plugin-transform-literals": "^7.24.7", - "@babel/plugin-transform-logical-assignment-operators": "^7.24.7", - "@babel/plugin-transform-member-expression-literals": "^7.24.7", - "@babel/plugin-transform-modules-amd": "^7.24.7", - "@babel/plugin-transform-modules-commonjs": "^7.24.8", - "@babel/plugin-transform-modules-systemjs": "^7.25.0", - "@babel/plugin-transform-modules-umd": "^7.24.7", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.24.7", - "@babel/plugin-transform-new-target": "^7.24.7", - "@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7", - "@babel/plugin-transform-numeric-separator": "^7.24.7", - "@babel/plugin-transform-object-rest-spread": "^7.24.7", - "@babel/plugin-transform-object-super": "^7.24.7", - "@babel/plugin-transform-optional-catch-binding": "^7.24.7", - "@babel/plugin-transform-optional-chaining": "^7.24.8", - "@babel/plugin-transform-parameters": "^7.24.7", - "@babel/plugin-transform-private-methods": "^7.24.7", - "@babel/plugin-transform-private-property-in-object": "^7.24.7", - "@babel/plugin-transform-property-literals": "^7.24.7", - "@babel/plugin-transform-regenerator": "^7.24.7", - "@babel/plugin-transform-reserved-words": "^7.24.7", - "@babel/plugin-transform-shorthand-properties": "^7.24.7", - "@babel/plugin-transform-spread": "^7.24.7", - "@babel/plugin-transform-sticky-regex": "^7.24.7", - "@babel/plugin-transform-template-literals": "^7.24.7", - "@babel/plugin-transform-typeof-symbol": "^7.24.8", - "@babel/plugin-transform-unicode-escapes": "^7.24.7", - "@babel/plugin-transform-unicode-property-regex": "^7.24.7", - "@babel/plugin-transform-unicode-regex": "^7.24.7", - "@babel/plugin-transform-unicode-sets-regex": "^7.24.7", - "@babel/preset-modules": "0.1.6-no-external-plugins", - "babel-plugin-polyfill-corejs2": "^0.4.10", - "babel-plugin-polyfill-corejs3": "^0.10.4", - "babel-plugin-polyfill-regenerator": "^0.6.1", - "core-js-compat": "^3.37.1", - "semver": "^6.3.1" - } - }, - "@babel/preset-modules": { -<<<<<<< HEAD - "version": "0.1.5", -======= - "version": "0.1.6-no-external-plugins", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", - "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - } - }, - "@babel/regjsgen": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", - "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==", - "dev": true - }, - "@babel/runtime": { -<<<<<<< HEAD - "version": "7.19.0", -======= - "version": "7.24.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.8.tgz", - "integrity": "sha512-5F7SDGs1T72ZczbRwbGO9lQi0NLjQxzl6i4lJxLxfW9U5UluCSyEJeniWvnhl3/euNiqQVbo8zruhsDfid0esA==", ->>>>>>> master - "dev": true, - "requires": { - "regenerator-runtime": "^0.14.0" - }, - "dependencies": { - "regenerator-runtime": { -<<<<<<< HEAD - "version": "0.13.9", -======= - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", ->>>>>>> master - "dev": true - } - } - }, - "@babel/template": { -<<<<<<< HEAD - "version": "7.18.10", - "dev": true, - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.18.10", - "@babel/types": "^7.18.10" - } - }, - "@babel/traverse": { - "version": "7.19.3", - "dev": true, - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.19.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.3", - "@babel/types": "^7.19.3", - "debug": "^4.1.0", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", - "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.24.7", - "@babel/parser": "^7.25.0", - "@babel/types": "^7.25.0" - } - }, - "@babel/traverse": { - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.0.tgz", - "integrity": "sha512-ubALThHQy4GCf6mbb+5ZRNmLLCI7bJ3f8Q6LHBSRlSKSWj5a7dSUzJBLv3VuIhFrFPgjF4IzPF567YG/HSCdZA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.24.7", - "@babel/generator": "^7.25.0", - "@babel/parser": "^7.25.0", - "@babel/template": "^7.25.0", - "@babel/types": "^7.25.0", - "debug": "^4.3.1", ->>>>>>> master - "globals": "^11.1.0" - } - }, - "@babel/types": { -<<<<<<< HEAD - "version": "7.25.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.2.tgz", - "integrity": "sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q==", -======= - "version": "7.25.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.0.tgz", - "integrity": "sha512-LcnxQSsd9aXOIgmmSpvZ/1yo46ra2ESYyqLcryaBZOghxy5qqOBjvCWP5JfkI8yl9rlxRgdLTTMCQQRcN2hdCg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-string-parser": "^7.24.8", - "@babel/helper-validator-identifier": "^7.24.7", - "to-fast-properties": "^2.0.0" - } - }, - "@bergos/jsonparse": { - "version": "1.4.1", - "requires": { - "buffer": "^6.0.3" - } - }, - "@cspotcode/source-map-support": { - "version": "0.8.1", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "dependencies": { - "@jridgewell/trace-mapping": { - "version": "0.3.9", - "dev": true, - "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - } - } - }, - "@discoveryjs/json-ext": { - "version": "0.5.7", - "dev": true - }, - "@docsearch/css": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@docsearch/css/-/css-3.6.1.tgz", - "integrity": "sha512-VtVb5DS+0hRIprU2CO6ZQjK2Zg4QU5HrDM1+ix6rT0umsYvFvatMAnf97NHZlVWDaaLlx7GRfR/7FikANiM2Fg==", - "dev": true - }, - "@docsearch/js": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@docsearch/js/-/js-3.6.1.tgz", - "integrity": "sha512-erI3RRZurDr1xES5hvYJ3Imp7jtrXj6f1xYIzDzxiS7nNBufYWPbJwrmMqWC5g9y165PmxEmN9pklGCdLi0Iqg==", - "dev": true, - "requires": { - "@docsearch/react": "3.6.1", - "preact": "^10.0.0" - } - }, - "@docsearch/react": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@docsearch/react/-/react-3.6.1.tgz", - "integrity": "sha512-qXZkEPvybVhSXj0K7U3bXc233tk5e8PfhoZ6MhPOiik/qUQxYC+Dn9DnoS7CxHQQhHfCvTiN0eY9M12oRghEXw==", - "dev": true, - "requires": { - "@algolia/autocomplete-core": "1.9.3", - "@algolia/autocomplete-preset-algolia": "1.9.3", - "@docsearch/css": "3.6.1", - "algoliasearch": "^4.19.1" - } - }, - "@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", - "dev": true, - "optional": true - }, - "@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", - "dev": true, - "optional": true - }, - "@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", - "dev": true, - "optional": true - }, - "@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", - "dev": true, - "optional": true - }, - "@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", - "dev": true, - "optional": true - }, - "@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", - "dev": true, - "optional": true - }, - "@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", - "dev": true, - "optional": true - }, - "@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", - "dev": true, - "optional": true - }, - "@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", - "dev": true, - "optional": true - }, - "@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", - "dev": true, - "optional": true - }, - "@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", - "dev": true, - "optional": true - }, - "@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", - "dev": true, - "optional": true - }, - "@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", - "dev": true, - "optional": true - }, - "@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", - "dev": true, - "optional": true - }, - "@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", - "dev": true, - "optional": true - }, - "@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", - "dev": true, - "optional": true - }, - "@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==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^3.3.0" - } - }, - "@eslint-community/regexpp": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", - "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", - "dev": true - }, - "@eslint/eslintrc": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", - "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - } - } - }, - "@eslint/js": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", - "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", - "dev": true - }, - "@fastify/busboy": { - "version": "2.1.0" - }, - "@humanwhocodes/config-array": { - "version": "0.11.14", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", - "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^2.0.2", - "debug": "^4.3.1", - "minimatch": "^3.0.5" - } - }, - "@humanwhocodes/module-importer": { - "version": "1.0.1", - "dev": true - }, - "@humanwhocodes/object-schema": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", - "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", - "dev": true - }, - "@inrupt/oidc-client": { - "version": "1.11.6", - "requires": { - "acorn": "^7.4.1", - "base64-js": "^1.5.1", - "core-js": "^3.8.3", - "crypto-js": "^4.0.0", - "serialize-javascript": "^4.0.0" - }, - "dependencies": { - "acorn": { - "version": "7.4.1" - }, - "core-js": { - "version": "3.34.0" - }, - "serialize-javascript": { - "version": "4.0.0", - "requires": { - "randombytes": "^2.1.0" - } - } - } - }, - "@inrupt/oidc-client-ext": { - "version": "1.17.5", - "requires": { - "@inrupt/oidc-client": "^1.11.6", - "@inrupt/solid-client-authn-core": "^1.17.5", - "@inrupt/universal-fetch": "^1.0.1", - "jose": "^4.15.4", - "uuid": "^9.0.1" - } - }, - "@inrupt/solid-client": { - "version": "1.30.2", - "requires": { - "@inrupt/universal-fetch": "^1.0.1", - "@rdfjs/dataset": "^1.1.0", - "@types/rdfjs__dataset": "^1.0.4", - "buffer": "^6.0.3", - "fsevents": "^2.3.2", - "http-link-header": "^1.1.0", - "jsonld-context-parser": "^2.3.0", - "jsonld-streaming-parser": "^3.2.0", - "n3": "^1.10.0", - "uuid": "^9.0.0" - } - }, - "@inrupt/solid-client-authn-browser": { - "version": "1.17.5", - "requires": { - "@inrupt/oidc-client-ext": "^1.17.5", - "@inrupt/solid-client-authn-core": "^1.17.5", - "@inrupt/universal-fetch": "^1.0.2", - "events": "^3.3.0", - "jose": "^4.15.4", - "uuid": "^9.0.1" - } - }, - "@inrupt/solid-client-authn-core": { - "version": "1.17.5", - "requires": { - "@inrupt/universal-fetch": "^1.0.1", - "events": "^3.3.0", - "jose": "^4.15.4", - "uuid": "^9.0.1" - } - }, - "@inrupt/universal-fetch": { - "version": "1.0.3", - "requires": { - "node-fetch": "^2.6.7", - "undici": "^5.19.1" - } - }, - "@inrupt/vocab-common-rdf": { - "version": "1.0.5" - }, - "@inrupt/vocab-solid": { - "version": "1.0.4" - }, - "@jridgewell/gen-mapping": { - "version": "0.1.1", - "dev": true, - "requires": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "@jridgewell/resolve-uri": { - "version": "3.1.0", - "dev": true - }, - "@jridgewell/set-array": { - "version": "1.2.1", - "dev": true - }, - "@jridgewell/source-map": { - "version": "0.3.6", - "dev": true, - "requires": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25" - }, - "dependencies": { - "@jridgewell/gen-mapping": { - "version": "0.3.5", - "dev": true, - "requires": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - } - } - } - }, - "@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true - }, - "@jridgewell/trace-mapping": { - "version": "0.3.25", - "dev": true, - "requires": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - } - }, - "@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true - }, - "@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "requires": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - } - }, - "@rdfjs/data-model": { - "version": "1.3.4", - "requires": { - "@rdfjs/types": ">=1.0.1" - } - }, - "@rdfjs/dataset": { - "version": "1.1.1", - "requires": { - "@rdfjs/data-model": "^1.2.0" - } - }, - "@rdfjs/types": { - "version": "1.1.0", - "requires": { - "@types/node": "*" - } - }, - "@rollup/rollup-android-arm-eabi": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.0.tgz", - "integrity": "sha512-WTWD8PfoSAJ+qL87lE7votj3syLavxunWhzCnx3XFxFiI/BA/r3X7MUM8dVrH8rb2r4AiO8jJsr3ZjdaftmnfA==", - "dev": true, - "optional": true - }, - "@rollup/rollup-android-arm64": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.0.tgz", - "integrity": "sha512-a1sR2zSK1B4eYkiZu17ZUZhmUQcKjk2/j9Me2IDjk1GHW7LB5Z35LEzj9iJch6gtUfsnvZs1ZNyDW2oZSThrkA==", - "dev": true, - "optional": true - }, - "@rollup/rollup-darwin-arm64": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.0.tgz", - "integrity": "sha512-zOnKWLgDld/svhKO5PD9ozmL6roy5OQ5T4ThvdYZLpiOhEGY+dp2NwUmxK0Ld91LrbjrvtNAE0ERBwjqhZTRAA==", - "dev": true, - "optional": true - }, - "@rollup/rollup-darwin-x64": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.0.tgz", - "integrity": "sha512-7doS8br0xAkg48SKE2QNtMSFPFUlRdw9+votl27MvT46vo44ATBmdZdGysOevNELmZlfd+NEa0UYOA8f01WSrg==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.0.tgz", - "integrity": "sha512-pWJsfQjNWNGsoCq53KjMtwdJDmh/6NubwQcz52aEwLEuvx08bzcy6tOUuawAOncPnxz/3siRtd8hiQ32G1y8VA==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.0.tgz", - "integrity": "sha512-efRIANsz3UHZrnZXuEvxS9LoCOWMGD1rweciD6uJQIx2myN3a8Im1FafZBzh7zk1RJ6oKcR16dU3UPldaKd83w==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.0.tgz", - "integrity": "sha512-ZrPhydkTVhyeGTW94WJ8pnl1uroqVHM3j3hjdquwAcWnmivjAwOYjTEAuEDeJvGX7xv3Z9GAvrBkEzCgHq9U1w==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-arm64-musl": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.0.tgz", - "integrity": "sha512-cfaupqd+UEFeURmqNP2eEvXqgbSox/LHOyN9/d2pSdV8xTrjdg3NgOFJCtc1vQ/jEke1qD0IejbBfxleBPHnPw==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.0.tgz", - "integrity": "sha512-ZKPan1/RvAhrUylwBXC9t7B2hXdpb/ufeu22pG2psV7RN8roOfGurEghw1ySmX/CmDDHNTDDjY3lo9hRlgtaHg==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.0.tgz", - "integrity": "sha512-H1eRaCwd5E8eS8leiS+o/NqMdljkcb1d6r2h4fKSsCXQilLKArq6WS7XBLDu80Yz+nMqHVFDquwcVrQmGr28rg==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.0.tgz", - "integrity": "sha512-zJ4hA+3b5tu8u7L58CCSI0A9N1vkfwPhWd/puGXwtZlsB5bTkwDNW/+JCU84+3QYmKpLi+XvHdmrlwUwDA6kqw==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-x64-gnu": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.0.tgz", - "integrity": "sha512-e2hrvElFIh6kW/UNBQK/kzqMNY5mO+67YtEh9OA65RM5IJXYTWiXjX6fjIiPaqOkBthYF1EqgiZ6OXKcQsM0hg==", - "dev": true, - "optional": true - }, - "@rollup/rollup-linux-x64-musl": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.0.tgz", - "integrity": "sha512-1vvmgDdUSebVGXWX2lIcgRebqfQSff0hMEkLJyakQ9JQUbLDkEaMsPTLOmyccyC6IJ/l3FZuJbmrBw/u0A0uCQ==", - "dev": true, - "optional": true - }, - "@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.0.tgz", - "integrity": "sha512-s5oFkZ/hFcrlAyBTONFY1TWndfyre1wOMwU+6KCpm/iatybvrRgmZVM+vCFwxmC5ZhdlgfE0N4XorsDpi7/4XQ==", - "dev": true, - "optional": true - }, - "@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.0.tgz", - "integrity": "sha512-G9+TEqRnAA6nbpqyUqgTiopmnfgnMkR3kMukFBDsiyy23LZvUCpiUwjTRx6ezYCjJODXrh52rBR9oXvm+Fp5wg==", - "dev": true, - "optional": true - }, - "@rollup/rollup-win32-x64-msvc": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.0.tgz", - "integrity": "sha512-2jsCDZwtQvRhejHLfZ1JY6w6kEuEtfF9nzYsZxzSlNVKDX+DpsDJ+Rbjkm74nvg2rdx0gwBS+IMdvwJuq3S9pQ==", - "dev": true, - "optional": true - }, - "@shikijs/core": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.14.1.tgz", - "integrity": "sha512-KyHIIpKNaT20FtFPFjCQB5WVSTpLR/n+jQXhWHWVUMm9MaOaG9BGOG0MSyt7yA4+Lm+4c9rTc03tt3nYzeYSfw==", - "dev": true, - "requires": { - "@types/hast": "^3.0.4" - } - }, - "@shikijs/transformers": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/@shikijs/transformers/-/transformers-1.14.1.tgz", - "integrity": "sha512-JJqL8QBVCJh3L61jqqEXgFq1cTycwjcGj7aSmqOEsbxnETM9hRlaB74QuXvY/fVJNjbNt8nvWo0VwAXKvMSLRg==", - "dev": true, - "requires": { - "shiki": "1.14.1" - } - }, - "@sinonjs/commons": { -<<<<<<< HEAD - "version": "1.8.3", -======= - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", - "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", ->>>>>>> master - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/fake-timers": { -<<<<<<< HEAD - "version": "9.1.2", -======= - "version": "11.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", - "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", ->>>>>>> master - "dev": true, - "requires": { - "@sinonjs/commons": "^3.0.0" - } - }, - "@sinonjs/samsam": { -<<<<<<< HEAD - "version": "6.1.1", -======= - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz", - "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==", ->>>>>>> master - "dev": true, - "requires": { - "@sinonjs/commons": "^2.0.0", - "lodash.get": "^4.4.2", - "type-detect": "^4.0.8" - }, - "dependencies": { - "@sinonjs/commons": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", - "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - } - } - }, - "@sinonjs/text-encoding": { - "version": "0.7.2", - "dev": true - }, - "@tsconfig/node10": { - "version": "1.0.9", - "dev": true - }, - "@tsconfig/node12": { - "version": "1.0.11", - "dev": true - }, - "@tsconfig/node14": { - "version": "1.0.3", - "dev": true - }, - "@tsconfig/node16": { - "version": "1.0.3", - "dev": true - }, -<<<<<<< HEAD - "@types/chai": { - "version": "4.3.3", - "dev": true - }, - "@types/chai-as-promised": { - "version": "7.1.5", - "dev": true, - "requires": { - "@types/chai": "*" - } - }, -======= ->>>>>>> master - "@types/eslint": { - "version": "8.56.10", - "dev": true, - "requires": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "@types/eslint-scope": { - "version": "3.7.7", - "dev": true, - "requires": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, - "@types/estree": { - "version": "1.0.5", - "dev": true - }, - "@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", - "dev": true, - "requires": { - "@types/unist": "*" - } - }, - "@types/http-link-header": { - "version": "1.0.5", - "requires": { - "@types/node": "*" - } - }, - "@types/json-schema": { - "version": "7.0.11", - "dev": true - }, - "@types/linkify-it": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", - "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", - "dev": true - }, - "@types/markdown-it": { - "version": "14.1.2", - "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", - "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", - "dev": true, - "requires": { - "@types/linkify-it": "^5", - "@types/mdurl": "^2" - } - }, - "@types/mdurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", - "dev": true - }, -<<<<<<< HEAD - "@types/mocha": { - "version": "9.1.1", - "dev": true - }, -======= ->>>>>>> master - "@types/node": { - "version": "20.14.0", - "requires": { - "undici-types": "~5.26.4" - } - }, - "@types/rdfjs__dataset": { - "version": "1.0.5", - "requires": { - "rdf-js": "^4.0.2" - } - }, - "@types/readable-stream": { - "version": "2.3.15", - "requires": { - "@types/node": "*", - "safe-buffer": "~5.1.1" - } - }, - "@types/tv4": { -<<<<<<< HEAD - "version": "1.2.31", -======= - "version": "1.2.33", - "resolved": "https://registry.npmjs.org/@types/tv4/-/tv4-1.2.33.tgz", - "integrity": "sha512-7phCVTXC6Bj50IV1iKOwqGkR4JONJyMbRZnKTSuujv1S/tO9rG5OdCt7BMSjytO+zJmYdn1/I4fd3SH0gtO99g==", ->>>>>>> master - "dev": true - }, - "@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "dev": true - }, - "@types/web-bluetooth": { - "version": "0.0.20", - "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.20.tgz", - "integrity": "sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==", - "dev": true - }, - "@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==", - "dev": true, - "requires": { - "@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", - "graphemer": "^1.4.0", - "ignore": "^5.3.1", - "natural-compare": "^1.4.0", - "ts-api-utils": "^1.3.0" - } - }, - "@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==", - "dev": true, - "requires": { - "@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", - "debug": "^4.3.4" - } - }, - "@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==", - "dev": true, - "requires": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0" - } - }, - "@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==", - "dev": true, - "requires": { - "@typescript-eslint/typescript-estree": "7.18.0", - "@typescript-eslint/utils": "7.18.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.3.0" - } - }, - "@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==", - "dev": true - }, - "@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==", - "dev": true, - "requires": { - "@typescript-eslint/types": "7.18.0", - "@typescript-eslint/visitor-keys": "7.18.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "^9.0.4", - "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true - } - } - }, - "@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==", - "dev": true, - "requires": { - "@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/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==", - "dev": true, - "requires": { - "@typescript-eslint/types": "7.18.0", - "eslint-visitor-keys": "^3.4.3" - } - }, - "@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==", - "dev": true - }, - "@vitejs/plugin-vue": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-5.1.2.tgz", - "integrity": "sha512-nY9IwH12qeiJqumTCLJLE7IiNx7HZ39cbHaysEUd+Myvbz9KAqd2yq+U01Kab1R/H1BmiyM2ShTYlNH32Fzo3A==", - "dev": true, - "requires": {} - }, - "@vue/compiler-core": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.4.38.tgz", - "integrity": "sha512-8IQOTCWnLFqfHzOGm9+P8OPSEDukgg3Huc92qSG49if/xI2SAwLHQO2qaPQbjCWPBcQoO1WYfXfTACUrWV3c5A==", - "dev": true, - "requires": { - "@babel/parser": "^7.24.7", - "@vue/shared": "3.4.38", - "entities": "^4.5.0", - "estree-walker": "^2.0.2", - "source-map-js": "^1.2.0" - } - }, - "@vue/compiler-dom": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.4.38.tgz", - "integrity": "sha512-Osc/c7ABsHXTsETLgykcOwIxFktHfGSUDkb05V61rocEfsFDcjDLH/IHJSNJP+/Sv9KeN2Lx1V6McZzlSb9EhQ==", - "dev": true, - "requires": { - "@vue/compiler-core": "3.4.38", - "@vue/shared": "3.4.38" - } - }, - "@vue/compiler-sfc": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.4.38.tgz", - "integrity": "sha512-s5QfZ+9PzPh3T5H4hsQDJtI8x7zdJaew/dCGgqZ2630XdzaZ3AD8xGZfBqpT8oaD/p2eedd+pL8tD5vvt5ZYJQ==", - "dev": true, - "requires": { - "@babel/parser": "^7.24.7", - "@vue/compiler-core": "3.4.38", - "@vue/compiler-dom": "3.4.38", - "@vue/compiler-ssr": "3.4.38", - "@vue/shared": "3.4.38", - "estree-walker": "^2.0.2", - "magic-string": "^0.30.10", - "postcss": "^8.4.40", - "source-map-js": "^1.2.0" - } - }, - "@vue/compiler-ssr": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.4.38.tgz", - "integrity": "sha512-YXznKFQ8dxYpAz9zLuVvfcXhc31FSPFDcqr0kyujbOwNhlmaNvL2QfIy+RZeJgSn5Fk54CWoEUeW+NVBAogGaw==", - "dev": true, - "requires": { - "@vue/compiler-dom": "3.4.38", - "@vue/shared": "3.4.38" - } - }, - "@vue/devtools-api": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.3.8.tgz", - "integrity": "sha512-NURFwmxz4WukFU54IHgyGI2KSejdgHG5JC4xTcWmTWEBIc8aelj9fBy4qsboObGHFp3JIdRxxANO9s2wZA/pVQ==", - "dev": true, - "requires": { - "@vue/devtools-kit": "^7.3.8" - } - }, - "@vue/devtools-kit": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.3.8.tgz", - "integrity": "sha512-HYy3MQP1nZ6GbE4vrgJ/UB+MvZnhYmEwCa/UafrEpdpwa+jNCkz1ZdUrC5I7LpkH1ShREEV2/pZlAQdBj+ncLQ==", - "dev": true, - "requires": { - "@vue/devtools-shared": "^7.3.8", - "birpc": "^0.2.17", - "hookable": "^5.5.3", - "mitt": "^3.0.1", - "perfect-debounce": "^1.0.0", - "speakingurl": "^14.0.1", - "superjson": "^2.2.1" - } - }, - "@vue/devtools-shared": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.3.8.tgz", - "integrity": "sha512-1NiJbn7Yp47nPDWhFZyEKpB2+5/+7JYv8IQnU0ccMrgslPR2dL7u1DIyI7mLqy4HN1ll36gQy0k8GqBYSFgZJw==", - "dev": true, - "requires": { - "rfdc": "^1.4.1" - } - }, - "@vue/reactivity": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.4.38.tgz", - "integrity": "sha512-4vl4wMMVniLsSYYeldAKzbk72+D3hUnkw9z8lDeJacTxAkXeDAP1uE9xr2+aKIN0ipOL8EG2GPouVTH6yF7Gnw==", - "dev": true, - "requires": { - "@vue/shared": "3.4.38" - } - }, - "@vue/runtime-core": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.4.38.tgz", - "integrity": "sha512-21z3wA99EABtuf+O3IhdxP0iHgkBs1vuoCAsCKLVJPEjpVqvblwBnTj42vzHRlWDCyxu9ptDm7sI2ZMcWrQqlA==", - "dev": true, - "requires": { - "@vue/reactivity": "3.4.38", - "@vue/shared": "3.4.38" - } - }, - "@vue/runtime-dom": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.4.38.tgz", - "integrity": "sha512-afZzmUreU7vKwKsV17H1NDThEEmdYI+GCAK/KY1U957Ig2NATPVjCROv61R19fjZNzMmiU03n79OMnXyJVN0UA==", - "dev": true, - "requires": { - "@vue/reactivity": "3.4.38", - "@vue/runtime-core": "3.4.38", - "@vue/shared": "3.4.38", - "csstype": "^3.1.3" - } - }, - "@vue/server-renderer": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.4.38.tgz", - "integrity": "sha512-NggOTr82FbPEkkUvBm4fTGcwUY8UuTsnWC/L2YZBmvaQ4C4Jl/Ao4HHTB+l7WnFCt5M/dN3l0XLuyjzswGYVCA==", - "dev": true, - "requires": { - "@vue/compiler-ssr": "3.4.38", - "@vue/shared": "3.4.38" - } - }, - "@vue/shared": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.38.tgz", - "integrity": "sha512-q0xCiLkuWWQLzVrecPb0RMsNWyxICOjPrcrwxTUEHb1fsnvni4dcuyG7RT/Ie7VPTvnjzIaWzRMUBsrqNj/hhw==", - "dev": true - }, - "@vueuse/core": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/core/-/core-11.0.1.tgz", - "integrity": "sha512-YTrekI18WwEyP3h168Fir94G/HNC27wvXJI21Alm0sPOwvhihfkrvHIe+5PNJq+MpgWdRcsjvE/38JaoKrgZhQ==", - "dev": true, - "requires": { - "@types/web-bluetooth": "^0.0.20", - "@vueuse/metadata": "11.0.1", - "@vueuse/shared": "11.0.1", - "vue-demi": ">=0.14.10" - }, - "dependencies": { - "vue-demi": { - "version": "0.14.10", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", - "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", - "dev": true, - "requires": {} - } - } - }, - "@vueuse/integrations": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/integrations/-/integrations-11.0.1.tgz", - "integrity": "sha512-V/FQTS/aiV6RTFXOj8cXgqhtNJBvxvbHeLElOUR7N7F3Kr0btS+dkymLB54mFd0Or6uEGpgwwb41cs/q2/rdOg==", - "dev": true, - "requires": { - "@vueuse/core": "11.0.1", - "@vueuse/shared": "11.0.1", - "vue-demi": ">=0.14.10" - }, - "dependencies": { - "vue-demi": { - "version": "0.14.10", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", - "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", - "dev": true, - "requires": {} - } - } - }, - "@vueuse/metadata": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/metadata/-/metadata-11.0.1.tgz", - "integrity": "sha512-dTFvuHFAjLYOiSd+t9Sk7xUiuL6jbfay/eX+g+jaipXXlwKur2VCqBCZX+jfu+2vROUGcUsdn3fJR9KkpadIOg==", - "dev": true - }, - "@vueuse/shared": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-11.0.1.tgz", - "integrity": "sha512-eAPf5CQB3HR0S76HqrhjBqFYstZfiHWZq8xF9EQmobGBkrhPfErJEhr8aMNQMqd6MkENIx2pblIEfJGlHpClug==", - "dev": true, - "requires": { - "vue-demi": ">=0.14.10" - }, - "dependencies": { - "vue-demi": { - "version": "0.14.10", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", - "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", - "dev": true, - "requires": {} - } - } - }, - "@webassemblyjs/ast": { - "version": "1.12.1", - "dev": true, - "requires": { - "@webassemblyjs/helper-numbers": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6" - } - }, - "@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.6", - "dev": true - }, - "@webassemblyjs/helper-api-error": { - "version": "1.11.6", - "dev": true - }, - "@webassemblyjs/helper-buffer": { - "version": "1.12.1", - "dev": true - }, - "@webassemblyjs/helper-numbers": { - "version": "1.11.6", - "dev": true, - "requires": { - "@webassemblyjs/floating-point-hex-parser": "1.11.6", - "@webassemblyjs/helper-api-error": "1.11.6", - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.6", - "dev": true - }, - "@webassemblyjs/helper-wasm-section": { - "version": "1.12.1", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/wasm-gen": "1.12.1" - } - }, - "@webassemblyjs/ieee754": { - "version": "1.11.6", - "dev": true, - "requires": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "@webassemblyjs/leb128": { - "version": "1.11.6", - "dev": true, - "requires": { - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/utf8": { - "version": "1.11.6", - "dev": true - }, - "@webassemblyjs/wasm-edit": { - "version": "1.12.1", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/helper-wasm-section": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-opt": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1", - "@webassemblyjs/wast-printer": "1.12.1" - } - }, - "@webassemblyjs/wasm-gen": { - "version": "1.12.1", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" - } - }, - "@webassemblyjs/wasm-opt": { - "version": "1.12.1", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-buffer": "1.12.1", - "@webassemblyjs/wasm-gen": "1.12.1", - "@webassemblyjs/wasm-parser": "1.12.1" - } - }, - "@webassemblyjs/wasm-parser": { - "version": "1.12.1", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.12.1", - "@webassemblyjs/helper-api-error": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" - } - }, - "@webassemblyjs/wast-printer": { - "version": "1.12.1", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.12.1", - "@xtuc/long": "4.2.2" - } - }, - "@webpack-cli/configtest": { - "version": "2.1.1", - "dev": true, - "requires": {} - }, - "@webpack-cli/info": { - "version": "2.0.2", - "dev": true, - "requires": {} - }, - "@webpack-cli/serve": { - "version": "2.0.5", - "dev": true, - "requires": {} - }, - "@xtuc/ieee754": { - "version": "1.2.0", - "dev": true - }, - "@xtuc/long": { - "version": "4.2.2", - "dev": true - }, - "abort-controller": { - "version": "3.0.0", - "requires": { - "event-target-shim": "^5.0.0" - } - }, - "accepts": { - "version": "1.3.8", - "dev": true, - "requires": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - } - }, - "acorn": { - "version": "8.12.1", - "dev": true - }, - "acorn-import-attributes": { - "version": "1.9.5", - "dev": true, - "requires": {} - }, - "acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} - }, - "acorn-to-esprima": { - "version": "2.0.8", - "dev": true - }, - "acorn-walk": { - "version": "8.2.0", - "dev": true - }, - "ajv": { - "version": "6.12.6", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-formats": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", - "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "dev": true, - "requires": { - "ajv": "^8.0.0" - }, - "dependencies": { - "ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - } - } - }, - "ajv-keywords": { - "version": "3.5.2", - "dev": true, - "requires": {} - }, - "algoliasearch": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.24.0.tgz", - "integrity": "sha512-bf0QV/9jVejssFBmz2HQLxUadxk574t4iwjCKp5E7NBzwKkrDEhKPISIIjAU/p6K5qDx3qoeh4+26zWN1jmw3g==", - "dev": true, - "requires": { - "@algolia/cache-browser-local-storage": "4.24.0", - "@algolia/cache-common": "4.24.0", - "@algolia/cache-in-memory": "4.24.0", - "@algolia/client-account": "4.24.0", - "@algolia/client-analytics": "4.24.0", - "@algolia/client-common": "4.24.0", - "@algolia/client-personalization": "4.24.0", - "@algolia/client-search": "4.24.0", - "@algolia/logger-common": "4.24.0", - "@algolia/logger-console": "4.24.0", - "@algolia/recommend": "4.24.0", - "@algolia/requester-browser-xhr": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/requester-node-http": "4.24.0", - "@algolia/transporter": "4.24.0" - }, - "dependencies": { - "@algolia/client-common": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.24.0.tgz", - "integrity": "sha512-bc2ROsNL6w6rqpl5jj/UywlIYC21TwSSoFHKl01lYirGMW+9Eek6r02Tocg4gZ8HAw3iBvu6XQiM3BEbmEMoiA==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "@algolia/client-search": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.24.0.tgz", - "integrity": "sha512-uRW6EpNapmLAD0mW47OXqTP8eiIx5F6qN9/x/7HHO6owL3N1IXqydGwW5nhDFBrV+ldouro2W1VX3XlcUXEFCA==", - "dev": true, - "requires": { - "@algolia/client-common": "4.24.0", - "@algolia/requester-common": "4.24.0", - "@algolia/transporter": "4.24.0" - } - }, - "@algolia/requester-browser-xhr": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.24.0.tgz", - "integrity": "sha512-Z2NxZMb6+nVXSjF13YpjYTdvV3032YTBSGm2vnYvYPA6mMxzM3v5rsCiSspndn9rzIW4Qp1lPHBvuoKJV6jnAA==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0" - } - }, - "@algolia/requester-node-http": { - "version": "4.24.0", - "resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.24.0.tgz", - "integrity": "sha512-JF18yTjNOVYvU/L3UosRcvbPMGT9B+/GQWNWnenIImglzNVGpyzChkXLnrSf6uxwVNO6ESGu6oN8MqcGQcjQJw==", - "dev": true, - "requires": { - "@algolia/requester-common": "4.24.0" - } - } - } - }, - "amdefine": { - "version": "1.0.1", - "dev": true - }, - "ansi-colors": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", - "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", - "dev": true - }, - "ansi-regex": { - "version": "5.0.1", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "anymatch": { - "version": "3.1.2", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "arg": { - "version": "4.1.3", - "dev": true - }, - "argparse": { - "version": "2.0.1", - "dev": true - }, - "array-flatten": { - "version": "1.1.1", - "dev": true - }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, - "assertion-error": { - "version": "1.1.0", - "dev": true - }, - "babel-code-frame": { - "version": "6.26.0", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "js-tokens": { - "version": "3.0.2", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "dev": true - } - } - }, - "babel-loader": { -<<<<<<< HEAD - "version": "8.2.5", -======= - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", - "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", ->>>>>>> master - "dev": true, - "requires": { - "find-cache-dir": "^4.0.0", - "schema-utils": "^4.0.0" - } - }, - "babel-messages": { - "version": "6.23.0", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, -<<<<<<< HEAD - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, - "babel-plugin-polyfill-corejs2": { - "version": "0.3.3", -======= - "babel-plugin-polyfill-corejs2": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz", - "integrity": "sha512-sMEJ27L0gRHShOh5G54uAAPaiCOygY/5ratXuiyb2G46FmlSpc9eFCzYVyDiPxfNbwzA7mYahmjQc5q+CZQ09Q==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/compat-data": "^7.22.6", - "@babel/helper-define-polyfill-provider": "^0.6.2", - "semver": "^6.3.1" - } - }, - "babel-plugin-polyfill-corejs3": { -<<<<<<< HEAD - "version": "0.6.0", -======= - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.4.tgz", - "integrity": "sha512-25J6I8NGfa5YkCDogHRID3fVCadIR8/pGl1/spvCkzb6lVn6SR3ojpx9nOn9iEBcUsjY24AmdKm5khcfKdylcg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-define-polyfill-provider": "^0.6.1", - "core-js-compat": "^3.36.1" - } - }, - "babel-plugin-polyfill-regenerator": { -<<<<<<< HEAD - "version": "0.4.1", -======= - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.2.tgz", - "integrity": "sha512-2R25rQZWP63nGwaAswvDazbPXfrM3HwVoBXK6HcqeKrSrL/JqcC/rDcf95l4r7LXLyxDXc8uQDa064GubtCABg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/helper-define-polyfill-provider": "^0.6.2" - } - }, - "babel-runtime": { - "version": "6.26.0", - "dev": true, - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-traverse": { - "version": "6.26.0", - "dev": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "globals": { - "version": "9.18.0", - "dev": true - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "babel-types": { - "version": "6.26.0", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - }, - "dependencies": { - "to-fast-properties": { - "version": "1.0.3", - "dev": true - } - } - }, - "babylon": { - "version": "6.18.0", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "dev": true - }, - "base64-js": { - "version": "1.5.1" - }, - "big.js": { - "version": "5.2.2", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "dev": true - }, - "birpc": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/birpc/-/birpc-0.2.17.tgz", - "integrity": "sha512-+hkTxhot+dWsLpp3gia5AkVHIsKlZybNT5gIYiDlNzJrmYPcTM9k5/w2uaj3IPpd7LlEYpmCj4Jj1nC41VhDFg==", - "dev": true - }, - "blob": { - "version": "0.1.0", - "requires": { - "esm": "^3.2.25" - } - }, - "bluebird": { - "version": "3.7.2", - "dev": true - }, - "body-parser": { -<<<<<<< HEAD - "version": "1.20.0", -======= - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", ->>>>>>> master - "dev": true, - "requires": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "brace-expansion": { - "version": "1.1.11", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { -<<<<<<< HEAD - "version": "3.0.2", -======= - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", ->>>>>>> master - "dev": true, - "requires": { - "fill-range": "^7.1.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "dev": true - }, - "browserslist": { - "version": "4.23.2", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001640", - "electron-to-chromium": "^1.4.820", - "node-releases": "^2.0.14", - "update-browserslist-db": "^1.1.0" - } - }, - "buffer": { - "version": "6.0.3", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "buffer-from": { - "version": "1.1.2", - "dev": true - }, - "bufferutil": { - "version": "4.0.6", - "dev": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "bytes": { - "version": "3.1.2", - "dev": true - }, - "call-bind": { - "version": "1.0.7", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", ->>>>>>> master - "dev": true, - "requires": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" - } - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - }, - "camelcase": { - "version": "6.3.0", - "dev": true - }, - "caniuse-lite": { - "version": "1.0.30001642", - "dev": true - }, - "canonicalize": { - "version": "1.0.8" - }, - "chai": { -<<<<<<< HEAD - "version": "4.3.6", -======= - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", - "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", ->>>>>>> master - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.3", - "deep-eql": "^4.1.3", - "get-func-name": "^2.0.2", - "loupe": "^2.3.6", - "pathval": "^1.1.1", - "type-detect": "^4.1.0" - }, - "dependencies": { - "type-detect": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", - "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", - "dev": true - } - } - }, - "chai-as-promised": { -<<<<<<< HEAD - "version": "7.1.1", -======= - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.2.tgz", - "integrity": "sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw==", ->>>>>>> master - "dev": true, - "requires": { - "check-error": "^1.0.2" - } - }, - "chalk": { - "version": "2.4.2", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "check-error": { -<<<<<<< HEAD - "version": "1.0.2", - "dev": true -======= - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", - "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", - "dev": true, - "requires": { - "get-func-name": "^2.0.2" - } ->>>>>>> master - }, - "chokidar": { - "version": "3.5.3", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.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" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, - "chrome-trace-event": { - "version": "1.0.3", - "dev": true - }, - "cliui": { - "version": "7.0.4", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "clone-deep": { - "version": "4.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - } - }, - "color-convert": { - "version": "1.9.3", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "dev": true - }, - "colorette": { - "version": "2.0.19", - "dev": true - }, - "commander": { - "version": "2.20.3", - "dev": true - }, -<<<<<<< HEAD - "commondir": { - "version": "1.0.1", -======= - "common-path-prefix": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", - "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", ->>>>>>> master - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "dev": true - }, - "content-disposition": { - "version": "0.5.4", - "dev": true, - "requires": { - "safe-buffer": "5.2.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.1", - "dev": true - } - } - }, - "content-type": { -<<<<<<< HEAD - "version": "1.0.4", - "dev": true - }, - "convert-source-map": { - "version": "1.8.0", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "cookie": { - "version": "0.5.0", -======= - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "dev": true - }, - "convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true - }, - "cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", ->>>>>>> master - "dev": true - }, - "cookie-signature": { - "version": "1.0.6", - "dev": true - }, - "copy-anything": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", - "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", - "dev": true, - "requires": { - "is-what": "^4.1.8" - } - }, - "core-js": { - "version": "2.6.12", - "dev": true - }, - "core-js-compat": { -<<<<<<< HEAD - "version": "3.25.3", -======= - "version": "3.37.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.37.1.tgz", - "integrity": "sha512-9TNiImhKvQqSUkOvk/mMRZzOANTiEVC7WaBNhHcKM7x+/5E1l5NvsysR19zuDQScE8k+kfQXWRN3AtS/eOSHpg==", ->>>>>>> master - "dev": true, - "requires": { - "browserslist": "^4.23.0" - } - }, - "core-util-is": { - "version": "1.0.3", - "dev": true - }, - "create-require": { - "version": "1.1.1", - "dev": true - }, - "cross-fetch": { - "version": "3.1.8", - "requires": { - "node-fetch": "^2.6.12" - } - }, - "cross-spawn": { - "version": "7.0.3", - "dev": true, - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "crypto-js": { - "version": "4.2.0" - }, - "csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true - }, - "d": { - "version": "1.0.1", - "dev": true, - "requires": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, - "debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "4.0.0", - "dev": true - }, - "deep-eql": { -<<<<<<< HEAD - "version": "3.0.1", -======= - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", - "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", ->>>>>>> master - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "define-data-property": { -<<<<<<< HEAD - "version": "1.1.4", - "dev": true, - "requires": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - } - }, - "define-properties": { - "version": "1.1.4", -======= - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", ->>>>>>> master - "dev": true, - "requires": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - } - }, - "depd": { - "version": "2.0.0", - "dev": true - }, - "dequal": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", - "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", - "dev": true - }, - "destroy": { - "version": "1.2.0", - "dev": true - }, - "diff": { - "version": "4.0.2", - "dev": true - }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, - "disparity": { - "version": "3.2.0", - "dev": true, - "requires": { - "ansi-styles": "^4.2.1", - "diff": "^4.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - } - } - }, - "doctrine": { - "version": "3.0.0", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "ee-first": { - "version": "1.1.1", - "dev": true - }, - "electron-to-chromium": { - "version": "1.4.829", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "dev": true - }, - "emojis-list": { - "version": "3.0.0", - "dev": true - }, - "encodeurl": { - "version": "1.0.2", - "dev": true - }, - "enhanced-resolve": { -<<<<<<< HEAD - "version": "4.5.0", -======= - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", - "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", ->>>>>>> master - "dev": true, - "requires": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - } - }, - "entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true - }, - "envinfo": { - "version": "7.13.0", - "dev": true - }, - "errno": { - "version": "0.1.8", - "dev": true, - "requires": { - "prr": "~1.0.1" - } - }, - "es-define-property": { - "version": "1.0.0", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", ->>>>>>> master - "dev": true, - "requires": { - "get-intrinsic": "^1.2.4" - } - }, - "es-errors": { - "version": "1.3.0", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", ->>>>>>> master - "dev": true - }, - "es-module-lexer": { - "version": "1.5.4", - "dev": true - }, - "es5-ext": { -<<<<<<< HEAD - "version": "0.10.62", -======= - "version": "0.10.64", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.64.tgz", - "integrity": "sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==", ->>>>>>> master - "dev": true, - "requires": { - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.3", - "esniff": "^2.0.1", - "next-tick": "^1.1.0" - } - }, - "es6-iterator": { - "version": "2.0.3", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "es6-symbol": { - "version": "3.1.3", - "dev": true, - "requires": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", - "dev": true, - "requires": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" - } - }, - "escalade": { - "version": "3.1.2", - "dev": true - }, - "escape-html": { - "version": "1.0.3", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "dev": true - }, - "esformatter": { - "version": "0.11.3", - "dev": true, - "requires": { - "acorn-to-esprima": "^2.0.6", - "babel-traverse": "^6.4.5", - "debug": "^4.1.1", - "disparity": "^3.0.0", - "esformatter-parser": "^1.0.0", - "glob": "^7.1.6", - "minimatch": "^3.0.2", - "minimist": "^1.2.5", - "mout": "^1.2.2", - "npm-run": "^5.0.1", - "resolve": "^1.15.1", - "rocambole": ">=0.7 <2.0", - "rocambole-indent": "^2.0.4", - "rocambole-linebreak": "^1.0.2", - "rocambole-node": "~1.0", - "rocambole-token": "^1.1.2", - "rocambole-whitespace": "^1.0.0", - "stdin": "*", - "strip-json-comments": "^3.0.1", - "supports-color": "^7.1.0", - "user-home": "^2.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "esformatter-parser": { - "version": "1.0.0", - "dev": true, - "requires": { - "acorn-to-esprima": "^2.0.8", - "babel-traverse": "^6.9.0", - "babylon": "^6.8.0", - "rocambole": "^0.7.0" - } - }, - "eslint": { - "version": "8.57.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", - "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", - "dev": true, - "requires": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.4", - "@eslint/js": "8.57.0", - "@humanwhocodes/config-array": "^0.11.14", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "@ungap/structured-clone": "^1.2.0", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "dev": true - }, - "eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - } - }, - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - }, - "globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "eslint-scope": { - "version": "5.1.1", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true - }, - "esm": { - "version": "3.2.25" - }, - "esniff": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz", - "integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==", - "dev": true, - "requires": { - "d": "^1.0.1", - "es5-ext": "^0.10.62", - "event-emitter": "^0.3.5", - "type": "^2.7.2" - }, - "dependencies": { - "type": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/type/-/type-2.7.3.tgz", - "integrity": "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==", - "dev": true - } - } - }, - "espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", - "dev": true, - "requires": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - } - }, - "esprima": { - "version": "2.7.3", - "dev": true - }, - "esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0", - "dev": true - }, - "estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - }, - "esutils": { - "version": "2.0.3", - "dev": true - }, - "etag": { - "version": "1.8.1", - "dev": true - }, -<<<<<<< HEAD - "event-target-shim": { - "version": "5.0.1" -======= - "event-emitter": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", - "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "~0.10.14" - } ->>>>>>> master - }, - "events": { - "version": "3.3.0" - }, - "express": { -<<<<<<< HEAD - "version": "4.18.1", -======= - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", ->>>>>>> master - "dev": true, - "requires": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.2", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.6.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - }, - "path-to-regexp": { - "version": "0.1.7", - "dev": true - }, - "safe-buffer": { - "version": "5.2.1", - "dev": true - } - } - }, - "ext": { - "version": "1.7.0", - "dev": true, - "requires": { - "type": "^2.7.2" - }, - "dependencies": { - "type": { - "version": "2.7.2", - "dev": true - } - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "dev": true - }, - "fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "dependencies": { - "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, - "requires": { - "is-glob": "^4.0.1" - } - } - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "dev": true - }, - "fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "fast-uri": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", - "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", - "dev": true - }, - "fastest-levenshtein": { - "version": "1.0.16", - "dev": true - }, - "fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "requires": { - "reusify": "^1.0.4" - } - }, - "fetch-mock": { -<<<<<<< HEAD - "version": "9.11.0", -======= - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/fetch-mock/-/fetch-mock-10.1.1.tgz", - "integrity": "sha512-R6MwxuGwlUe0K6GzdLY1Wa9voX/GbUBDZjNHBsvlBhrpXurCYpQN4EW0iFCmtWddDTuS0ubR93OtFSgy9E/L2A==", ->>>>>>> master - "dev": true, - "requires": { - "debug": "^4.1.1", - "dequal": "^2.0.3", - "globrex": "^0.1.2", - "is-subset": "^0.1.1", -<<<<<<< HEAD - "lodash.isequal": "^4.5.0", - "path-to-regexp": "^2.2.1", - "querystring": "^0.2.0", - "whatwg-url": "^6.5.0" - }, - "dependencies": { - "core-js": { - "version": "3.25.3", - "dev": true - } -======= - "regexparam": "^3.0.0" ->>>>>>> master - } - }, - "file-entry-cache": { - "version": "6.0.1", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "fill-range": { -<<<<<<< HEAD - "version": "7.0.1", -======= - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", ->>>>>>> master - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "finalhandler": { - "version": "1.2.0", - "dev": true, - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "find-cache-dir": { -<<<<<<< HEAD - "version": "3.3.2", -======= - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", - "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", ->>>>>>> master - "dev": true, - "requires": { - "common-path-prefix": "^3.0.0", - "pkg-dir": "^7.0.0" - }, - "dependencies": { - "find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "requires": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - } - }, - "locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, - "requires": { - "p-locate": "^6.0.0" - } - }, - "p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "requires": { - "yocto-queue": "^1.0.0" - } - }, - "p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "requires": { - "p-limit": "^4.0.0" - } - }, - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true - }, - "pkg-dir": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", - "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", - "dev": true, - "requires": { - "find-up": "^6.3.0" - } - }, - "yocto-queue": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", - "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", - "dev": true - } - } - }, - "find-up": { - "version": "5.0.0", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "dev": true - }, - "flat-cache": { - "version": "3.0.4", - "dev": true, - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - } - }, - "flatted": { - "version": "3.2.7", - "dev": true - }, - "focus-trap": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz", - "integrity": "sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==", - "dev": true, - "requires": { - "tabbable": "^6.2.0" - } - }, - "foreachasync": { - "version": "3.0.0", - "dev": true - }, - "forwarded": { - "version": "0.2.0", - "dev": true - }, - "fresh": { - "version": "0.5.2", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "dev": true - }, - "fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "optional": true - }, - "function-bind": { - "version": "1.1.2", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", ->>>>>>> master - "dev": true - }, - "gensync": { - "version": "1.0.0-beta.2", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "dev": true - }, - "get-intrinsic": { - "version": "1.2.4", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", ->>>>>>> master - "dev": true, - "requires": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" - } - }, - "glob": { - "version": "7.2.3", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "6.0.2", - "dev": true, - "requires": { - "is-glob": "^4.0.3" - } - }, - "glob-to-regexp": { - "version": "0.4.1", - "dev": true - }, - "globals": { - "version": "11.12.0", - "dev": true - }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, -<<<<<<< HEAD - "gopd": { - "version": "1.0.1", -======= - "globrex": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", - "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", - "dev": true - }, - "gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", ->>>>>>> master - "dev": true, - "requires": { - "get-intrinsic": "^1.1.3" - } - }, - "graceful-fs": { - "version": "4.2.11", - "dev": true - }, - "graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true - }, - "has": { - "version": "1.0.3", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - } - } - }, - "has-flag": { - "version": "3.0.0", - "dev": true - }, - "has-property-descriptors": { - "version": "1.0.2", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", ->>>>>>> master - "dev": true, - "requires": { - "es-define-property": "^1.0.0" - } - }, - "has-proto": { - "version": "1.0.3", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", ->>>>>>> master - "dev": true - }, - "has-symbols": { - "version": "1.0.3", - "dev": true - }, - "hasown": { - "version": "2.0.2", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", ->>>>>>> master - "dev": true, - "requires": { - "function-bind": "^1.1.2" - } - }, - "he": { - "version": "1.2.0", - "dev": true - }, - "hookable": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz", - "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==", - "dev": true - }, - "http-errors": { - "version": "2.0.0", - "dev": true, - "requires": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - } - }, - "http-link-header": { - "version": "1.1.1" - }, - "iconv-lite": { - "version": "0.4.24", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.2.1" - }, - "ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "import-local": { - "version": "3.1.0", - "dev": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "dev": true - }, - "interpret": { - "version": "3.1.1", - "dev": true - }, - "invariant": { - "version": "2.2.4", - "dev": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, - "ipaddr.js": { - "version": "1.9.1", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-core-module": { - "version": "2.10.0", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-extglob": { - "version": "2.1.1", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "dev": true - }, - "is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "dev": true - }, - "is-plain-object": { - "version": "2.0.4", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-subset": { - "version": "0.1.1", - "dev": true - }, - "is-typedarray": { - "version": "1.0.0", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "dev": true - }, - "is-what": { - "version": "4.1.16", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz", - "integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "dev": true - }, - "jaribu": { - "version": "2.2.3", - "dev": true, - "requires": { - "amdefine": "^1.0.1", - "bluebird": "^3.5.3", - "body-parser": "^1.18.3", - "express": "^4.16.4", - "node-fetch": "^2.6.1", - "requirejs": "^2.3.6", - "walk": "^2.3.14", - "websocket": "^1.0.28", - "whatwg-fetch": "^3.5.0" - } - }, - "jest-worker": { - "version": "27.5.1", - "dev": true, - "requires": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jose": { - "version": "4.15.4" - }, - "js-tokens": { - "version": "4.0.0", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "jsesc": { - "version": "2.5.2", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "dev": true - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "dev": true - }, - "json5": { - "version": "2.2.1", - "dev": true - }, - "jsonld-context-parser": { - "version": "2.4.0", - "requires": { - "@types/http-link-header": "^1.0.1", - "@types/node": "^18.0.0", - "cross-fetch": "^3.0.6", - "http-link-header": "^1.0.2", - "relative-to-absolute-iri": "^1.0.5" - }, - "dependencies": { - "@types/node": { - "version": "18.19.3", - "requires": { - "undici-types": "~5.26.4" - } - } - } - }, - "jsonld-streaming-parser": { - "version": "3.3.0", - "requires": { - "@bergos/jsonparse": "^1.4.0", - "@rdfjs/types": "*", - "@types/http-link-header": "^1.0.1", - "@types/readable-stream": "^2.3.13", - "buffer": "^6.0.3", - "canonicalize": "^1.0.1", - "http-link-header": "^1.0.2", - "jsonld-context-parser": "^2.4.0", - "rdf-data-factory": "^1.1.0", - "readable-stream": "^4.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "4.5.1", - "requires": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - } - }, - "safe-buffer": { - "version": "5.2.1" - }, - "string_decoder": { - "version": "1.3.0", - "requires": { - "safe-buffer": "~5.2.0" - } - } - } - }, - "just-extend": { -<<<<<<< HEAD - "version": "4.2.1", -======= - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", - "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", ->>>>>>> master - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "dev": true - }, - "levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "linkify-it": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", - "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", - "dev": true, - "requires": { - "uc.micro": "^2.0.0" - } - }, - "loader-runner": { - "version": "4.3.0", - "dev": true - }, - "loader-utils": { - "version": "2.0.2", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "locate-path": { - "version": "6.0.0", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "lodash": { - "version": "4.17.21", - "dev": true - }, - "lodash.debounce": { - "version": "4.0.8", - "dev": true - }, - "lodash.get": { - "version": "4.4.2", - "dev": true - }, -<<<<<<< HEAD - "lodash.isequal": { - "version": "4.5.0", - "dev": true - }, -======= ->>>>>>> master - "lodash.merge": { - "version": "4.6.2", - "dev": true - }, -<<<<<<< HEAD - "lodash.sortby": { - "version": "4.7.0", - "dev": true - }, -======= ->>>>>>> master - "log-symbols": { - "version": "4.1.0", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "loose-envify": { - "version": "1.4.0", - "dev": true, - "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" - } - }, - "loupe": { -<<<<<<< HEAD - "version": "2.3.4", -======= - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", - "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", ->>>>>>> master - "dev": true, - "requires": { - "get-func-name": "^2.0.1" - } - }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, - "lunr": { - "version": "2.3.9", - "dev": true - }, - "magic-string": { - "version": "0.30.11", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.11.tgz", - "integrity": "sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==", - "dev": true, - "requires": { - "@jridgewell/sourcemap-codec": "^1.5.0" - } - }, -<<<<<<< HEAD - "make-dir": { - "version": "3.1.0", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, -======= ->>>>>>> master - "make-error": { - "version": "1.3.6", - "dev": true - }, - "mark.js": { - "version": "8.11.1", - "resolved": "https://registry.npmjs.org/mark.js/-/mark.js-8.11.1.tgz", - "integrity": "sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==", - "dev": true - }, - "markdown-it": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", - "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", - "dev": true, - "requires": { - "argparse": "^2.0.1", - "entities": "^4.4.0", - "linkify-it": "^5.0.0", - "mdurl": "^2.0.0", - "punycode.js": "^2.3.1", - "uc.micro": "^2.1.0" - } - }, - "mdurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", - "dev": true - }, - "media-typer": { - "version": "0.3.0", - "dev": true - }, - "memory-fs": { - "version": "0.5.0", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "merge-descriptors": { - "version": "1.0.1", - "dev": true - }, - "merge-stream": { - "version": "2.0.0", - "dev": true - }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, - "methods": { - "version": "1.1.2", - "dev": true - }, - "micromatch": { - "version": "4.0.5", - "dev": true, - "requires": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - } - }, - "mime": { - "version": "1.6.0", - "dev": true - }, - "mime-db": { - "version": "1.52.0", - "dev": true - }, - "mime-types": { - "version": "2.1.35", - "dev": true, - "requires": { - "mime-db": "1.52.0" - } - }, - "minimatch": { - "version": "3.1.2", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.6", - "dev": true - }, - "minisearch": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-7.1.0.tgz", - "integrity": "sha512-tv7c/uefWdEhcu6hvrfTihflgeEi2tN6VV7HJnCjK6VxM75QQJh4t9FwJCsA2EsRS8LCnu3W87CuGPWMocOLCA==", - "dev": true - }, - "mitt": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", - "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", - "dev": true - }, - "mocha": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.3.tgz", - "integrity": "sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A==", - "dev": true, - "requires": { - "ansi-colors": "^4.1.3", - "browser-stdout": "^1.3.1", - "chokidar": "^3.5.3", - "debug": "^4.3.5", - "diff": "^5.2.0", - "escape-string-regexp": "^4.0.0", - "find-up": "^5.0.0", - "glob": "^8.1.0", - "he": "^1.2.0", - "js-yaml": "^4.1.0", - "log-symbols": "^4.1.0", - "minimatch": "^5.1.6", - "ms": "^2.1.3", - "serialize-javascript": "^6.0.2", - "strip-json-comments": "^3.1.1", - "supports-color": "^8.1.1", - "workerpool": "^6.5.1", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9", - "yargs-unparser": "^2.0.0" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "diff": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "dev": true - }, - "glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - } - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "ms": { - "version": "2.1.3", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "mout": { - "version": "1.2.4", - "dev": true - }, - "ms": { - "version": "2.1.2", - "dev": true - }, - "n3": { - "version": "1.17.2", - "requires": { - "queue-microtask": "^1.1.2", - "readable-stream": "^4.0.0" - }, - "dependencies": { - "readable-stream": { - "version": "4.5.1", - "requires": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - } - }, - "safe-buffer": { - "version": "5.2.1" - }, - "string_decoder": { - "version": "1.3.0", - "requires": { - "safe-buffer": "~5.2.0" - } - } - } - }, - "nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", - "dev": true - }, - "natural-compare": { - "version": "1.4.0", - "dev": true - }, - "negotiator": { - "version": "0.6.3", - "dev": true - }, - "neo-async": { - "version": "2.6.2", - "dev": true - }, - "next-tick": { - "version": "1.1.0", - "dev": true - }, - "nise": { -<<<<<<< HEAD - "version": "5.1.1", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.8.3", - "@sinonjs/fake-timers": ">=5", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "path-to-regexp": "^1.7.0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "dev": true - }, - "path-to-regexp": { - "version": "1.8.0", - "dev": true, - "requires": { - "isarray": "0.0.1" - } - } -======= - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/nise/-/nise-6.0.0.tgz", - "integrity": "sha512-K8ePqo9BFvN31HXwEtTNGzgrPpmvgciDsFz8aztFjt4LqKO/JeFD8tBOeuDiCMXrIl/m1YvfH8auSpxfaD09wg==", - "dev": true, - "requires": { - "@sinonjs/commons": "^3.0.0", - "@sinonjs/fake-timers": "^11.2.2", - "@sinonjs/text-encoding": "^0.7.2", - "just-extend": "^6.2.0", - "path-to-regexp": "^6.2.1" ->>>>>>> master - } - }, - "node-fetch": { - "version": "2.7.0", - "requires": { - "whatwg-url": "^5.0.0" - }, - "dependencies": { - "tr46": { - "version": "0.0.3" - }, - "webidl-conversions": { - "version": "3.0.1" - }, - "whatwg-url": { - "version": "5.0.0", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - } - } - }, - "node-gyp-build": { - "version": "4.5.0", - "dev": true - }, - "node-releases": { - "version": "2.0.17", - "dev": true - }, - "normalize-path": { - "version": "3.0.0", - "dev": true - }, - "npm-path": { - "version": "2.0.4", - "dev": true, - "requires": { - "which": "^1.2.10" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "npm-run": { - "version": "5.0.1", - "dev": true, - "requires": { - "minimist": "^1.2.0", - "npm-path": "^2.0.4", - "npm-which": "^3.0.1", - "serializerr": "^1.0.3" - } - }, - "npm-which": { - "version": "3.0.1", - "dev": true, - "requires": { - "commander": "^2.9.0", - "npm-path": "^2.0.2", - "which": "^1.2.10" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "object-inspect": { -<<<<<<< HEAD - "version": "1.12.2", - "dev": true - }, - "object-keys": { - "version": "1.1.1", - "dev": true - }, - "object.assign": { - "version": "4.1.4", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "has-symbols": "^1.0.3", - "object-keys": "^1.1.1" - } - }, -======= - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", - "dev": true - }, ->>>>>>> master - "on-finished": { - "version": "2.4.1", - "dev": true, - "requires": { - "ee-first": "1.1.1" - } - }, - "once": { - "version": "1.4.0", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" - } - }, - "os-homedir": { - "version": "1.0.2", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "p-try": { - "version": "2.2.0", - "dev": true - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parseurl": { - "version": "1.3.3", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "dev": true - }, - "path-key": { - "version": "3.1.1", - "dev": true - }, - "path-parse": { - "version": "1.0.7", - "dev": true - }, - "path-to-regexp": { -<<<<<<< HEAD - "version": "2.4.0", -======= - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", ->>>>>>> master - "dev": true - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "pathval": { - "version": "1.1.1", - "dev": true - }, - "perfect-debounce": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", - "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==", - "dev": true - }, - "picocolors": { - "version": "1.0.1", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "dev": true - }, - "pkg-dir": { - "version": "4.2.0", - "dev": true, - "requires": { - "find-up": "^4.0.0" - }, - "dependencies": { - "find-up": { - "version": "4.1.0", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "locate-path": { - "version": "5.0.0", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.3.0", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - } - } - }, - "postcss": { - "version": "8.4.41", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.41.tgz", - "integrity": "sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==", - "dev": true, - "requires": { - "nanoid": "^3.3.7", - "picocolors": "^1.0.1", - "source-map-js": "^1.2.0" - } - }, - "preact": { - "version": "10.23.2", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.23.2.tgz", - "integrity": "sha512-kKYfePf9rzKnxOAKDpsWhg/ysrHPqT+yQ7UW4JjdnqjFIeNUnNcEJvhuA8fDenxAGWzUqtd51DfVg7xp/8T9NA==", - "dev": true - }, - "prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true - }, - "process": { - "version": "0.11.10" - }, - "process-nextick-args": { - "version": "2.0.1", - "dev": true - }, - "protochain": { - "version": "1.0.5", - "dev": true - }, - "proxy-addr": { - "version": "2.0.7", - "dev": true, - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, - "prr": { - "version": "1.0.1", - "dev": true - }, - "punycode": { - "version": "2.1.1", - "dev": true - }, - "punycode.js": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", - "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", - "dev": true - }, - "qs": { -<<<<<<< HEAD - "version": "6.10.3", -======= - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", ->>>>>>> master - "dev": true, - "requires": { - "side-channel": "^1.0.4" - } - }, -<<<<<<< HEAD - "querystring": { - "version": "0.2.1", - "dev": true - }, -======= ->>>>>>> master - "queue-microtask": { - "version": "1.2.3" - }, - "randombytes": { - "version": "2.1.0", - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "range-parser": { - "version": "1.2.1", - "dev": true - }, - "raw-body": { -<<<<<<< HEAD - "version": "2.5.1", -======= - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", ->>>>>>> master - "dev": true, - "requires": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "rdf-data-factory": { - "version": "1.1.2", - "requires": { - "@rdfjs/types": "*" - } - }, - "rdf-js": { - "version": "4.0.2", - "requires": { - "@rdfjs/types": "*" - } - }, - "readable-stream": { -<<<<<<< HEAD - "version": "2.3.7", -======= - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", ->>>>>>> master - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "3.6.0", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "rechoir": { - "version": "0.8.0", - "dev": true, - "requires": { - "resolve": "^1.20.0" - } - }, - "regenerate": { - "version": "1.4.2", - "dev": true - }, - "regenerate-unicode-properties": { -<<<<<<< HEAD - "version": "10.1.0", -======= - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.1.tgz", - "integrity": "sha512-X007RyZLsCJVVrjgEFVpLUTZwyOZk3oiL75ZcuYjlIWd6rNJtOjkBwQc5AsRrpbKVkxN6sklw/k/9m2jJYOf8Q==", ->>>>>>> master - "dev": true, - "requires": { - "regenerate": "^1.4.2" - } - }, - "regenerator-runtime": { - "version": "0.11.1", - "dev": true - }, - "regenerator-transform": { -<<<<<<< HEAD - "version": "0.15.0", -======= - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", - "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/runtime": "^7.8.4" - } - }, - "regexparam": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/regexparam/-/regexparam-3.0.0.tgz", - "integrity": "sha512-RSYAtP31mvYLkAHrOlh25pCNQ5hWnT106VukGaaFfuJrZFkGRX5GhUAdPqpSDXxOhA2c4akmRuplv1mRqnBn6Q==", - "dev": true - }, - "regexpu-core": { -<<<<<<< HEAD - "version": "5.2.1", -======= - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.3.2.tgz", - "integrity": "sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ==", ->>>>>>> master - "dev": true, - "requires": { - "@babel/regjsgen": "^0.8.0", - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^10.1.0", - "regjsparser": "^0.9.1", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.1.0" - } - }, -<<<<<<< HEAD - "regjsgen": { - "version": "0.7.1", - "dev": true - }, -======= ->>>>>>> master - "regjsparser": { - "version": "0.9.1", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "dev": true - } - } - }, - "relative-to-absolute-iri": { - "version": "1.0.7" - }, - "repeat-string": { - "version": "1.6.1", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "dev": true - }, - "require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true - }, - "requirejs": { -<<<<<<< HEAD - "version": "2.3.6", -======= - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.7.tgz", - "integrity": "sha512-DouTG8T1WanGok6Qjg2SXuCMzszOo0eHeH9hDZ5Y4x8Je+9JB38HdTLT4/VA8OaUhBa0JPVHJ0pyBkM1z+pDsw==", ->>>>>>> master - "dev": true - }, - "resolve": { - "version": "1.22.1", - "dev": true, - "requires": { - "is-core-module": "^2.9.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "resolve-cwd": { - "version": "3.0.0", - "dev": true, - "requires": { - "resolve-from": "^5.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "5.0.0", - "dev": true - } - } - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true - }, - "rfdc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", - "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "rocambole": { - "version": "0.7.0", - "dev": true, - "requires": { - "esprima": "^2.1" - } - }, - "rocambole-indent": { - "version": "2.0.4", - "dev": true, - "requires": { - "debug": "^2.1.3", - "mout": "^0.11.0", - "rocambole-token": "^1.2.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "mout": { - "version": "0.11.1", - "dev": true - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "rocambole-linebreak": { - "version": "1.0.2", - "dev": true, - "requires": { - "debug": "^2.1.3", - "rocambole-token": "^1.2.1", - "semver": "^4.3.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - }, - "semver": { - "version": "4.3.6", - "dev": true - } - } - }, - "rocambole-node": { - "version": "1.0.0", - "dev": true - }, - "rocambole-token": { - "version": "1.2.1", - "dev": true - }, - "rocambole-whitespace": { - "version": "1.0.0", - "dev": true, - "requires": { - "debug": "^2.1.3", - "repeat-string": "^1.5.0", - "rocambole-token": "^1.2.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "rollup": { - "version": "4.21.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.0.tgz", - "integrity": "sha512-vo+S/lfA2lMS7rZ2Qoubi6I5hwZwzXeUIctILZLbHI+laNtvhhOIon2S1JksA5UEDQ7l3vberd0fxK44lTYjbQ==", - "dev": true, - "requires": { - "@rollup/rollup-android-arm-eabi": "4.21.0", - "@rollup/rollup-android-arm64": "4.21.0", - "@rollup/rollup-darwin-arm64": "4.21.0", - "@rollup/rollup-darwin-x64": "4.21.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.21.0", - "@rollup/rollup-linux-arm-musleabihf": "4.21.0", - "@rollup/rollup-linux-arm64-gnu": "4.21.0", - "@rollup/rollup-linux-arm64-musl": "4.21.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.21.0", - "@rollup/rollup-linux-riscv64-gnu": "4.21.0", - "@rollup/rollup-linux-s390x-gnu": "4.21.0", - "@rollup/rollup-linux-x64-gnu": "4.21.0", - "@rollup/rollup-linux-x64-musl": "4.21.0", - "@rollup/rollup-win32-arm64-msvc": "4.21.0", - "@rollup/rollup-win32-ia32-msvc": "4.21.0", - "@rollup/rollup-win32-x64-msvc": "4.21.0", - "@types/estree": "1.0.5", - "fsevents": "~2.3.2" - } - }, - "run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "requires": { - "queue-microtask": "^1.2.2" - } - }, - "safe-buffer": { - "version": "5.1.2" - }, - "safer-buffer": { - "version": "2.1.2", - "dev": true - }, - "schema-utils": { -<<<<<<< HEAD - "version": "2.7.1", -======= - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", - "integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==", ->>>>>>> master - "dev": true, - "requires": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "dependencies": { - "ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - } - }, - "ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.3" - } - }, - "json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - } - } - }, - "search-insights": { - "version": "2.16.3", - "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.16.3.tgz", - "integrity": "sha512-hSHy/s4Zk2xibhj9XTCACB+1PqS+CaJxepGNBhKc/OsHRpqvHAUAm5+uZ6kJJbGXn0pb3XqekHjg6JAqPExzqg==", - "dev": true, - "peer": true - }, - "semver": { - "version": "6.3.0", - "dev": true - }, - "send": { - "version": "0.18.0", - "dev": true, - "requires": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "ms": { - "version": "2.1.3", - "dev": true - } - } - }, - "serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "serializerr": { - "version": "1.0.3", - "dev": true, - "requires": { - "protochain": "^1.0.5" - } - }, - "serve-static": { - "version": "1.15.0", - "dev": true, - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - } - }, - "set-function-length": { - "version": "1.2.2", -<<<<<<< HEAD -======= - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", ->>>>>>> master - "dev": true, - "requires": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - } - }, - "setprototypeof": { - "version": "1.2.0", - "dev": true - }, - "shallow-clone": { - "version": "3.0.1", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - } - }, - "shebang-command": { - "version": "2.0.0", - "dev": true, - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0", - "dev": true - }, - "shiki": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.14.1.tgz", - "integrity": "sha512-FujAN40NEejeXdzPt+3sZ3F2dx1U24BY2XTY01+MG8mbxCiA2XukXdcbyMyLAHJ/1AUUnQd1tZlvIjefWWEJeA==", - "dev": true, - "requires": { - "@shikijs/core": "1.14.1", - "@types/hast": "^3.0.4" - } - }, - "side-channel": { -<<<<<<< HEAD - "version": "1.0.4", -======= - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", ->>>>>>> master - "dev": true, - "requires": { - "call-bind": "^1.0.7", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" - } - }, - "sinon": { -<<<<<<< HEAD - "version": "14.0.0", -======= - "version": "18.0.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-18.0.0.tgz", - "integrity": "sha512-+dXDXzD1sBO6HlmZDd7mXZCR/y5ECiEiGCBSGuFD/kZ0bDTofPYc6JaeGmPSF+1j1MejGUWkORbYOLDyvqCWpA==", ->>>>>>> master - "dev": true, - "requires": { - "@sinonjs/commons": "^3.0.1", - "@sinonjs/fake-timers": "^11.2.2", - "@sinonjs/samsam": "^8.0.0", - "diff": "^5.2.0", - "nise": "^6.0.0", - "supports-color": "^7" - }, - "dependencies": { - "diff": { -<<<<<<< HEAD - "version": "5.1.0", -======= - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", ->>>>>>> master - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "dev": true - }, - "source-map-js": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", - "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", - "dev": true - }, - "source-map-support": { - "version": "0.5.21", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "speakingurl": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/speakingurl/-/speakingurl-14.0.1.tgz", - "integrity": "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==", - "dev": true - }, - "statuses": { - "version": "2.0.1", - "dev": true - }, - "stdin": { - "version": "0.0.1", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "string-width": { - "version": "4.2.3", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "dev": true - }, - "superjson": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.1.tgz", - "integrity": "sha512-8iGv75BYOa0xRJHK5vRLEjE2H/i4lulTjzpUXic3Eg8akftYjkmQDa8JARQ42rlczXyFR3IeRoeFCc7RxHsYZA==", - "dev": true, - "requires": { - "copy-anything": "^3.0.2" - } - }, - "supports-color": { - "version": "5.5.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "dev": true - }, - "tabbable": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", - "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==", - "dev": true - }, - "tapable": { -<<<<<<< HEAD - "version": "1.1.3", -======= - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", ->>>>>>> master - "dev": true - }, - "terser": { - "version": "5.31.3", - "dev": true, - "requires": { - "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - } - }, - "terser-webpack-plugin": { - "version": "5.3.10", - "dev": true, - "requires": { - "@jridgewell/trace-mapping": "^0.3.20", - "jest-worker": "^27.4.5", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.1", - "terser": "^5.26.0" - }, - "dependencies": { - "schema-utils": { - "version": "3.3.0", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - } - } - }, - "text-table": { - "version": "0.2.0", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "toidentifier": { - "version": "1.0.1", - "dev": true - }, -<<<<<<< HEAD - "tr46": { - "version": "1.0.1", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, -======= ->>>>>>> master - "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==", - "dev": true, - "requires": {} - }, - "ts-loader": { - "version": "8.4.0", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "enhanced-resolve": "^4.0.0", - "loader-utils": "^2.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "enhanced-resolve": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.5.0.tgz", - "integrity": "sha512-Nv9m36S/vxpsI+Hc4/ZGRs0n9mXqSWGGq49zxb/cJfPAQMbUtttJAlNPS4AQzaBdw/pKskw5bMbekT/Y7W/Wlg==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.5.0", - "tapable": "^1.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "lru-cache": { - "version": "6.0.0", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.7", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "tapable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", - "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "dev": true - } - } - }, - "ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "requires": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - } - }, - "tv4": { - "version": "1.3.0" - }, - "type": { - "version": "1.2.0", - "dev": true - }, - "type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-detect": { - "version": "4.0.8", - "dev": true - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, - "type-is": { - "version": "1.6.18", - "dev": true, - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "typedoc": { - "version": "0.26.6", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.6.tgz", - "integrity": "sha512-SfEU3SH3wHNaxhFPjaZE2kNl/NFtLNW5c1oHsg7mti7GjmUj1Roq6osBQeMd+F4kL0BoRBBr8gQAuqBlfFu8LA==", - "dev": true, - "requires": { - "lunr": "^2.3.9", - "markdown-it": "^14.1.0", - "minimatch": "^9.0.5", - "shiki": "^1.9.1", - "yaml": "^2.4.5" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, - "typedoc-plugin-markdown": { -<<<<<<< HEAD - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.2.5.tgz", - "integrity": "sha512-ZWIfc0OqwEtQfuaqbmM1kesMi/Fhc++W+5f3TDEm1Tsi28pHSoZk4WCOm4lNuN30WtEImwAHhhXC4DIWki1DiA==", -======= - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.2.3.tgz", - "integrity": "sha512-esucQj79SFYOv0f5XVha7QWdLUH5C5HRlDf7Z8CXzHedmVPn7jox6Gt7FdoBXN8AFxyHpa3Lbuxu65Dobwt+4Q==", ->>>>>>> master - "dev": true, - "requires": {} - }, - "typedoc-vitepress-theme": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/typedoc-vitepress-theme/-/typedoc-vitepress-theme-1.0.1.tgz", - "integrity": "sha512-pnpgzSQRaR9QLMl3it/tjq7vlV+eeUzKa22w/xF6ZUdAcYdmeag13kuA6EKfU7/kkIkJ/qsu1GPd3OcIC36Hlw==", - "dev": true, - "requires": {} - }, - "typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", - "dev": true - }, - "uc.micro": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", - "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", - "dev": true - }, - "undici": { - "version": "5.28.2", - "requires": { - "@fastify/busboy": "^2.0.0" - } - }, - "undici-types": { - "version": "5.26.5" - }, - "unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "dev": true - }, - "unicode-match-property-ecmascript": { - "version": "2.0.0", - "dev": true, - "requires": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - } - }, - "unicode-match-property-value-ecmascript": { -<<<<<<< HEAD - "version": "2.0.0", -======= - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz", - "integrity": "sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA==", ->>>>>>> master - "dev": true - }, - "unicode-property-aliases-ecmascript": { - "version": "2.1.0", - "dev": true - }, - "unpipe": { - "version": "1.0.0", - "dev": true - }, - "update-browserslist-db": { - "version": "1.1.0", - "dev": true, - "requires": { - "escalade": "^3.1.2", - "picocolors": "^1.0.1" - } - }, - "uri-js": { - "version": "4.4.1", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "user-home": { - "version": "2.0.0", - "dev": true, - "requires": { - "os-homedir": "^1.0.0" - } - }, - "utf-8-validate": { - "version": "5.0.9", - "dev": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "util-deprecate": { - "version": "1.0.2", - "dev": true - }, - "utils-merge": { - "version": "1.0.1", - "dev": true - }, - "uuid": { - "version": "9.0.1" - }, - "v8-compile-cache-lib": { - "version": "3.0.1", - "dev": true - }, - "vary": { - "version": "1.1.2", - "dev": true - }, - "vite": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.2.tgz", - "integrity": "sha512-dDrQTRHp5C1fTFzcSaMxjk6vdpKvT+2/mIdE07Gw2ykehT49O0z/VHS3zZ8iV/Gh8BJJKHWOe5RjaNrW5xf/GA==", - "dev": true, - "requires": { - "esbuild": "^0.21.3", - "fsevents": "~2.3.3", - "postcss": "^8.4.41", - "rollup": "^4.20.0" - } - }, - "vitepress": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/vitepress/-/vitepress-1.3.3.tgz", - "integrity": "sha512-6UzEw/wZ41S/CATby7ea7UlffvRER/uekxgN6hbEvSys9ukmLOKsz87Ehq9yOx1Rwiw+Sj97yjpivP8w1sUmng==", - "dev": true, - "requires": { - "@docsearch/css": "^3.6.1", - "@docsearch/js": "^3.6.1", - "@shikijs/core": "^1.13.0", - "@shikijs/transformers": "^1.13.0", - "@types/markdown-it": "^14.1.2", - "@vitejs/plugin-vue": "^5.1.2", - "@vue/devtools-api": "^7.3.8", - "@vue/shared": "^3.4.38", - "@vueuse/core": "^11.0.0", - "@vueuse/integrations": "^11.0.0", - "focus-trap": "^7.5.4", - "mark.js": "8.11.1", - "minisearch": "^7.1.0", - "shiki": "^1.13.0", - "vite": "^5.4.1", - "vue": "^3.4.38" - } - }, - "vue": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/vue/-/vue-3.4.38.tgz", - "integrity": "sha512-f0ZgN+mZ5KFgVv9wz0f4OgVKukoXtS3nwET4c2vLBGQR50aI8G0cqbFtLlX9Yiyg3LFGBitruPHt2PxwTduJEw==", - "dev": true, - "requires": { - "@vue/compiler-dom": "3.4.38", - "@vue/compiler-sfc": "3.4.38", - "@vue/runtime-dom": "3.4.38", - "@vue/server-renderer": "3.4.38", - "@vue/shared": "3.4.38" - } - }, - "walk": { - "version": "2.3.15", - "dev": true, - "requires": { - "foreachasync": "^3.0.0" + "node": ">=10.13.0" } }, - "watchpack": { - "version": "2.4.1", + "node_modules/webpack/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "requires": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "webfinger.js": { - "version": "2.7.1", - "requires": { - "xhr2": "0.2.1" + "node_modules/webpack/node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, + "peerDependencies": { + "ajv": "^6.9.1" } }, -<<<<<<< HEAD - "webidl-conversions": { - "version": "4.0.2", - "dev": true - }, - "webpack": { - "version": "5.93.0", -======= - "webpack": { - "version": "5.93.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.93.0.tgz", - "integrity": "sha512-Y0m5oEY1LRuwly578VqluorkXbvXKh7U3rLoQCEO04M97ScRr44afGVkI0FQFsXzysk5OgFAxjZAb9rsGQVihA==", ->>>>>>> master - "dev": true, - "requires": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.5", - "@webassemblyjs/ast": "^1.12.1", - "@webassemblyjs/wasm-edit": "^1.12.1", - "@webassemblyjs/wasm-parser": "^1.12.1", - "acorn": "^8.7.1", - "acorn-import-attributes": "^1.9.5", - "browserslist": "^4.21.10", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.0", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.11", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.10", - "watchpack": "^2.4.1", - "webpack-sources": "^3.2.3" - }, + "node_modules/webpack/node_modules/enhanced-resolve": { + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", + "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", + "dev": true, "dependencies": { -<<<<<<< HEAD - "enhanced-resolve": { - "version": "5.17.0", - "dev": true, - "requires": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - } - }, -======= ->>>>>>> master - "schema-utils": { - "version": "3.3.0", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } -<<<<<<< HEAD - }, - "tapable": { - "version": "2.2.1", - "dev": true -======= ->>>>>>> master - } + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" } }, - "webpack-cli": { - "version": "5.1.4", + "node_modules/webpack/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/webpack/node_modules/schema-utils": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", + "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", "dev": true, - "requires": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^2.1.1", - "@webpack-cli/info": "^2.0.2", - "@webpack-cli/serve": "^2.0.5", - "colorette": "^2.0.14", - "commander": "^10.0.1", - "cross-spawn": "^7.0.3", - "envinfo": "^7.7.3", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^3.1.1", - "rechoir": "^0.8.0", - "webpack-merge": "^5.7.3" - }, "dependencies": { - "commander": { - "version": "10.0.1", - "dev": true - } + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "webpack-merge": { - "version": "5.8.0", + "node_modules/webpack/node_modules/tapable": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", + "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", "dev": true, - "requires": { - "clone-deep": "^4.0.1", - "wildcard": "^2.0.0" + "engines": { + "node": ">=6" } }, - "webpack-sources": { - "version": "3.2.3", - "dev": true - }, - "websocket": { + "node_modules/websocket": { "version": "1.0.34", "dev": true, - "requires": { + "license": "Apache-2.0", + "dependencies": { "bufferutil": "^4.0.1", "debug": "^2.2.0", "es5-ext": "^0.10.50", @@ -18517,115 +9169,151 @@ "utf-8-validate": "^5.0.2", "yaeti": "^0.0.6" }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/websocket/node_modules/debug": { + "version": "2.6.9", + "dev": true, + "license": "MIT", "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - } + "ms": "2.0.0" } }, - "whatwg-fetch": { - "version": "3.6.2", - "dev": true + "node_modules/websocket/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" }, -<<<<<<< HEAD - "whatwg-url": { - "version": "6.5.0", + "node_modules/whatwg-fetch": { + "version": "3.6.2", "dev": true, - "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } + "license": "MIT" }, -======= ->>>>>>> master - "which": { + "node_modules/which": { "version": "2.0.2", "dev": true, - "requires": { + "license": "ISC", + "dependencies": { "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, - "wildcard": { + "node_modules/wildcard": { "version": "2.0.0", - "dev": true + "dev": true, + "license": "MIT" }, - "word-wrap": { + "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "workerpool": { + "node_modules/workerpool": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", "dev": true }, - "wrap-ansi": { + "node_modules/wrap-ansi": { "version": "7.0.0", "dev": true, - "requires": { + "license": "MIT", + "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - } + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, - "wrappy": { + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/wrappy": { "version": "1.0.2", - "dev": true + "dev": true, + "license": "ISC" }, - "xhr2": { - "version": "0.2.1" + "node_modules/xhr2": { + "version": "0.2.1", + "license": "MIT", + "engines": { + "node": ">= 6" + } }, - "yaeti": { + "node_modules/yaeti": { "version": "0.0.6", - "dev": true + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.32" + } }, - "yallist": { + "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, - "yaml": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", - "integrity": "sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw==", - "dev": true + "node_modules/yaml": { + "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" + }, + "engines": { + "node": ">= 14" + } }, - "yargs": { + "node_modules/yargs": { "version": "16.2.0", "dev": true, - "requires": { + "license": "MIT", + "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", @@ -18634,36 +9322,69 @@ "y18n": "^5.0.5", "yargs-parser": "^20.2.2" }, - "dependencies": { - "y18n": { - "version": "5.0.8", - "dev": true - } + "engines": { + "node": ">=10" } }, - "yargs-parser": { + "node_modules/yargs-parser": { "version": "20.2.9", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true + "dev": true, + "engines": { + "node": ">=10" + } }, - "yargs-unparser": { + "node_modules/yargs-unparser": { "version": "2.0.0", "dev": true, - "requires": { + "license": "MIT", + "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/y18n": { + "version": "5.0.8", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" } }, - "yn": { + "node_modules/yn": { "version": "3.1.1", - "dev": true + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } }, - "yocto-queue": { + "node_modules/yocto-queue": { "version": "0.1.0", - "dev": true + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "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" + } } } } diff --git a/release/remotestorage.js b/release/remotestorage.js index 116c69476..c57446958 100644 --- a/release/remotestorage.js +++ b/release/remotestorage.js @@ -1,67763 +1,3 @@ -<<<<<<< HEAD -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define("RemoteStorage", [], factory); - else if(typeof exports === 'object') - exports["RemoteStorage"] = factory(); - else - root["RemoteStorage"] = factory(); -})(this, function() { -return /******/ (function() { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./node_modules/@bergos/jsonparse/jsonparse.js": -/*!*****************************************************!*\ - !*** ./node_modules/@bergos/jsonparse/jsonparse.js ***! - \*****************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -var { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -// Named constants with unique integer values -var C = {}; -// Tokens -var LEFT_BRACE = C.LEFT_BRACE = 0x1; -var RIGHT_BRACE = C.RIGHT_BRACE = 0x2; -var LEFT_BRACKET = C.LEFT_BRACKET = 0x3; -var RIGHT_BRACKET = C.RIGHT_BRACKET = 0x4; -var COLON = C.COLON = 0x5; -var COMMA = C.COMMA = 0x6; -var TRUE = C.TRUE = 0x7; -var FALSE = C.FALSE = 0x8; -var NULL = C.NULL = 0x9; -var STRING = C.STRING = 0xa; -var NUMBER = C.NUMBER = 0xb; -// Tokenizer States -var START = C.START = 0x11; -var STOP = C.STOP = 0x12; -var TRUE1 = C.TRUE1 = 0x21; -var TRUE2 = C.TRUE2 = 0x22; -var TRUE3 = C.TRUE3 = 0x23; -var FALSE1 = C.FALSE1 = 0x31; -var FALSE2 = C.FALSE2 = 0x32; -var FALSE3 = C.FALSE3 = 0x33; -var FALSE4 = C.FALSE4 = 0x34; -var NULL1 = C.NULL1 = 0x41; -var NULL2 = C.NULL2 = 0x42; -var NULL3 = C.NULL3 = 0x43; -var NUMBER1 = C.NUMBER1 = 0x51; -var NUMBER3 = C.NUMBER3 = 0x53; -var STRING1 = C.STRING1 = 0x61; -var STRING2 = C.STRING2 = 0x62; -var STRING3 = C.STRING3 = 0x63; -var STRING4 = C.STRING4 = 0x64; -var STRING5 = C.STRING5 = 0x65; -var STRING6 = C.STRING6 = 0x66; -// Parser States -var VALUE = C.VALUE = 0x71; -var KEY = C.KEY = 0x72; -// Parser Modes -var OBJECT = C.OBJECT = 0x81; -var ARRAY = C.ARRAY = 0x82; -// Character constants -var BACK_SLASH = "\\".charCodeAt(0); -var FORWARD_SLASH = "\/".charCodeAt(0); -var BACKSPACE = "\b".charCodeAt(0); -var FORM_FEED = "\f".charCodeAt(0); -var NEWLINE = "\n".charCodeAt(0); -var CARRIAGE_RETURN = "\r".charCodeAt(0); -var TAB = "\t".charCodeAt(0); - -var STRING_BUFFER_SIZE = 64 * 1024; - -function alloc(size) { - return Buffer.alloc ? Buffer.alloc(size) : new Buffer(size); -} - -function Parser() { - this.tState = START; - this.value = undefined; - - this.string = undefined; // string data - this.stringBuffer = alloc(STRING_BUFFER_SIZE); - this.stringBufferOffset = 0; - this.unicode = undefined; // unicode escapes - this.highSurrogate = undefined; - - this.key = undefined; - this.mode = undefined; - this.stack = []; - this.state = VALUE; - this.bytes_remaining = 0; // number of bytes remaining in multi byte utf8 char to read after split boundary - this.bytes_in_sequence = 0; // bytes in multi byte utf8 char to read - this.temp_buffs = { "2": alloc(2), "3": alloc(3), "4": alloc(4) }; // for rebuilding chars split before boundary is reached - - // Stream offset - this.offset = -1; -} - -// Slow code to string converter (only used when throwing syntax errors) -Parser.toknam = function (code) { - var keys = Object.keys(C); - for (var i = 0, l = keys.length; i < l; i++) { - var key = keys[i]; - if (C[key] === code) { return key; } - } - return code && ("0x" + code.toString(16)); -}; - -var proto = Parser.prototype; -proto.onError = function (err) { throw err; }; -proto.charError = function (buffer, i) { - this.tState = STOP; - this.onError(new Error("Unexpected " + JSON.stringify(String.fromCharCode(buffer[i])) + " at position " + i + " in state " + Parser.toknam(this.tState))); -}; -proto.appendStringChar = function (char) { - if (this.stringBufferOffset >= STRING_BUFFER_SIZE) { - this.string += this.stringBuffer.toString('utf8'); - this.stringBufferOffset = 0; - } - - this.stringBuffer[this.stringBufferOffset++] = char; -}; -proto.appendStringBuf = function (buf, start, end) { - var size = buf.length; - if (typeof start === 'number') { - if (typeof end === 'number') { - if (end < 0) { - // adding a negative end decreeses the size - size = buf.length - start + end; - } else { - size = end - start; - } - } else { - size = buf.length - start; - } - } - - if (size < 0) { - size = 0; - } - - if (this.stringBufferOffset + size > STRING_BUFFER_SIZE) { - this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset); - this.stringBufferOffset = 0; - } - - buf.copy(this.stringBuffer, this.stringBufferOffset, start, end); - this.stringBufferOffset += size; -}; -proto.write = function (buffer) { - if (typeof buffer === "string") buffer = new Buffer(buffer); - var n; - for (var i = 0, l = buffer.length; i < l; i++) { - if (this.tState === START){ - n = buffer[i]; - this.offset++; - if(n === 0x7b){ this.onToken(LEFT_BRACE, "{"); // { - }else if(n === 0x7d){ this.onToken(RIGHT_BRACE, "}"); // } - }else if(n === 0x5b){ this.onToken(LEFT_BRACKET, "["); // [ - }else if(n === 0x5d){ this.onToken(RIGHT_BRACKET, "]"); // ] - }else if(n === 0x3a){ this.onToken(COLON, ":"); // : - }else if(n === 0x2c){ this.onToken(COMMA, ","); // , - }else if(n === 0x74){ this.tState = TRUE1; // t - }else if(n === 0x66){ this.tState = FALSE1; // f - }else if(n === 0x6e){ this.tState = NULL1; // n - }else if(n === 0x22){ // " - this.string = ""; - this.stringBufferOffset = 0; - this.tState = STRING1; - }else if(n === 0x2d){ this.string = "-"; this.tState = NUMBER1; // - - }else{ - if (n >= 0x30 && n < 0x40) { // 1-9 - this.string = String.fromCharCode(n); this.tState = NUMBER3; - } else if (n === 0x20 || n === 0x09 || n === 0x0a || n === 0x0d) { - // whitespace - } else { - return this.charError(buffer, i); - } - } - }else if (this.tState === STRING1){ // After open quote - n = buffer[i]; // get current byte from buffer - // check for carry over of a multi byte char split between data chunks - // & fill temp buffer it with start of this data chunk up to the boundary limit set in the last iteration - if (this.bytes_remaining > 0) { - for (var j = 0; j < this.bytes_remaining; j++) { - this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence - this.bytes_remaining + j] = buffer[j]; - } - - this.appendStringBuf(this.temp_buffs[this.bytes_in_sequence]); - this.bytes_in_sequence = this.bytes_remaining = 0; - i = i + j - 1; - } else if (this.bytes_remaining === 0 && n >= 128) { // else if no remainder bytes carried over, parse multi byte (>=128) chars one at a time - if (n <= 193 || n > 244) { - return this.onError(new Error("Invalid UTF-8 character at position " + i + " in state " + Parser.toknam(this.tState))); - } - if ((n >= 194) && (n <= 223)) this.bytes_in_sequence = 2; - if ((n >= 224) && (n <= 239)) this.bytes_in_sequence = 3; - if ((n >= 240) && (n <= 244)) this.bytes_in_sequence = 4; - if ((this.bytes_in_sequence + i) > buffer.length) { // if bytes needed to complete char fall outside buffer length, we have a boundary split - for (var k = 0; k <= (buffer.length - 1 - i); k++) { - this.temp_buffs[this.bytes_in_sequence][k] = buffer[i + k]; // fill temp buffer of correct size with bytes available in this chunk - } - this.bytes_remaining = (i + this.bytes_in_sequence) - buffer.length; - i = buffer.length - 1; - } else { - this.appendStringBuf(buffer, i, i + this.bytes_in_sequence); - i = i + this.bytes_in_sequence - 1; - } - } else if (n === 0x22) { - this.tState = START; - this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset); - this.stringBufferOffset = 0; - this.onToken(STRING, this.string); - this.offset += Buffer.byteLength(this.string, 'utf8') + 1; - this.string = undefined; - } - else if (n === 0x5c) { - this.tState = STRING2; - } - else if (n >= 0x20) { this.appendStringChar(n); } - else { - return this.charError(buffer, i); - } - }else if (this.tState === STRING2){ // After backslash - n = buffer[i]; - if(n === 0x22){ this.appendStringChar(n); this.tState = STRING1; - }else if(n === 0x5c){ this.appendStringChar(BACK_SLASH); this.tState = STRING1; - }else if(n === 0x2f){ this.appendStringChar(FORWARD_SLASH); this.tState = STRING1; - }else if(n === 0x62){ this.appendStringChar(BACKSPACE); this.tState = STRING1; - }else if(n === 0x66){ this.appendStringChar(FORM_FEED); this.tState = STRING1; - }else if(n === 0x6e){ this.appendStringChar(NEWLINE); this.tState = STRING1; - }else if(n === 0x72){ this.appendStringChar(CARRIAGE_RETURN); this.tState = STRING1; - }else if(n === 0x74){ this.appendStringChar(TAB); this.tState = STRING1; - }else if(n === 0x75){ this.unicode = ""; this.tState = STRING3; - }else{ - return this.charError(buffer, i); - } - }else if (this.tState === STRING3 || this.tState === STRING4 || this.tState === STRING5 || this.tState === STRING6){ // unicode hex codes - n = buffer[i]; - // 0-9 A-F a-f - if ((n >= 0x30 && n < 0x40) || (n > 0x40 && n <= 0x46) || (n > 0x60 && n <= 0x66)) { - this.unicode += String.fromCharCode(n); - if (this.tState++ === STRING6) { - var intVal = parseInt(this.unicode, 16); - this.unicode = undefined; - if (this.highSurrogate !== undefined && intVal >= 0xDC00 && intVal < (0xDFFF + 1)) { //<56320,57343> - lowSurrogate - this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate, intVal))); - this.highSurrogate = undefined; - } else if (this.highSurrogate === undefined && intVal >= 0xD800 && intVal < (0xDBFF + 1)) { //<55296,56319> - highSurrogate - this.highSurrogate = intVal; - } else { - if (this.highSurrogate !== undefined) { - this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate))); - this.highSurrogate = undefined; - } - this.appendStringBuf(new Buffer(String.fromCharCode(intVal))); - } - this.tState = STRING1; - } - } else { - return this.charError(buffer, i); - } - } else if (this.tState === NUMBER1 || this.tState === NUMBER3) { - n = buffer[i]; - - switch (n) { - case 0x30: // 0 - case 0x31: // 1 - case 0x32: // 2 - case 0x33: // 3 - case 0x34: // 4 - case 0x35: // 5 - case 0x36: // 6 - case 0x37: // 7 - case 0x38: // 8 - case 0x39: // 9 - case 0x2e: // . - case 0x65: // e - case 0x45: // E - case 0x2b: // + - case 0x2d: // - - this.string += String.fromCharCode(n); - this.tState = NUMBER3; - break; - default: - this.tState = START; - var error = this.numberReviver(this.string); - if (error){ - return error; - } - - this.offset += this.string.length - 1; - this.string = undefined; - i--; - break; - } - }else if (this.tState === TRUE1){ // r - if (buffer[i] === 0x72) { this.tState = TRUE2; } - else { return this.charError(buffer, i); } - }else if (this.tState === TRUE2){ // u - if (buffer[i] === 0x75) { this.tState = TRUE3; } - else { return this.charError(buffer, i); } - }else if (this.tState === TRUE3){ // e - if (buffer[i] === 0x65) { this.tState = START; this.onToken(TRUE, true); this.offset+= 3; } - else { return this.charError(buffer, i); } - }else if (this.tState === FALSE1){ // a - if (buffer[i] === 0x61) { this.tState = FALSE2; } - else { return this.charError(buffer, i); } - }else if (this.tState === FALSE2){ // l - if (buffer[i] === 0x6c) { this.tState = FALSE3; } - else { return this.charError(buffer, i); } - }else if (this.tState === FALSE3){ // s - if (buffer[i] === 0x73) { this.tState = FALSE4; } - else { return this.charError(buffer, i); } - }else if (this.tState === FALSE4){ // e - if (buffer[i] === 0x65) { this.tState = START; this.onToken(FALSE, false); this.offset+= 4; } - else { return this.charError(buffer, i); } - }else if (this.tState === NULL1){ // u - if (buffer[i] === 0x75) { this.tState = NULL2; } - else { return this.charError(buffer, i); } - }else if (this.tState === NULL2){ // l - if (buffer[i] === 0x6c) { this.tState = NULL3; } - else { return this.charError(buffer, i); } - }else if (this.tState === NULL3){ // l - if (buffer[i] === 0x6c) { this.tState = START; this.onToken(NULL, null); this.offset += 3; } - else { return this.charError(buffer, i); } - } - } -}; -proto.onToken = function (token, value) { - // Override this to get events -}; - -proto.parseError = function (token, value) { - this.tState = STOP; - this.onError(new Error("Unexpected " + Parser.toknam(token) + (value ? ("(" + JSON.stringify(value) + ")") : "") + " in state " + Parser.toknam(this.state))); -}; -proto.push = function () { - this.stack.push({value: this.value, key: this.key, mode: this.mode}); -}; -proto.pop = function () { - var value = this.value; - var parent = this.stack.pop(); - this.value = parent.value; - this.key = parent.key; - this.mode = parent.mode; - this.emit(value); - if (!this.mode) { this.state = VALUE; } -}; -proto.emit = function (value) { - if (this.mode) { this.state = COMMA; } - this.onValue(value); -}; -proto.onValue = function (value) { - // Override me -}; -proto.onToken = function (token, value) { - if(this.state === VALUE){ - if(token === STRING || token === NUMBER || token === TRUE || token === FALSE || token === NULL){ - if (this.value) { - this.value[this.key] = value; - } - this.emit(value); - }else if(token === LEFT_BRACE){ - this.push(); - if (this.value) { - this.value = this.value[this.key] = {}; - } else { - this.value = {}; - } - this.key = undefined; - this.state = KEY; - this.mode = OBJECT; - }else if(token === LEFT_BRACKET){ - this.push(); - if (this.value) { - this.value = this.value[this.key] = []; - } else { - this.value = []; - } - this.key = 0; - this.mode = ARRAY; - this.state = VALUE; - }else if(token === RIGHT_BRACE){ - if (this.mode === OBJECT) { - this.pop(); - } else { - return this.parseError(token, value); - } - }else if(token === RIGHT_BRACKET){ - if (this.mode === ARRAY) { - this.pop(); - } else { - return this.parseError(token, value); - } - }else{ - return this.parseError(token, value); - } - }else if(this.state === KEY){ - if (token === STRING) { - this.key = value; - this.state = COLON; - } else if (token === RIGHT_BRACE) { - this.pop(); - } else { - return this.parseError(token, value); - } - }else if(this.state === COLON){ - if (token === COLON) { this.state = VALUE; } - else { return this.parseError(token, value); } - }else if(this.state === COMMA){ - if (token === COMMA) { - if (this.mode === ARRAY) { this.key++; this.state = VALUE; } - else if (this.mode === OBJECT) { this.state = KEY; } - - } else if (token === RIGHT_BRACKET && this.mode === ARRAY || token === RIGHT_BRACE && this.mode === OBJECT) { - this.pop(); - } else { - return this.parseError(token, value); - } - }else{ - return this.parseError(token, value); - } -}; - -// Override to implement your own number reviver. -// Any value returned is treated as error and will interrupt parsing. -proto.numberReviver = function (text) { - var result = Number(text); - - if (isNaN(result)) { - return this.charError(buffer, i); - } - - if ((text.match(/[0-9]+/) == text) && (result.toString() != text)) { - // Long string of digits which is an ID string and not valid and/or safe JavaScript integer Number - this.onToken(STRING, text); - } else { - this.onToken(NUMBER, result); - } -} - -Parser.C = C; - -module.exports = Parser; - - -/***/ }), - -/***/ "./node_modules/@inrupt/oidc-client-ext/dist/index.es.js": -/*!***************************************************************!*\ - !*** ./node_modules/@inrupt/oidc-client-ext/dist/index.es.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CordovaIFrameNavigator: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.CordovaIFrameNavigator; }, -/* harmony export */ CordovaPopupNavigator: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.CordovaPopupNavigator; }, -/* harmony export */ InMemoryWebStorage: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.InMemoryWebStorage; }, -/* harmony export */ Log: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.Log; }, -/* harmony export */ OidcClient: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.OidcClient; }, -/* harmony export */ SessionMonitor: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.SessionMonitor; }, -/* harmony export */ User: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.User; }, -/* harmony export */ UserManager: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.UserManager; }, -/* harmony export */ Version: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.Version; }, -/* harmony export */ WebStorageStateStore: function() { return /* reexport safe */ _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.WebStorageStateStore; }, -/* harmony export */ clearOidcPersistentStorage: function() { return /* binding */ clearOidcPersistentStorage; }, -/* harmony export */ getBearerToken: function() { return /* binding */ getBearerToken; }, -/* harmony export */ getDpopToken: function() { return /* binding */ getDpopToken; }, -/* harmony export */ normalizeCallbackUrl: function() { return /* binding */ normalizeCallbackUrl; }, -/* harmony export */ refresh: function() { return /* binding */ refresh; }, -/* harmony export */ registerClient: function() { return /* binding */ registerClient; } -/* harmony export */ }); -/* harmony import */ var _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @inrupt/oidc-client */ "./node_modules/@inrupt/oidc-client/lib/oidc-client.min.js"); -/* harmony import */ var _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @inrupt/solid-client-authn-core */ "./node_modules/@inrupt/solid-client-authn-core/dist/index.mjs"); -/* harmony import */ var _inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.mjs"); - - - - - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function processErrorResponse( -// The type is any here because the object is parsed from a JSON response -// eslint-disable-next-line @typescript-eslint/no-explicit-any -responseBody, options) { - var _a, _b, _c, _d; - // The following errors are defined by the spec, and allow providing some context. - // See https://tools.ietf.org/html/rfc7591#section-3.2.2 for more information - if (responseBody.error === "invalid_redirect_uri") { - throw new Error(`Dynamic client registration failed: the provided redirect uri [${(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()}] is invalid - ${(_b = responseBody.error_description) !== null && _b !== void 0 ? _b : ""}`); - } - if (responseBody.error === "invalid_client_metadata") { - throw new Error(`Dynamic client registration failed: the provided client metadata ${JSON.stringify(options)} is invalid - ${(_c = responseBody.error_description) !== null && _c !== void 0 ? _c : ""}`); - } - // We currently don't support software statements, so no related error should happen. - // If an error outside of the spec happens, no additional context can be provided - throw new Error(`Dynamic client registration failed: ${responseBody.error} - ${(_d = responseBody.error_description) !== null && _d !== void 0 ? _d : ""}`); -} -function validateRegistrationResponse( -// The type is any here because the object is parsed from a JSON response -// eslint-disable-next-line @typescript-eslint/no-explicit-any -responseBody, options) { - if (responseBody.client_id === undefined) { - throw new Error(`Dynamic client registration failed: no client_id has been found on ${JSON.stringify(responseBody)}`); - } - if (options.redirectUrl && - (responseBody.redirect_uris === undefined || - responseBody.redirect_uris[0] !== options.redirectUrl.toString())) { - throw new Error(`Dynamic client registration failed: the returned redirect URIs ${JSON.stringify(responseBody.redirect_uris)} don't match the provided ${JSON.stringify([ - options.redirectUrl.toString(), - ])}`); - } -} -async function registerClient(options, issuerConfig) { - var _a; - if (!issuerConfig.registrationEndpoint) { - throw new Error("Dynamic Registration could not be completed because the issuer has no registration endpoint."); - } - if (!Array.isArray(issuerConfig.idTokenSigningAlgValuesSupported)) { - throw new Error("The OIDC issuer discovery profile is missing the 'id_token_signing_alg_values_supported' value, which is mandatory."); - } - const signingAlg = (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.determineSigningAlg)(issuerConfig.idTokenSigningAlgValuesSupported, _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.PREFERRED_SIGNING_ALG); - const config = { - /* eslint-disable camelcase */ - client_name: options.clientName, - application_type: "web", - redirect_uris: [(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()], - subject_type: "public", - token_endpoint_auth_method: "client_secret_basic", - id_token_signed_response_alg: signingAlg, - grant_types: ["authorization_code", "refresh_token"], - /* eslint-enable camelcase */ - }; - const headers = { - "Content-Type": "application/json", - }; - const registerResponse = await fetch(issuerConfig.registrationEndpoint.toString(), { - method: "POST", - headers, - body: JSON.stringify(config), - }); - if (registerResponse.ok) { - const responseBody = await registerResponse.json(); - validateRegistrationResponse(responseBody, options); - return { - clientId: responseBody.client_id, - clientSecret: responseBody.client_secret, - idTokenSignedResponseAlg: responseBody.id_token_signed_response_alg, - clientType: "dynamic", - }; - } - if (registerResponse.status === 400) { - processErrorResponse(await registerResponse.json(), options); - } - throw new Error(`Dynamic client registration failed: the server returned ${registerResponse.status} ${registerResponse.statusText} - ${await registerResponse.text()}`); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Identifiers in camelcase are mandated by the OAuth spec. -/* eslint-disable camelcase */ -function hasError(value) { - return value.error !== undefined && typeof value.error === "string"; -} -function hasErrorDescription(value) { - return (value.error_description !== undefined && - typeof value.error_description === "string"); -} -function hasErrorUri(value) { - return value.error_uri !== undefined && typeof value.error_uri === "string"; -} -function hasAccessToken(value) { - return (value.access_token !== undefined && typeof value.access_token === "string"); -} -function hasIdToken(value) { - return value.id_token !== undefined && typeof value.id_token === "string"; -} -function hasRefreshToken(value) { - return (value.refresh_token !== undefined && typeof value.refresh_token === "string"); -} -function hasTokenType(value) { - return value.token_type !== undefined && typeof value.token_type === "string"; -} -function hasExpiresIn(value) { - return value.expires_in === undefined || typeof value.expires_in === "number"; -} -function validatePreconditions(issuer, data) { - if (data.grantType && - (!issuer.grantTypesSupported || - !issuer.grantTypesSupported.includes(data.grantType))) { - throw new Error(`The issuer [${issuer.issuer}] does not support the [${data.grantType}] grant`); - } - if (!issuer.tokenEndpoint) { - throw new Error(`This issuer [${issuer.issuer}] does not have a token endpoint`); - } -} -function validateTokenEndpointResponse(tokenResponse, dpop) { - if (hasError(tokenResponse)) { - throw new _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.OidcProviderError(`Token endpoint returned error [${tokenResponse.error}]${hasErrorDescription(tokenResponse) - ? `: ${tokenResponse.error_description}` - : ""}${hasErrorUri(tokenResponse) ? ` (see ${tokenResponse.error_uri})` : ""}`, tokenResponse.error, hasErrorDescription(tokenResponse) - ? tokenResponse.error_description - : undefined); - } - if (!hasAccessToken(tokenResponse)) { - throw new _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.InvalidResponseError(["access_token"]); - } - if (!hasIdToken(tokenResponse)) { - throw new _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.InvalidResponseError(["id_token"]); - } - if (!hasTokenType(tokenResponse)) { - throw new _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.InvalidResponseError(["token_type"]); - } - if (!hasExpiresIn(tokenResponse)) { - throw new _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.InvalidResponseError(["expires_in"]); - } - // TODO: Due to a bug in both the ESS ID broker AND NSS (what were the odds), a DPoP token is returned - // with a token_type 'Bearer'. To work around this, this test is currently disabled. - // https://github.com/solid/oidc-op/issues/26 - // Fixed, but unreleased for the ESS (current version: inrupt-oidc-server-0.5.2) - // if (dpop && tokenResponse.token_type.toLowerCase() !== "dpop") { - // throw new Error( - // `Invalid token endpoint response: requested a [DPoP] token, but got a 'token_type' value of [${tokenResponse.token_type}].` - // ); - // } - if (!dpop && tokenResponse.token_type.toLowerCase() !== "bearer") { - throw new Error(`Invalid token endpoint response: requested a [Bearer] token, but got a 'token_type' value of [${tokenResponse.token_type}].`); - } - return tokenResponse; -} -async function getTokens(issuer, client, data, dpop) { - validatePreconditions(issuer, data); - const headers = { - "content-type": "application/x-www-form-urlencoded", - }; - let dpopKey; - if (dpop) { - dpopKey = await (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.generateDpopKeyPair)(); - headers.DPoP = await (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.createDpopHeader)(issuer.tokenEndpoint, "POST", dpopKey); - } - // TODO: Find out where this is specified. - if (client.clientSecret) { - headers.Authorization = `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`; - } - const requestBody = { - /* eslint-disable camelcase */ - grant_type: data.grantType, - redirect_uri: data.redirectUrl, - code: data.code, - code_verifier: data.codeVerifier, - client_id: client.clientId, - /* eslint-enable camelcase */ - }; - const tokenRequestInit = { - method: "POST", - headers, - body: new URLSearchParams(requestBody).toString(), - }; - const rawTokenResponse = await (0,_inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__.fetch)(issuer.tokenEndpoint, tokenRequestInit); - const jsonTokenResponse = (await rawTokenResponse.json()); - const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop); - const webId = await (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.getWebidFromTokenPayload)(tokenResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId); - return { - accessToken: tokenResponse.access_token, - idToken: tokenResponse.id_token, - refreshToken: hasRefreshToken(tokenResponse) - ? tokenResponse.refresh_token - : undefined, - webId, - dpopKey, - expiresIn: tokenResponse.expires_in, - }; -} -/** - * This function exchanges an authorization code for a bearer token. - * Note that it is based on oidc-client-js, and assumes that the same client has - * been used to issue the initial redirect. - * @param redirectUrl The URL to which the user has been redirected - */ -async function getBearerToken(redirectUrl) { - let signinResponse; - try { - const client = new _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.OidcClient({ - // TODO: We should look at the various interfaces being used for storage, - // i.e. between oidc-client-js (WebStorageStoreState), localStorage - // (which has an interface Storage), and our own proprietary interface - // IStorage - i.e. we should really just be using the browser Web Storage - // API, e.g. "stateStore: window.localStorage,". - // We are instantiating a new instance here, so the only value we need to - // explicitly provide is the response mode (default otherwise will look - // for a hash '#' fragment!). - // eslint-disable-next-line camelcase - response_mode: "query", - // The userinfo endpoint on NSS fails, so disable this for now - // Note that in Solid, information should be retrieved from the - // profile referenced by the WebId. - // TODO: Note that this is heavy-handed, and that this userinfo check - // verifies that the `sub` claim in the id token you get along with the - // access token matches the sub claim associated with the access token at - // the userinfo endpoint. - // That is a useful check, and in the future it should be only disabled - // against NSS, and not in general. - // Issue tracker: https://github.com/solid/node-solid-server/issues/1490 - loadUserInfo: false, - }); - signinResponse = await client.processSigninResponse(redirectUrl); - if (client.settings.metadata === undefined) { - throw new Error("Cannot retrieve issuer metadata from client information in storage."); - } - if (client.settings.metadata.jwks_uri === undefined) { - throw new Error("Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined"); - } - if (client.settings.metadata.issuer === undefined) { - throw new Error("Missing some issuer metadata from client information in storage: 'issuer' is undefined"); - } - if (client.settings.client_id === undefined) { - throw new Error("Missing some client information in storage: 'client_id' is undefined"); - } - const webId = await (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.getWebidFromTokenPayload)(signinResponse.id_token, client.settings.metadata.jwks_uri, client.settings.metadata.issuer, client.settings.client_id); - return { - accessToken: signinResponse.access_token, - idToken: signinResponse.id_token, - webId, - // Although not a field in the TypeScript response interface, the refresh - // token (which can optionally come back with the access token (if, as per - // the OAuth2 spec, we requested one using the scope of 'offline_access') - // will be included in the signin response object. - // eslint-disable-next-line camelcase - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - refreshToken: signinResponse.refresh_token, - }; - } - catch (err) { - throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${redirectUrl}]: ${err}`); - } -} -async function getDpopToken(issuer, client, data) { - return getTokens(issuer, client, data, true); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const isValidUrl = (url) => { - try { - // Here, the URL constructor is just called to parse the given string and - // verify if it is a well-formed IRI. - // eslint-disable-next-line no-new - new URL(url); - return true; - } - catch (_a) { - return false; - } -}; -// Identifiers in snake_case are mandated by the OAuth spec. -/* eslint-disable camelcase */ -async function refresh(refreshToken, issuer, client, dpopKey) { - if (client.clientId === undefined) { - throw new Error("No client ID available when trying to refresh the access token."); - } - const requestBody = { - grant_type: "refresh_token", - refresh_token: refreshToken, - scope: _inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.DEFAULT_SCOPES, - }; - let dpopHeader = {}; - if (dpopKey !== undefined) { - dpopHeader = { - DPoP: await (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.createDpopHeader)(issuer.tokenEndpoint, "POST", dpopKey), - }; - } - let authHeader = {}; - if (client.clientSecret !== undefined) { - authHeader = { - // We assume that client_secret_basic is the client authentication method. - // TODO: Get the authentication method from the IClient configuration object. - Authorization: `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`, - }; - } - else if (isValidUrl(client.clientId)) { - // If the client ID is an URL, and there is no client secret, the client - // has a Solid-OIDC Client Identifier, and it should be present in the - // request body. - requestBody.client_id = client.clientId; - } - const rawResponse = await (0,_inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__.fetch)(issuer.tokenEndpoint, { - method: "POST", - body: new URLSearchParams(requestBody).toString(), - headers: { - ...dpopHeader, - ...authHeader, - "Content-Type": "application/x-www-form-urlencoded", - }, - }); - let response; - try { - response = await rawResponse.json(); - } - catch (e) { - // The response is left out of the error on purpose not to leak any sensitive information. - throw new Error(`The token endpoint of issuer ${issuer.issuer} returned a malformed response.`); - } - const validatedResponse = validateTokenEndpointResponse(response, dpopKey !== undefined); - const webId = await (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.getWebidFromTokenPayload)(validatedResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId); - return { - accessToken: validatedResponse.access_token, - idToken: validatedResponse.id_token, - refreshToken: typeof validatedResponse.refresh_token === "string" - ? validatedResponse.refresh_token - : undefined, - webId, - dpopKey, - expiresIn: validatedResponse.expires_in, - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Removes OIDC-specific query parameters from a given URL (state, code...), and - * sanitizes the URL (e.g. removes the hash fragment). - * @param redirectUrl The URL to clean up. - * @returns A copy of the URL, without OIDC-specific query params. - */ -function normalizeCallbackUrl(redirectUrl) { - const cleanedUrl = (0,_inrupt_solid_client_authn_core__WEBPACK_IMPORTED_MODULE_1__.removeOpenIdParams)(redirectUrl); - // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL - // must not include a hash fragment. - cleanedUrl.hash = ""; - // Do not normalize the trailing slash, and respect the original redirect URL. - if ( - // The trailing slash is present in the original redirect URL - redirectUrl.includes(`${cleanedUrl.origin}/`)) { - return cleanedUrl.href; - } - // Calling cleanedUrl.href appends a trailing slash to the origin, which may - // create a redirect URL mismatch if it wasn't originally present. - return `${cleanedUrl.origin}${cleanedUrl.href.substring( - // Adds 1 to the origin length to remove the trailing slash - cleanedUrl.origin.length + 1)}`; -} -/** - * Clears any OIDC-related data lingering in the local storage. - */ -async function clearOidcPersistentStorage() { - const client = new _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.OidcClient({ - // TODO: We should look at the various interfaces being used for storage, - // i.e. between oidc-client-js (WebStorageStoreState), localStorage - // (which has an interface Storage), and our own proprietary interface - // IStorage - i.e. we should really just be using the browser Web Storage - // API, e.g. "stateStore: window.localStorage,". - // We are instantiating a new instance here, so the only value we need to - // explicitly provide is the response mode (default otherwise will look - // for a hash '#' fragment!). - // eslint-disable-next-line camelcase - response_mode: "query", - }); - await client.clearStaleState(new _inrupt_oidc_client__WEBPACK_IMPORTED_MODULE_0__.WebStorageStateStore({})); - const myStorage = window.localStorage; - const itemsToRemove = []; - for (let i = 0; i <= myStorage.length; i += 1) { - const key = myStorage.key(i); - if (key && - (key.match(/^oidc\..+$/) || - key.match(/^solidClientAuthenticationUser:.+$/))) { - itemsToRemove.push(key); - } - } - itemsToRemove.forEach((key) => myStorage.removeItem(key)); -} - - - - -/***/ }), - -/***/ "./node_modules/@inrupt/oidc-client/lib/oidc-client.min.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@inrupt/oidc-client/lib/oidc-client.min.js ***! - \*****************************************************************/ -/***/ (function(module) { - -!function t(e,r){if(true)module.exports=r();else { var i, n; }}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=22)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r=4){for(var e=arguments.length,r=Array(e),n=0;n=3){for(var e=arguments.length,r=Array(e),n=0;n=2){for(var e=arguments.length,r=Array(e),n=0;n=1){for(var e=arguments.length,r=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(s(this,t),!e)throw i.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=e,this._jsonService=new r(["application/jwk-set+json"])}return t.prototype.resetSigningKeys=function t(){this._settings=this._settings||{},this._settings.signingKeys=void 0},t.prototype.getMetadata=function t(){var e=this;return this._settings.metadata?(i.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(i.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(t){i.Log.debug("MetadataService.getMetadata: json received");var r=e._settings.metadataSeed||{};return e._settings.metadata=Object.assign({},r,t),e._settings.metadata}))):(i.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},t.prototype.getIssuer=function t(){return this._getMetadataProperty("issuer")},t.prototype.getAuthorizationEndpoint=function t(){return this._getMetadataProperty("authorization_endpoint")},t.prototype.getUserInfoEndpoint=function t(){return this._getMetadataProperty("userinfo_endpoint")},t.prototype.getTokenEndpoint=function t(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",e)},t.prototype.getCheckSessionIframe=function t(){return this._getMetadataProperty("check_session_iframe",!0)},t.prototype.getEndSessionEndpoint=function t(){return this._getMetadataProperty("end_session_endpoint",!0)},t.prototype.getRevocationEndpoint=function t(){return this._getMetadataProperty("revocation_endpoint",!0)},t.prototype.getKeysEndpoint=function t(){return this._getMetadataProperty("jwks_uri",!0)},t.prototype._getMetadataProperty=function t(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.Log.debug("MetadataService.getMetadataProperty for: "+e),this.getMetadata().then((function(t){if(i.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),void 0===t[e]){if(!0===r)return void i.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+e);throw i.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+e),new Error("Metadata does not contain property "+e)}return t[e]}))},t.prototype.getSigningKeys=function t(){var e=this;return this._settings.signingKeys?(i.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(t){return i.Log.debug("MetadataService.getSigningKeys: jwks_uri received",t),e._jsonService.getJson(t).then((function(t){if(i.Log.debug("MetadataService.getSigningKeys: key set received",t),!t.keys)throw i.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return e._settings.signingKeys=t.keys,e._settings.signingKeys}))}))},n(t,[{key:"metadataUrl",get:function t(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(a)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=a))),this._metadataUrl}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UrlUtility=void 0;var n=r(0),i=r(1);e.UrlUtility=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.addQueryParam=function t(e,r,n){return e.indexOf("?")<0&&(e+="?"),"?"!==e[e.length-1]&&(e+="&"),e+=encodeURIComponent(r),e+="=",e+=encodeURIComponent(n)},t.parseUrlFragment=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.Global;"string"!=typeof e&&(e=o.location.href);var s=e.lastIndexOf(r);s>=0&&(e=e.substr(s+1)),"?"===r&&(s=e.indexOf("#"))>=0&&(e=e.substr(0,s));for(var a,u={},c=/([^&=]+)=([^&]*)/g,h=0;a=c.exec(e);)if(u[decodeURIComponent(a[1])]=decodeURIComponent(a[2].replace(/\+/g," ")),h++>50)return n.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",e),{error:"Response exceeded expected number of parameters"};for(var l in u)return u;return{}},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JoseUtil=void 0;var n=r(26),i=function o(t){return t&&t.__esModule?t:{default:t}}(r(33));e.JoseUtil=(0,i.default)({jws:n.jws,KeyUtil:n.KeyUtil,X509:n.X509,crypto:n.crypto,hextob64u:n.hextob64u,b64tohex:n.b64tohex,AllowedSigningAlgs:n.AllowedSigningAlgs})},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OidcClientSettings=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=e.authority,i=e.metadataUrl,o=e.metadata,l=e.signingKeys,p=e.metadataSeed,v=e.client_id,y=e.client_secret,m=e.response_type,_=void 0===m?f:m,S=e.scope,b=void 0===S?g:S,w=e.redirect_uri,F=e.post_logout_redirect_uri,E=e.client_authentication,x=void 0===E?d:E,A=e.prompt,k=e.display,P=e.max_age,C=e.ui_locales,T=e.acr_values,R=e.resource,I=e.response_mode,D=e.filterProtocolClaims,L=void 0===D||D,N=e.loadUserInfo,U=void 0===N||N,B=e.staleStateAge,O=void 0===B?900:B,j=e.clockSkew,M=void 0===j?300:j,H=e.clockService,V=void 0===H?new s.ClockService:H,K=e.userInfoJwtIssuer,q=void 0===K?"OP":K,J=e.mergeClaims,W=void 0!==J&&J,z=e.stateStore,Y=void 0===z?new a.WebStorageStateStore:z,G=e.ResponseValidatorCtor,X=void 0===G?u.ResponseValidator:G,$=e.MetadataServiceCtor,Q=void 0===$?c.MetadataService:$,Z=e.extraQueryParams,tt=void 0===Z?{}:Z,et=e.extraTokenParams,rt=void 0===et?{}:et;h(this,t),this._authority=r,this._metadataUrl=i,this._metadata=o,this._metadataSeed=p,this._signingKeys=l,this._client_id=v,this._client_secret=y,this._response_type=_,this._scope=b,this._redirect_uri=w,this._post_logout_redirect_uri=F,this._client_authentication=x,this._prompt=A,this._display=k,this._max_age=P,this._ui_locales=C,this._acr_values=T,this._resource=R,this._response_mode=I,this._filterProtocolClaims=!!L,this._loadUserInfo=!!U,this._staleStateAge=O,this._clockSkew=M,this._clockService=V,this._userInfoJwtIssuer=q,this._mergeClaims=!!W,this._stateStore=Y,this._validator=new X(this),this._metadataService=new Q(this),this._extraQueryParams="object"===(void 0===tt?"undefined":n(tt))?tt:{},this._extraTokenParams="object"===(void 0===rt?"undefined":n(rt))?rt:{}}return t.prototype.getEpochTime=function t(){return this._clockService.getEpochTime()},i(t,[{key:"client_id",get:function t(){return this._client_id},set:function t(e){if(this._client_id)throw o.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=e}},{key:"client_secret",get:function t(){return this._client_secret}},{key:"response_type",get:function t(){return this._response_type}},{key:"scope",get:function t(){return this._scope}},{key:"redirect_uri",get:function t(){return this._redirect_uri}},{key:"post_logout_redirect_uri",get:function t(){return this._post_logout_redirect_uri}},{key:"client_authentication",get:function t(){return this._client_authentication}},{key:"prompt",get:function t(){return this._prompt}},{key:"display",get:function t(){return this._display}},{key:"max_age",get:function t(){return this._max_age}},{key:"ui_locales",get:function t(){return this._ui_locales}},{key:"acr_values",get:function t(){return this._acr_values}},{key:"resource",get:function t(){return this._resource}},{key:"response_mode",get:function t(){return this._response_mode}},{key:"authority",get:function t(){return this._authority},set:function t(e){if(this._authority)throw o.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=e}},{key:"metadataUrl",get:function t(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(l)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=l)),this._metadataUrl}},{key:"metadata",get:function t(){return this._metadata},set:function t(e){this._metadata=e}},{key:"metadataSeed",get:function t(){return this._metadataSeed},set:function t(e){this._metadataSeed=e}},{key:"signingKeys",get:function t(){return this._signingKeys},set:function t(e){this._signingKeys=e}},{key:"filterProtocolClaims",get:function t(){return this._filterProtocolClaims}},{key:"loadUserInfo",get:function t(){return this._loadUserInfo}},{key:"staleStateAge",get:function t(){return this._staleStateAge}},{key:"clockSkew",get:function t(){return this._clockSkew}},{key:"userInfoJwtIssuer",get:function t(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function t(){return this._mergeClaims}},{key:"stateStore",get:function t(){return this._stateStore}},{key:"validator",get:function t(){return this._validator}},{key:"metadataService",get:function t(){return this._metadataService}},{key:"extraQueryParams",get:function t(){return this._extraQueryParams},set:function t(e){"object"===(void 0===e?"undefined":n(e))?this._extraQueryParams=e:this._extraQueryParams={}}},{key:"extraTokenParams",get:function t(){return this._extraTokenParams},set:function t(e){"object"===(void 0===e?"undefined":n(e))?this._extraTokenParams=e:this._extraTokenParams={}}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.WebStorageStateStore=void 0;var n=r(0),i=r(1);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.WebStorageStateStore=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.prefix,n=void 0===r?"oidc.":r,s=e.store,a=void 0===s?i.Global.localStorage:s;o(this,t),this._store=a,this._prefix=n}return t.prototype.set=function t(e,r){return n.Log.debug("WebStorageStateStore.set",e),e=this._prefix+e,this._store.setItem(e,r),Promise.resolve()},t.prototype.get=function t(e){n.Log.debug("WebStorageStateStore.get",e),e=this._prefix+e;var r=this._store.getItem(e);return Promise.resolve(r)},t.prototype.remove=function t(e){n.Log.debug("WebStorageStateStore.remove",e),e=this._prefix+e;var r=this._store.getItem(e);return this._store.removeItem(e),Promise.resolve(r)},t.prototype.getAllKeys=function t(){n.Log.debug("WebStorageStateStore.getAllKeys");for(var e=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.Global.XMLHttpRequest,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t),e&&Array.isArray(e)?this._contentTypes=e.slice():this._contentTypes=[],this._contentTypes.push("application/json"),n&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=r,this._jwtHandler=n}return t.prototype.getJson=function t(e,r){var i=this;if(!e)throw n.Log.error("JsonService.getJson: No url passed"),new Error("url");return n.Log.debug("JsonService.getJson, url: ",e),new Promise((function(t,o){var s=new i._XMLHttpRequest;s.open("GET",e);var a=i._contentTypes,u=i._jwtHandler;s.onload=function(){if(n.Log.debug("JsonService.getJson: HTTP response received, status",s.status),200===s.status){var r=s.getResponseHeader("Content-Type");if(r){var i=a.find((function(t){if(r.startsWith(t))return!0}));if("application/jwt"==i)return void u(s).then(t,o);if(i)try{return void t(JSON.parse(s.responseText))}catch(t){return n.Log.error("JsonService.getJson: Error parsing JSON response",t.message),void o(t)}}o(Error("Invalid response Content-Type: "+r+", from URL: "+e))}else o(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){n.Log.error("JsonService.getJson: network error"),o(Error("Network Error"))},r&&(n.Log.debug("JsonService.getJson: token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+r)),s.send()}))},t.prototype.postForm=function t(e,r,i){var o=this;if(!e)throw n.Log.error("JsonService.postForm: No url passed"),new Error("url");return n.Log.debug("JsonService.postForm, url: ",e),new Promise((function(t,s){var a=new o._XMLHttpRequest;a.open("POST",e);var u=o._contentTypes;a.onload=function(){if(n.Log.debug("JsonService.postForm: HTTP response received, status",a.status),200!==a.status){if(400===a.status)if(i=a.getResponseHeader("Content-Type"))if(u.find((function(t){if(i.startsWith(t))return!0})))try{var r=JSON.parse(a.responseText);if(r&&r.error)return n.Log.error("JsonService.postForm: Error from server: ",r.error),void s(new Error(r.error))}catch(t){return n.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error(a.statusText+" ("+a.status+")"))}else{var i;if((i=a.getResponseHeader("Content-Type"))&&u.find((function(t){if(i.startsWith(t))return!0})))try{return void t(JSON.parse(a.responseText))}catch(t){return n.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error("Invalid response Content-Type: "+i+", from URL: "+e))}},a.onerror=function(){n.Log.error("JsonService.postForm: network error"),s(Error("Network Error"))};var c="";for(var h in r){var l=r[h];l&&(c.length>0&&(c+="&"),c+=encodeURIComponent(h),c+="=",c+=encodeURIComponent(l))}a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void 0!==i&&a.setRequestHeader("Authorization","Basic "+btoa(i)),a.send(c)}))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SigninRequest=void 0;var n=r(0),i=r(3),o=r(13);e.SigninRequest=function(){function t(e){var r=e.url,s=e.client_id,a=e.redirect_uri,u=e.response_type,c=e.scope,h=e.authority,l=e.data,f=e.prompt,g=e.display,d=e.max_age,p=e.ui_locales,v=e.id_token_hint,y=e.login_hint,m=e.acr_values,_=e.resource,S=e.response_mode,b=e.request,w=e.request_uri,F=e.extraQueryParams,E=e.request_type,x=e.client_secret,A=e.extraTokenParams,k=e.skipUserInfo;if(function P(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!r)throw n.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!s)throw n.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!a)throw n.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!u)throw n.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!c)throw n.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!h)throw n.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var C=t.isOidc(u),T=t.isCode(u);S||(S=t.isCode(u)?"query":null),this.state=new o.SigninState({nonce:C,data:l,client_id:s,authority:h,redirect_uri:a,code_verifier:T,request_type:E,response_mode:S,client_secret:x,scope:c,extraTokenParams:A,skipUserInfo:k}),r=i.UrlUtility.addQueryParam(r,"client_id",s),r=i.UrlUtility.addQueryParam(r,"redirect_uri",a),r=i.UrlUtility.addQueryParam(r,"response_type",u),r=i.UrlUtility.addQueryParam(r,"scope",c),r=i.UrlUtility.addQueryParam(r,"state",this.state.id),C&&(r=i.UrlUtility.addQueryParam(r,"nonce",this.state.nonce)),T&&(r=i.UrlUtility.addQueryParam(r,"code_challenge",this.state.code_challenge),r=i.UrlUtility.addQueryParam(r,"code_challenge_method","S256"));var R={prompt:f,display:g,max_age:d,ui_locales:p,id_token_hint:v,login_hint:y,acr_values:m,resource:_,request:b,request_uri:w,response_mode:S};for(var I in R)R[I]&&(r=i.UrlUtility.addQueryParam(r,I,R[I]));for(var D in F)r=i.UrlUtility.addQueryParam(r,D,F[D]);this.url=r}return t.isOidc=function t(e){return!!e.split(/\s+/g).filter((function(t){return"id_token"===t}))[0]},t.isOAuth=function t(e){return!!e.split(/\s+/g).filter((function(t){return"token"===t}))[0]},t.isCode=function t(e){return!!e.split(/\s+/g).filter((function(t){return"code"===t}))[0]},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.State=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=e.id,n=e.data,i=e.created,s=e.request_type;a(this,t),this._id=r||(0,o.default)(),this._data=n,this._created="number"==typeof i&&i>0?i:parseInt(Date.now()/1e3),this._request_type=s}return t.prototype.toStorageString=function t(){return i.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},t.fromStorageString=function e(r){return i.Log.debug("State.fromStorageString"),new t(JSON.parse(r))},t.clearStaleState=function e(r,n){var o=Date.now()/1e3-n;return r.getAllKeys().then((function(e){i.Log.debug("State.clearStaleState: got keys",e);for(var n=[],s=function s(a){var c=e[a];u=r.get(c).then((function(e){var n=!1;if(e)try{var s=t.fromStorageString(e);i.Log.debug("State.clearStaleState: got item from key: ",c,s.created),s.created<=o&&(n=!0)}catch(t){i.Log.error("State.clearStaleState: Error parsing state for key",c,t.message),n=!0}else i.Log.debug("State.clearStaleState: no item in storage for key: ",c),n=!0;if(n)return i.Log.debug("State.clearStaleState: removed item for key: ",c),r.remove(c)})),n.push(u)},a=0;a0&&void 0!==arguments[0]?arguments[0]:{};g(this,t),e instanceof o.OidcClientSettings?this._settings=e:this._settings=new o.OidcClientSettings(e)}return t.prototype.createSigninRequest=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.response_type,o=r.scope,s=r.redirect_uri,u=r.data,c=r.state,h=r.prompt,l=r.display,f=r.max_age,g=r.ui_locales,d=r.id_token_hint,p=r.login_hint,v=r.acr_values,y=r.resource,m=r.request,_=r.request_uri,S=r.response_mode,b=r.extraQueryParams,w=r.extraTokenParams,F=r.request_type,E=r.skipUserInfo,x=arguments[1];i.Log.debug("OidcClient.createSigninRequest");var A=this._settings.client_id;n=n||this._settings.response_type,o=o||this._settings.scope,s=s||this._settings.redirect_uri,h=h||this._settings.prompt,l=l||this._settings.display,f=f||this._settings.max_age,g=g||this._settings.ui_locales,v=v||this._settings.acr_values,y=y||this._settings.resource,S=S||this._settings.response_mode,b=b||this._settings.extraQueryParams,w=w||this._settings.extraTokenParams;var k=this._settings.authority;return a.SigninRequest.isCode(n)&&"code"!==n?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then((function(t){i.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",t);var r=new a.SigninRequest({url:t,client_id:A,redirect_uri:s,response_type:n,scope:o,data:u||c,authority:k,prompt:h,display:l,max_age:f,ui_locales:g,id_token_hint:d,login_hint:p,acr_values:v,resource:y,request:m,request_uri:_,extraQueryParams:b,extraTokenParams:w,request_type:F,response_mode:S,client_secret:e._settings.client_secret,skipUserInfo:E}),P=r.state;return(x=x||e._stateStore).set(P.id,P.toStorageString()).then((function(){return r}))}))},t.prototype.readSigninResponseState=function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug("OidcClient.readSigninResponseState");var o="query"===this._settings.response_mode||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type),s=o?"?":"#",c=new u.SigninResponse(e,s);if(!c.state)return i.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));r=r||this._stateStore;var h=n?r.remove.bind(r):r.get.bind(r);return h(c.state).then((function(t){if(!t)throw i.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:l.SigninState.fromStorageString(t),response:c}}))},t.prototype.processSigninResponse=function t(e,r){var n=this;return i.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(e,r,!0).then((function(t){var e=t.state,r=t.response;return i.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),n._validator.validateSigninResponse(e,r)}))},t.prototype.createSignoutRequest=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.id_token_hint,o=r.data,s=r.state,a=r.post_logout_redirect_uri,u=r.extraQueryParams,h=r.request_type,l=arguments[1];return i.Log.debug("OidcClient.createSignoutRequest"),a=a||this._settings.post_logout_redirect_uri,u=u||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(t){if(!t)throw i.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");i.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",t);var r=new c.SignoutRequest({url:t,id_token_hint:n,post_logout_redirect_uri:a,data:o||s,extraQueryParams:u,request_type:h}),f=r.state;return f&&(i.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(l=l||e._stateStore).set(f.id,f.toStorageString())),r}))},t.prototype.readSignoutResponseState=function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug("OidcClient.readSignoutResponseState");var o=new h.SignoutResponse(e);if(!o.state)return i.Log.debug("OidcClient.readSignoutResponseState: No state in response"),o.error?(i.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",o.error),Promise.reject(new s.ErrorResponse(o))):Promise.resolve({state:void 0,response:o});var a=o.state;r=r||this._stateStore;var u=n?r.remove.bind(r):r.get.bind(r);return u(a).then((function(t){if(!t)throw i.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:f.State.fromStorageString(t),response:o}}))},t.prototype.processSignoutResponse=function t(e,r){var n=this;return i.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(e,r,!0).then((function(t){var e=t.state,r=t.response;return e?(i.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),n._validator.validateSignoutResponse(e,r)):(i.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),r)}))},t.prototype.clearStaleState=function t(e){return i.Log.debug("OidcClient.clearStaleState"),e=e||this._stateStore,f.State.clearStaleState(e,this.settings.staleStateAge)},n(t,[{key:"_stateStore",get:function t(){return this.settings.stateStore}},{key:"_validator",get:function t(){return this.settings.validator}},{key:"_metadataService",get:function t(){return this.settings.metadataService}},{key:"settings",get:function t(){return this._settings}},{key:"metadataService",get:function t(){return this._metadataService}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenClient=void 0;var n=r(7),i=r(2),o=r(0);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.TokenClient=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw o.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=e,this._jsonService=new r,this._metadataService=new a(this._settings)}return t.prototype.exchangeCode=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).grant_type=r.grant_type||"authorization_code",r.client_id=r.client_id||this._settings.client_id,r.client_secret=r.client_secret||this._settings.client_secret,r.redirect_uri=r.redirect_uri||this._settings.redirect_uri;var n=void 0,i=r._client_authentication||this._settings._client_authentication;return delete r._client_authentication,r.code?r.redirect_uri?r.code_verifier?r.client_id?r.client_secret||"client_secret_basic"!=i?("client_secret_basic"==i&&(n=r.client_id+":"+r.client_secret,delete r.client_id,delete r.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(t){return o.Log.debug("TokenClient.exchangeCode: Received token endpoint"),e._jsonService.postForm(t,r,n).then((function(t){return o.Log.debug("TokenClient.exchangeCode: response received"),t}))}))):(o.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(o.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(o.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(o.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},t.prototype.exchangeRefreshToken=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).grant_type=r.grant_type||"refresh_token",r.client_id=r.client_id||this._settings.client_id,r.client_secret=r.client_secret||this._settings.client_secret;var n=void 0,i=r._client_authentication||this._settings._client_authentication;return delete r._client_authentication,r.refresh_token?r.client_id?("client_secret_basic"==i&&(n=r.client_id+":"+r.client_secret,delete r.client_id,delete r.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(t){return o.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),e._jsonService.postForm(t,r,n).then((function(t){return o.Log.debug("TokenClient.exchangeRefreshToken: response received"),t}))}))):(o.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorResponse=void 0;var n=r(0);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.ErrorResponse=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=r.error,a=r.error_description,u=r.error_uri,c=r.state,h=r.session_state;if(i(this,e),!s)throw n.Log.error("No error passed to ErrorResponse"),new Error("error");var l=o(this,t.call(this,a||s));return l.name="ErrorResponse",l.error=s,l.error_description=a,l.error_uri=u,l.state=c,l.session_state=h,l}return function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(Error)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SigninState=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=r.nonce,i=r.authority,o=r.client_id,u=r.redirect_uri,l=r.code_verifier,f=r.response_mode,g=r.client_secret,d=r.scope,p=r.extraTokenParams,v=r.skipUserInfo;c(this,e);var y=h(this,t.call(this,arguments[0]));if(!0===n?y._nonce=(0,a.default)():n&&(y._nonce=n),!0===l?y._code_verifier=(0,a.default)()+(0,a.default)()+(0,a.default)():l&&(y._code_verifier=l),y.code_verifier){var m=s.JoseUtil.hashString(y.code_verifier,"SHA256");y._code_challenge=s.JoseUtil.hexToBase64Url(m)}return y._redirect_uri=u,y._authority=i,y._client_id=o,y._response_mode=f,y._client_secret=g,y._scope=d,y._extraTokenParams=p,y._skipUserInfo=v,y}return function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toStorageString=function t(){return i.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},e.fromStorageString=function t(r){return i.Log.debug("SigninState.fromStorageString"),new e(JSON.parse(r))},n(e,[{key:"nonce",get:function t(){return this._nonce}},{key:"authority",get:function t(){return this._authority}},{key:"client_id",get:function t(){return this._client_id}},{key:"redirect_uri",get:function t(){return this._redirect_uri}},{key:"code_verifier",get:function t(){return this._code_verifier}},{key:"code_challenge",get:function t(){return this._code_challenge}},{key:"response_mode",get:function t(){return this._response_mode}},{key:"client_secret",get:function t(){return this._client_secret}},{key:"scope",get:function t(){return this._scope}},{key:"extraTokenParams",get:function t(){return this._extraTokenParams}},{key:"skipUserInfo",get:function t(){return this._skipUserInfo}}]),e}(o.State)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function n(){return("undefined"!=i&&null!==i&&void 0!==i.getRandomValues?o:s)().replace(/-/g,"")};var i="undefined"!=typeof window?window.crypto||window.msCrypto:null;function o(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^i.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}function s(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^16*Math.random()>>t/4).toString(16)}))}t.exports=e.default},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.User=void 0;var n=function(){function t(t,e){for(var r=0;r0){var n=parseInt(Date.now()/1e3);this.expires_at=n+r}}},{key:"expired",get:function t(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:"scopes",get:function t(){return(this.scope||"").split(" ")}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AccessTokenEvents=void 0;var n=r(0),i=r(46);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.AccessTokenEvents=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.accessTokenExpiringNotificationTime,n=void 0===r?60:r,s=e.accessTokenExpiringTimer,a=void 0===s?new i.Timer("Access token expiring"):s,u=e.accessTokenExpiredTimer,c=void 0===u?new i.Timer("Access token expired"):u;o(this,t),this._accessTokenExpiringNotificationTime=n,this._accessTokenExpiring=a,this._accessTokenExpired=c}return t.prototype.load=function t(e){if(e.access_token&&void 0!==e.expires_in){var r=e.expires_in;if(n.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",r),r>0){var i=r-this._accessTokenExpiringNotificationTime;i<=0&&(i=1),n.Log.debug("AccessTokenEvents.load: registering expiring timer in:",i),this._accessTokenExpiring.init(i)}else n.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var o=r+1;n.Log.debug("AccessTokenEvents.load: registering expired timer in:",o),this._accessTokenExpired.init(o)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function t(){n.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function t(e){this._accessTokenExpiring.addHandler(e)},t.prototype.removeAccessTokenExpiring=function t(e){this._accessTokenExpiring.removeHandler(e)},t.prototype.addAccessTokenExpired=function t(e){this._accessTokenExpired.addHandler(e)},t.prototype.removeAccessTokenExpired=function t(e){this._accessTokenExpired.removeHandler(e)},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0;var n=r(0);e.Event=function(){function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function t(e){this._callbacks.push(e)},t.prototype.removeHandler=function t(e){var r=this._callbacks.findIndex((function(t){return t===e}));r>=0&&this._callbacks.splice(r,1)},t.prototype.raise=function t(){n.Log.debug("Event: Raising event: "+this._name);for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(a(this,t),!e)throw i.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=e,this._CheckSessionIFrameCtor=n,this._timer=u,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(t){t?r._start(t):r._settings.monitorAnonymousSession&&r._userManager.querySessionStatus().then((function(t){var e={session_state:t.session_state};t.sub&&t.sid&&(e.profile={sub:t.sub,sid:t.sid}),r._start(e)})).catch((function(t){i.Log.error("SessionMonitor ctor: error from querySessionStatus:",t.message)}))})).catch((function(t){i.Log.error("SessionMonitor ctor: error from getUser:",t.message)})))}return t.prototype._start=function t(e){var r=this,n=e.session_state;n&&(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,i.Log.debug("SessionMonitor._start: session_state:",n,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,i.Log.debug("SessionMonitor._start: session_state:",n,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(n):this._metadataService.getCheckSessionIframe().then((function(t){if(t){i.Log.debug("SessionMonitor._start: Initializing check session iframe");var e=r._client_id,o=r._checkSessionInterval,s=r._stopCheckSessionOnError;r._checkSessionIFrame=new r._CheckSessionIFrameCtor(r._callback.bind(r),e,t,o,s),r._checkSessionIFrame.load().then((function(){r._checkSessionIFrame.start(n)}))}else i.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(t){i.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",t.message)})))},t.prototype._stop=function t(){var e=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(i.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var r=this._timer.setInterval((function(){e._timer.clearInterval(r),e._userManager.querySessionStatus().then((function(t){var r={session_state:t.session_state};t.sub&&t.sid&&(r.profile={sub:t.sub,sid:t.sid}),e._start(r)})).catch((function(t){i.Log.error("SessionMonitor: error from querySessionStatus:",t.message)}))}),1e3)},t.prototype._callback=function t(){var e=this;this._userManager.querySessionStatus().then((function(t){var r=!0;t?t.sub===e._sub?(r=!1,e._checkSessionIFrame.start(t.session_state),t.sid===e._sid?i.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",t.session_state):(i.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",t.session_state),e._userManager.events._raiseUserSessionChanged())):i.Log.debug("SessionMonitor._callback: Different subject signed into OP:",t.sub):i.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),r&&(e._sub?(i.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),e._userManager.events._raiseUserSignedOut()):(i.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),e._userManager.events._raiseUserSignedIn()))})).catch((function(t){e._sub&&(i.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",t.message),e._userManager.events._raiseUserSignedOut())}))},n(t,[{key:"_settings",get:function t(){return this._userManager.settings}},{key:"_metadataService",get:function t(){return this._userManager.metadataService}},{key:"_client_id",get:function t(){return this._settings.client_id}},{key:"_checkSessionInterval",get:function t(){return this._settings.checkSessionInterval}},{key:"_stopCheckSessionOnError",get:function t(){return this._settings.stopCheckSessionOnError}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CheckSessionIFrame=void 0;var n=r(0);function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.CheckSessionIFrame=function(){function t(e,r,n,o){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];i(this,t),this._callback=e,this._client_id=r,this._url=n,this._interval=o||2e3,this._stopOnError=s;var a=n.indexOf("/",n.indexOf("//")+2);this._frame_origin=n.substr(0,a),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=n}return t.prototype.load=function t(){var e=this;return new Promise((function(t){e._frame.onload=function(){t()},window.document.body.appendChild(e._frame),e._boundMessageEvent=e._message.bind(e),window.addEventListener("message",e._boundMessageEvent,!1)}))},t.prototype._message=function t(e){e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(n.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(n.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):n.Log.debug("CheckSessionIFrame: "+e.data+" message from check session op iframe"))},t.prototype.start=function t(e){var r=this;if(this._session_state!==e){n.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=e;var i=function t(){r._frame.contentWindow.postMessage(r._client_id+" "+r._session_state,r._frame_origin)};i(),this._timer=window.setInterval(i,this._interval)}},t.prototype.stop=function t(){this._session_state=null,this._timer&&(n.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenRevocationClient=void 0;var n=r(0),i=r(2),o=r(1);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a="access_token",u="refresh_token";e.TokenRevocationClient=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw n.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=e,this._XMLHttpRequestCtor=r,this._metadataService=new a(this._settings)}return t.prototype.revoke=function t(e,r){var i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"access_token";if(!e)throw n.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(o!==a&&o!=u)throw n.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then((function(t){if(t){n.Log.debug("TokenRevocationClient.revoke: Revoking "+o);var s=i._settings.client_id,a=i._settings.client_secret;return i._revoke(t,s,a,e,o)}if(r)throw n.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},t.prototype._revoke=function t(e,r,i,o,s){var a=this;return new Promise((function(t,u){var c=new a._XMLHttpRequestCtor;c.open("POST",e),c.onload=function(){n.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",c.status),200===c.status?t():u(Error(c.statusText+" ("+c.status+")"))},c.onerror=function(){n.Log.debug("TokenRevocationClient.revoke: Network Error."),u("Network Error")};var h="client_id="+encodeURIComponent(r);i&&(h+="&client_secret="+encodeURIComponent(i)),h+="&token_type_hint="+encodeURIComponent(s),h+="&token="+encodeURIComponent(o),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(h)}))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaPopupWindow=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.JoseUtil,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:a.TokenClient;if(h(this,t),!e)throw i.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=e,this._metadataService=new r(this._settings),this._userInfoService=new n(this._settings),this._joseUtil=u,this._tokenClient=new l(this._settings)}return t.prototype.validateSigninResponse=function t(e,r){var n=this;return i.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(e,r).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: state processed"),n._validateTokens(e,t).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),n._processClaims(e,t).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),t}))}))}))},t.prototype.validateSignoutResponse=function t(e,r){return e.id!==r.state?(i.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(i.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),r.state=e.data,r.error?(i.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",r.error),Promise.reject(new u.ErrorResponse(r))):Promise.resolve(r))},t.prototype._processSigninParams=function t(e,r){if(e.id!==r.state)return i.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!e.client_id)return i.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!e.authority)return i.Log.error("ResponseValidator._processSigninParams: No authority on state"),Promise.reject(new Error("No authority on state"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==e.authority)return i.Log.error("ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state"),Promise.reject(new Error("authority mismatch on settings vs. signin state"))}else this._settings.authority=e.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==e.client_id)return i.Log.error("ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state"),Promise.reject(new Error("client_id mismatch on settings vs. signin state"))}else this._settings.client_id=e.client_id;return i.Log.debug("ResponseValidator._processSigninParams: state validated"),r.state=e.data,r.error?(i.Log.warn("ResponseValidator._processSigninParams: Response was error",r.error),Promise.reject(new u.ErrorResponse(r))):e.nonce&&!r.id_token?(i.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!e.nonce&&r.id_token?(i.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):e.code_verifier&&!r.code?(i.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!e.code_verifier&&r.code?(i.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(r.scope||(r.scope=e.scope),Promise.resolve(r))},t.prototype._processClaims=function t(e,r){var n=this;if(r.isOpenIdConnect){if(i.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),r.profile=this._filterProtocolClaims(r.profile),!0!==e.skipUserInfo&&this._settings.loadUserInfo&&r.access_token)return i.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(r.access_token).then((function(t){return i.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),t.sub!==r.profile.sub?(i.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(r.profile=n._mergeClaims(r.profile,t),i.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",r.profile),r)}));i.Log.debug("ResponseValidator._processClaims: not loading user info")}else i.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(r)},t.prototype._mergeClaims=function t(e,r){var i=Object.assign({},e);for(var o in r){var s=r[o];Array.isArray(s)||(s=[s]);for(var a=0;a1)return i.Log.error("ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));o=t[0]}return Promise.resolve(o)}))},t.prototype._getSigningKeyForJwtWithSingleRetry=function t(e){var r=this;return this._getSigningKeyForJwt(e).then((function(t){return t?Promise.resolve(t):(r._metadataService.resetSigningKeys(),r._getSigningKeyForJwt(e))}))},t.prototype._validateIdToken=function t(e,r){var n=this;if(!e.nonce)return i.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var o=this._joseUtil.parseJwt(r.id_token);return o&&o.header&&o.payload?e.nonce!==o.payload.nonce?(i.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then((function(t){return i.Log.debug("ResponseValidator._validateIdToken: Received issuer"),n._getSigningKeyForJwtWithSingleRetry(o).then((function(s){if(!s)return i.Log.error("ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var a=e.client_id,u=n._settings.clockSkew;return i.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",u),n._joseUtil.validateJwt(r.id_token,s,t,a,u).then((function(){return i.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),o.payload.sub?(r.profile=o.payload,r):(i.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))})):(i.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",o),Promise.reject(new Error("Failed to parse id_token")))},t.prototype._filterByAlg=function t(e,r){var n=null;if(r.startsWith("RS"))n="RSA";else if(r.startsWith("PS"))n="PS";else{if(!r.startsWith("ES"))return i.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",r),[];n="EC"}return i.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",n),e=e.filter((function(t){return t.kty===n})),i.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",n,e.length),e},t.prototype._validateAccessToken=function t(e){if(!e.profile)return i.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!e.profile.at_hash)return i.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!e.id_token)return i.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var r=this._joseUtil.parseJwt(e.id_token);if(!r||!r.header)return i.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",r),Promise.reject(new Error("Failed to parse id_token"));var n=r.header.alg;if(!n||5!==n.length)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n),Promise.reject(new Error("Unsupported alg: "+n));var o=n.substr(2,3);if(!o)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n,o),Promise.reject(new Error("Unsupported alg: "+n));if(256!==(o=parseInt(o))&&384!==o&&512!==o)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n,o),Promise.reject(new Error("Unsupported alg: "+n));var s="sha"+o,a=this._joseUtil.hashString(e.access_token,s);if(!a)return i.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",s),Promise.reject(new Error("Failed to validate at_hash"));var u=a.substr(0,a.length/2),c=this._joseUtil.hexToBase64Url(u);return c!==e.profile.at_hash?(i.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",c,e.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(i.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(e))},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UserInfoService=void 0;var n=r(7),i=r(2),o=r(0),s=r(4);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.UserInfoService=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(a(this,t),!e)throw o.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=e,this._jsonService=new r(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new u(this._settings),this._joseUtil=c}return t.prototype.getClaims=function t(e){var r=this;return e?this._metadataService.getUserInfoEndpoint().then((function(t){return o.Log.debug("UserInfoService.getClaims: received userinfo url",t),r._jsonService.getJson(t,e).then((function(t){return o.Log.debug("UserInfoService.getClaims: claims received",t),t}))})):(o.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},t.prototype._getClaimsFromJwt=function t(e){var r=this;try{var n=this._joseUtil.parseJwt(e.responseText);if(!n||!n.header||!n.payload)return o.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",n),Promise.reject(new Error("Failed to parse id_token"));var i=n.header.kid,s=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":s=this._metadataService.getIssuer();break;case"ANY":s=Promise.resolve(n.payload.iss);break;default:s=Promise.resolve(this._settings.userInfoJwtIssuer)}return s.then((function(t){return o.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+t),r._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));o.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var a=void 0;if(i)a=s.filter((function(t){return t.kid===i}))[0];else{if((s=r._filterByAlg(s,n.header.alg)).length>1)return o.Log.error("UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));a=s[0]}if(!a)return o.Log.error("UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var u=r._settings.client_id,c=r._settings.clockSkew;return o.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",c),r._joseUtil.validateJwt(e.responseText,a,t,u,c,void 0,!0).then((function(){return o.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),n.payload}))}))}))}catch(t){return o.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",t.message),void reject(t)}},t.prototype._filterByAlg=function t(e,r){var n=null;if(r.startsWith("RS"))n="RSA";else if(r.startsWith("PS"))n="PS";else{if(!r.startsWith("ES"))return o.Log.debug("UserInfoService._filterByAlg: alg not supported: ",r),[];n="EC"}return o.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",n),e=e.filter((function(t){return t.kty===n})),o.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",n,e.length),e},t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AllowedSigningAlgs=e.b64tohex=e.hextob64u=e.crypto=e.X509=e.KeyUtil=e.jws=void 0;var n=r(27);e.jws=n.jws,e.KeyUtil=n.KEYUTIL,e.X509=n.X509,e.crypto=n.crypto,e.hextob64u=n.hextob64u,e.b64tohex=n.b64tohex,e.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var r,n,i,o,s,a,u,c,h,l,f,g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d={userAgent:!1},p={},v=v||(r=Math,i=(n={}).lib={},o=i.Base=function(){function t(){}return{extend:function e(r){t.prototype=this;var n=new t;return r&&n.mixIn(r),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function t(){var e=this.extend();return e.init.apply(e,arguments),e},init:function t(){},mixIn:function t(e){for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function t(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=o.extend({init:function t(e,r){e=this.words=e||[],this.sigBytes=null!=r?r:4*e.length},toString:function t(e){return(e||u).stringify(this)},concat:function t(e){var r=this.words,n=e.words,i=this.sigBytes,o=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s>>2]>>>24-s%4*8&255;r[i+s>>>2]|=a<<24-(i+s)%4*8}else for(s=0;s>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function t(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=r.ceil(n/4)},clone:function t(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function t(e){for(var n=[],i=0;i>>2]>>>24-o%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function t(e){for(var r=e.length,n=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,r/2)}},c=a.Latin1={stringify:function t(e){for(var r=e.words,n=e.sigBytes,i=[],o=0;o>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function t(e){for(var r=e.length,n=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,r)}},h=a.Utf8={stringify:function t(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function t(e){return c.parse(unescape(encodeURIComponent(e)))}},l=i.BufferedBlockAlgorithm=o.extend({reset:function t(){this._data=new s.init,this._nDataBytes=0},_append:function t(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function t(e){var n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,u=o/(4*a),c=(u=e?r.ceil(u):r.max((0|u)-this._minBufferSize,0))*a,h=r.min(4*c,o);if(c){for(var l=0;l>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;4>a&&o+.75*a>>6*(3-a)&63));if(r=i.charAt(64))for(;e.length%4;)e.push(r);return e.join("")},parse:function t(r){var n=r.length,i=this._map;(o=i.charAt(64))&&(-1!=(o=r.indexOf(o))&&(n=o));for(var o=[],s=0,a=0;a>>6-a%4*2;o[s>>>2]|=(u|c)<<24-s%4*8,s++}return e.create(o,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){for(var e=v,r=(i=e.lib).WordArray,n=i.Hasher,i=e.algo,o=[],s=[],a=function t(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var h;t:{h=u;for(var l=t.sqrt(h),f=2;f<=l;f++)if(!(h%f)){h=!1;break t}h=!0}h&&(8>c&&(o[c]=a(t.pow(u,.5))),s[c]=a(t.pow(u,1/3)),c++),u++}var g=[];i=i.SHA256=n.extend({_doReset:function t(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function t(e,r){for(var n=this._hash.words,i=n[0],o=n[1],a=n[2],u=n[3],c=n[4],h=n[5],l=n[6],f=n[7],d=0;64>d;d++){if(16>d)g[d]=0|e[r+d];else{var p=g[d-15],v=g[d-2];g[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+g[d-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+g[d-16]}p=f+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&h^~c&l)+s[d]+g[d],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&o^i&a^o&a),f=l,l=h,h=c,c=u+p|0,u=a,a=o,o=i,i=p+v|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+u|0,n[4]=n[4]+c|0,n[5]=n[5]+h|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0},_doFinalize:function e(){var r=this._data,n=r.words,i=8*this._nDataBytes,o=8*r.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(i/4294967296),n[15+(o+64>>>9<<4)]=i,r.sigBytes=4*n.length,this._process(),this._hash},clone:function t(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=n._createHelper(i),e.HmacSHA256=n._createHmacHelper(i)}(Math),function(){function t(){return n.create.apply(n,arguments)}for(var e=v,r=e.lib.Hasher,n=(o=e.x64).Word,i=o.WordArray,o=e.algo,s=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();o=o.SHA512=r.extend({_doReset:function t(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function t(e,r){for(var n=(f=this._hash.words)[0],i=f[1],o=f[2],u=f[3],c=f[4],h=f[5],l=f[6],f=f[7],g=n.high,d=n.low,p=i.high,v=i.low,y=o.high,m=o.low,_=u.high,S=u.low,b=c.high,w=c.low,F=h.high,E=h.low,x=l.high,A=l.low,k=f.high,P=f.low,C=g,T=d,R=p,I=v,D=y,L=m,N=_,U=S,B=b,O=w,j=F,M=E,H=x,V=A,K=k,q=P,J=0;80>J;J++){var W=a[J];if(16>J)var z=W.high=0|e[r+2*J],Y=W.low=0|e[r+2*J+1];else{z=((Y=(z=a[J-15]).high)>>>1|(G=z.low)<<31)^(Y>>>8|G<<24)^Y>>>7;var G=(G>>>1|Y<<31)^(G>>>8|Y<<24)^(G>>>7|Y<<25),X=((Y=(X=a[J-2]).high)>>>19|($=X.low)<<13)^(Y<<3|$>>>29)^Y>>>6,$=($>>>19|Y<<13)^($<<3|Y>>>29)^($>>>6|Y<<26),Q=(Y=a[J-7]).high,Z=(tt=a[J-16]).high,tt=tt.low;z=(z=(z=z+Q+((Y=G+Y.low)>>>0>>0?1:0))+X+((Y=Y+$)>>>0<$>>>0?1:0))+Z+((Y=Y+tt)>>>0>>0?1:0);W.high=z,W.low=Y}Q=B&j^~B&H,tt=O&M^~O&V,W=C&R^C&D^R&D;var et=T&I^T&L^I&L,rt=(G=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),X=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),($=s[J]).high),nt=$.low;Z=K+((B>>>14|O<<18)^(B>>>18|O<<14)^(B<<23|O>>>9))+(($=q+((O>>>14|B<<18)^(O>>>18|B<<14)^(O<<23|B>>>9)))>>>0>>0?1:0),K=H,q=V,H=j,V=M,j=B,M=O,B=N+(Z=(Z=(Z=Z+Q+(($=$+tt)>>>0>>0?1:0))+rt+(($=$+nt)>>>0>>0?1:0))+z+(($=$+Y)>>>0>>0?1:0))+((O=U+$|0)>>>0>>0?1:0)|0,N=D,U=L,D=R,L=I,R=C,I=T,C=Z+(W=G+W+((Y=X+et)>>>0>>0?1:0))+((T=$+Y|0)>>>0<$>>>0?1:0)|0}d=n.low=d+T,n.high=g+C+(d>>>0>>0?1:0),v=i.low=v+I,i.high=p+R+(v>>>0>>0?1:0),m=o.low=m+L,o.high=y+D+(m>>>0>>0?1:0),S=u.low=S+U,u.high=_+N+(S>>>0>>0?1:0),w=c.low=w+O,c.high=b+B+(w>>>0>>0?1:0),E=h.low=E+M,h.high=F+j+(E>>>0>>0?1:0),A=l.low=A+V,l.high=x+H+(A>>>0>>0?1:0),P=f.low=P+q,f.high=k+K+(P>>>0>>0?1:0)},_doFinalize:function t(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),r[31+(i+128>>>10<<5)]=n,e.sigBytes=4*r.length,this._process(),this._hash.toX32()},clone:function t(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),e.SHA512=r._createHelper(o),e.HmacSHA512=r._createHmacHelper(o)}(),function(){var t=v,e=(i=t.x64).Word,r=i.WordArray,n=(i=t.algo).SHA512,i=i.SHA384=n.extend({_doReset:function t(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function t(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)}(); -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -var y,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function _(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=m.charAt(r>>6)+m.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=m.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=m.charAt(r>>2)+m.charAt((3&r)<<4)),"=";(3&n.length)>0;)n+="=";return n}function S(t){var e,r,n,i="",o=0;for(e=0;e>2),r=3&n,o=1):1==o?(i+=T(r<<2|n>>4),r=15&n,o=2):2==o?(i+=T(r),i+=T(n>>2),r=3&n,o=3):(i+=T(r<<2|n>>4),i+=T(15&n),o=0));return 1==o&&(i+=T(r<<2)),i}function b(t){var e,r=S(t),n=new Array;for(e=0;2*e>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i},y=30):"Netscape"!=d.appName?(w.prototype.am=function x(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},y=26):(w.prototype.am=function A(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i},y=28),w.prototype.DB=y,w.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function L(t){this.m=t}function N(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function H(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function V(){}function K(t){return t}function q(t){this.r2=F(),this.q3=F(),w.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}L.prototype.convert=function J(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},L.prototype.revert=function W(t){return t},L.prototype.reduce=function z(t){t.divRemTo(this.m,null,t)},L.prototype.mulTo=function Y(t,e,r){t.multiplyTo(e,r),this.reduce(r)},L.prototype.sqrTo=function G(t,e){t.squareTo(e),this.reduce(e)},N.prototype.convert=function X(t){var e=F();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(w.ZERO)>0&&this.m.subTo(e,e),e},N.prototype.revert=function $(t){var e=F();return t.copyTo(e),this.reduce(e),e},N.prototype.reduce=function Q(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},N.prototype.mulTo=function Z(t,e,r){t.multiplyTo(e,r),this.reduce(r)},N.prototype.sqrTo=function tt(t,e){t.squareTo(e),this.reduce(e)},w.prototype.copyTo=function et(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},w.prototype.fromInt=function rt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},w.prototype.fromString=function nt(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var s=8==r?255&t[n]:R(t,n);s<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},w.prototype.dlShiftTo=function ot(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},w.prototype.drShiftTo=function st(t,e){for(var r=t;r=0;--r)e[r+s+1]=this[r]>>i|a,a=(this[r]&o)<=0;--r)e[r]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},w.prototype.rShiftTo=function ut(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(e[this.t-r-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},w.prototype.multiplyTo=function ht(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},w.prototype.divRemTo=function ft(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,h=o[c-1];if(0!=h){var l=h*(1<1?o[c-2]>>this.F2:0),f=this.FV/l,g=(1<=0&&(r[r.t++]=1,r.subTo(y,r)),w.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t=0;){var m=r[--p]==h?this.DM:Math.floor(r[p]*f+(r[p-1]+d)*g);if((r[p]+=o.am(0,m,r,v,0,c))0&&r.rShiftTo(u,r),s<0&&w.ZERO.subTo(r,r)}}},w.prototype.invDigit=function gt(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},w.prototype.isEven=function dt(){return 0==(this.t>0?1&this[0]:this.s)},w.prototype.exp=function pt(t,e){if(t>4294967295||t<1)return w.ONE;var r=F(),n=F(),i=e.convert(this),o=D(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)},w.prototype.toString=function vt(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=T(r));s>=0;)a>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=T(r));return i?o:"0"},w.prototype.negate=function yt(){var t=F();return w.ZERO.subTo(this,t),t},w.prototype.abs=function mt(){return this.s<0?this.negate():this},w.prototype.compareTo=function _t(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},w.prototype.bitLength=function St(){return this.t<=0?0:this.DB*(this.t-1)+D(this[this.t-1]^this.s&this.DM)},w.prototype.mod=function bt(t){var e=F();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(w.ZERO)>0&&t.subTo(e,e),e},w.prototype.modPowInt=function wt(t,e){var r;return r=t<256||e.isEven()?new L(e):new N(e),this.exp(t,r)},w.ZERO=I(0),w.ONE=I(1),V.prototype.convert=K,V.prototype.revert=K,V.prototype.mulTo=function Ft(t,e,r){t.multiplyTo(e,r)},V.prototype.sqrTo=function Et(t,e){t.squareTo(e)},q.prototype.convert=function xt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=F();return t.copyTo(e),this.reduce(e),e},q.prototype.revert=function At(t){return t},q.prototype.reduce=function kt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},q.prototype.mulTo=function Pt(t,e,r){t.multiplyTo(e,r),this.reduce(r)},q.prototype.sqrTo=function Ct(t,e){t.squareTo(e),this.reduce(e)};var Tt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Rt=(1<<26)/Tt[Tt.length-1]; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function It(){this.i=0,this.j=0,this.S=new Array}w.prototype.chunkSize=function Dt(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},w.prototype.toRadix=function Lt(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=I(r),i=F(),o=F(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s},w.prototype.fromRadix=function Nt(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&w.ZERO.subTo(this,this)},w.prototype.fromNumber=function Ut(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(w.ONE.shiftLeft(t-1),B,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(w.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},w.prototype.dMultiply=function Mt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},w.prototype.dAddOffset=function Ht(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},w.prototype.multiplyLowerTo=function Vt(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i=0;)r[n]=0;for(n=Math.max(e-this.t,0);n0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},w.prototype.millerRabin=function Jt(t){var e=this.subtract(w.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>Tt.length&&(t=Tt.length);for(var i=F(),o=0;o>24},w.prototype.shortValue=function Gt(){return 0==this.t?this.s:this[0]<<16>>16},w.prototype.signum=function Xt(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},w.prototype.toByteArray=function $t(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<=0;)n<8?(r=(this[t]&(1<>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},w.prototype.equals=function Qt(t){return 0==this.compareTo(t)},w.prototype.min=function Zt(t){return this.compareTo(t)<0?this:t},w.prototype.max=function te(t){return this.compareTo(t)>0?this:t},w.prototype.and=function ee(t){var e=F();return this.bitwiseTo(t,U,e),e},w.prototype.or=function re(t){var e=F();return this.bitwiseTo(t,B,e),e},w.prototype.xor=function ne(t){var e=F();return this.bitwiseTo(t,O,e),e},w.prototype.andNot=function ie(t){var e=F();return this.bitwiseTo(t,j,e),e},w.prototype.not=function oe(){for(var t=F(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var h=F();for(n.sqrTo(s[1],h);a<=c;)s[a]=F(),n.mulTo(h,s[a-2],s[a]),a+=2}var l,f,g=t.t-1,d=!0,p=F();for(i=D(t[g])-1;g>=0;){for(i>=u?l=t[g]>>i-u&c:(l=(t[g]&(1<0&&(l|=t[g-1]>>this.DB+i-u)),a=r;0==(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--g),d)s[l].copyTo(o),d=!1;else{for(;a>1;)n.sqrTo(o,p),n.sqrTo(p,o),a-=2;a>0?n.sqrTo(o,p):(f=o,o=p,p=f),n.mulTo(p,s[l],o)}for(;g>=0&&0==(t[g]&1<=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}return 0!=n.compareTo(w.ONE)?w.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},w.prototype.pow=function we(t){return this.exp(t,new V)},w.prototype.gcd=function Fe(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},w.prototype.isProbablePrime=function Ee(t){var e,r=this.abs();if(1==r.t&&r[0]<=Tt[Tt.length-1]){for(e=0;e>8&255,Ce[Te++]^=e>>16&255,Ce[Te++]^=e>>24&255,Te>=256&&(Te-=256)}((new Date).getTime())}if(null==Ce){var Ie;if(Ce=new Array,Te=0,void 0!==p&&(void 0!==p.crypto||void 0!==p.msCrypto)){var De=p.crypto||p.msCrypto;if(De.getRandomValues){var Le=new Uint8Array(32);for(De.getRandomValues(Le),Ie=0;Ie<32;++Ie)Ce[Te++]=Le[Ie]}else if("Netscape"==d.appName&&d.appVersion<"5"){var Ne=p.crypto.random(32);for(Ie=0;Ie>>8,Ce[Te++]=255&Ie;Te=0,Re()}function Ue(){if(null==Pe){for(Re(),(Pe=function t(){return new It}()).init(Ce),Te=0;Te>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function Me(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null} -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function He(t,e){this.x=e,this.q=t}function Ve(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=null==n?w.ONE:n,this.zinv=null}function Ke(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new Ve(this,null,null)}Be.prototype.nextBytes=function qe(t){var e;for(e=0;e0&&e.length>0))throw"Invalid RSA public key";this.n=Oe(t,16),this.e=parseInt(e,16)}},Me.prototype.encrypt=function ze(t){var e=function r(t,e){if(e=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new Be,s=new Array;e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new w(r)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var i=n.toString(16);return 0==(1&i.length)?i:"0"+i},Me.prototype.encryptOAEP=function Ye(t,e,r){var n=function i(t,e,r,n){var i=Sr.crypto.MessageDigest,o=Sr.crypto.Util,s=null;if(r||(r="sha1"),"string"==typeof r&&(s=i.getCanonicalAlgName(r),n=i.getHashLength(s),r=function t(e){return Lr(o.hashHex(Nr(e),s))}),t.length+2*n+2>e)throw"Message too long for RSA";var a,u="";for(a=0;a>3,e,r);if(null==n)return null;var o=this.doPublic(n);if(null==o)return null;var s=o.toString(16);return 0==(1&s.length)?s:"0"+s},Me.prototype.type="RSA",He.prototype.equals=function Ge(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},He.prototype.toBigInteger=function Xe(){return this.x},He.prototype.negate=function $e(){return new He(this.q,this.x.negate().mod(this.q))},He.prototype.add=function Qe(t){return new He(this.q,this.x.add(t.toBigInteger()).mod(this.q))},He.prototype.subtract=function Ze(t){return new He(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},He.prototype.multiply=function tr(t){return new He(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},He.prototype.square=function er(){return new He(this.q,this.x.square().mod(this.q))},He.prototype.divide=function rr(t){return new He(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},Ve.prototype.getX=function nr(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ve.prototype.getY=function ir(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ve.prototype.equals=function or(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(w.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(w.ZERO))},Ve.prototype.isInfinity=function sr(){return null==this.x&&null==this.y||this.z.equals(w.ZERO)&&!this.y.toBigInteger().equals(w.ZERO)},Ve.prototype.negate=function ar(){return new Ve(this.curve,this.x,this.y.negate(),this.z)},Ve.prototype.add=function ur(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(w.ZERO.equals(r))return w.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new w("3"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),a=s.multiply(r),u=i.multiply(s),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(r).mod(this.curve.q),l=u.multiply(n).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),f=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new Ve(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(l),f)},Ve.prototype.twice=function cr(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new w("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);w.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=s.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Ve(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},Ve.prototype.multiply=function hr(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new w("3")),i=this.negate(),o=this,s=this.curve.q.subtract(t),a=s.multiply(new w("3")),u=new Ve(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>0;--e){o=o.twice();var h=n.testBit(e);h!=r.testBit(e)&&(o=o.add(h?this:i))}for(e=a.bitLength()-2;e>0;--e){u=u.twice();var l=a.testBit(e);l!=s.testBit(e)&&(u=u.add(l?u:c))}return o},Ve.prototype.multiplyTwo=function lr(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(o):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i},Ke.prototype.getQ=function fr(){return this.q},Ke.prototype.getA=function gr(){return this.a},Ke.prototype.getB=function dr(){return this.b},Ke.prototype.equals=function pr(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},Ke.prototype.getInfinity=function vr(){return this.infinity},Ke.prototype.fromBigInteger=function yr(t){return new He(this.q,t)},Ke.prototype.decodePointHex=function mr(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),n=t.substr(e+2,e);return new Ve(this,this.fromBigInteger(new w(r,16)),this.fromBigInteger(new w(n,16)));default:return null}}, -/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */ -He.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},Ve.prototype.getEncoded=function(t){var e=function t(e,r){var n=e.toByteArrayUnsigned();if(rn.length;)n.unshift(0);return n},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},Ve.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var o=new w(n),s=new w(i);return new Ve(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ve.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),o=new w(n,16),s=new w(i,16);return new Ve(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ve.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y).divide(e),n=r.square().subtract(this.x).subtract(t.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ve(this.curve,n,i)},Ve.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(w.valueOf(2)),e=this.curve.fromBigInteger(w.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ve(this.curve,n,i)},Ve.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new w("3")),i=this.negate(),o=this;for(e=n.bitLength()-2;e>0;--e){o=o.twice();var s=n.testBit(e);s!=r.testBit(e)&&(o=o.add2D(s?this:i))}return o},Ve.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),o=e.multiply(e).mod(i),s=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return o.equals(s)},Ve.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},Ve.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(w.ONE)<0||e.compareTo(t.subtract(w.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(w.ONE)<0||r.compareTo(t.subtract(w.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0}; -/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */ -var _r=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function n(t,e,n){return e?r[e]:String.fromCharCode(parseInt(n,16))}var i=new String(""),o=Object.hasOwnProperty;return function(r,s){var a,u,c=r.match(t),h=c[0],l=!1;"{"===h?a={}:"["===h?a=[]:(a=[],l=!0);for(var f=[a],d=1-l,p=c.length;d=0;)delete n[i[c]]}return s.call(e,r,n)}({"":a},"")}return a}}();void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.asn1&&Sr.asn1||(Sr.asn1={}),Sr.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+r).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},Sr.asn1.DERAbstractString=function(t){Sr.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=Ir(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Zr(Sr.asn1.DERAbstractString,Sr.asn1.ASN1Object),Sr.asn1.DERAbstractTime=function(t){Sr.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var u=n(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=kr(t)},this.setByDateValue=function(t,e,r,n,i,o){var s=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},Zr(Sr.asn1.DERAbstractTime,Sr.asn1.ASN1Object),Sr.asn1.DERAbstractStructured=function(t){Sr.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Zr(Sr.asn1.DERAbstractStructured,Sr.asn1.ASN1Object),Sr.asn1.DERBoolean=function(t){Sr.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},Zr(Sr.asn1.DERBoolean,Sr.asn1.ASN1Object),Sr.asn1.DERInteger=function(t){Sr.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Sr.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new w(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Zr(Sr.asn1.DERInteger,Sr.asn1.ASN1Object),Sr.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Sr.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}Sr.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7i.length&&(i=n[r]);return(t=t.replace(i,"::")).slice(1,-1)}function zr(t){var e="malformed hex value";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?Wr(t):t;try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}function Yr(t){return t.match(/.{4}/g).map((function e(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return Dr((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return Dr((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))})).join("")}function Gr(t){for(var e=encodeURIComponent(t),r="",n=0;n"7"?"00"+t:t}Fr.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0=n)break}return s},Fr.getNthChildIdx=function(t,e,r){return Fr.getChildIdx(t,e)[r]},Fr.getIdxbyList=function(t,e,r,n){var i,o,s=Fr;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[i],r,n)},Fr.getIdxbyListEx=function(t,e,r,n){var i,o,s=Fr;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u=t.length?null:i.getTLV(t,o)},Fr.getTLVbyListEx=function(t,e,r,n){var i=Fr,o=i.getIdxbyListEx(t,e,r,n);return-1==o?null:i.getTLV(t,o)},Fr.getVbyList=function(t,e,r,n,i){var o,s,a=Fr;return-1==(o=a.getIdxbyList(t,e,r,n))||o>=t.length?null:(s=a.getV(t,o),!0===i&&(s=s.substr(2)),s)},Fr.getVbyListEx=function(t,e,r,n,i){var o,s,a=Fr;return-1==(o=a.getIdxbyListEx(t,e,r,n))?null:(s=a.getV(t,o),"03"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},Fr.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if("02"!=n&&"03"!=n)return r;var i=Fr.getV(t,e);return"02"==n?parseInt(i,16):function o(t){try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16),n=t.substr(2),i=parseInt(n,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-r),parseInt(i,2)}catch(t){return-1}}(i)}catch(t){return r}},Fr.getOID=function(t,e,r){null==r&&(r=null);try{return"06"!=t.substr(e,2)?r:function n(t){if(!Xr(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),o=[],s=0;s0&&(c=c+"."+a.join(".")),c}catch(t){return null}}(Fr.getV(t,e))}catch(t){return r}},Fr.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=Fr.getOID(t,e,r);if(n==r)return r;var i=Sr.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(t){return r}},Fr.getString=function(t,e,r){null==r&&(r=null);try{return Lr(Fr.getV(t,e))}catch(t){return r}},Fr.hextooidstr=function(t){var e=function t(e,r){return e.length>=r?e:new Array(r-e.length+1).join("0")+e},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=t.substr(2),s=[],a=0;a0&&(h=h+"."+u.join(".")),h},Fr.dump=function(t,e,r,n){var i=Fr,o=i.getV,s=i.dump,a=i.getChildIdx,u=t;t instanceof Sr.asn1.ASN1Object&&(u=t.getEncodedHex());var c=function t(e,r){return e.length<=2*r?e:e.substr(0,r)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-r,r)};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n="");var h,l=e.ommit_long_octet;if("01"==(h=u.substr(r,2)))return"00"==(f=o(u,r))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==h)return n+"INTEGER "+c(f=o(u,r),l)+"\n";if("03"==h){var f=o(u,r);if(i.isASN1HEX(f.substr(2))){var g=n+"BITSTRING, encapsulates\n";return g+=s(f.substr(2),e,0,n+" ")}return n+"BITSTRING "+c(f,l)+"\n"}if("04"==h){f=o(u,r);if(i.isASN1HEX(f)){g=n+"OCTETSTRING, encapsulates\n";return g+=s(f,e,0,n+" ")}return n+"OCTETSTRING "+c(f,l)+"\n"}if("05"==h)return n+"NULL\n";if("06"==h){var d=o(u,r),p=Sr.asn1.ASN1Util.oidHexToInt(d),v=Sr.asn1.x509.OID.oid2name(p),y=p.replace(/\./g," ");return""!=v?n+"ObjectIdentifier "+v+" ("+y+")\n":n+"ObjectIdentifier ("+y+")\n"}if("0a"==h)return n+"ENUMERATED "+parseInt(o(u,r))+"\n";if("0c"==h)return n+"UTF8String '"+Dr(o(u,r))+"'\n";if("13"==h)return n+"PrintableString '"+Dr(o(u,r))+"'\n";if("14"==h)return n+"TeletexString '"+Dr(o(u,r))+"'\n";if("16"==h)return n+"IA5String '"+Dr(o(u,r))+"'\n";if("17"==h)return n+"UTCTime "+Dr(o(u,r))+"\n";if("18"==h)return n+"GeneralizedTime "+Dr(o(u,r))+"\n";if("1a"==h)return n+"VisualString '"+Dr(o(u,r))+"'\n";if("1e"==h)return n+"BMPString '"+Yr(o(u,r))+"'\n";if("30"==h){if("3000"==u.substr(r,4))return n+"SEQUENCE {}\n";g=n+"SEQUENCE\n";var m=e;if((2==(b=a(u,r)).length||3==b.length)&&"06"==u.substr(b[0],2)&&"04"==u.substr(b[b.length-1],2)){v=i.oidname(o(u,b[0]));var _=JSON.parse(JSON.stringify(e));_.x509ExtName=v,m=_}for(var S=0;S31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},Fr.isASN1HEX=function(t){var e=Fr;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},Fr.checkStrictDER=function(t,e,r,n,i){var o=Fr;if(void 0===r){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!Sr.lang.String.isHex(t))throw new Error("not hex string");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(t,e).length>2*i)throw new Error("L of TLV too long: idx="+e);var s=o.getVblen(t,e);if(s>n)throw new Error("value of L too long than hex: idx="+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===e&&t.length!=a.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+a.length);var c=t.substr(e,2);if("02"===c){var h=o.getVidx(t,e);if("00"==t.substr(h,2)&&t.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var l=o.getVblen(t,e),f=0,g=o.getChildIdx(t,e),d=0;d=r?e:new Array(r-e.length+1).join(n)+e};function Zr(t,e){var r=function t(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.crypto&&Sr.crypto||(Sr.crypto={}),Sr.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:v.algo.MD5,sha1:v.algo.SHA1,sha224:v.algo.SHA224,sha256:v.algo.SHA256,sha384:v.algo.SHA384,sha512:v.algo.SHA512,ripemd160:v.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var o="0001",s="00"+n,a="",u=i-o.length-s.length,c=0;c=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(o)>=0)return!1;var a=n.modInverse(o),u=t.multiply(a).mod(o),c=e.multiply(a).mod(o);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(o).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),n=e.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===c(t))throw new Error("not ASN.1 hex string");var e,r,n;try{e=u(t,0,["[0]",0],"06"),r=u(t,0,[1],"04");try{n=u(t,0,["[1]",0],"03")}catch(t){}}catch(t){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n,i;try{u(t,0,[1,0],"06"),r=u(t,0,[1,1],"06"),n=u(t,0,[2,0,1],"04");try{i=u(t,0,[2,0,"[1]",0],"03")}catch(t){}}catch(t){throw new e("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(r),void 0===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n;try{u(t,0,[0,0],"06"),r=u(t,0,[0,1],"06"),n=u(t,0,[1],"03")}catch(t){throw new e("malformed PKCS#8 ECC public key")}if(this.curveName=s(r),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===c(t))throw new e("not ASN.1 hex string");var n,i;try{n=u(t,0,[0,5,0,1],"06"),i=u(t,0,[0,5,1],"03")}catch(t){throw new e("malformed X.509 certificate ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},Sr.crypto.ECDSA.parseSigHex=function(t){var e=Sr.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new w(e.r,16),s:new w(e.s,16)}},Sr.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=Fr,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),"30"!=t.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=r(t,0);if(2!=i.length)throw new Error("signature shall have two elements");var o=i[0],s=i[1];if("02"!=t.substr(o,2))throw new Error("1st item not ASN.1 integer");if("02"!=t.substr(s,2))throw new Error("2nd item not ASN.1 integer");return{r:n(t,o),s:n(t,s)}},Sr.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=Sr.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if("00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),"00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw"unknown ECDSA sig r length error";if(n.length%32!=0)throw"unknown ECDSA sig s length error";return r+n},Sr.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return Sr.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},Sr.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new w(t,16),n=new w(e,16);return Sr.crypto.ECDSA.biRSSigToASN1Sig(r,n)},Sr.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=Sr.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).getEncodedHex()},Sr.crypto.ECDSA.getName=function(t){return"2b8104001f"===t?"secp192k1":"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040021"===t?"secp224r1":"2b81040022"===t?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(t)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":null},void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.crypto&&Sr.crypto||(Sr.crypto={}),Sr.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new w(t,16)}this.getByName=function(r){var n=r;if(void 0!==e[n]&&(n=e[r]),void 0!==t[n])return t[n];throw"unregistered EC curve name: "+n},this.regist=function(n,i,o,s,a,u,c,h,l,f,g,d){t[n]={};var p=r(o),v=r(s),y=r(a),m=r(u),_=r(c),S=new Ke(p,v,y),b=S.decodePointHex("04"+h+l);t[n].name=n,t[n].keylen=i,t[n].curve=S,t[n].G=b,t[n].n=m,t[n].h=_,t[n].oid=g,t[n].info=d;for(var w=0;w=2*u)break}var f={};return f.keyhex=c.substr(0,2*i[e].keylen),f.ivhex=c.substr(2*i[e].keylen,2*i[e].ivlen),f},a=function t(e,r,n,o){var s=v.enc.Base64.parse(e),a=v.enc.Hex.stringify(s);return(0,i[r].proc)(a,n,o)};return{version:"1.0.0",parsePKCS5PEM:function t(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function t(e,r,n){return s(e,r,n)},decryptKeyB64:function t(e,r,n,i){return a(e,r,n,i)},getDecryptedKeyHex:function t(e,r){var n=o(e),i=(n.type,n.cipher),u=n.ivsalt,c=n.data,h=s(i,r,u).keyhex;return a(c,i,h,u)},getEncryptedPKCS5PEMFromPrvKeyHex:function t(e,r,n,o,a){var u="";if(void 0!==o&&null!=o||(o="AES-256-CBC"),void 0===i[o])throw new Error("KEYUTIL unsupported algorithm: "+o);void 0!==a&&null!=a||(a=function t(e){var r=v.lib.WordArray.random(e);return v.enc.Hex.stringify(r)}(i[o].ivlen).toUpperCase());var c=function t(e,r,n,o){return(0,i[r].eproc)(e,n,o)}(r,o,s(o,n,a).keyhex,a);u="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return u+="Proc-Type: 4,ENCRYPTED\r\n",u+="DEK-Info: "+o+","+a+"\r\n",u+="\r\n",u+=c.replace(/(.{64})/g,"$1\r\n"),u+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={},s=n(e,0);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+s.length);o.ciphertext=i(e,s[1]);var a=n(e,s[0]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+a.length);if("2a864886f70d01050d"!=i(e,a[0]))throw new Error("this only supports pkcs5PBES2");var u=n(e,a[1]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+u.length);var c=n(e,u[1]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+c.length);if("2a864886f70d0307"!=i(e,c[0]))throw"this only supports TripleDES";o.encryptionSchemeAlg="TripleDES",o.encryptionSchemeIV=i(e,c[1]);var h=n(e,u[0]);if(2!=h.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+h.length);if("2a864886f70d01050c"!=i(e,h[0]))throw new Error("this only supports pkcs5PBKDF2");var l=n(e,h[1]);if(l.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+l.length);o.pbkdf2Salt=i(e,l[0]);var f=i(e,l[1]);try{o.pbkdf2Iter=parseInt(f,16)}catch(t){throw new Error("malformed format pbkdf2Iter: "+f)}return o},getPBKDF2KeyHexFromParam:function t(e,r){var n=v.enc.Hex.parse(e.pbkdf2Salt),i=e.pbkdf2Iter,o=v.PBKDF2(r,n,{keySize:6,iterations:i});return v.enc.Hex.stringify(o)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function t(e,r){var n=Mr(e,"ENCRYPTED PRIVATE KEY"),i=this.parseHexOfEncryptedPKCS8(n),o=tn.getPBKDF2KeyHexFromParam(i,r),s={};s.ciphertext=v.enc.Hex.parse(i.ciphertext);var a=v.enc.Hex.parse(o),u=v.enc.Hex.parse(i.encryptionSchemeIV),c=v.TripleDES.decrypt(s,a,{iv:u});return v.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function t(e,r){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,r);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var s=n(e,0);if(s.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(s[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=n(e,s[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(o.algoid=i(e,a[0]),"06"==e.substr(a[1],2)&&(o.algparam=i(e,a[1])),"04"!=e.substr(s[2],2))throw new Error("malformed PKCS8 private key(code:006)");return o.keyidx=r.getVidx(e,s[2]),o},getKeyFromPlainPrivatePKCS8PEM:function t(e){var r=Mr(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(r)},getKeyFromPlainPrivatePKCS8Hex:function t(e){var r,n=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==n.algoid)r=new Me;else if("2a8648ce380401"==n.algoid)r=new Sr.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw new Error("unsupported private key algorithm");r=new Sr.crypto.ECDSA}return r.readPKCS8PrvKeyHex(e),r},_getKeyFromPublicPKCS8Hex:function t(e){var r,n=Fr.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===n)r=new Me;else if("2a8648ce380401"===n)r=new Sr.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw new Error("unsupported PKCS#8 public key hex");r=new Sr.crypto.ECDSA}return r.readPKCS8PubKeyHex(e),r},parsePublicRawRSAKeyHex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var s=n(e,0);if(2!=s.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(s[0],2))throw new Error("malformed RSA key(code:003)");if(o.n=i(e,s[0]),"02"!=e.substr(s[1],2))throw new Error("malformed RSA key(code:004)");return o.e=i(e,s[1]),o},parsePublicPKCS8Hex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={algparam:null},s=n(e,0);if(2!=s.length)throw new Error("outer DERSequence shall have 2 elements: "+s.length);var a=s[0];if("30"!=e.substr(a,2))throw new Error("malformed PKCS8 public key(code:001)");var u=n(e,a);if(2!=u.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(u[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(o.algoid=i(e,u[0]),"06"==e.substr(u[1],2)?o.algparam=i(e,u[1]):"30"==e.substr(u[1],2)&&(o.algparam={},o.algparam.p=r.getVbyList(e,u[1],[0],"02"),o.algparam.q=r.getVbyList(e,u[1],[1],"02"),o.algparam.g=r.getVbyList(e,u[1],[2],"02")),"03"!=e.substr(s[1],2))throw new Error("malformed PKCS8 public key(code:004)");return o.key=i(e,s[1]).substr(2),o}}}();tn.getKey=function(t,e,r){var n=(v=Fr).getChildIdx,i=(v.getV,v.getVbyList),o=Sr.crypto,s=o.ECDSA,a=o.DSA,u=Me,c=Mr,h=tn;if(void 0!==u&&t instanceof u)return t;if(void 0!==s&&t instanceof s)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new s({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new s({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(t.n,t.e),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(P=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(P=new u).setPrivate(t.n,t.e,t.d),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(P=new a).setPublic(t.p,t.q,t.g,t.y),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(P=new a).setPrivate(t.p,t.q,t.g,t.y,t.x),P;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(Rr(t.n),Rr(t.e)),P;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(P=new u).setPrivateEx(Rr(t.n),Rr(t.e),Rr(t.d),Rr(t.p),Rr(t.q),Rr(t.dp),Rr(t.dq),Rr(t.qi)),P;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(P=new u).setPrivate(Rr(t.n),Rr(t.e),Rr(t.d)),P;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(k=new s({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+Rr(t.x)).slice(-l)+("0000000000"+Rr(t.y)).slice(-l);return k.setPublicKeyHex(f),k}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(k=new s({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+Rr(t.x)).slice(-l)+("0000000000"+Rr(t.y)).slice(-l);var g=("0000000000"+Rr(t.d)).slice(-l);return k.setPublicKeyHex(f),k.setPrivateKeyHex(g),k}if("pkcs5prv"===r){var d,p=t,v=Fr;if(9===(d=n(p,0)).length)(P=new u).readPKCS5PrvKeyHex(p);else if(6===d.length)(P=new a).readPKCS5PrvKeyHex(p);else{if(!(d.length>2&&"04"===p.substr(d[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(P=new s).readPKCS5PrvKeyHex(p)}return P}if("pkcs8prv"===r)return P=h.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return h._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return on.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return on.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var y=Mr(t,"PUBLIC KEY");return h._getKeyFromPublicPKCS8Hex(y)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var m=c(t,"RSA PRIVATE KEY");return h.getKey(m,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var _=i(R=c(t,"DSA PRIVATE KEY"),0,[1],"02"),S=i(R,0,[2],"02"),b=i(R,0,[3],"02"),F=i(R,0,[4],"02"),E=i(R,0,[5],"02");return(P=new a).setPrivate(new w(_,16),new w(S,16),new w(b,16),new w(F,16),new w(E,16)),P}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){m=c(t,"EC PRIVATE KEY");return h.getKey(m,null,"pkcs5prv")}if(-1!=t.indexOf("-END PRIVATE KEY-"))return h.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var x=h.getDecryptedKeyHex(t,e),A=new Me;return A.readPKCS5PrvKeyHex(x),A}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var k,P=i(R=h.getDecryptedKeyHex(t,e),0,[1],"04"),C=i(R,0,[2,0],"06"),T=i(R,0,[3,0],"03").substr(2);if(void 0===Sr.crypto.OID.oidhex2name[C])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+C);return(k=new s({curve:Sr.crypto.OID.oidhex2name[C]})).setPublicKeyHex(T),k.setPrivateKeyHex(P),k.isPublic=!1,k}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var R;_=i(R=h.getDecryptedKeyHex(t,e),0,[1],"02"),S=i(R,0,[2],"02"),b=i(R,0,[3],"02"),F=i(R,0,[4],"02"),E=i(R,0,[5],"02");return(P=new a).setPrivate(new w(_,16),new w(S,16),new w(b,16),new w(F,16),new w(E,16)),P}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},tn.generateKeypair=function(t,e){if("RSA"==t){var r=e;(s=new Me).generate(r,"10001"),s.isPrivate=!0,s.isPublic=!0;var n=new Me,i=s.n.toString(16),o=s.e.toString(16);return n.setPublic(i,o),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}if("EC"==t){var s,a,u=e,c=new Sr.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new Sr.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(n=new Sr.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}throw new Error("unknown algorithm: "+t)},tn.getPEM=function(t,e,r,n,i,o){var s=Sr,a=s.asn1,u=a.DERObjectIdentifier,c=a.DERInteger,h=a.ASN1Util.newObject,l=a.x509.SubjectPublicKeyInfo,f=s.crypto,g=f.DSA,d=f.ECDSA,p=Me;function y(t){return h({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function m(t){return h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function _(t){return h({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==p&&t instanceof p||void 0!==g&&t instanceof g||void 0!==d&&t instanceof d)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return jr(F=new l(t).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return jr(F=y(t).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate){var S=new u({name:t.curveName}).getEncodedHex(),b=m(t).getEncodedHex(),w="";return w+=jr(S,"EC PARAMETERS"),w+=jr(b,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate)return jr(F=_(t).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate){var F=y(t).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",F,r,n,o)}if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){F=m(t).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",F,r,n,o)}if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate){F=_(t).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",F,r,n,o)}var E=function t(e,r){var n=x(e,r);return new h({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},x=function t(e,r){var n=v.lib.WordArray.random(8),i=v.lib.WordArray.random(8),o=v.PBKDF2(r,n,{keySize:6,iterations:100}),s=v.enc.Hex.parse(e),a=v.TripleDES.encrypt(s,o,{iv:i})+"",u={};return u.ciphertext=a,u.pbkdf2Salt=v.enc.Hex.stringify(n),u.pbkdf2Iter=100,u.encryptionSchemeAlg="DES-EDE3-CBC",u.encryptionSchemeIV=v.enc.Hex.stringify(i),u};if("PKCS8PRV"==e&&null!=p&&t instanceof p&&1==t.isPrivate){var A=y(t).getEncodedHex();F=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,"PRIVATE KEY"):jr(b=E(F,r),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate){A=new h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,"PRIVATE KEY"):jr(b=E(F,r),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){A=new c({bigint:t.x}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,"PRIVATE KEY"):jr(b=E(F,r),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},tn.getKeyFromCSRPEM=function(t){var e=Mr(t,"CERTIFICATE REQUEST");return tn.getKeyFromCSRHex(e)},tn.getKeyFromCSRHex=function(t){var e=tn.parseCSRHex(t);return tn.getKey(e.p8pubkeyhex,null,"pkcs8pub")},tn.parseCSRHex=function(t){var e=Fr,r=e.getChildIdx,n=e.getTLV,i={},o=t;if("30"!=o.substr(0,2))throw new Error("malformed CSR(code:001)");var s=r(o,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if("30"!=o.substr(s[0],2))throw new Error("malformed CSR(code:003)");var a=r(o,s[0]);if(a.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(o,a[2]),i},tn.getKeyID=function(t){var e=tn,r=Fr;"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&(t=e.getKey(t));var n=Mr(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),o=r.getV(n,i).substring(2);return Sr.crypto.Util.hashHex(o,"sha1")},tn.getJWKFromKey=function(t){var e={};if(t instanceof Me&&t.isPrivate)return e.kty="RSA",e.n=Tr(t.n.toString(16)),e.e=Tr(t.e.toString(16)),e.d=Tr(t.d.toString(16)),e.p=Tr(t.p.toString(16)),e.q=Tr(t.q.toString(16)),e.dp=Tr(t.dmp1.toString(16)),e.dq=Tr(t.dmq1.toString(16)),e.qi=Tr(t.coeff.toString(16)),e;if(t instanceof Me&&t.isPublic)return e.kty="RSA",e.n=Tr(t.n.toString(16)),e.e=Tr(t.e.toString(16)),e;if(t instanceof Sr.crypto.ECDSA&&t.isPrivate){if("P-256"!==(n=t.getShortNISTPCurveName())&&"P-384"!==n)throw new Error("unsupported curve name for JWT: "+n);var r=t.getPublicKeyXYHex();return e.kty="EC",e.crv=n,e.x=Tr(r.x),e.y=Tr(r.y),e.d=Tr(t.prvKeyHex),e}if(t instanceof Sr.crypto.ECDSA&&t.isPublic){var n;if("P-256"!==(n=t.getShortNISTPCurveName())&&"P-384"!==n)throw new Error("unsupported curve name for JWT: "+n);r=t.getPublicKeyXYHex();return e.kty="EC",e.crv=n,e.x=Tr(r.x),e.y=Tr(r.y),e}throw new Error("not supported key object")},Me.getPosArrayOfChildrenFromHex=function(t){return Fr.getChildIdx(t,0)},Me.getHexValueArrayOfChildrenFromHex=function(t){var e,r=Fr.getV,n=r(t,(e=Me.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),o=r(t,e[2]),s=r(t,e[3]),a=r(t,e[4]),u=r(t,e[5]),c=r(t,e[6]),h=r(t,e[7]),l=r(t,e[8]);return(e=new Array).push(n,i,o,s,a,u,c,h,l),e},Me.prototype.readPrivateKeyFromPEMString=function(t){var e=Mr(t),r=Me.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},Me.prototype.readPKCS5PrvKeyHex=function(t){var e=Me.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},Me.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,o,s,a,u,c=Fr,h=c.getVbyListEx;if(!1===c.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=h(t,0,[2,0,1],"02"),r=h(t,0,[2,0,2],"02"),n=h(t,0,[2,0,3],"02"),i=h(t,0,[2,0,4],"02"),o=h(t,0,[2,0,5],"02"),s=h(t,0,[2,0,6],"02"),a=h(t,0,[2,0,7],"02"),u=h(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,o,s,a,u)},Me.prototype.readPKCS5PubKeyHex=function(t){var e=Fr,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(2!==n.length||"02"!==t.substr(n[0],2)||"02"!==t.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),o=r(t,n[1]);this.setPublic(i,o)},Me.prototype.readPKCS8PubKeyHex=function(t){var e=Fr;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},Me.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new on).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};new RegExp("[^0-9a-f]","gi");function en(t,e){for(var r="",n=e/4-t.length,i=0;i>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function nn(t){for(var e in Sr.crypto.Util.DIGESTINFOHEAD){var r=Sr.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function on(t){var e,r=Fr,n=r.getChildIdx,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getVbyListEx,u=r.getTLVbyList,c=r.getTLVbyListEx,h=r.getIdxbyList,l=r.getIdxbyListEx,f=r.getVidx,g=r.getInt,d=r.oidname,p=r.hextooidstr,v=Mr;try{e=Sr.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=u(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=u(t,0,[0]),r=g(e,0);if(r<0||21){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=o(t,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&(-1!=l(this.hex,0,[0,"[3]"])&&(t=c(this.hex,0,[0,"[3]",0],"30")));for(var e=[],r=n(t,0),i=0;i0&&(c=new Array(r),(new Be).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=Lr(u(Nr("\0\0\0\0\0\0\0\0"+i+c))),l=[];for(n=0;n>8*a-s&255;for(d[0]&=~p,n=0;nn)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var o=nn(i.replace(/^1f+00/,""));if(0==o.length)return!1;var s=o[0];return o[1]==function t(e){return Sr.crypto.Util.hashString(e,s)}(t)},Me.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=Oe(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=nn(this.doPublic(r).toString(16).replace(/^1f+00/,""));if(0==n.length)return!1;n[0];return n[1]==t},Me.prototype.verifyPSS=function(t,e,r,n){var i=function t(e){return Sr.crypto.Util.hashHex(e,r)}(Nr(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(i,e,r,n)},Me.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new w(e,16),s=function t(e){return Sr.crypto.Util.hashHex(e,r)},a=Lr(t),u=a.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=h-u-2;else if(n<-2)throw new Error("invalid salt length");if(h>8*h-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error("bits beyond keysize not zero");var p=rn(g,f.length,s),v=[];for(i=0;i0)&&-1==(":"+r.join(":")+":").indexOf(":"+v+":"))throw"algorithm '"+v+"' not accepted in the list";if("none"!=v&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=tn.getKey(e)),!("RS"!=y&&"PS"!=y||e instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==y&&!(e instanceof u))throw"key shall be a ECDSA obj for ES* algs";var m=null;if(void 0===o.jwsalg2sigalg[p.alg])throw"unsupported alg name: "+v;if("none"==(m=o.jwsalg2sigalg[v]))throw"not supported";if("Hmac"==m.substr(0,4)){if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var _=new c({alg:m,pass:e});return _.updateString(f),d==_.doFinal()}if(-1!=m.indexOf("withECDSA")){var S,b=null;try{b=u.concatSigToASN1Sig(d)}catch(t){return!1}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(b)}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(d)},Sr.jws.JWS.parse=function(t){var e,r,n,i=t.split("."),o={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[0],r=i[1],3==i.length&&(n=i[2]),o.headerObj=Sr.jws.JWS.readSafeJSONString(wr(e)),o.payloadObj=Sr.jws.JWS.readSafeJSONString(wr(r)),o.headerPP=JSON.stringify(o.headerObj,null," "),null==o.payloadObj?o.payloadPP=wr(r):o.payloadPP=JSON.stringify(o.payloadObj,null," "),void 0!==n&&(o.sigHex=Rr(n)),o},Sr.jws.JWS.verifyJWT=function(t,e,r){var n=Sr.jws,i=n.JWS,o=i.readSafeJSONString,s=i.inArray,a=i.includedArray,u=t.split("."),c=u[0],h=u[1],l=(Rr(u[2]),o(wr(c))),f=o(wr(h));if(void 0===l.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!s(l.alg,r.alg))return!1;if(void 0!==f.iss&&"object"===g(r.iss)&&!s(f.iss,r.iss))return!1;if(void 0!==f.sub&&"object"===g(r.sub)&&!s(f.sub,r.sub))return!1;if(void 0!==f.aud&&"object"===g(r.aud))if("string"==typeof f.aud){if(!s(f.aud,r.aud))return!1}else if("object"==g(f.aud)&&!a(f.aud,r.aud))return!1;var d=n.IntDate.getNow();return void 0!==r.verifyAt&&"number"==typeof r.verifyAt&&(d=r.verifyAt),void 0!==r.gracePeriod&&"number"==typeof r.gracePeriod||(r.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+r.gracePeriodr.length&&(n=r.length);for(var i=0;i - * @license MIT - */ -var n=r(30),i=r(31),o=r(32);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return K(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return q(t).length;default:if(n)return K(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return A(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var l=!0,f=0;fi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function f(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n0&&(r=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(r+=" ... ")),""},u.prototype.compare=function t(e,r,n,i,o){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(n>>>=0)-(r>>>=0),c=Math.min(s,a),h=this.slice(i,o),l=e.slice(r,n),f=0;fo)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return _(this,e,r,n);case"utf8":case"utf-8":return S(this,e,r,n);case"ascii":return b(this,e,r,n);case"latin1":case"binary":return w(this,e,r,n);case"base64":return F(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function U(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function O(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(t,e,r,n,o){return o||O(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return o||O(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function t(e,r){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(r=void 0===r?i:~~r)<0?(r+=i)<0&&(r=0):r>i&&(r=i),r0&&(o*=256);)i+=this[e+--r]*o;return i},u.prototype.readUInt8=function t(e,r){return r||L(e,1,this.length),this[e]},u.prototype.readUInt16LE=function t(e,r){return r||L(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function t(e,r){return r||L(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function t(e,r){return r||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function t(e,r){return r||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=this[e],o=1,s=0;++s=(o*=128)&&(i-=Math.pow(2,8*r)),i},u.prototype.readIntBE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*r)),s},u.prototype.readInt8=function t(e,r){return r||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function t(e,r){r||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function t(e,r){r||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function t(e,r){return r||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function t(e,r){return r||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function t(e,r,n,i){(e=+e,r|=0,n|=0,i)||N(this,e,r,n,Math.pow(2,8*n)-1,0);var o=1,s=0;for(this[r]=255&e;++s=0&&(s*=256);)this[r+o]=e/s&255;return r+n},u.prototype.writeUInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},u.prototype.writeUInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeUInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeUInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):B(this,e,r,!0),r+4},u.prototype.writeUInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeIntLE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&e;++s>0)-u&255;return r+n},u.prototype.writeIntBE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&e;--s>=0&&(a*=256);)e<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(e/a>>0)-u&255;return r+n},u.prototype.writeInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},u.prototype.writeInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):B(this,e,r,!0),r+4},u.prototype.writeInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeFloatLE=function t(e,r,n){return j(this,e,r,!0,n)},u.prototype.writeFloatBE=function t(e,r,n){return j(this,e,r,!1,n)},u.prototype.writeDoubleLE=function t(e,r,n){return M(this,e,r,!0,n)},u.prototype.writeDoubleBE=function t(e,r,n){return M(this,e,r,!1,n)},u.prototype.copy=function t(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r=0;--o)e[o+r]=this[o+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=r;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(t){return n.toByteArray(function e(t){if((t=function e(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function J(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(29))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function n(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function i(t){var e,r,n=f(t),i=n[0],o=n[1],s=new u(function c(t,e,r){return 3*(e+r)/4-r}(0,i,o)),h=0,l=o>0?i-4:i;for(r=0;r>16&255,s[h++]=e>>8&255,s[h++]=255&e;2===o&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,s[h++]=255&e);1===o&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,s[h++]=e>>8&255,s[h++]=255&e);return s},e.fromByteArray=function o(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,u=r-n;au?u:a+o));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+"="));return i.join("")};for(var s=[],a=[],u="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,l=c.length;h0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function g(t,e,r){for(var n,i,o=[],a=e;a>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(t,e){ -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,h=-7,l=r?i-1:0,f=r?-1:1,g=t[e+l];for(l+=f,o=g&(1<<-h)-1,g>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,n),o-=c}return(g?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,h=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,d=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+g]=255&a,g+=d,a/=256,i-=8);for(s=s<0;t[r+g]=255&s,g+=d,s/=256,c-=8);t[r+g-d]|=128*p}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function n(t){var e=t.jws,r=t.KeyUtil,n=t.X509,o=t.crypto,s=t.hextob64u,a=t.b64tohex,u=t.AllowedSigningAlgs;return function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.parseJwt=function t(r){i.Log.debug("JoseUtil.parseJwt");try{var n=e.JWS.parse(r);return{header:n.headerObj,payload:n.payloadObj}}catch(t){i.Log.error(t)}},t.validateJwt=function e(o,s,u,c,h,l,f){i.Log.debug("JoseUtil.validateJwt");try{if("RSA"===s.kty)if(s.e&&s.n)s=r.getKey(s);else{if(!s.x5c||!s.x5c.length)return i.Log.error("JoseUtil.validateJwt: RSA key missing key material",s),Promise.reject(new Error("RSA key missing key material"));var g=a(s.x5c[0]);s=n.getPublicKeyFromCertHex(g)}else{if("EC"!==s.kty)return i.Log.error("JoseUtil.validateJwt: Unsupported key type",s&&s.kty),Promise.reject(new Error(s.kty));if(!(s.crv&&s.x&&s.y))return i.Log.error("JoseUtil.validateJwt: EC key missing key material",s),Promise.reject(new Error("EC key missing key material"));s=r.getKey(s)}return t._validateJwt(o,s,u,c,h,l,f)}catch(t){return i.Log.error(t&&t.message||t),Promise.reject("JWT validation failed")}},t.validateJwtAttributes=function e(r,n,o,s,a,u){s||(s=0),a||(a=parseInt(Date.now()/1e3));var c=t.parseJwt(r).payload;if(!c.iss)return i.Log.error("JoseUtil._validateJwt: issuer was not provided"),Promise.reject(new Error("issuer was not provided"));if(c.iss!==n)return i.Log.error("JoseUtil._validateJwt: Invalid issuer in token",c.iss),Promise.reject(new Error("Invalid issuer in token: "+c.iss));if(!c.aud)return i.Log.error("JoseUtil._validateJwt: aud was not provided"),Promise.reject(new Error("aud was not provided"));if(!(c.aud===o||Array.isArray(c.aud)&&c.aud.indexOf(o)>=0))return i.Log.error("JoseUtil._validateJwt: Invalid audience in token",c.aud),Promise.reject(new Error("Invalid audience in token: "+c.aud));if(c.azp&&c.azp!==o)return i.Log.error("JoseUtil._validateJwt: Invalid azp in token",c.azp),Promise.reject(new Error("Invalid azp in token: "+c.azp));if(!u){var h=a+s,l=a-s;if(!c.iat)return i.Log.error("JoseUtil._validateJwt: iat was not provided"),Promise.reject(new Error("iat was not provided"));if(h1&&void 0!==arguments[1]?arguments[1]:"#";o(this,t);var n=i.UrlUtility.parseUrlFragment(e,r);this.error=n.error,this.error_description=n.error_description,this.error_uri=n.error_uri,this.code=n.code,this.state=n.state,this.id_token=n.id_token,this.session_state=n.session_state,this.access_token=n.access_token,this.token_type=n.token_type,this.scope=n.scope,this.profile=void 0,this.expires_in=n.expires_in}return n(t,[{key:"expires_in",get:function t(){if(this.expires_at){var e=parseInt(Date.now()/1e3);return this.expires_at-e}},set:function t(e){var r=parseInt(e);if("number"==typeof r&&r>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+r}}},{key:"expired",get:function t(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:"scopes",get:function t(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function t(){return this.scopes.indexOf("openid")>=0||!!this.id_token}}]),t}()},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SignoutRequest=void 0;var n=r(0),i=r(3),o=r(9);e.SignoutRequest=function t(e){var r=e.url,s=e.id_token_hint,a=e.post_logout_redirect_uri,u=e.data,c=e.extraQueryParams,h=e.request_type;if(function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!r)throw n.Log.error("SignoutRequest.ctor: No url passed"),new Error("url");for(var f in s&&(r=i.UrlUtility.addQueryParam(r,"id_token_hint",s)),a&&(r=i.UrlUtility.addQueryParam(r,"post_logout_redirect_uri",a),u&&(this.state=new o.State({data:u,request_type:h}),r=i.UrlUtility.addQueryParam(r,"state",this.state.id))),c)r=i.UrlUtility.addQueryParam(r,f,c[f]);this.url=r}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SignoutResponse=void 0;var n=r(3);e.SignoutResponse=function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var i=n.UrlUtility.parseUrlFragment(e,"?");this.error=i.error,this.error_description=i.error_description,this.error_uri=i.error_uri,this.state=i.state}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.InMemoryWebStorage=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.TokenRevocationClient,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:g.TokenClient,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:d.JoseUtil;p(this,e),r instanceof s.UserManagerSettings||(r=new s.UserManagerSettings(r));var m=v(this,t.call(this,r));return m._events=new u.UserManagerEvents(r),m._silentRenewService=new n(m),m.settings.automaticSilentRenew&&(i.Log.debug("UserManager.ctor: automaticSilentRenew is configured, setting up silent renew"),m.startSilentRenew()),m.settings.monitorSession&&(i.Log.debug("UserManager.ctor: monitorSession is configured, setting up session monitor"),m._sessionMonitor=new o(m)),m._tokenRevocationClient=new a(m._settings),m._tokenClient=new l(m._settings),m._joseUtil=y,m}return function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUser=function t(){var e=this;return this._loadUser().then((function(t){return t?(i.Log.info("UserManager.getUser: user loaded"),e._events.load(t,!1),t):(i.Log.info("UserManager.getUser: user not found in storage"),null)}))},e.prototype.removeUser=function t(){var e=this;return this.storeUser(null).then((function(){i.Log.info("UserManager.removeUser: user removed from storage"),e._events.unload()}))},e.prototype.signinRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="si:r";var r={useReplaceToNavigate:e.useReplaceToNavigate};return this._signinStart(e,this._redirectNavigator,r).then((function(){i.Log.info("UserManager.signinRedirect: successful")}))},e.prototype.signinRedirectCallback=function t(e){return this._signinEnd(e||this._redirectNavigator.url).then((function(t){return t.profile&&t.profile.sub?i.Log.info("UserManager.signinRedirectCallback: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinRedirectCallback: no sub"),t}))},e.prototype.signinPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="si:p";var r=e.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.display="popup",this._signin(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinPopup: signinPopup successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinPopup: no sub")),t}))):(i.Log.error("UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured"),Promise.reject(new Error("No popup_redirect_uri or redirect_uri configured")))},e.prototype.signinPopupCallback=function t(e){return this._signinCallback(e,this._popupNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinPopupCallback: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinPopupCallback: no sub")),t})).catch((function(t){i.Log.error(t.message)}))},e.prototype.signinSilent=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r=Object.assign({},r),this._loadUser().then((function(t){return t&&t.refresh_token?(r.refresh_token=t.refresh_token,e._useRefreshToken(r)):(r.request_type="si:s",r.id_token_hint=r.id_token_hint||e.settings.includeIdTokenInSilentRenew&&t&&t.id_token,t&&e._settings.validateSubOnSilentRenew&&(i.Log.debug("UserManager.signinSilent, subject prior to silent renew: ",t.profile.sub),r.current_sub=t.profile.sub),e._signinSilentIframe(r))}))},e.prototype._useRefreshToken=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(r).then((function(t){return t?t.access_token?e._loadUser().then((function(r){if(r){var n=Promise.resolve();return t.id_token&&(n=e._validateIdTokenFromTokenRefreshToken(r.profile,t.id_token)),n.then((function(){return i.Log.debug("UserManager._useRefreshToken: refresh token response success"),r.id_token=t.id_token||r.id_token,r.access_token=t.access_token,r.refresh_token=t.refresh_token||r.refresh_token,r.expires_in=t.expires_in,e.storeUser(r).then((function(){return e._events.load(r),r}))}))}return null})):(i.Log.error("UserManager._useRefreshToken: No access token returned from token endpoint"),Promise.reject("No access token returned from token endpoint")):(i.Log.error("UserManager._useRefreshToken: No response returned from token endpoint"),Promise.reject("No response returned from token endpoint"))}))},e.prototype._validateIdTokenFromTokenRefreshToken=function t(e,r){var n=this;return this._metadataService.getIssuer().then((function(t){return n.settings.getEpochTime().then((function(o){return n._joseUtil.validateJwtAttributes(r,t,n._settings.client_id,n._settings.clockSkew,o).then((function(t){return t?t.sub!==e.sub?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub"),Promise.reject(new Error("sub in id_token does not match current sub"))):t.auth_time&&t.auth_time!==e.auth_time?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time"),Promise.reject(new Error("auth_time in id_token does not match original auth_time"))):t.azp&&t.azp!==e.azp?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp"),Promise.reject(new Error("azp in id_token does not match original azp"))):!t.azp&&e.azp?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token"),Promise.reject(new Error("azp not in id_token, but present in original id_token"))):void 0:(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token"),Promise.reject(new Error("Failed to validate id_token")))}))}))}))},e.prototype._signinSilentIframe=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.prompt=e.prompt||"none",this._signin(e,this._iframeNavigator,{startUrl:r,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinSilent: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinSilent: no sub")),t}))):(i.Log.error("UserManager.signinSilent: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype.signinSilentCallback=function t(e){return this._signinCallback(e,this._iframeNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info("UserManager.signinSilentCallback: successful, signed in sub: ",t.profile.sub):i.Log.info("UserManager.signinSilentCallback: no sub")),t}))},e.prototype.signinCallback=function t(e){var r=this;return this.readSigninResponseState(e).then((function(t){var n=t.state;t.response;return"si:r"===n.request_type?r.signinRedirectCallback(e):"si:p"===n.request_type?r.signinPopupCallback(e):"si:s"===n.request_type?r.signinSilentCallback(e):Promise.reject(new Error("invalid response_type in state"))}))},e.prototype.signoutCallback=function t(e,r){var n=this;return this.readSignoutResponseState(e).then((function(t){var i=t.state,o=t.response;return i?"so:r"===i.request_type?n.signoutRedirectCallback(e):"so:p"===i.request_type?n.signoutPopupCallback(e,r):Promise.reject(new Error("invalid response_type in state")):o}))},e.prototype.querySessionStatus=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).request_type="si:s";var n=r.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return n?(r.redirect_uri=n,r.prompt="none",r.response_type=r.response_type||this.settings.query_status_response_type,r.scope=r.scope||"openid",r.skipUserInfo=!0,this._signinStart(r,this._iframeNavigator,{startUrl:n,silentRequestTimeout:r.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return e.processSigninResponse(t.url).then((function(t){if(i.Log.debug("UserManager.querySessionStatus: got signin response"),t.session_state&&t.profile.sub)return i.Log.info("UserManager.querySessionStatus: querySessionStatus success for sub: ",t.profile.sub),{session_state:t.session_state,sub:t.profile.sub,sid:t.profile.sid};i.Log.info("querySessionStatus successful, user not authenticated")})).catch((function(t){if(t.session_state&&e.settings.monitorAnonymousSession&&("login_required"==t.message||"consent_required"==t.message||"interaction_required"==t.message||"account_selection_required"==t.message))return i.Log.info("UserManager.querySessionStatus: querySessionStatus success for anonymous user"),{session_state:t.session_state};throw t}))}))):(i.Log.error("UserManager.querySessionStatus: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype._signin=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(e,r,i).then((function(t){return n._signinEnd(t.url,e)}))},e.prototype._signinStart=function t(e,r){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.prepare(o).then((function(t){return i.Log.debug("UserManager._signinStart: got navigator window handle"),n.createSigninRequest(e).then((function(e){return i.Log.debug("UserManager._signinStart: got signin request"),o.url=e.url,o.id=e.state.id,t.navigate(o)})).catch((function(e){throw t.close&&(i.Log.debug("UserManager._signinStart: Error after preparing navigator, closing navigator window"),t.close()),e}))}))},e.prototype._signinEnd=function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.processSigninResponse(e).then((function(t){i.Log.debug("UserManager._signinEnd: got signin response");var e=new a.User(t);if(n.current_sub){if(n.current_sub!==e.profile.sub)return i.Log.debug("UserManager._signinEnd: current user does not match user returned from signin. sub from signin: ",e.profile.sub),Promise.reject(new Error("login_required"));i.Log.debug("UserManager._signinEnd: current user matches user returned from signin")}return r.storeUser(e).then((function(){return i.Log.debug("UserManager._signinEnd: user stored"),r._events.load(e),e}))}))},e.prototype._signinCallback=function t(e,r){i.Log.debug("UserManager._signinCallback");var n="query"===this._settings.response_mode||!this._settings.response_mode&&l.SigninRequest.isCode(this._settings.response_type)?"?":"#";return r.callback(e,void 0,n)},e.prototype.signoutRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="so:r";var r=e.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;r&&(e.post_logout_redirect_uri=r);var n={useReplaceToNavigate:e.useReplaceToNavigate};return this._signoutStart(e,this._redirectNavigator,n).then((function(){i.Log.info("UserManager.signoutRedirect: successful")}))},e.prototype.signoutRedirectCallback=function t(e){return this._signoutEnd(e||this._redirectNavigator.url).then((function(t){return i.Log.info("UserManager.signoutRedirectCallback: successful"),t}))},e.prototype.signoutPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="so:p";var r=e.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return e.post_logout_redirect_uri=r,e.display="popup",e.post_logout_redirect_uri&&(e.state=e.state||{}),this._signout(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){i.Log.info("UserManager.signoutPopup: successful")}))},e.prototype.signoutPopupCallback=function t(e,r){void 0===r&&"boolean"==typeof e&&(r=e,e=null);return this._popupNavigator.callback(e,r,"?").then((function(){i.Log.info("UserManager.signoutPopupCallback: successful")}))},e.prototype._signout=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(e,r,i).then((function(t){return n._signoutEnd(t.url)}))},e.prototype._signoutStart=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this,n=arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.prepare(o).then((function(t){return i.Log.debug("UserManager._signoutStart: got navigator window handle"),r._loadUser().then((function(n){return i.Log.debug("UserManager._signoutStart: loaded current user from storage"),(r._settings.revokeAccessTokenOnSignout?r._revokeInternal(n):Promise.resolve()).then((function(){var s=e.id_token_hint||n&&n.id_token;return s&&(i.Log.debug("UserManager._signoutStart: Setting id_token into signout request"),e.id_token_hint=s),r.removeUser().then((function(){return i.Log.debug("UserManager._signoutStart: user removed, creating signout request"),r.createSignoutRequest(e).then((function(e){return i.Log.debug("UserManager._signoutStart: got signout request"),o.url=e.url,e.state&&(o.id=e.state.id),t.navigate(o)}))}))}))})).catch((function(e){throw t.close&&(i.Log.debug("UserManager._signoutStart: Error after preparing navigator, closing navigator window"),t.close()),e}))}))},e.prototype._signoutEnd=function t(e){return this.processSignoutResponse(e).then((function(t){return i.Log.debug("UserManager._signoutEnd: got signout response"),t}))},e.prototype.revokeAccessToken=function t(){var e=this;return this._loadUser().then((function(t){return e._revokeInternal(t,!0).then((function(r){if(r)return i.Log.debug("UserManager.revokeAccessToken: removing token properties from user and re-storing"),t.access_token=null,t.refresh_token=null,t.expires_at=null,t.token_type=null,e.storeUser(t).then((function(){i.Log.debug("UserManager.revokeAccessToken: user stored"),e._events.load(t)}))}))})).then((function(){i.Log.info("UserManager.revokeAccessToken: access token revoked successfully")}))},e.prototype._revokeInternal=function t(e,r){var n=this;if(e){var o=e.access_token,s=e.refresh_token;return this._revokeAccessTokenInternal(o,r).then((function(t){return n._revokeRefreshTokenInternal(s,r).then((function(e){return t||e||i.Log.debug("UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format"),t||e}))}))}return Promise.resolve(!1)},e.prototype._revokeAccessTokenInternal=function t(e,r){return!e||e.indexOf(".")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(e,r).then((function(){return!0}))},e.prototype._revokeRefreshTokenInternal=function t(e,r){return e?this._tokenRevocationClient.revoke(e,r,"refresh_token").then((function(){return!0})):Promise.resolve(!1)},e.prototype.startSilentRenew=function t(){this._silentRenewService.start()},e.prototype.stopSilentRenew=function t(){this._silentRenewService.stop()},e.prototype._loadUser=function t(){return this._userStore.get(this._userStoreKey).then((function(t){return t?(i.Log.debug("UserManager._loadUser: user storageString loaded"),a.User.fromStorageString(t)):(i.Log.debug("UserManager._loadUser: no user storageString"),null)}))},e.prototype.storeUser=function t(e){if(e){i.Log.debug("UserManager.storeUser: storing user");var r=e.toStorageString();return this._userStore.set(this._userStoreKey,r)}return i.Log.debug("storeUser.storeUser: removing user"),this._userStore.remove(this._userStoreKey)},n(e,[{key:"_redirectNavigator",get:function t(){return this.settings.redirectNavigator}},{key:"_popupNavigator",get:function t(){return this.settings.popupNavigator}},{key:"_iframeNavigator",get:function t(){return this.settings.iframeNavigator}},{key:"_userStore",get:function t(){return this.settings.userStore}},{key:"events",get:function t(){return this._events}},{key:"_userStoreKey",get:function t(){return"user:"+this.settings.authority+":"+this.settings.client_id}}]),e}(o.OidcClient)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.UserManagerSettings=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=r.popup_redirect_uri,i=r.popup_post_logout_redirect_uri,g=r.popupWindowFeatures,d=r.popupWindowTarget,p=r.silent_redirect_uri,v=r.silentRequestTimeout,y=r.automaticSilentRenew,m=void 0!==y&&y,_=r.validateSubOnSilentRenew,S=void 0!==_&&_,b=r.includeIdTokenInSilentRenew,w=void 0===b||b,F=r.monitorSession,E=void 0===F||F,x=r.monitorAnonymousSession,A=void 0!==x&&x,k=r.checkSessionInterval,P=void 0===k?2e3:k,C=r.stopCheckSessionOnError,T=void 0===C||C,R=r.query_status_response_type,I=r.revokeAccessTokenOnSignout,D=void 0!==I&&I,L=r.accessTokenExpiringNotificationTime,N=void 0===L?60:L,U=r.redirectNavigator,B=void 0===U?new o.RedirectNavigator:U,O=r.popupNavigator,j=void 0===O?new s.PopupNavigator:O,M=r.iframeNavigator,H=void 0===M?new a.IFrameNavigator:M,V=r.userStore,K=void 0===V?new u.WebStorageStateStore({store:c.Global.sessionStorage}):V;l(this,e);var q=f(this,t.call(this,arguments[0]));return q._popup_redirect_uri=n,q._popup_post_logout_redirect_uri=i,q._popupWindowFeatures=g,q._popupWindowTarget=d,q._silent_redirect_uri=p,q._silentRequestTimeout=v,q._automaticSilentRenew=m,q._validateSubOnSilentRenew=S,q._includeIdTokenInSilentRenew=w,q._accessTokenExpiringNotificationTime=N,q._monitorSession=E,q._monitorAnonymousSession=A,q._checkSessionInterval=P,q._stopCheckSessionOnError=T,R?q._query_status_response_type=R:arguments[0]&&arguments[0].response_type?q._query_status_response_type=h.SigninRequest.isOidc(arguments[0].response_type)?"id_token":"code":q._query_status_response_type="id_token",q._revokeAccessTokenOnSignout=D,q._redirectNavigator=B,q._popupNavigator=j,q._iframeNavigator=H,q._userStore=K,q}return function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),n(e,[{key:"popup_redirect_uri",get:function t(){return this._popup_redirect_uri}},{key:"popup_post_logout_redirect_uri",get:function t(){return this._popup_post_logout_redirect_uri}},{key:"popupWindowFeatures",get:function t(){return this._popupWindowFeatures}},{key:"popupWindowTarget",get:function t(){return this._popupWindowTarget}},{key:"silent_redirect_uri",get:function t(){return this._silent_redirect_uri}},{key:"silentRequestTimeout",get:function t(){return this._silentRequestTimeout}},{key:"automaticSilentRenew",get:function t(){return this._automaticSilentRenew}},{key:"validateSubOnSilentRenew",get:function t(){return this._validateSubOnSilentRenew}},{key:"includeIdTokenInSilentRenew",get:function t(){return this._includeIdTokenInSilentRenew}},{key:"accessTokenExpiringNotificationTime",get:function t(){return this._accessTokenExpiringNotificationTime}},{key:"monitorSession",get:function t(){return this._monitorSession}},{key:"monitorAnonymousSession",get:function t(){return this._monitorAnonymousSession}},{key:"checkSessionInterval",get:function t(){return this._checkSessionInterval}},{key:"stopCheckSessionOnError",get:function t(){return this._stopCheckSessionOnError}},{key:"query_status_response_type",get:function t(){return this._query_status_response_type}},{key:"revokeAccessTokenOnSignout",get:function t(){return this._revokeAccessTokenOnSignout}},{key:"redirectNavigator",get:function t(){return this._redirectNavigator}},{key:"popupNavigator",get:function t(){return this._popupNavigator}},{key:"iframeNavigator",get:function t(){return this._iframeNavigator}},{key:"userStore",get:function t(){return this._userStore}}]),e}(i.OidcClientSettings)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RedirectNavigator=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1])||arguments[1];n.Log.debug("UserManagerEvents.load"),t.prototype.load.call(this,r),i&&this._userLoaded.raise(r)},e.prototype.unload=function e(){n.Log.debug("UserManagerEvents.unload"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function t(e){this._userLoaded.addHandler(e)},e.prototype.removeUserLoaded=function t(e){this._userLoaded.removeHandler(e)},e.prototype.addUserUnloaded=function t(e){this._userUnloaded.addHandler(e)},e.prototype.removeUserUnloaded=function t(e){this._userUnloaded.removeHandler(e)},e.prototype.addSilentRenewError=function t(e){this._silentRenewError.addHandler(e)},e.prototype.removeSilentRenewError=function t(e){this._silentRenewError.removeHandler(e)},e.prototype._raiseSilentRenewError=function t(e){n.Log.debug("UserManagerEvents._raiseSilentRenewError",e.message),this._silentRenewError.raise(e)},e.prototype.addUserSignedIn=function t(e){this._userSignedIn.addHandler(e)},e.prototype.removeUserSignedIn=function t(e){this._userSignedIn.removeHandler(e)},e.prototype._raiseUserSignedIn=function t(){n.Log.debug("UserManagerEvents._raiseUserSignedIn"),this._userSignedIn.raise()},e.prototype.addUserSignedOut=function t(e){this._userSignedOut.addHandler(e)},e.prototype.removeUserSignedOut=function t(e){this._userSignedOut.removeHandler(e)},e.prototype._raiseUserSignedOut=function t(){n.Log.debug("UserManagerEvents._raiseUserSignedOut"),this._userSignedOut.raise()},e.prototype.addUserSessionChanged=function t(e){this._userSessionChanged.addHandler(e)},e.prototype.removeUserSessionChanged=function t(e){this._userSessionChanged.removeHandler(e)},e.prototype._raiseUserSessionChanged=function t(){n.Log.debug("UserManagerEvents._raiseUserSessionChanged"),this._userSessionChanged.raise()},e}(i.AccessTokenEvents)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Timer=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;a(this,e);var s=u(this,t.call(this,r));return s._timer=n,s._nowFunc=i||function(){return Date.now()/1e3},s}return function r(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.init=function t(e){e<=0&&(e=1),e=parseInt(e);var r=this.now+e;if(this.expiration===r&&this._timerHandle)i.Log.debug("Timer.init timer "+this._name+" skipping initialization since already initialized for expiration:",this.expiration);else{this.cancel(),i.Log.debug("Timer.init timer "+this._name+" for duration:",e),this._expiration=r;var n=5;e { - var _a, _b; - // In order to get a clean start, make sure that the session is logged out - // on login. - // But we may want to preserve our client application info, particularly if - // we used Dynamic Client Registration to register (since we don't - // necessarily want the user to have to register this app each time they - // login). - await this.sessionInfoManager.clear(options.sessionId); - // In the case of the user hitting the 'back' button in their browser, they - // could return to a previous redirect URL that contains OIDC params that - // are now longer valid. To be safe, strip relevant params now. - // If the user is providing a redirect IRI, it should not be modified, so - // normalization only applies if we default to the current location (which is - // a bad practice and should be discouraged). - const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : oidcClientExt.normalizeCallbackUrl(window.location.href); - if (!solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) { - throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`); - } - await this.loginHandler.handle({ - ...options, - redirectUrl, - // If no clientName is provided, the clientId may be used instead. - clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId, - eventEmitter, - }); - }; - // Collects session information from storage, and returns them. Returns null - // if the expected information cannot be found. - // Note that the ID token is not stored, which means the session information - // cannot be validated at this point. - this.validateCurrentSession = async (currentSessionId) => { - const sessionInfo = await this.sessionInfoManager.get(currentSessionId); - if (sessionInfo === undefined || - sessionInfo.clientAppId === undefined || - sessionInfo.issuer === undefined) { - return null; - } - return sessionInfo; - }; - this.handleIncomingRedirect = async (url, eventEmitter) => { - try { - const redirectInfo = await this.redirectHandler.handle(url, eventEmitter); - // The `FallbackRedirectHandler` directly returns the global `fetch` for - // his value, so we should ensure it's bound to `window` rather than to - // ClientAuthentication, to avoid the following error: - // > 'fetch' called on an object that does not implement interface Window. - this.fetch = redirectInfo.fetch.bind(window); - this.boundLogout = redirectInfo.getLogoutUrl; - // Strip the oauth params: - await this.cleanUrlAfterRedirect(url); - return { - isLoggedIn: redirectInfo.isLoggedIn, - webId: redirectInfo.webId, - sessionId: redirectInfo.sessionId, - expirationDate: redirectInfo.expirationDate, - }; - } - catch (err) { - // Strip the oauth params: - await this.cleanUrlAfterRedirect(url); - // FIXME: EVENTS.ERROR should be errorCode, errorDescription - // - // I'm not sure if "redirect" is a good error code, and in theory `err` - // maybe an Error object and not a string; Maybe we want to just hardcode - // a description instead? - eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, "redirect", err); - return undefined; - } - }; - } - async cleanUrlAfterRedirect(url) { - const cleanedUpUrl = solidClientAuthnCore.removeOpenIdParams(url).href; - // Remove OAuth-specific query params (since the login flow finishes with - // the browser being redirected back with OAuth2 query params (e.g. for - // 'code' and 'state'), and so if the user simply refreshes this page our - // authentication library will be called again with what are now invalid - // query parameters!). - window.history.replaceState(null, "", cleanedUpUrl); - while (window.location.href !== cleanedUpUrl) { - // Poll the current URL every ms. Active polling is required because - // window.history.replaceState is asynchronous, but the associated - // 'popstate' event which should be listened to is only sent on active - // navigation, which we will not have here. - // See https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent - // eslint-disable-next-line no-await-in-loop - await new Promise((resolve) => { - setTimeout(() => resolve(), 1); - }); - } - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function hasIssuer(options) { - return typeof options.oidcIssuer === "string"; -} -function hasRedirectUrl(options) { - return typeof options.redirectUrl === "string"; -} -/** - * @hidden - */ -class OidcLoginHandler { - constructor(storageUtility, oidcHandler, issuerConfigFetcher, clientRegistrar) { - this.storageUtility = storageUtility; - this.oidcHandler = oidcHandler; - this.issuerConfigFetcher = issuerConfigFetcher; - this.clientRegistrar = clientRegistrar; - this.storageUtility = storageUtility; - this.oidcHandler = oidcHandler; - this.issuerConfigFetcher = issuerConfigFetcher; - this.clientRegistrar = clientRegistrar; - } - async canHandle(options) { - return hasIssuer(options) && hasRedirectUrl(options); - } - async handle(options) { - if (!hasIssuer(options)) { - throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(options)}`); - } - if (!hasRedirectUrl(options)) { - throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(options)}`); - } - // Fetch issuer config. - const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer); - const clientRegistration = await solidClientAuthnCore.handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar); - // Construct OIDC Options - const OidcOptions = { - // Note that here, the issuer is not the one from the received options, but - // from the issuer's config. This enforces the canonical URL is used and stored, - // which is also the one present in the ID token, so storing a technically - // valid, but different issuer URL (e.g. using a trailing slash or not) now - // could prevent from validating the ID token later. - issuer: issuerConfig.issuer, - // TODO: differentiate if DPoP should be true - dpop: options.tokenType.toLowerCase() === "dpop", - ...options, - issuerConfiguration: issuerConfig, - client: clientRegistration, - }; - // Call proper OIDC Handler - return this.oidcHandler.handle(OidcOptions); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth - * PKCE: https://tools.ietf.org/html/rfc7636 - */ -class AuthorizationCodeWithPkceOidcHandler extends solidClientAuthnCore.AuthorizationCodeWithPkceOidcHandlerBase { - async handle(oidcLoginOptions) { - var _a; - /* eslint-disable camelcase */ - const oidcOptions = { - authority: oidcLoginOptions.issuer.toString(), - client_id: oidcLoginOptions.client.clientId, - client_secret: oidcLoginOptions.client.clientSecret, - redirect_uri: oidcLoginOptions.redirectUrl.toString(), - post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(), - response_type: "code", - scope: solidClientAuthnCore.DEFAULT_SCOPES, - filterProtocolClaims: true, - // The userinfo endpoint on NSS fails, so disable this for now - // Note that in Solid, information should be retrieved from the - // profile referenced by the WebId. - loadUserInfo: false, - code_verifier: true, - prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : "consent", - }; - /* eslint-enable camelcase */ - const oidcClientLibrary = new oidcClientExt.OidcClient(oidcOptions); - try { - const signingRequest = await oidcClientLibrary.createSigninRequest(); - // Make sure to await the promise before returning so that the error is caught. - return await this.handleRedirect({ - oidcLoginOptions, - // eslint-disable-next-line no-underscore-dangle - state: signingRequest.state._id, - // eslint-disable-next-line no-underscore-dangle - codeVerifier: signingRequest.state._code_verifier, - targetUrl: signingRequest.url.toString(), - }); - } - catch (err) { - // eslint-disable-next-line no-console - console.error(err); - } - // The login is only completed AFTER redirect, so nothing to return here. - return undefined; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const WELL_KNOWN_OPENID_CONFIG = ".well-known/openid-configuration"; -/* eslint-disable camelcase */ -const issuerConfigKeyMap = { - issuer: { - toKey: "issuer", - convertToUrl: true, - }, - authorization_endpoint: { - toKey: "authorizationEndpoint", - convertToUrl: true, - }, - token_endpoint: { - toKey: "tokenEndpoint", - convertToUrl: true, - }, - userinfo_endpoint: { - toKey: "userinfoEndpoint", - convertToUrl: true, - }, - jwks_uri: { - toKey: "jwksUri", - convertToUrl: true, - }, - registration_endpoint: { - toKey: "registrationEndpoint", - convertToUrl: true, - }, - end_session_endpoint: { - toKey: "endSessionEndpoint", - convertToUrl: true, - }, - scopes_supported: { toKey: "scopesSupported" }, - response_types_supported: { toKey: "responseTypesSupported" }, - response_modes_supported: { toKey: "responseModesSupported" }, - grant_types_supported: { toKey: "grantTypesSupported" }, - acr_values_supported: { toKey: "acrValuesSupported" }, - subject_types_supported: { toKey: "subjectTypesSupported" }, - id_token_signing_alg_values_supported: { - toKey: "idTokenSigningAlgValuesSupported", - }, - id_token_encryption_alg_values_supported: { - toKey: "idTokenEncryptionAlgValuesSupported", - }, - id_token_encryption_enc_values_supported: { - toKey: "idTokenEncryptionEncValuesSupported", - }, - userinfo_signing_alg_values_supported: { - toKey: "userinfoSigningAlgValuesSupported", - }, - userinfo_encryption_alg_values_supported: { - toKey: "userinfoEncryptionAlgValuesSupported", - }, - userinfo_encryption_enc_values_supported: { - toKey: "userinfoEncryptionEncValuesSupported", - }, - request_object_signing_alg_values_supported: { - toKey: "requestObjectSigningAlgValuesSupported", - }, - request_object_encryption_alg_values_supported: { - toKey: "requestObjectEncryptionAlgValuesSupported", - }, - request_object_encryption_enc_values_supported: { - toKey: "requestObjectEncryptionEncValuesSupported", - }, - token_endpoint_auth_methods_supported: { - toKey: "tokenEndpointAuthMethodsSupported", - }, - token_endpoint_auth_signing_alg_values_supported: { - toKey: "tokenEndpointAuthSigningAlgValuesSupported", - }, - display_values_supported: { toKey: "displayValuesSupported" }, - claim_types_supported: { toKey: "claimTypesSupported" }, - claims_supported: { toKey: "claimsSupported" }, - service_documentation: { toKey: "serviceDocumentation" }, - claims_locales_supported: { toKey: "claimsLocalesSupported" }, - ui_locales_supported: { toKey: "uiLocalesSupported" }, - claims_parameter_supported: { toKey: "claimsParameterSupported" }, - request_parameter_supported: { toKey: "requestParameterSupported" }, - request_uri_parameter_supported: { toKey: "requestUriParameterSupported" }, - require_request_uri_registration: { toKey: "requireRequestUriRegistration" }, - op_policy_uri: { - toKey: "opPolicyUri", - convertToUrl: true, - }, - op_tos_uri: { - toKey: "opTosUri", - convertToUrl: true, - }, -}; -/* eslint-enable camelcase */ -function processConfig(config) { - const parsedConfig = {}; - Object.keys(config).forEach((key) => { - if (issuerConfigKeyMap[key]) { - // TODO: PMcB55: Validate URL if "issuerConfigKeyMap[key].convertToUrl" - // if (issuerConfigKeyMap[key].convertToUrl) { - // validateUrl(config[key]); - // } - parsedConfig[issuerConfigKeyMap[key].toKey] = config[key]; - } - }); - if (!Array.isArray(parsedConfig.scopesSupported)) { - parsedConfig.scopesSupported = ["openid"]; - } - return parsedConfig; -} -/** - * @hidden - */ -class IssuerConfigFetcher { - constructor(storageUtility) { - this.storageUtility = storageUtility; - this.storageUtility = storageUtility; - } - // This method needs no state (so can be static), and can be exposed to allow - // callers to know where this implementation puts state it needs. - static getLocalStorageKey(issuer) { - return `issuerConfig:${issuer}`; - } - async fetchConfig(issuer) { - let issuerConfig; - const openIdConfigUrl = new URL(WELL_KNOWN_OPENID_CONFIG, - // Make sure to append a slash at issuer URL, so that the .well-known URL - // includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig. - issuer.endsWith("/") ? issuer : `${issuer}/`).href; - const issuerConfigRequestBody = await universalFetch.fetch.call(globalThis, openIdConfigUrl); - // Check the validity of the fetched config - try { - issuerConfig = processConfig(await issuerConfigRequestBody.json()); - } - catch (err) { - throw new solidClientAuthnCore.ConfigurationError(`[${issuer.toString()}] has an invalid configuration: ${err.message}`); - } - // Update store with fetched config - await this.storageUtility.set(IssuerConfigFetcher.getLocalStorageKey(issuer), JSON.stringify(issuerConfig)); - return issuerConfig; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @param sessionId - * @param storage - * @hidden - */ -async function clear(sessionId, storage) { - await solidClientAuthnCore.clear(sessionId, storage); - await oidcClientExt.clearOidcPersistentStorage(); -} -/** - * @hidden - */ -class SessionInfoManager extends solidClientAuthnCore.SessionInfoManagerBase { - async get(sessionId) { - const [isLoggedIn, webId, clientId, clientSecret, redirectUrl, refreshToken, issuer, tokenType,] = await Promise.all([ - this.storageUtility.getForUser(sessionId, "isLoggedIn", { - secure: true, - }), - this.storageUtility.getForUser(sessionId, "webId", { - secure: true, - }), - this.storageUtility.getForUser(sessionId, "clientId", { - secure: false, - }), - this.storageUtility.getForUser(sessionId, "clientSecret", { - secure: false, - }), - this.storageUtility.getForUser(sessionId, "redirectUrl", { - secure: false, - }), - this.storageUtility.getForUser(sessionId, "refreshToken", { - secure: true, - }), - this.storageUtility.getForUser(sessionId, "issuer", { - secure: false, - }), - this.storageUtility.getForUser(sessionId, "tokenType", { - secure: false, - }), - ]); - if (typeof redirectUrl === "string" && !solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) { - // This resolves the issue for people experiencing https://github.com/inrupt/solid-client-authn-js/issues/2891. - // An invalid redirect URL is present in the storage, and the session should - // be cleared to get a fresh start. This will require the user to log back in. - await Promise.all([ - this.storageUtility.deleteAllUserData(sessionId, { secure: false }), - this.storageUtility.deleteAllUserData(sessionId, { secure: true }), - ]); - return undefined; - } - if (tokenType !== undefined && !solidClientAuthnCore.isSupportedTokenType(tokenType)) { - throw new Error(`Tokens of type [${tokenType}] are not supported.`); - } - if (clientId === undefined && - isLoggedIn === undefined && - webId === undefined && - refreshToken === undefined) { - return undefined; - } - return { - sessionId, - webId, - isLoggedIn: isLoggedIn === "true", - redirectUrl, - refreshToken, - issuer, - clientAppId: clientId, - clientAppSecret: clientSecret, - // Default the token type to DPoP if unspecified. - tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : "DPoP", - }; - } - /** - * This function removes all session-related information from storage. - * @param sessionId the session identifier - * @param storage the storage where session info is stored - * @hidden - */ - async clear(sessionId) { - return clear(sessionId, this.storageUtility); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * This class handles redirect IRIs without any query params, and returns an unauthenticated - * session. It serves as a fallback so that consuming libraries don't have to test - * for the query params themselves, and can always try to use them as a redirect IRI. - * @hidden - */ -class FallbackRedirectHandler { - async canHandle(redirectUrl) { - try { - // The next URL object is built for validating it. - // eslint-disable-next-line no-new - new URL(redirectUrl); - return true; - } - catch (e) { - throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`); - } - } - async handle( - // The argument is ignored, but must be present to implement the interface - _redirectUrl) { - return solidClientAuthnCore.getUnauthenticatedSession(); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -// FIXME: The following doesn't work in the browser, it results in all the fetches -// being unauthenticated. This should be looked into when migrating to universal-fetch. -// import { fetch } from "cross-fetch"; -const globalFetch = (...args) => universalFetch.fetch.call(globalThis, ...args); -/** - * @hidden - */ -class AuthCodeRedirectHandler { - constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) { - this.storageUtility = storageUtility; - this.sessionInfoManager = sessionInfoManager; - this.issuerConfigFetcher = issuerConfigFetcher; - this.clientRegistrar = clientRegistrar; - this.tokerRefresher = tokerRefresher; - this.storageUtility = storageUtility; - this.sessionInfoManager = sessionInfoManager; - this.issuerConfigFetcher = issuerConfigFetcher; - this.clientRegistrar = clientRegistrar; - this.tokerRefresher = tokerRefresher; - } - async canHandle(redirectUrl) { - try { - const myUrl = new URL(redirectUrl); - return (myUrl.searchParams.get("code") !== null && - myUrl.searchParams.get("state") !== null); - } - catch (e) { - throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`); - } - } - async handle(redirectUrl, eventEmitter) { - if (!(await this.canHandle(redirectUrl))) { - throw new Error(`AuthCodeRedirectHandler cannot handle [${redirectUrl}]: it is missing one of [code, state].`); - } - const url = new URL(redirectUrl); - const oauthState = url.searchParams.get("state"); - const storedSessionId = (await this.storageUtility.getForUser(oauthState, "sessionId", { - errorIfNull: true, - })); - const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await solidClientAuthnCore.loadOidcContextFromStorage(storedSessionId, this.storageUtility, this.issuerConfigFetcher); - const iss = url.searchParams.get("iss"); - if (typeof iss === "string" && iss !== issuerConfig.issuer) { - throw new Error(`The value of the iss parameter (${iss}) does not match the issuer identifier of the authorization server (${issuerConfig.issuer}). See [rfc9207](https://www.rfc-editor.org/rfc/rfc9207.html#section-2.3-3.1.1)`); - } - if (codeVerifier === undefined) { - throw new Error(`The code verifier for session ${storedSessionId} is missing from storage.`); - } - if (storedRedirectIri === undefined) { - throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`); - } - const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig); - let tokens; - const tokenCreatedAt = Date.now(); - if (isDpop) { - tokens = await oidcClientExt.getDpopToken(issuerConfig, client, { - grantType: "authorization_code", - // We rely on our 'canHandle' function checking that the OAuth 'code' - // parameter is present in our query string. - code: url.searchParams.get("code"), - codeVerifier, - redirectUrl: storedRedirectIri, - }); - // Delete oidc-client-specific session information from storage. This is - // done automatically when retrieving a bearer token, but since the DPoP - // binding uses our custom code, this needs to be done manually. - window.localStorage.removeItem(`oidc.${oauthState}`); - } - else { - tokens = await oidcClientExt.getBearerToken(url.toString()); - } - let refreshOptions; - if (tokens.refreshToken !== undefined) { - refreshOptions = { - sessionId: storedSessionId, - refreshToken: tokens.refreshToken, - tokenRefresher: this.tokerRefresher, - }; - } - const authFetch = await solidClientAuthnCore.buildAuthenticatedFetch(globalFetch, tokens.accessToken, { - dpopKey: tokens.dpopKey, - refreshOptions, - eventEmitter, - expiresIn: tokens.expiresIn, - }); - await this.storageUtility.setForUser(storedSessionId, { - webId: tokens.webId, - isLoggedIn: "true", - }, { secure: true }); - const sessionInfo = await this.sessionInfoManager.get(storedSessionId); - if (!sessionInfo) { - throw new Error(`Could not retrieve session: [${storedSessionId}].`); - } - return Object.assign(sessionInfo, { - fetch: authFetch, - getLogoutUrl: solidClientAuthnCore.maybeBuildRpInitiatedLogout({ - idTokenHint: tokens.idToken, - endSessionEndpoint: issuerConfig.endSessionEndpoint, - }), - expirationDate: typeof tokens.expiresIn === "number" - ? tokenCreatedAt + tokens.expiresIn * 1000 - : undefined, - }); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class AggregateRedirectHandler extends solidClientAuthnCore.AggregateHandler { - constructor(redirectHandlers) { - super(redirectHandlers); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class BrowserStorage { - get storage() { - return window.localStorage; - } - async get(key) { - return this.storage.getItem(key) || undefined; - } - async set(key, value) { - this.storage.setItem(key, value); - } - async delete(key) { - this.storage.removeItem(key); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class Redirector { - redirect(redirectUrl, options) { - if (options && options.handleRedirect) { - options.handleRedirect(redirectUrl); - } - else if (options && options.redirectByReplacingState) { - window.history.replaceState({}, "", redirectUrl); - } - else { - window.location.href = redirectUrl; - } - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class ClientRegistrar { - constructor(storageUtility) { - this.storageUtility = storageUtility; - this.storageUtility = storageUtility; - } - async getClient(options, issuerConfig) { - // If client secret and/or client id are stored in storage, use those. - const [storedClientId, storedClientSecret, - // storedClientName, - ] = await Promise.all([ - this.storageUtility.getForUser(options.sessionId, "clientId", { - secure: false, - }), - this.storageUtility.getForUser(options.sessionId, "clientSecret", { - secure: false, - }), - // this.storageUtility.getForUser(options.sessionId, "clientName", { - // // FIXME: figure out how to persist secure storage at reload - // secure: false, - // }), - ]); - if (storedClientId) { - return { - clientId: storedClientId, - clientSecret: storedClientSecret, - clientType: "dynamic", - }; - } - try { - const registeredClient = await oidcClientExt.registerClient(options, issuerConfig); - // Save info - const infoToSave = { - clientId: registeredClient.clientId, - }; - if (registeredClient.clientSecret) { - infoToSave.clientSecret = registeredClient.clientSecret; - } - if (registeredClient.idTokenSignedResponseAlg) { - infoToSave.idTokenSignedResponseAlg = - registeredClient.idTokenSignedResponseAlg; - } - await this.storageUtility.setForUser(options.sessionId, infoToSave, { - // FIXME: figure out how to persist secure storage at reload - // Otherwise, the client info cannot be retrieved from storage, and - // the lib tries to re-register the client on each fetch - secure: false, - }); - return registeredClient; - } - catch (error) { - throw new Error(`Client registration failed: [${error}]`); - } - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * This class handles redirect IRIs without any query params, and returns an unauthenticated - * session. It serves as a fallback so that consuming libraries don't have to test - * for the query params themselves, and can always try to use them as a redirect IRI. - * @hidden - */ -class ErrorOidcHandler { - async canHandle(redirectUrl) { - try { - // eslint-disable-next-line no-new - return new URL(redirectUrl).searchParams.has("error"); - } - catch (e) { - throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`); - } - } - async handle(redirectUrl, eventEmitter) { - if (eventEmitter !== undefined) { - const url = new URL(redirectUrl); - const errorUrl = url.searchParams.get("error"); - const errorDescriptionUrl = url.searchParams.get("error_description"); - eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, errorUrl, errorDescriptionUrl); - } - return solidClientAuthnCore.getUnauthenticatedSession(); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Some identifiers are not in camelcase on purpose, as they are named using the -// official names from the OIDC/OAuth2 specifications. -/* eslint-disable camelcase */ -/** - * @hidden - */ -class TokenRefresher { - constructor(storageUtility, issuerConfigFetcher, clientRegistrar) { - this.storageUtility = storageUtility; - this.issuerConfigFetcher = issuerConfigFetcher; - this.clientRegistrar = clientRegistrar; - this.storageUtility = storageUtility; - this.issuerConfigFetcher = issuerConfigFetcher; - this.clientRegistrar = clientRegistrar; - } - async refresh(sessionId, refreshToken, dpopKey, eventEmitter) { - const oidcContext = await solidClientAuthnCore.loadOidcContextFromStorage(sessionId, this.storageUtility, this.issuerConfigFetcher); - // This should also retrieve the client from storage - const clientInfo = await this.clientRegistrar.getClient({ sessionId }, oidcContext.issuerConfig); - if (refreshToken === undefined) { - // TODO: in a next PR, look up storage for a refresh token - throw new Error(`Session [${sessionId}] has no refresh token to allow it to refresh its access token.`); - } - if (oidcContext.dpop && dpopKey === undefined) { - throw new Error(`For session [${sessionId}], the key bound to the DPoP access token must be provided to refresh said access token.`); - } - const tokenSet = await oidcClientExt.refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey); - if (tokenSet.refreshToken !== undefined) { - eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(solidClientAuthnCore.EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken); - await this.storageUtility.setForUser(sessionId, { - refreshToken: tokenSet.refreshToken, - }); - } - return tokenSet; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * - * @param dependencies - * @deprecated This function will be removed from the external API in an upcoming release. - */ -function getClientAuthenticationWithDependencies(dependencies) { - const inMemoryStorage = new solidClientAuthnCore.InMemoryStorage(); - const secureStorage = dependencies.secureStorage || inMemoryStorage; - const insecureStorage = dependencies.insecureStorage || new BrowserStorage(); - const storageUtility = new StorageUtilityBrowser(secureStorage, insecureStorage); - const issuerConfigFetcher = new IssuerConfigFetcher(storageUtility); - const clientRegistrar = new ClientRegistrar(storageUtility); - const sessionInfoManager = new SessionInfoManager(storageUtility); - const tokenRefresher = new TokenRefresher(storageUtility, issuerConfigFetcher, clientRegistrar); - const redirector = new Redirector(); - // make new handler for redirect and login - const loginHandler = new OidcLoginHandler(storageUtility, new AuthorizationCodeWithPkceOidcHandler(storageUtility, redirector), issuerConfigFetcher, clientRegistrar); - const redirectHandler = new AggregateRedirectHandler([ - new ErrorOidcHandler(), - new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher), - // This catch-all class will always be able to handle the - // redirect IRI, so it must be registered last. - new FallbackRedirectHandler(), - ]); - return new ClientAuthentication(loginHandler, redirectHandler, new solidClientAuthnCore.IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const KEY_CURRENT_SESSION = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`; -const KEY_CURRENT_URL = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -async function silentlyAuthenticate(sessionId, clientAuthn, session) { - var _a; - const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId); - if (storedSessionInfo !== null) { - // It can be really useful to save the user's current browser location, - // so that we can restore it after completing the silent authentication - // on incoming redirect. This way, the user is eventually redirected back - // to the page they were on and not to the app's redirect page. - window.localStorage.setItem(KEY_CURRENT_URL, window.location.href); - await clientAuthn.login({ - sessionId, - prompt: "none", - oidcIssuer: storedSessionInfo.issuer, - redirectUrl: storedSessionInfo.redirectUrl, - clientId: storedSessionInfo.clientAppId, - clientSecret: storedSessionInfo.clientAppSecret, - tokenType: (_a = storedSessionInfo.tokenType) !== null && _a !== void 0 ? _a : "DPoP", - }, session.events); - return true; - } - return false; -} -function isLoggedIn(sessionInfo) { - return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn); -} -/** - * A {@link Session} object represents a user's session on an application. The session holds state, as it stores information enabling acces to private resources after login for instance. - */ -class Session extends EventEmitter { - /** - * Session object constructor. Typically called as follows: - * - * ```typescript - * const session = new Session(); - * ``` - * - * See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession). - * - * @param sessionOptions The options enabling the correct instantiation of - * the session. Either both storages or clientAuthentication are required. For - * more information, see {@link ISessionOptions}. - * @param sessionId A string uniquely identifying the session. - * - */ - constructor(sessionOptions = {}, sessionId = undefined) { - super(); - this.tokenRequestInProgress = false; - /** - * Triggers the login process. Note that this method will redirect the user away from your app. - * - * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider. - * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by {@linkcode handleIncomingRedirect}. - */ - // Define these functions as properties so that they don't get accidentally re-bound. - // Isn't Javascript fun? - this.login = async (options) => { - var _a; - await this.clientAuthentication.login({ - sessionId: this.info.sessionId, - ...options, - // Defaults the token type to DPoP - tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : "DPoP", - }, this.events); - // `login` redirects the user away from the app, - // so unless it throws an error, there is no code that should run afterwards - // (since there is no "after" in the lifetime of the script). - // Hence, this Promise never resolves: - return new Promise(() => { }); - }; - /** - * Fetches data using available login information. If the user is not logged in, this will behave as a regular `fetch`. The signature of this method is identical to the [canonical `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). - * - * @param url The URL from which data should be fetched. - * @param init Optional parameters customizing the request, by specifying an HTTP method, headers, a body, etc. Follows the [WHATWG Fetch Standard](https://fetch.spec.whatwg.org/). - */ - this.fetch = (url, init) => this.clientAuthentication.fetch(url, init); - /** - * An internal logout function, to control whether or not the logout signal - * should be sent, i.e. if the logout was user-initiated or is the result of - * an external event. - * - * @hidden - */ - this.internalLogout = async (emitSignal, options) => { - // Clearing this value means that silent refresh will no longer be attempted. - // In particular, in the case of a silent authentication error it prevents - // from getting stuck in an authentication retries loop. - window.localStorage.removeItem(KEY_CURRENT_SESSION); - await this.clientAuthentication.logout(this.info.sessionId, options); - this.info.isLoggedIn = false; - if (emitSignal) { - this.events.emit(solidClientAuthnCore.EVENTS.LOGOUT); - } - }; - /** - * Logs the user out of the application. - * - * There are 2 types of logout supported by this library, - * `app` logout and `idp` logout. - * - * App logout will log the user out within the application - * by clearing any session data from the browser. It does - * not log the user out of their Solid identity provider, - * and should not redirect the user away. - * App logout can be performed as follows: - * ```typescript - * await session.logout({ logoutType: 'app' }); - * ``` - * - * IDP logout will log the user out of their Solid identity provider, - * and will redirect the user away from the application to do so. In order - * for users to be redirected back to `postLogoutUrl` you MUST include the - * `postLogoutUrl` value in the `post_logout_redirect_uris` field in the - * [Client ID Document](https://docs.inrupt.com/ess/latest/security/authentication/#client-identifier-client-id). - * IDP logout can be performed as follows: - * ```typescript - * await session.logout({ - * logoutType: 'idp', - * // An optional URL to redirect to after logout has completed; - * // this MUST match a logout URL listed in the Client ID Document - * // of the application that is logged in. - * // If the application is logged in with a Client ID that is not - * // a URI dereferencing to a Client ID Document then users will - * // not be redirected back to the `postLogoutUrl` after logout. - * postLogoutUrl: 'https://example.com/logout', - * // An optional value to be included in the query parameters - * // when the IDP provider redirects the user to the postLogoutRedirectUrl. - * state: "my-state" - * }); - * ``` - */ - this.logout = async (options) => this.internalLogout(true, options); - /** - * Completes the login process by processing the information provided by the - * Solid identity provider through redirect. - * - * @param options See {@see IHandleIncomingRedirectOptions}. - */ - this.handleIncomingRedirect = async (inputOptions = {}) => { - var _a; - if (this.info.isLoggedIn) { - return this.info; - } - if (this.tokenRequestInProgress) { - return undefined; - } - const options = typeof inputOptions === "string" ? { url: inputOptions } : inputOptions; - const url = (_a = options.url) !== null && _a !== void 0 ? _a : window.location.href; - this.tokenRequestInProgress = true; - const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events); - if (isLoggedIn(sessionInfo)) { - this.setSessionInfo(sessionInfo); - const currentUrl = window.localStorage.getItem(KEY_CURRENT_URL); - if (currentUrl === null) { - // The login event can only be triggered **after** the user has been - // redirected from the IdP with access and ID tokens. - this.events.emit(solidClientAuthnCore.EVENTS.LOGIN); - } - else { - // If an URL is stored in local storage, we are being logged in after a - // silent authentication, so remove our currently stored URL location - // to clean up our state now that we are completing the re-login process. - window.localStorage.removeItem(KEY_CURRENT_URL); - this.events.emit(solidClientAuthnCore.EVENTS.SESSION_RESTORED, currentUrl); - } - } - else if (options.restorePreviousSession === true) { - // Silent authentication happens after a refresh, which means there are no - // OAuth params in the current location IRI. It can only succeed if a session - // was previously logged in, in which case its ID will be present with a known - // identifier in local storage. - // Check if we have a locally stored session ID... - const storedSessionId = window.localStorage.getItem(KEY_CURRENT_SESSION); - // ...if not, then there is no ID token, and so silent authentication cannot happen, but - // if we do have a stored session ID, attempt to re-authenticate now silently. - if (storedSessionId !== null) { - const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this); - // At this point, we know that the main window will imminently be redirected. - // However, this redirect is asynchronous and there is no way to halt execution - // until it happens precisely. That's why the current Promise simply does not - // resolve. - if (attemptedSilentAuthentication) { - return new Promise(() => { }); - } - } - } - this.tokenRequestInProgress = false; - return sessionInfo; - }; - // Until Session no longer implements EventEmitter, this.events is just a proxy - // to this (with some interface filtering). When we make the breaking change, - // this.events will be a regular EventEmitter (implementing ISessionEventEmitter): - // this.events = new EventEmitter(); - this.events = new Proxy(this, solidClientAuthnCore.buildProxyHandler(Session.prototype, "events only implements ISessionEventListener")); - if (sessionOptions.clientAuthentication) { - this.clientAuthentication = sessionOptions.clientAuthentication; - } - else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) { - this.clientAuthentication = getClientAuthenticationWithDependencies({ - secureStorage: sessionOptions.secureStorage, - insecureStorage: sessionOptions.insecureStorage, - }); - } - else { - this.clientAuthentication = getClientAuthenticationWithDependencies({}); - } - if (sessionOptions.sessionInfo) { - this.info = { - sessionId: sessionOptions.sessionInfo.sessionId, - isLoggedIn: false, - webId: sessionOptions.sessionInfo.webId, - }; - } - else { - this.info = { - sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : uuid.v4(), - isLoggedIn: false, - }; - } - // When a session is logged in, we want to track its ID in local storage to - // enable silent refresh. The current session ID specifically stored in 'localStorage' - // (as opposed to using our storage abstraction layer) because it is only - // used in a browser-specific mechanism. - this.events.on(solidClientAuthnCore.EVENTS.LOGIN, () => window.localStorage.setItem(KEY_CURRENT_SESSION, this.info.sessionId)); - this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false)); - this.events.on(solidClientAuthnCore.EVENTS.ERROR, () => this.internalLogout(false)); - } - /** - * Register a callback function to be called when a user completes login. - * - * The callback is called when {@link handleIncomingRedirect} completes successfully. - * - * @param callback The function called when a user completes login. - * @deprecated Prefer session.events.on(EVENTS.LOGIN, callback) - */ - onLogin(callback) { - this.events.on(solidClientAuthnCore.EVENTS.LOGIN, callback); - } - /** - * Register a callback function to be called when a user logs out: - * - * @param callback The function called when a user completes logout. - * @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback) - */ - onLogout(callback) { - this.events.on(solidClientAuthnCore.EVENTS.LOGOUT, callback); - } - /** - * Register a callback function to be called when a user logs out: - * - * @param callback The function called when an error occurs. - * @since 1.11.0 - * @deprecated Prefer session.events.on(EVENTS.ERROR, callback) - */ - onError(callback) { - this.events.on(solidClientAuthnCore.EVENTS.ERROR, callback); - } - /** - * Register a callback function to be called when a session is restored. - * - * Note: the callback will be called with the saved value of the 'current URL' - * at the time the session was restored. - * - * @param callback The function called when a user's already logged-in session is restored, e.g., after a silent authentication is completed after a page refresh. - * @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback) - */ - onSessionRestore(callback) { - this.events.on(solidClientAuthnCore.EVENTS.SESSION_RESTORED, callback); - } - /** - * Register a callback that runs when the session expires and can no longer - * make authenticated requests, but following a user logout. - * @param callback The function that runs on session expiration. - * @since 1.11.0 - * @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback) - */ - onSessionExpiration(callback) { - this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, callback); - } - setSessionInfo(sessionInfo) { - this.info.isLoggedIn = sessionInfo.isLoggedIn; - this.info.webId = sessionInfo.webId; - this.info.sessionId = sessionInfo.sessionId; - this.info.expirationDate = sessionInfo.expirationDate; - this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXTENDED, (expiresIn) => { - this.info.expirationDate = Date.now() + expiresIn * 1000; - }); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -let defaultSession; -/** - * Obtain the {@link Session} used when not explicitly instantiating one yourself. - * - * When using the top-level exports {@link fetch}, {@link login}, {@link logout}, - * {@link handleIncomingRedirect}, {@link onLogin} and {@link onLogout}, these apply to an - * implicitly-instantiated {@link Session}. - * This function returns a reference to that Session in order to obtain e.g. the current user's - * WebID. - * @since 1.3.0 - */ -function getDefaultSession() { - if (typeof defaultSession === "undefined") { - defaultSession = new Session(); - } - return defaultSession; -} -/** - * This function's signature is equal to `window.fetch`, but if the current user is authenticated - * (see [[login]] and [[handleIncomingRedirect]]), requests made using it will include that user's - * credentials. If not, this will behave just like the regular `window.fetch`. - * - * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch} - * @since 1.3.0 - */ -/* eslint-disable-next-line no-shadow */ -const fetch = (...args) => { - const session = getDefaultSession(); - return session.fetch(...args); -}; -/** - * Triggers the login process. Note that this method will redirect the user away from your app. - * - * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider. - * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by [[handleIncomingRedirect]]. - * @since 1.3.0 - */ -const login = (...args) => { - const session = getDefaultSession(); - return session.login(...args); -}; -/** - * Logs the user out of the application. - * - * By default this does not log the user out of their Solid identity provider. - * In order to do so, you must set the logoutType to `idp`. For usage details - * see {@link Session.logout}. - * - * @since 1.3.0 - */ -const logout = (...args) => { - const session = getDefaultSession(); - return session.logout(...args); -}; -/** - * Completes the login process by processing the information provided by the Solid identity provider through redirect. - * - * @param url The URL of the page handling the redirect, including the query parameters — these contain the information to process the login. - * @since 1.3.0 - */ -const handleIncomingRedirect = (...args) => { - const session = getDefaultSession(); - return session.handleIncomingRedirect(...args); -}; -/** - * Register a callback function to be called when a user completes login. - * - * The callback is called when {@link handleIncomingRedirect} completes successfully. - * @since 1.3.0 - * - * @param callback The function called when a user completes login. - * @deprecated Prefer events.on(EVENTS.LOGIN, callback) - - */ -const onLogin = (...args) => { - const session = getDefaultSession(); - return session.onLogin(...args); -}; -/** - * Register a callback function to be called when a user logs out: - * - * @param callback The function called when a user completes logout. - * @since 1.3.0 - * @deprecated Prefer events.on(EVENTS.LOGOUT, callback) - * - */ -const onLogout = (...args) => { - const session = getDefaultSession(); - return session.onLogout(...args); -}; -/** - * Register a callback function to be called when a session is restored: - * - * @param callback The function called when a session is restored. - * @since 1.3.0 - * @deprecated Prefer events.on(EVENTS.SESSION_RESTORED, callback) - */ -const onSessionRestore = (...args) => { - const session = getDefaultSession(); - return session.onSessionRestore(...args); -}; -/** - * {@link SessionEventEmitter} instance to subscribe to events by the default session. - * - * @since 1.14.0 - */ -const events = () => { - return getDefaultSession().events; -}; - -Object.defineProperty(exports, "ConfigurationError", ({ - enumerable: true, - get: function () { return solidClientAuthnCore.ConfigurationError; } -})); -Object.defineProperty(exports, "EVENTS", ({ - enumerable: true, - get: function () { return solidClientAuthnCore.EVENTS; } -})); -Object.defineProperty(exports, "InMemoryStorage", ({ - enumerable: true, - get: function () { return solidClientAuthnCore.InMemoryStorage; } -})); -Object.defineProperty(exports, "NotImplementedError", ({ - enumerable: true, - get: function () { return solidClientAuthnCore.NotImplementedError; } -})); -exports.Session = Session; -exports.events = events; -exports.fetch = fetch; -exports.getClientAuthenticationWithDependencies = getClientAuthenticationWithDependencies; -exports.getDefaultSession = getDefaultSession; -exports.handleIncomingRedirect = handleIncomingRedirect; -exports.login = login; -exports.logout = logout; -exports.onLogin = onLogin; -exports.onLogout = onLogout; -exports.onSessionRestore = onSessionRestore; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ "./node_modules/@inrupt/solid-client-authn-core/dist/index.js": -/*!********************************************************************!*\ - !*** ./node_modules/@inrupt/solid-client-authn-core/dist/index.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -var events = __webpack_require__(/*! events */ "./node_modules/events/events.js"); -var universalFetch = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js"); -var jose = __webpack_require__(/*! jose */ "./node_modules/jose/dist/browser/index.js"); -var uuid = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/commonjs-browser/index.js"); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Intended to be used by dependent packages as a common prefix for keys into - * storage mechanisms (so as to group all keys related to Solid Client Authn - * within those storage mechanisms, e.g., window.localStorage). - */ -const SOLID_CLIENT_AUTHN_KEY_PREFIX = "solidClientAuthn:"; -/** - * Ordered list of signature algorithms, from most preferred to least preferred. - */ -const PREFERRED_SIGNING_ALG = ["ES256", "RS256"]; -const EVENTS = { - // Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events. - ERROR: "error", - LOGIN: "login", - LOGOUT: "logout", - NEW_REFRESH_TOKEN: "newRefreshToken", - SESSION_EXPIRED: "sessionExpired", - SESSION_EXTENDED: "sessionExtended", - SESSION_RESTORED: "sessionRestore", - TIMEOUT_SET: "timeoutSet", -}; -/** - * We want to refresh a token 5 seconds before it expires. - */ -const REFRESH_BEFORE_EXPIRATION_SECONDS = 5; -// The openid scope requests an OIDC ID token token to be returned. -const SCOPE_OPENID = "openid"; -// The offline_access scope requests a refresh token to be returned. -const SCOPE_OFFLINE = "offline_access"; -// The webid scope is required as per https://solid.github.io/solid-oidc/#webid-scope -const SCOPE_WEBID = "webid"; -// The scopes are expected as a space-separated list. -const DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(" "); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Temporary internal builder for safe proxying. - */ -const buildProxyHandler = ( -// The class to be excluded needs to be injected, because it is defined in a -// dependency. -// eslint-disable-next-line @typescript-eslint/no-explicit-any -toExclude, errorMessage) => ({ - // This proxy is only a temporary measure until Session no longer extends - // SessionEventEmitter, and the proxying is no longer necessary. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - get(target, prop, receiver) { - // Reject any calls to the proxy that isn't specific to the EventEmitter API - if (!Object.getOwnPropertyNames(events.EventEmitter).includes(prop) && - Object.getOwnPropertyNames(toExclude).includes(prop)) { - throw new Error(`${errorMessage}: [${prop}] is not supported`); - } - return Reflect.get(target, prop, receiver); - }, -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class AggregateHandler { - constructor(handleables) { - this.handleables = handleables; - this.handleables = handleables; - } - /** - * Helper function that will asynchronously determine the proper handler to use. If multiple - * handlers can handle, it will choose the first one in the list - * @param params Paramerters to feed to the handler - */ - async getProperHandler(params) { - // TODO : This function doesn't currently operate as described. Tests need to be written - // return new Promise | null>((resolve, reject) => { - // const resolvedValues: Array = Array(this.handleables.length).map(() => null) - // let numberResolved = 0 - // this.handleables.forEach(async (handleable: IHandleable, index: number) => { - // resolvedValues[index] = await handleable.canHandle(...params) - // numberResolved++ - // let curResolvedValueIndex = 0 - // while ( - // resolvedValues[curResolvedValueIndex] !== null || - // resolvedValues[curResolvedValueIndex] !== undefined - // ) { - // if (resolvedValues[curResolvedValueIndex]) { - // resolve(this.handleables[curResolvedValueIndex]) - // } - // curResolvedValueIndex++ - // } - // }) - // }) - const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params))); - for (let i = 0; i < canHandleList.length; i += 1) { - if (canHandleList[i]) { - return this.handleables[i]; - } - } - return null; - } - async canHandle(...params) { - return (await this.getProperHandler(params)) !== null; - } - async handle(...params) { - const handler = await this.getProperHandler(params); - if (handler) { - return handler.handle(...params); - } - throw new Error(`[${this.constructor.name}] cannot find a suitable handler for: ${params - .map((param) => { - try { - return JSON.stringify(param); - } - catch (err) { - /* eslint-disable @typescript-eslint/no-explicit-any */ - return param.toString(); - } - }) - .join(", ")}`); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// eslint-disable-next-line no-shadow -async function fetchJwks(jwksIri, issuerIri) { - // FIXME: the following line works, but the underlying network calls don't seem - // to be mocked properly by our test code. It would be nicer to replace calls to this - // function by the following line and to fix the mocks. - // const jwks = createRemoteJWKSet(new URL(jwksIri)); - const jwksResponse = await universalFetch.fetch.call(globalThis, jwksIri); - if (jwksResponse.status !== 200) { - throw new Error(`Could not fetch JWKS for [${issuerIri}] at [${jwksIri}]: ${jwksResponse.status} ${jwksResponse.statusText}`); - } - // The JWKS should only contain the current key for the issuer. - let jwk; - try { - jwk = (await jwksResponse.json()).keys[0]; - } - catch (e) { - throw new Error(`Malformed JWKS for [${issuerIri}] at [${jwksIri}]: ${e.message}`); - } - return jwk; -} -/** - * Extract a WebID from an ID token payload based on https://github.com/solid/webid-oidc-spec. - * Note that this does not yet implement the user endpoint lookup, and only checks - * for `webid` or IRI-like `sub` claims. - * - * @param idToken the payload of the ID token from which the WebID can be extracted. - * @returns a WebID extracted from the ID token. - * @internal - */ -async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) { - const jwk = await fetchJwks(jwksIri, issuerIri); - let payload; - try { - const { payload: verifiedPayload } = await jose.jwtVerify(idToken, await jose.importJWK(jwk), { - issuer: issuerIri, - audience: clientId, - }); - payload = verifiedPayload; - } - catch (e) { - throw new Error(`Token verification failed: ${e.stack}`); - } - if (typeof payload.webid === "string") { - return payload.webid; - } - if (typeof payload.sub !== "string") { - throw new Error(`The token ${JSON.stringify(payload)} is invalid: it has no 'webid' claim and no 'sub' claim.`); - } - try { - // This parses the 'sub' claim to check if it is a well-formed IRI. - // However, the normalized value isn't returned to make sure the WebID is returned - // as specified by the Identity Provider. - // eslint-disable-next-line no-new - new URL(payload.sub); - return payload.sub; - } - catch (e) { - throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${payload.sub}] is invalid as a URL - error [${e}].`); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function isValidRedirectUrl(redirectUrl) { - // If the redirect URL is not a valid URL, an error will be thrown. - try { - const urlObject = new URL(redirectUrl); - const noReservedQuery = !urlObject.searchParams.has("code") && - !urlObject.searchParams.has("state"); - // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL - // must not include a hash fragment. - const noHash = urlObject.hash === ""; - return noReservedQuery && noHash; - } - catch (e) { - return false; - } -} -function removeOpenIdParams(redirectUrl) { - const cleanedUpUrl = new URL(redirectUrl); - // For auth code flow - cleanedUpUrl.searchParams.delete("state"); - cleanedUpUrl.searchParams.delete("code"); - // For login error - cleanedUpUrl.searchParams.delete("error"); - cleanedUpUrl.searchParams.delete("error_description"); - // For RFC9207 - cleanedUpUrl.searchParams.delete("iss"); - return cleanedUpUrl; -} - -/** - * @hidden - * @packageDocumentation - */ -/** - * @hidden - * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth - * PKCE: https://tools.ietf.org/html/rfc7636 - */ -class AuthorizationCodeWithPkceOidcHandlerBase { - constructor(storageUtility, redirector) { - this.storageUtility = storageUtility; - this.redirector = redirector; - this.storageUtility = storageUtility; - this.redirector = redirector; - } - async canHandle(oidcLoginOptions) { - return !!(oidcLoginOptions.issuerConfiguration.grantTypesSupported && - oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf("authorization_code") > -1); - } - async handleRedirect({ oidcLoginOptions, state, codeVerifier, targetUrl, }) { - await Promise.all([ - // We use the OAuth 'state' value (which should be crypto-random) as - // the key in our storage to store our actual SessionID. We do this - // 'cos we'll need to lookup our session information again when the - // browser is redirected back to us (i.e. the OAuth client - // application) from the Authorization Server. - // We don't want to use our session ID as the OAuth 'state' value, as - // that session ID can be any developer-specified value, and therefore - // may not be appropriate (since the OAuth 'state' value should really - // be an unguessable crypto-random value). - // eslint-disable-next-line no-underscore-dangle - this.storageUtility.setForUser(state, { - sessionId: oidcLoginOptions.sessionId, - }), - // Store our login-process state using the session ID as the key. - // Strictly speaking, this indirection from our OAuth state value to - // our session ID is unnecessary, but it provides a slightly cleaner - // separation of concerns. - this.storageUtility.setForUser(oidcLoginOptions.sessionId, { - // eslint-disable-next-line no-underscore-dangle - codeVerifier, - issuer: oidcLoginOptions.issuer.toString(), - // The redirect URL is read after redirect, so it must be stored now. - redirectUrl: oidcLoginOptions.redirectUrl, - dpop: oidcLoginOptions.dpop ? "true" : "false", - }), - ]); - this.redirector.redirect(targetUrl, { - handleRedirect: oidcLoginOptions.handleRedirect, - }); - return undefined; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class GeneralLogoutHandler { - constructor(sessionInfoManager) { - this.sessionInfoManager = sessionInfoManager; - this.sessionInfoManager = sessionInfoManager; - } - async canHandle() { - return true; - } - async handle(userId) { - await this.sessionInfoManager.clear(userId); - } -} - -class IRpLogoutHandler { - constructor(redirector) { - this.redirector = redirector; - this.redirector = redirector; - } - async canHandle(userId, options) { - return (options === null || options === void 0 ? void 0 : options.logoutType) === "idp"; - } - async handle(userId, options) { - if ((options === null || options === void 0 ? void 0 : options.logoutType) !== "idp") { - throw new Error("Attempting to call idp logout handler to perform app logout"); - } - if (options.toLogoutUrl === undefined) { - throw new Error("Cannot perform IDP logout. Did you log in using the OIDC authentication flow?"); - } - this.redirector.redirect(options.toLogoutUrl(options), { - handleRedirect: options.handleRedirect, - }); - } -} - -class IWaterfallLogoutHandler { - constructor(sessionInfoManager, redirector) { - this.handlers = [ - new GeneralLogoutHandler(sessionInfoManager), - new IRpLogoutHandler(redirector), - ]; - } - async canHandle() { - return true; - } - async handle(userId, options) { - for (const handler of this.handlers) { - /* eslint-disable no-await-in-loop */ - if (await handler.canHandle(userId, options)) - await handler.handle(userId, options); - /* eslint-enable no-await-in-loop */ - } - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -function getUnauthenticatedSession() { - return { - isLoggedIn: false, - sessionId: uuid.v4(), - fetch: (...args) => universalFetch.fetch.call(globalThis, ...args), - }; -} -/** - * @param sessionId - * @param storage - * @hidden - */ -async function clear(sessionId, storage) { - await Promise.all([ - storage.deleteAllUserData(sessionId, { secure: false }), - storage.deleteAllUserData(sessionId, { secure: true }), - ]); -} -/** - * @hidden - */ -class SessionInfoManagerBase { - constructor(storageUtility) { - this.storageUtility = storageUtility; - this.storageUtility = storageUtility; - } - update(_sessionId, _options) { - throw new Error("Not Implemented"); - } - get(_) { - throw new Error("Not implemented"); - } - // eslint-disable-next-line class-methods-use-this - async getAll() { - throw new Error("Not implemented"); - } - /** - * This function removes all session-related information from storage. - * @param sessionId the session identifier - * @param storage the storage where session info is stored - * @hidden - */ - async clear(sessionId) { - return clear(sessionId, this.storageUtility); - } - /** - * Registers a new session, so that its ID can be retrieved. - * @param sessionId - */ - async register(_sessionId) { - throw new Error("Not implemented"); - } - /** - * Returns all the registered session IDs. Differs from getAll, which also - * returns additional session information. - */ - async getRegisteredSessionIdAll() { - throw new Error("Not implemented"); - } - /** - * Deletes all information about all sessions, including their registrations. - */ - async clearAll() { - throw new Error("Not implemented"); - } -} - -/** - * This function is designed to isomorphically capture the behavior in oidc-client-js and node-oidc-provider - * - https://github.com/IdentityModel/oidc-client-js/blob/edec8f59897bdeedcb0b4167586d49626203c2c1/src/OidcClient.js#L138 - * - https://github.com/panva/node-openid-client/blob/35758419489ff751a71f5b66f5020087a63e1e88/lib/client.js#L284 - * - * @param options IEndSessionOptions - * @returns The URL to redirect to in order to perform RP Initiated Logout - * @hidden - */ -function getEndSessionUrl({ endSessionEndpoint, idTokenHint, postLogoutRedirectUri, state, }) { - const url = new URL(endSessionEndpoint); - if (idTokenHint !== undefined) - url.searchParams.append("id_token_hint", idTokenHint); - if (postLogoutRedirectUri !== undefined) { - url.searchParams.append("post_logout_redirect_uri", postLogoutRedirectUri); - if (state !== undefined) - url.searchParams.append("state", state); - } - return url.toString(); -} -/** - * @param options.endSessionEndpoint The end_session_endpoint advertised by the server - * @param options.idTokenHint The idToken supplied by the server after logging in - * Redirects the window to the location required to perform RP initiated logout - * - * @hidden - */ -function maybeBuildRpInitiatedLogout({ endSessionEndpoint, idTokenHint, }) { - if (endSessionEndpoint === undefined) - return undefined; - return function logout({ state, postLogoutUrl }) { - return getEndSessionUrl({ - endSessionEndpoint, - idTokenHint, - state, - postLogoutRedirectUri: postLogoutUrl, - }); - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function isSupportedTokenType(token) { - return typeof token === "string" && ["DPoP", "Bearer"].includes(token); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const USER_SESSION_PREFIX = "solidClientAuthenticationUser"; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function isValidUrl(url) { - try { - // Here, the URL constructor is just called to parse the given string and - // verify if it is a well-formed IRI. - // eslint-disable-next-line no-new - new URL(url); - return true; - } - catch (_a) { - return false; - } -} -function determineSigningAlg(supported, preferred) { - var _a; - return ((_a = preferred.find((signingAlg) => { - return supported.includes(signingAlg); - })) !== null && _a !== void 0 ? _a : null); -} -function determineClientType(options, issuerConfig) { - if (options.clientId !== undefined && !isValidUrl(options.clientId)) { - return "static"; - } - if (issuerConfig.scopesSupported.includes("webid") && - options.clientId !== undefined && - isValidUrl(options.clientId)) { - return "solid-oidc"; - } - // If no client_id is provided, the client must go through Dynamic Client Registration. - // If a client_id is provided and it looks like a URI, yet the Identity Provider - // does *not* support Solid-OIDC, then we also perform DCR (and discard the - // provided client_id). - return "dynamic"; -} -async function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) { - const clientType = determineClientType(options, issuerConfig); - if (clientType === "dynamic") { - return clientRegistrar.getClient({ - sessionId: options.sessionId, - clientName: options.clientName, - redirectUrl: options.redirectUrl, - }, issuerConfig); - } - // If a client_id was provided, and the Identity Provider is Solid-OIDC compliant, - // or it is not compliant but the client_id isn't an IRI (we assume it has already - // been registered with the IdP), then the client registration information needs - // to be stored so that it can be retrieved later after redirect. - await storageUtility.setForUser(options.sessionId, { - // If the client is either static or solid-oidc compliant, its client ID cannot be undefined. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - clientId: options.clientId, - }); - if (options.clientSecret) { - await storageUtility.setForUser(options.sessionId, { - clientSecret: options.clientSecret, - }); - } - if (options.clientName) { - await storageUtility.setForUser(options.sessionId, { - clientName: options.clientName, - }); - } - return { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - clientId: options.clientId, - clientSecret: options.clientSecret, - clientName: options.clientName, - clientType, - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -// By only referring to `window` at runtime, apps that do server-side rendering -// won't run into errors when rendering code that instantiates a -// ClientAuthentication: -const globalFetch = (request, init) => universalFetch.fetch.call(globalThis, request, init); -/** - * @hidden - */ -class ClientAuthentication { - constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) { - this.loginHandler = loginHandler; - this.redirectHandler = redirectHandler; - this.logoutHandler = logoutHandler; - this.sessionInfoManager = sessionInfoManager; - this.issuerConfigFetcher = issuerConfigFetcher; - // By default, our fetch() resolves to the environment fetch() function. - this.fetch = globalFetch; - this.logout = async (sessionId, options) => { - // When doing IDP logout this will redirect away from the current page, so we should not expect - // code after this condition to be run if it is true. - // We also need to make sure that any other cleanup that we want to do for - // our session takes place before this condition is run - await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === "idp" - ? { - ...options, - toLogoutUrl: this.boundLogout, - } - : options); - // Restore our fetch() function back to the environment fetch(), effectively - // leaving us with un-authenticated fetches from now on. - this.fetch = globalFetch; - // Delete the bound logout function, so that it can't be called after this. - delete this.boundLogout; - }; - this.getSessionInfo = async (sessionId) => { - // TODO complete - return this.sessionInfoManager.get(sessionId); - }; - this.getAllSessionInfo = async () => { - return this.sessionInfoManager.getAll(); - }; - this.loginHandler = loginHandler; - this.redirectHandler = redirectHandler; - this.logoutHandler = logoutHandler; - this.sessionInfoManager = sessionInfoManager; - this.issuerConfigFetcher = issuerConfigFetcher; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * A helper class that will validate items taken from local storage - */ -async function getSessionIdFromOauthState(storageUtility, oauthState) { - return storageUtility.getForUser(oauthState, "sessionId"); -} -/** - * Based on the provided state, this looks up contextual information stored - * before redirecting the user to the OIDC issuer. - * @param sessionId The state (~ correlation ID) of the OIDC request - * @param storageUtility - * @param configFetcher - * @returns Information stored about the client issuing the request - */ -async function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) { - try { - const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([ - storageUtility.getForUser(sessionId, "issuer", { - errorIfNull: true, - }), - storageUtility.getForUser(sessionId, "codeVerifier"), - storageUtility.getForUser(sessionId, "redirectUrl"), - storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true }), - ]); - // Clear the code verifier, which is one-time use. - await storageUtility.deleteForUser(sessionId, "codeVerifier"); - // Unlike openid-client, this looks up the configuration from storage - const issuerConfig = await configFetcher.fetchConfig(issuerIri); - return { - codeVerifier, - redirectUrl: storedRedirectIri, - issuerConfig, - dpop: dpop === "true", - }; - } - catch (e) { - throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`); - } -} -/** - * Stores information about the session in the provided storage. Note that not - * all storage are equally secure, and it is strongly advised not to store either - * the refresh token or the DPoP key in the browser's local storage. - * - * @param storageUtility - * @param sessionId - * @param webId - * @param isLoggedIn - * @param refreshToken - * @param secure - * @param dpopKey - */ -async function saveSessionInfoToStorage(storageUtility, sessionId, webId, isLoggedIn, refreshToken, secure, dpopKey) { - // TODO: Investigate why this does not work with a Promise.all - if (refreshToken !== undefined) { - await storageUtility.setForUser(sessionId, { refreshToken }, { secure }); - } - if (webId !== undefined) { - await storageUtility.setForUser(sessionId, { webId }, { secure }); - } - if (isLoggedIn !== undefined) { - await storageUtility.setForUser(sessionId, { isLoggedIn }, { secure }); - } - if (dpopKey !== undefined) { - await storageUtility.setForUser(sessionId, { - publicKey: JSON.stringify(dpopKey.publicKey), - privateKey: JSON.stringify(await jose.exportJWK(dpopKey.privateKey)), - }, { secure }); - } -} -// TOTEST: this does not handle all possible bad inputs for example what if it's not proper JSON -/** - * @hidden - */ -class StorageUtility { - constructor(secureStorage, insecureStorage) { - this.secureStorage = secureStorage; - this.insecureStorage = insecureStorage; - this.secureStorage = secureStorage; - this.insecureStorage = insecureStorage; - } - getKey(userId) { - return `solidClientAuthenticationUser:${userId}`; - } - async getUserData(userId, secure) { - const stored = await (secure - ? this.secureStorage - : this.insecureStorage).get(this.getKey(userId)); - if (stored === undefined) { - return {}; - } - try { - return JSON.parse(stored); - } - catch (err) { - throw new Error(`Data for user [${userId}] in [${secure ? "secure" : "unsecure"}] storage is corrupted - expected valid JSON, but got: ${stored}`); - } - } - async setUserData(userId, data, secure) { - await (secure ? this.secureStorage : this.insecureStorage).set(this.getKey(userId), JSON.stringify(data)); - } - async get(key, options) { - const value = await ((options === null || options === void 0 ? void 0 : options.secure) - ? this.secureStorage - : this.insecureStorage).get(key); - if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) { - throw new Error(`[${key}] is not stored`); - } - return value; - } - async set(key, value, options) { - return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).set(key, value); - } - async delete(key, options) { - return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(key); - } - async getForUser(userId, key, options) { - const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure); - let value; - if (!userData || !userData[key]) { - value = undefined; - } - value = userData[key]; - if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) { - throw new Error(`Field [${key}] for user [${userId}] is not stored`); - } - return value || undefined; - } - async setForUser(userId, values, options) { - let userData; - try { - userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure); - } - catch (_a) { - // if reading the user data throws, the data is corrupted, and we want to write over it - userData = {}; - } - await this.setUserData(userId, { ...userData, ...values }, options === null || options === void 0 ? void 0 : options.secure); - } - async deleteForUser(userId, key, options) { - const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure); - delete userData[key]; - await this.setUserData(userId, userData, options === null || options === void 0 ? void 0 : options.secure); - } - async deleteAllUserData(userId, options) { - await ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(this.getKey(userId)); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class InMemoryStorage { - constructor() { - this.map = {}; - } - async get(key) { - return this.map[key] || undefined; - } - async set(key, value) { - this.map[key] = value; - } - async delete(key) { - delete this.map[key]; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered when a poor configuration is received - */ -// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages -// https://github.com/gotwarlost/istanbul/issues/690 -// The workaround is to put istanbul ignore on the constructor -/** - * @hidden - */ -class ConfigurationError extends Error { - /* istanbul ignore next */ - constructor(message) { - super(message); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered if a method is not implemented - * @hidden - */ -class NotImplementedError extends Error { - /* istanbul ignore next */ - constructor(methodName) { - super(`[${methodName}] is not implemented`); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered when receiving a response missing mandatory elements - */ -// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages -// https://github.com/gotwarlost/istanbul/issues/690 -// The workaround is to put istanbul ignore on the constructor -/** - * @hidden - */ -class InvalidResponseError extends Error { - /* istanbul ignore next */ - constructor(missingFields) { - super(`Invalid response from OIDC provider: missing fields ${missingFields}`); - this.missingFields = missingFields; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered when receiving a response missing mandatory elements - */ -// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages -// https://github.com/gotwarlost/istanbul/issues/690 -// The workaround is to put istanbul ignore on the constructor -/** - * @hidden - */ -class OidcProviderError extends Error { - /* istanbul ignore next */ - constructor(message, error, errorDescription) { - super(message); - this.error = error; - this.errorDescription = errorDescription; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Normalizes a URL in order to generate the DPoP token based on a consistent scheme. - * - * @param audience The URL to normalize. - * @returns The normalized URL as a string. - * @hidden - */ -function normalizeHTU(audience) { - const audienceUrl = new URL(audience); - return new URL(audienceUrl.pathname, audienceUrl.origin).toString(); -} -/** - * Creates a DPoP header according to https://tools.ietf.org/html/draft-fett-oauth-dpop-04, - * based on the target URL and method, using the provided key. - * - * @param audience Target URL. - * @param method HTTP method allowed. - * @param key Key used to sign the token. - * @returns A JWT that can be used as a DPoP Authorization header. - */ -async function createDpopHeader(audience, method, dpopKey) { - return new jose.SignJWT({ - htu: normalizeHTU(audience), - htm: method.toUpperCase(), - jti: uuid.v4(), - }) - .setProtectedHeader({ - alg: PREFERRED_SIGNING_ALG[0], - jwk: dpopKey.publicKey, - typ: "dpop+jwt", - }) - .setIssuedAt() - .sign(dpopKey.privateKey, {}); -} -async function generateDpopKeyPair() { - const { privateKey, publicKey } = await jose.generateKeyPair(PREFERRED_SIGNING_ALG[0]); - const dpopKeyPair = { - privateKey, - publicKey: await jose.exportJWK(publicKey), - }; - // The alg property isn't set by exportJWK, so set it manually. - [dpopKeyPair.publicKey.alg] = PREFERRED_SIGNING_ALG; - return dpopKeyPair; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * If expires_in isn't specified for the access token, we assume its lifetime is - * 10 minutes. - */ -const DEFAULT_EXPIRATION_TIME_SECONDS = 600; -function isExpectedAuthError(statusCode) { - // As per https://tools.ietf.org/html/rfc7235#section-3.1 and https://tools.ietf.org/html/rfc7235#section-3.1, - // a response failing because the provided credentials aren't accepted by the - // server can get a 401 or a 403 response. - return [401, 403].includes(statusCode); -} -async function buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions) { - var _a; - const headers = new universalFetch.Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers); - // Any pre-existing Authorization header should be overriden. - headers.set("Authorization", `DPoP ${authToken}`); - headers.set("DPoP", await createDpopHeader(targetUrl, (_a = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.method) !== null && _a !== void 0 ? _a : "get", dpopKey)); - return { - ...defaultOptions, - headers, - }; -} -async function buildAuthenticatedHeaders(targetUrl, authToken, dpopKey, defaultOptions) { - if (dpopKey !== undefined) { - return buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions); - } - const headers = new universalFetch.Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers); - // Any pre-existing Authorization header should be overriden. - headers.set("Authorization", `Bearer ${authToken}`); - return { - ...defaultOptions, - headers, - }; -} -async function makeAuthenticatedRequest(unauthFetch, accessToken, url, defaultRequestInit, dpopKey) { - return unauthFetch(url, await buildAuthenticatedHeaders(url.toString(), accessToken, dpopKey, defaultRequestInit)); -} -async function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) { - var _a; - const tokenSet = await refreshOptions.tokenRefresher.refresh(refreshOptions.sessionId, refreshOptions.refreshToken, dpopKey); - eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.SESSION_EXTENDED, (_a = tokenSet.expiresIn) !== null && _a !== void 0 ? _a : DEFAULT_EXPIRATION_TIME_SECONDS); - if (typeof tokenSet.refreshToken === "string") { - eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken); - } - return { - accessToken: tokenSet.accessToken, - refreshToken: tokenSet.refreshToken, - expiresIn: tokenSet.expiresIn, - }; -} -/** - * - * @param expiresIn Delay until the access token expires. - * @returns a delay until the access token should be refreshed. - */ -const computeRefreshDelay = (expiresIn) => { - if (expiresIn !== undefined) { - return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 - ? // We want to refresh the token 5 seconds before they actually expire. - expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS - : expiresIn; - } - return DEFAULT_EXPIRATION_TIME_SECONDS; -}; -/** - * @param unauthFetch a regular fetch function, compliant with the WHATWG spec. - * @param authToken an access token, either a Bearer token or a DPoP one. - * @param options The option object may contain two objects: the DPoP key token - * is bound to if applicable, and options to customise token renewal behaviour. - * - * @returns A fetch function that adds an appropriate Authorization header with - * the provided token, and adds a DPoP header if applicable. - */ -async function buildAuthenticatedFetch(unauthFetch, accessToken, options) { - var _a; - let currentAccessToken = accessToken; - let latestTimeout; - const currentRefreshOptions = options === null || options === void 0 ? void 0 : options.refreshOptions; - // Setup the refresh timeout outside of the authenticated fetch, so that - // an idle app will not get logged out if it doesn't issue a fetch before - // the first expiration date. - if (currentRefreshOptions !== undefined) { - const proactivelyRefreshToken = async () => { - var _a, _b, _c, _d; - try { - const { accessToken: refreshedAccessToken, refreshToken, expiresIn, } = await refreshAccessToken(currentRefreshOptions, - // If currentRefreshOptions is defined, options is necessarily defined too. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.dpopKey, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.eventEmitter); - // Update the tokens in the closure if appropriate. - currentAccessToken = refreshedAccessToken; - if (refreshToken !== undefined) { - currentRefreshOptions.refreshToken = refreshToken; - } - // Each time the access token is refreshed, we must plan fo the next - // refresh iteration. - clearTimeout(latestTimeout); - latestTimeout = setTimeout(proactivelyRefreshToken, computeRefreshDelay(expiresIn) * 1000); - // If currentRefreshOptions is defined, options is necessarily defined too. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout); - } - catch (e) { - // It is possible that an underlying library throws an error on refresh flow failure. - // If we used a log framework, the error could be logged at the `debug` level, - // but otherwise the failure of the refresh flow should not blow up in the user's - // face, so we just swallow the error. - if (e instanceof OidcProviderError) { - // The OIDC provider refused to refresh the access token and returned an error instead. - /* istanbul ignore next 100% coverage would require testing that nothing - happens here if the emitter is undefined, which is more cumbersome - than what it's worth. */ - (_b = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _b === void 0 ? void 0 : _b.emit(EVENTS.ERROR, e.error, e.errorDescription); - /* istanbul ignore next 100% coverage would require testing that nothing - happens here if the emitter is undefined, which is more cumbersome - than what it's worth. */ - (_c = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _c === void 0 ? void 0 : _c.emit(EVENTS.SESSION_EXPIRED); - } - if (e instanceof InvalidResponseError && - e.missingFields.includes("access_token")) { - // In this case, the OIDC provider returned a non-standard response, but - // did not specify that it was an error. We cannot refresh nonetheless. - /* istanbul ignore next 100% coverage would require testing that nothing - happens here if the emitter is undefined, which is more cumbersome - than what it's worth. */ - (_d = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _d === void 0 ? void 0 : _d.emit(EVENTS.SESSION_EXPIRED); - } - } - }; - latestTimeout = setTimeout(proactivelyRefreshToken, - // If currentRefreshOptions is defined, options is necessarily defined too. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - computeRefreshDelay(options.expiresIn) * 1000); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout); - } - else if (options !== undefined && options.eventEmitter !== undefined) { - // If no refresh options are provided, the session expires when the access token does. - const expirationTimeout = setTimeout(() => { - // The event emitter is always defined in our code, and it would be tedious - // to test for conditions when it is not. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.eventEmitter.emit(EVENTS.SESSION_EXPIRED); - }, computeRefreshDelay(options.expiresIn) * 1000); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout); - } - return async (url, requestInit) => { - let response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, url, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey); - const failedButNotExpectedAuthError = !response.ok && !isExpectedAuthError(response.status); - if (response.ok || failedButNotExpectedAuthError) { - // If there hasn't been a redirection, or if there has been a non-auth related - // issue, it should be handled at the application level - return response; - } - const hasBeenRedirected = response.url !== url; - if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== undefined) { - // If the request failed for auth reasons, and has been redirected, we should - // replay it generating a DPoP header for the rediration target IRI. This - // doesn't apply to Bearer tokens, as the Bearer tokens aren't specific - // to a given resource and method, while the DPoP header (associated to a - // DPoP token) is. - response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, - // Replace the original target IRI (`url`) by the redirection target - response.url, requestInit, options.dpopKey); - } - return response; - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const StorageUtilityGetResponse = "getResponse"; -const StorageUtilityMock = { - /* eslint-disable @typescript-eslint/no-unused-vars */ - get: async (key, options) => StorageUtilityGetResponse, - set: async (key, value) => { - /* do nothing */ - }, - delete: async (key) => { - /* do nothing */ - }, - getForUser: async (userId, key, options) => StorageUtilityGetResponse, - setForUser: async (userId, values, options) => { - /* do nothing */ - }, - deleteForUser: async (userId, key, options) => { - /* do nothing */ - }, - deleteAllUserData: async (userId, options) => { - /* do nothing */ - }, -}; -const mockStorage = (stored) => { - const store = stored; - return { - get: async (key) => { - if (store[key] === undefined) { - return undefined; - } - if (typeof store[key] === "string") { - return store[key]; - } - return JSON.stringify(store[key]); - }, - set: async (key, value) => { - store[key] = value; - }, - delete: async (key) => { - delete store[key]; - }, - }; -}; -const mockStorageUtility = (stored, isSecure = false) => { - if (isSecure) { - return new StorageUtility(mockStorage(stored), mockStorage({})); - } - return new StorageUtility(mockStorage({}), mockStorage(stored)); -}; - -exports.AggregateHandler = AggregateHandler; -exports.AuthorizationCodeWithPkceOidcHandlerBase = AuthorizationCodeWithPkceOidcHandlerBase; -exports.ClientAuthentication = ClientAuthentication; -exports.ConfigurationError = ConfigurationError; -exports.DEFAULT_SCOPES = DEFAULT_SCOPES; -exports.EVENTS = EVENTS; -exports.GeneralLogoutHandler = GeneralLogoutHandler; -exports.IRpLogoutHandler = IRpLogoutHandler; -exports.IWaterfallLogoutHandler = IWaterfallLogoutHandler; -exports.InMemoryStorage = InMemoryStorage; -exports.InvalidResponseError = InvalidResponseError; -exports.NotImplementedError = NotImplementedError; -exports.OidcProviderError = OidcProviderError; -exports.PREFERRED_SIGNING_ALG = PREFERRED_SIGNING_ALG; -exports.REFRESH_BEFORE_EXPIRATION_SECONDS = REFRESH_BEFORE_EXPIRATION_SECONDS; -exports.SOLID_CLIENT_AUTHN_KEY_PREFIX = SOLID_CLIENT_AUTHN_KEY_PREFIX; -exports.SessionInfoManagerBase = SessionInfoManagerBase; -exports.StorageUtility = StorageUtility; -exports.StorageUtilityGetResponse = StorageUtilityGetResponse; -exports.StorageUtilityMock = StorageUtilityMock; -exports.USER_SESSION_PREFIX = USER_SESSION_PREFIX; -exports.buildAuthenticatedFetch = buildAuthenticatedFetch; -exports.buildProxyHandler = buildProxyHandler; -exports.clear = clear; -exports.createDpopHeader = createDpopHeader; -exports.determineSigningAlg = determineSigningAlg; -exports.fetchJwks = fetchJwks; -exports.generateDpopKeyPair = generateDpopKeyPair; -exports.getEndSessionUrl = getEndSessionUrl; -exports.getSessionIdFromOauthState = getSessionIdFromOauthState; -exports.getUnauthenticatedSession = getUnauthenticatedSession; -exports.getWebidFromTokenPayload = getWebidFromTokenPayload; -exports.handleRegistration = handleRegistration; -exports.isSupportedTokenType = isSupportedTokenType; -exports.isValidRedirectUrl = isValidRedirectUrl; -exports.loadOidcContextFromStorage = loadOidcContextFromStorage; -exports.maybeBuildRpInitiatedLogout = maybeBuildRpInitiatedLogout; -exports.mockStorage = mockStorage; -exports.mockStorageUtility = mockStorageUtility; -exports.removeOpenIdParams = removeOpenIdParams; -exports.saveSessionInfoToStorage = saveSessionInfoToStorage; -//# sourceMappingURL=index.js.map - - -/***/ }), - -/***/ "./node_modules/@inrupt/solid-client-authn-core/dist/index.mjs": -/*!*********************************************************************!*\ - !*** ./node_modules/@inrupt/solid-client-authn-core/dist/index.mjs ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ AggregateHandler: function() { return /* binding */ AggregateHandler; }, -/* harmony export */ AuthorizationCodeWithPkceOidcHandlerBase: function() { return /* binding */ AuthorizationCodeWithPkceOidcHandlerBase; }, -/* harmony export */ ClientAuthentication: function() { return /* binding */ ClientAuthentication; }, -/* harmony export */ ConfigurationError: function() { return /* binding */ ConfigurationError; }, -/* harmony export */ DEFAULT_SCOPES: function() { return /* binding */ DEFAULT_SCOPES; }, -/* harmony export */ EVENTS: function() { return /* binding */ EVENTS; }, -/* harmony export */ GeneralLogoutHandler: function() { return /* binding */ GeneralLogoutHandler; }, -/* harmony export */ IRpLogoutHandler: function() { return /* binding */ IRpLogoutHandler; }, -/* harmony export */ IWaterfallLogoutHandler: function() { return /* binding */ IWaterfallLogoutHandler; }, -/* harmony export */ InMemoryStorage: function() { return /* binding */ InMemoryStorage; }, -/* harmony export */ InvalidResponseError: function() { return /* binding */ InvalidResponseError; }, -/* harmony export */ NotImplementedError: function() { return /* binding */ NotImplementedError; }, -/* harmony export */ OidcProviderError: function() { return /* binding */ OidcProviderError; }, -/* harmony export */ PREFERRED_SIGNING_ALG: function() { return /* binding */ PREFERRED_SIGNING_ALG; }, -/* harmony export */ REFRESH_BEFORE_EXPIRATION_SECONDS: function() { return /* binding */ REFRESH_BEFORE_EXPIRATION_SECONDS; }, -/* harmony export */ SOLID_CLIENT_AUTHN_KEY_PREFIX: function() { return /* binding */ SOLID_CLIENT_AUTHN_KEY_PREFIX; }, -/* harmony export */ SessionInfoManagerBase: function() { return /* binding */ SessionInfoManagerBase; }, -/* harmony export */ StorageUtility: function() { return /* binding */ StorageUtility; }, -/* harmony export */ StorageUtilityGetResponse: function() { return /* binding */ StorageUtilityGetResponse; }, -/* harmony export */ StorageUtilityMock: function() { return /* binding */ StorageUtilityMock; }, -/* harmony export */ USER_SESSION_PREFIX: function() { return /* binding */ USER_SESSION_PREFIX; }, -/* harmony export */ buildAuthenticatedFetch: function() { return /* binding */ buildAuthenticatedFetch; }, -/* harmony export */ buildProxyHandler: function() { return /* binding */ buildProxyHandler; }, -/* harmony export */ clear: function() { return /* binding */ clear; }, -/* harmony export */ createDpopHeader: function() { return /* binding */ createDpopHeader; }, -/* harmony export */ determineSigningAlg: function() { return /* binding */ determineSigningAlg; }, -/* harmony export */ fetchJwks: function() { return /* binding */ fetchJwks; }, -/* harmony export */ generateDpopKeyPair: function() { return /* binding */ generateDpopKeyPair; }, -/* harmony export */ getEndSessionUrl: function() { return /* binding */ getEndSessionUrl; }, -/* harmony export */ getSessionIdFromOauthState: function() { return /* binding */ getSessionIdFromOauthState; }, -/* harmony export */ getUnauthenticatedSession: function() { return /* binding */ getUnauthenticatedSession; }, -/* harmony export */ getWebidFromTokenPayload: function() { return /* binding */ getWebidFromTokenPayload; }, -/* harmony export */ handleRegistration: function() { return /* binding */ handleRegistration; }, -/* harmony export */ isSupportedTokenType: function() { return /* binding */ isSupportedTokenType; }, -/* harmony export */ isValidRedirectUrl: function() { return /* binding */ isValidRedirectUrl; }, -/* harmony export */ loadOidcContextFromStorage: function() { return /* binding */ loadOidcContextFromStorage; }, -/* harmony export */ maybeBuildRpInitiatedLogout: function() { return /* binding */ maybeBuildRpInitiatedLogout; }, -/* harmony export */ mockStorage: function() { return /* binding */ mockStorage; }, -/* harmony export */ mockStorageUtility: function() { return /* binding */ mockStorageUtility; }, -/* harmony export */ removeOpenIdParams: function() { return /* binding */ removeOpenIdParams; }, -/* harmony export */ saveSessionInfoToStorage: function() { return /* binding */ saveSessionInfoToStorage; } -/* harmony export */ }); -/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ "./node_modules/events/events.js"); -/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.mjs"); -/* harmony import */ var jose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jose */ "./node_modules/jose/dist/browser/index.js"); -/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/v4.js"); - - - - - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Intended to be used by dependent packages as a common prefix for keys into - * storage mechanisms (so as to group all keys related to Solid Client Authn - * within those storage mechanisms, e.g., window.localStorage). - */ -const SOLID_CLIENT_AUTHN_KEY_PREFIX = "solidClientAuthn:"; -/** - * Ordered list of signature algorithms, from most preferred to least preferred. - */ -const PREFERRED_SIGNING_ALG = ["ES256", "RS256"]; -const EVENTS = { - // Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events. - ERROR: "error", - LOGIN: "login", - LOGOUT: "logout", - NEW_REFRESH_TOKEN: "newRefreshToken", - SESSION_EXPIRED: "sessionExpired", - SESSION_EXTENDED: "sessionExtended", - SESSION_RESTORED: "sessionRestore", - TIMEOUT_SET: "timeoutSet", -}; -/** - * We want to refresh a token 5 seconds before it expires. - */ -const REFRESH_BEFORE_EXPIRATION_SECONDS = 5; -// The openid scope requests an OIDC ID token token to be returned. -const SCOPE_OPENID = "openid"; -// The offline_access scope requests a refresh token to be returned. -const SCOPE_OFFLINE = "offline_access"; -// The webid scope is required as per https://solid.github.io/solid-oidc/#webid-scope -const SCOPE_WEBID = "webid"; -// The scopes are expected as a space-separated list. -const DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(" "); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Temporary internal builder for safe proxying. - */ -const buildProxyHandler = ( -// The class to be excluded needs to be injected, because it is defined in a -// dependency. -// eslint-disable-next-line @typescript-eslint/no-explicit-any -toExclude, errorMessage) => ({ - // This proxy is only a temporary measure until Session no longer extends - // SessionEventEmitter, and the proxying is no longer necessary. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - get(target, prop, receiver) { - // Reject any calls to the proxy that isn't specific to the EventEmitter API - if (!Object.getOwnPropertyNames(events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter).includes(prop) && - Object.getOwnPropertyNames(toExclude).includes(prop)) { - throw new Error(`${errorMessage}: [${prop}] is not supported`); - } - return Reflect.get(target, prop, receiver); - }, -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class AggregateHandler { - constructor(handleables) { - this.handleables = handleables; - this.handleables = handleables; - } - /** - * Helper function that will asynchronously determine the proper handler to use. If multiple - * handlers can handle, it will choose the first one in the list - * @param params Paramerters to feed to the handler - */ - async getProperHandler(params) { - // TODO : This function doesn't currently operate as described. Tests need to be written - // return new Promise | null>((resolve, reject) => { - // const resolvedValues: Array = Array(this.handleables.length).map(() => null) - // let numberResolved = 0 - // this.handleables.forEach(async (handleable: IHandleable, index: number) => { - // resolvedValues[index] = await handleable.canHandle(...params) - // numberResolved++ - // let curResolvedValueIndex = 0 - // while ( - // resolvedValues[curResolvedValueIndex] !== null || - // resolvedValues[curResolvedValueIndex] !== undefined - // ) { - // if (resolvedValues[curResolvedValueIndex]) { - // resolve(this.handleables[curResolvedValueIndex]) - // } - // curResolvedValueIndex++ - // } - // }) - // }) - const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params))); - for (let i = 0; i < canHandleList.length; i += 1) { - if (canHandleList[i]) { - return this.handleables[i]; - } - } - return null; - } - async canHandle(...params) { - return (await this.getProperHandler(params)) !== null; - } - async handle(...params) { - const handler = await this.getProperHandler(params); - if (handler) { - return handler.handle(...params); - } - throw new Error(`[${this.constructor.name}] cannot find a suitable handler for: ${params - .map((param) => { - try { - return JSON.stringify(param); - } - catch (err) { - /* eslint-disable @typescript-eslint/no-explicit-any */ - return param.toString(); - } - }) - .join(", ")}`); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// eslint-disable-next-line no-shadow -async function fetchJwks(jwksIri, issuerIri) { - // FIXME: the following line works, but the underlying network calls don't seem - // to be mocked properly by our test code. It would be nicer to replace calls to this - // function by the following line and to fix the mocks. - // const jwks = createRemoteJWKSet(new URL(jwksIri)); - const jwksResponse = await _inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__.fetch.call(globalThis, jwksIri); - if (jwksResponse.status !== 200) { - throw new Error(`Could not fetch JWKS for [${issuerIri}] at [${jwksIri}]: ${jwksResponse.status} ${jwksResponse.statusText}`); - } - // The JWKS should only contain the current key for the issuer. - let jwk; - try { - jwk = (await jwksResponse.json()).keys[0]; - } - catch (e) { - throw new Error(`Malformed JWKS for [${issuerIri}] at [${jwksIri}]: ${e.message}`); - } - return jwk; -} -/** - * Extract a WebID from an ID token payload based on https://github.com/solid/webid-oidc-spec. - * Note that this does not yet implement the user endpoint lookup, and only checks - * for `webid` or IRI-like `sub` claims. - * - * @param idToken the payload of the ID token from which the WebID can be extracted. - * @returns a WebID extracted from the ID token. - * @internal - */ -async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) { - const jwk = await fetchJwks(jwksIri, issuerIri); - let payload; - try { - const { payload: verifiedPayload } = await (0,jose__WEBPACK_IMPORTED_MODULE_1__.jwtVerify)(idToken, await (0,jose__WEBPACK_IMPORTED_MODULE_1__.importJWK)(jwk), { - issuer: issuerIri, - audience: clientId, - }); - payload = verifiedPayload; - } - catch (e) { - throw new Error(`Token verification failed: ${e.stack}`); - } - if (typeof payload.webid === "string") { - return payload.webid; - } - if (typeof payload.sub !== "string") { - throw new Error(`The token ${JSON.stringify(payload)} is invalid: it has no 'webid' claim and no 'sub' claim.`); - } - try { - // This parses the 'sub' claim to check if it is a well-formed IRI. - // However, the normalized value isn't returned to make sure the WebID is returned - // as specified by the Identity Provider. - // eslint-disable-next-line no-new - new URL(payload.sub); - return payload.sub; - } - catch (e) { - throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${payload.sub}] is invalid as a URL - error [${e}].`); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function isValidRedirectUrl(redirectUrl) { - // If the redirect URL is not a valid URL, an error will be thrown. - try { - const urlObject = new URL(redirectUrl); - const noReservedQuery = !urlObject.searchParams.has("code") && - !urlObject.searchParams.has("state"); - // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL - // must not include a hash fragment. - const noHash = urlObject.hash === ""; - return noReservedQuery && noHash; - } - catch (e) { - return false; - } -} -function removeOpenIdParams(redirectUrl) { - const cleanedUpUrl = new URL(redirectUrl); - // For auth code flow - cleanedUpUrl.searchParams.delete("state"); - cleanedUpUrl.searchParams.delete("code"); - // For login error - cleanedUpUrl.searchParams.delete("error"); - cleanedUpUrl.searchParams.delete("error_description"); - // For RFC9207 - cleanedUpUrl.searchParams.delete("iss"); - return cleanedUpUrl; -} - -/** - * @hidden - * @packageDocumentation - */ -/** - * @hidden - * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth - * PKCE: https://tools.ietf.org/html/rfc7636 - */ -class AuthorizationCodeWithPkceOidcHandlerBase { - constructor(storageUtility, redirector) { - this.storageUtility = storageUtility; - this.redirector = redirector; - this.storageUtility = storageUtility; - this.redirector = redirector; - } - async canHandle(oidcLoginOptions) { - return !!(oidcLoginOptions.issuerConfiguration.grantTypesSupported && - oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf("authorization_code") > -1); - } - async handleRedirect({ oidcLoginOptions, state, codeVerifier, targetUrl, }) { - await Promise.all([ - // We use the OAuth 'state' value (which should be crypto-random) as - // the key in our storage to store our actual SessionID. We do this - // 'cos we'll need to lookup our session information again when the - // browser is redirected back to us (i.e. the OAuth client - // application) from the Authorization Server. - // We don't want to use our session ID as the OAuth 'state' value, as - // that session ID can be any developer-specified value, and therefore - // may not be appropriate (since the OAuth 'state' value should really - // be an unguessable crypto-random value). - // eslint-disable-next-line no-underscore-dangle - this.storageUtility.setForUser(state, { - sessionId: oidcLoginOptions.sessionId, - }), - // Store our login-process state using the session ID as the key. - // Strictly speaking, this indirection from our OAuth state value to - // our session ID is unnecessary, but it provides a slightly cleaner - // separation of concerns. - this.storageUtility.setForUser(oidcLoginOptions.sessionId, { - // eslint-disable-next-line no-underscore-dangle - codeVerifier, - issuer: oidcLoginOptions.issuer.toString(), - // The redirect URL is read after redirect, so it must be stored now. - redirectUrl: oidcLoginOptions.redirectUrl, - dpop: oidcLoginOptions.dpop ? "true" : "false", - }), - ]); - this.redirector.redirect(targetUrl, { - handleRedirect: oidcLoginOptions.handleRedirect, - }); - return undefined; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class GeneralLogoutHandler { - constructor(sessionInfoManager) { - this.sessionInfoManager = sessionInfoManager; - this.sessionInfoManager = sessionInfoManager; - } - async canHandle() { - return true; - } - async handle(userId) { - await this.sessionInfoManager.clear(userId); - } -} - -class IRpLogoutHandler { - constructor(redirector) { - this.redirector = redirector; - this.redirector = redirector; - } - async canHandle(userId, options) { - return (options === null || options === void 0 ? void 0 : options.logoutType) === "idp"; - } - async handle(userId, options) { - if ((options === null || options === void 0 ? void 0 : options.logoutType) !== "idp") { - throw new Error("Attempting to call idp logout handler to perform app logout"); - } - if (options.toLogoutUrl === undefined) { - throw new Error("Cannot perform IDP logout. Did you log in using the OIDC authentication flow?"); - } - this.redirector.redirect(options.toLogoutUrl(options), { - handleRedirect: options.handleRedirect, - }); - } -} - -class IWaterfallLogoutHandler { - constructor(sessionInfoManager, redirector) { - this.handlers = [ - new GeneralLogoutHandler(sessionInfoManager), - new IRpLogoutHandler(redirector), - ]; - } - async canHandle() { - return true; - } - async handle(userId, options) { - for (const handler of this.handlers) { - /* eslint-disable no-await-in-loop */ - if (await handler.canHandle(userId, options)) - await handler.handle(userId, options); - /* eslint-enable no-await-in-loop */ - } - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -function getUnauthenticatedSession() { - return { - isLoggedIn: false, - sessionId: (0,uuid__WEBPACK_IMPORTED_MODULE_3__["default"])(), - fetch: (...args) => _inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__.fetch.call(globalThis, ...args), - }; -} -/** - * @param sessionId - * @param storage - * @hidden - */ -async function clear(sessionId, storage) { - await Promise.all([ - storage.deleteAllUserData(sessionId, { secure: false }), - storage.deleteAllUserData(sessionId, { secure: true }), - ]); -} -/** - * @hidden - */ -class SessionInfoManagerBase { - constructor(storageUtility) { - this.storageUtility = storageUtility; - this.storageUtility = storageUtility; - } - update(_sessionId, _options) { - throw new Error("Not Implemented"); - } - get(_) { - throw new Error("Not implemented"); - } - // eslint-disable-next-line class-methods-use-this - async getAll() { - throw new Error("Not implemented"); - } - /** - * This function removes all session-related information from storage. - * @param sessionId the session identifier - * @param storage the storage where session info is stored - * @hidden - */ - async clear(sessionId) { - return clear(sessionId, this.storageUtility); - } - /** - * Registers a new session, so that its ID can be retrieved. - * @param sessionId - */ - async register(_sessionId) { - throw new Error("Not implemented"); - } - /** - * Returns all the registered session IDs. Differs from getAll, which also - * returns additional session information. - */ - async getRegisteredSessionIdAll() { - throw new Error("Not implemented"); - } - /** - * Deletes all information about all sessions, including their registrations. - */ - async clearAll() { - throw new Error("Not implemented"); - } -} - -/** - * This function is designed to isomorphically capture the behavior in oidc-client-js and node-oidc-provider - * - https://github.com/IdentityModel/oidc-client-js/blob/edec8f59897bdeedcb0b4167586d49626203c2c1/src/OidcClient.js#L138 - * - https://github.com/panva/node-openid-client/blob/35758419489ff751a71f5b66f5020087a63e1e88/lib/client.js#L284 - * - * @param options IEndSessionOptions - * @returns The URL to redirect to in order to perform RP Initiated Logout - * @hidden - */ -function getEndSessionUrl({ endSessionEndpoint, idTokenHint, postLogoutRedirectUri, state, }) { - const url = new URL(endSessionEndpoint); - if (idTokenHint !== undefined) - url.searchParams.append("id_token_hint", idTokenHint); - if (postLogoutRedirectUri !== undefined) { - url.searchParams.append("post_logout_redirect_uri", postLogoutRedirectUri); - if (state !== undefined) - url.searchParams.append("state", state); - } - return url.toString(); -} -/** - * @param options.endSessionEndpoint The end_session_endpoint advertised by the server - * @param options.idTokenHint The idToken supplied by the server after logging in - * Redirects the window to the location required to perform RP initiated logout - * - * @hidden - */ -function maybeBuildRpInitiatedLogout({ endSessionEndpoint, idTokenHint, }) { - if (endSessionEndpoint === undefined) - return undefined; - return function logout({ state, postLogoutUrl }) { - return getEndSessionUrl({ - endSessionEndpoint, - idTokenHint, - state, - postLogoutRedirectUri: postLogoutUrl, - }); - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function isSupportedTokenType(token) { - return typeof token === "string" && ["DPoP", "Bearer"].includes(token); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const USER_SESSION_PREFIX = "solidClientAuthenticationUser"; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function isValidUrl(url) { - try { - // Here, the URL constructor is just called to parse the given string and - // verify if it is a well-formed IRI. - // eslint-disable-next-line no-new - new URL(url); - return true; - } - catch (_a) { - return false; - } -} -function determineSigningAlg(supported, preferred) { - var _a; - return ((_a = preferred.find((signingAlg) => { - return supported.includes(signingAlg); - })) !== null && _a !== void 0 ? _a : null); -} -function determineClientType(options, issuerConfig) { - if (options.clientId !== undefined && !isValidUrl(options.clientId)) { - return "static"; - } - if (issuerConfig.scopesSupported.includes("webid") && - options.clientId !== undefined && - isValidUrl(options.clientId)) { - return "solid-oidc"; - } - // If no client_id is provided, the client must go through Dynamic Client Registration. - // If a client_id is provided and it looks like a URI, yet the Identity Provider - // does *not* support Solid-OIDC, then we also perform DCR (and discard the - // provided client_id). - return "dynamic"; -} -async function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) { - const clientType = determineClientType(options, issuerConfig); - if (clientType === "dynamic") { - return clientRegistrar.getClient({ - sessionId: options.sessionId, - clientName: options.clientName, - redirectUrl: options.redirectUrl, - }, issuerConfig); - } - // If a client_id was provided, and the Identity Provider is Solid-OIDC compliant, - // or it is not compliant but the client_id isn't an IRI (we assume it has already - // been registered with the IdP), then the client registration information needs - // to be stored so that it can be retrieved later after redirect. - await storageUtility.setForUser(options.sessionId, { - // If the client is either static or solid-oidc compliant, its client ID cannot be undefined. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - clientId: options.clientId, - }); - if (options.clientSecret) { - await storageUtility.setForUser(options.sessionId, { - clientSecret: options.clientSecret, - }); - } - if (options.clientName) { - await storageUtility.setForUser(options.sessionId, { - clientName: options.clientName, - }); - } - return { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - clientId: options.clientId, - clientSecret: options.clientSecret, - clientName: options.clientName, - clientType, - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -// By only referring to `window` at runtime, apps that do server-side rendering -// won't run into errors when rendering code that instantiates a -// ClientAuthentication: -const globalFetch = (request, init) => _inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__.fetch.call(globalThis, request, init); -/** - * @hidden - */ -class ClientAuthentication { - constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) { - this.loginHandler = loginHandler; - this.redirectHandler = redirectHandler; - this.logoutHandler = logoutHandler; - this.sessionInfoManager = sessionInfoManager; - this.issuerConfigFetcher = issuerConfigFetcher; - // By default, our fetch() resolves to the environment fetch() function. - this.fetch = globalFetch; - this.logout = async (sessionId, options) => { - // When doing IDP logout this will redirect away from the current page, so we should not expect - // code after this condition to be run if it is true. - // We also need to make sure that any other cleanup that we want to do for - // our session takes place before this condition is run - await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === "idp" - ? { - ...options, - toLogoutUrl: this.boundLogout, - } - : options); - // Restore our fetch() function back to the environment fetch(), effectively - // leaving us with un-authenticated fetches from now on. - this.fetch = globalFetch; - // Delete the bound logout function, so that it can't be called after this. - delete this.boundLogout; - }; - this.getSessionInfo = async (sessionId) => { - // TODO complete - return this.sessionInfoManager.get(sessionId); - }; - this.getAllSessionInfo = async () => { - return this.sessionInfoManager.getAll(); - }; - this.loginHandler = loginHandler; - this.redirectHandler = redirectHandler; - this.logoutHandler = logoutHandler; - this.sessionInfoManager = sessionInfoManager; - this.issuerConfigFetcher = issuerConfigFetcher; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * A helper class that will validate items taken from local storage - */ -async function getSessionIdFromOauthState(storageUtility, oauthState) { - return storageUtility.getForUser(oauthState, "sessionId"); -} -/** - * Based on the provided state, this looks up contextual information stored - * before redirecting the user to the OIDC issuer. - * @param sessionId The state (~ correlation ID) of the OIDC request - * @param storageUtility - * @param configFetcher - * @returns Information stored about the client issuing the request - */ -async function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) { - try { - const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([ - storageUtility.getForUser(sessionId, "issuer", { - errorIfNull: true, - }), - storageUtility.getForUser(sessionId, "codeVerifier"), - storageUtility.getForUser(sessionId, "redirectUrl"), - storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true }), - ]); - // Clear the code verifier, which is one-time use. - await storageUtility.deleteForUser(sessionId, "codeVerifier"); - // Unlike openid-client, this looks up the configuration from storage - const issuerConfig = await configFetcher.fetchConfig(issuerIri); - return { - codeVerifier, - redirectUrl: storedRedirectIri, - issuerConfig, - dpop: dpop === "true", - }; - } - catch (e) { - throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`); - } -} -/** - * Stores information about the session in the provided storage. Note that not - * all storage are equally secure, and it is strongly advised not to store either - * the refresh token or the DPoP key in the browser's local storage. - * - * @param storageUtility - * @param sessionId - * @param webId - * @param isLoggedIn - * @param refreshToken - * @param secure - * @param dpopKey - */ -async function saveSessionInfoToStorage(storageUtility, sessionId, webId, isLoggedIn, refreshToken, secure, dpopKey) { - // TODO: Investigate why this does not work with a Promise.all - if (refreshToken !== undefined) { - await storageUtility.setForUser(sessionId, { refreshToken }, { secure }); - } - if (webId !== undefined) { - await storageUtility.setForUser(sessionId, { webId }, { secure }); - } - if (isLoggedIn !== undefined) { - await storageUtility.setForUser(sessionId, { isLoggedIn }, { secure }); - } - if (dpopKey !== undefined) { - await storageUtility.setForUser(sessionId, { - publicKey: JSON.stringify(dpopKey.publicKey), - privateKey: JSON.stringify(await (0,jose__WEBPACK_IMPORTED_MODULE_1__.exportJWK)(dpopKey.privateKey)), - }, { secure }); - } -} -// TOTEST: this does not handle all possible bad inputs for example what if it's not proper JSON -/** - * @hidden - */ -class StorageUtility { - constructor(secureStorage, insecureStorage) { - this.secureStorage = secureStorage; - this.insecureStorage = insecureStorage; - this.secureStorage = secureStorage; - this.insecureStorage = insecureStorage; - } - getKey(userId) { - return `solidClientAuthenticationUser:${userId}`; - } - async getUserData(userId, secure) { - const stored = await (secure - ? this.secureStorage - : this.insecureStorage).get(this.getKey(userId)); - if (stored === undefined) { - return {}; - } - try { - return JSON.parse(stored); - } - catch (err) { - throw new Error(`Data for user [${userId}] in [${secure ? "secure" : "unsecure"}] storage is corrupted - expected valid JSON, but got: ${stored}`); - } - } - async setUserData(userId, data, secure) { - await (secure ? this.secureStorage : this.insecureStorage).set(this.getKey(userId), JSON.stringify(data)); - } - async get(key, options) { - const value = await ((options === null || options === void 0 ? void 0 : options.secure) - ? this.secureStorage - : this.insecureStorage).get(key); - if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) { - throw new Error(`[${key}] is not stored`); - } - return value; - } - async set(key, value, options) { - return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).set(key, value); - } - async delete(key, options) { - return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(key); - } - async getForUser(userId, key, options) { - const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure); - let value; - if (!userData || !userData[key]) { - value = undefined; - } - value = userData[key]; - if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) { - throw new Error(`Field [${key}] for user [${userId}] is not stored`); - } - return value || undefined; - } - async setForUser(userId, values, options) { - let userData; - try { - userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure); - } - catch (_a) { - // if reading the user data throws, the data is corrupted, and we want to write over it - userData = {}; - } - await this.setUserData(userId, { ...userData, ...values }, options === null || options === void 0 ? void 0 : options.secure); - } - async deleteForUser(userId, key, options) { - const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure); - delete userData[key]; - await this.setUserData(userId, userData, options === null || options === void 0 ? void 0 : options.secure); - } - async deleteAllUserData(userId, options) { - await ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(this.getKey(userId)); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - */ -class InMemoryStorage { - constructor() { - this.map = {}; - } - async get(key) { - return this.map[key] || undefined; - } - async set(key, value) { - this.map[key] = value; - } - async delete(key) { - delete this.map[key]; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered when a poor configuration is received - */ -// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages -// https://github.com/gotwarlost/istanbul/issues/690 -// The workaround is to put istanbul ignore on the constructor -/** - * @hidden - */ -class ConfigurationError extends Error { - /* istanbul ignore next */ - constructor(message) { - super(message); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered if a method is not implemented - * @hidden - */ -class NotImplementedError extends Error { - /* istanbul ignore next */ - constructor(methodName) { - super(`[${methodName}] is not implemented`); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered when receiving a response missing mandatory elements - */ -// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages -// https://github.com/gotwarlost/istanbul/issues/690 -// The workaround is to put istanbul ignore on the constructor -/** - * @hidden - */ -class InvalidResponseError extends Error { - /* istanbul ignore next */ - constructor(missingFields) { - super(`Invalid response from OIDC provider: missing fields ${missingFields}`); - this.missingFields = missingFields; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * @packageDocumentation - */ -/** - * Error to be triggered when receiving a response missing mandatory elements - */ -// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages -// https://github.com/gotwarlost/istanbul/issues/690 -// The workaround is to put istanbul ignore on the constructor -/** - * @hidden - */ -class OidcProviderError extends Error { - /* istanbul ignore next */ - constructor(message, error, errorDescription) { - super(message); - this.error = error; - this.errorDescription = errorDescription; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Normalizes a URL in order to generate the DPoP token based on a consistent scheme. - * - * @param audience The URL to normalize. - * @returns The normalized URL as a string. - * @hidden - */ -function normalizeHTU(audience) { - const audienceUrl = new URL(audience); - return new URL(audienceUrl.pathname, audienceUrl.origin).toString(); -} -/** - * Creates a DPoP header according to https://tools.ietf.org/html/draft-fett-oauth-dpop-04, - * based on the target URL and method, using the provided key. - * - * @param audience Target URL. - * @param method HTTP method allowed. - * @param key Key used to sign the token. - * @returns A JWT that can be used as a DPoP Authorization header. - */ -async function createDpopHeader(audience, method, dpopKey) { - return new jose__WEBPACK_IMPORTED_MODULE_1__.SignJWT({ - htu: normalizeHTU(audience), - htm: method.toUpperCase(), - jti: (0,uuid__WEBPACK_IMPORTED_MODULE_3__["default"])(), - }) - .setProtectedHeader({ - alg: PREFERRED_SIGNING_ALG[0], - jwk: dpopKey.publicKey, - typ: "dpop+jwt", - }) - .setIssuedAt() - .sign(dpopKey.privateKey, {}); -} -async function generateDpopKeyPair() { - const { privateKey, publicKey } = await (0,jose__WEBPACK_IMPORTED_MODULE_1__.generateKeyPair)(PREFERRED_SIGNING_ALG[0]); - const dpopKeyPair = { - privateKey, - publicKey: await (0,jose__WEBPACK_IMPORTED_MODULE_1__.exportJWK)(publicKey), - }; - // The alg property isn't set by exportJWK, so set it manually. - [dpopKeyPair.publicKey.alg] = PREFERRED_SIGNING_ALG; - return dpopKeyPair; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * If expires_in isn't specified for the access token, we assume its lifetime is - * 10 minutes. - */ -const DEFAULT_EXPIRATION_TIME_SECONDS = 600; -function isExpectedAuthError(statusCode) { - // As per https://tools.ietf.org/html/rfc7235#section-3.1 and https://tools.ietf.org/html/rfc7235#section-3.1, - // a response failing because the provided credentials aren't accepted by the - // server can get a 401 or a 403 response. - return [401, 403].includes(statusCode); -} -async function buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions) { - var _a; - const headers = new _inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__.Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers); - // Any pre-existing Authorization header should be overriden. - headers.set("Authorization", `DPoP ${authToken}`); - headers.set("DPoP", await createDpopHeader(targetUrl, (_a = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.method) !== null && _a !== void 0 ? _a : "get", dpopKey)); - return { - ...defaultOptions, - headers, - }; -} -async function buildAuthenticatedHeaders(targetUrl, authToken, dpopKey, defaultOptions) { - if (dpopKey !== undefined) { - return buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions); - } - const headers = new _inrupt_universal_fetch__WEBPACK_IMPORTED_MODULE_2__.Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers); - // Any pre-existing Authorization header should be overriden. - headers.set("Authorization", `Bearer ${authToken}`); - return { - ...defaultOptions, - headers, - }; -} -async function makeAuthenticatedRequest(unauthFetch, accessToken, url, defaultRequestInit, dpopKey) { - return unauthFetch(url, await buildAuthenticatedHeaders(url.toString(), accessToken, dpopKey, defaultRequestInit)); -} -async function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) { - var _a; - const tokenSet = await refreshOptions.tokenRefresher.refresh(refreshOptions.sessionId, refreshOptions.refreshToken, dpopKey); - eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.SESSION_EXTENDED, (_a = tokenSet.expiresIn) !== null && _a !== void 0 ? _a : DEFAULT_EXPIRATION_TIME_SECONDS); - if (typeof tokenSet.refreshToken === "string") { - eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken); - } - return { - accessToken: tokenSet.accessToken, - refreshToken: tokenSet.refreshToken, - expiresIn: tokenSet.expiresIn, - }; -} -/** - * - * @param expiresIn Delay until the access token expires. - * @returns a delay until the access token should be refreshed. - */ -const computeRefreshDelay = (expiresIn) => { - if (expiresIn !== undefined) { - return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0 - ? // We want to refresh the token 5 seconds before they actually expire. - expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS - : expiresIn; - } - return DEFAULT_EXPIRATION_TIME_SECONDS; -}; -/** - * @param unauthFetch a regular fetch function, compliant with the WHATWG spec. - * @param authToken an access token, either a Bearer token or a DPoP one. - * @param options The option object may contain two objects: the DPoP key token - * is bound to if applicable, and options to customise token renewal behaviour. - * - * @returns A fetch function that adds an appropriate Authorization header with - * the provided token, and adds a DPoP header if applicable. - */ -async function buildAuthenticatedFetch(unauthFetch, accessToken, options) { - var _a; - let currentAccessToken = accessToken; - let latestTimeout; - const currentRefreshOptions = options === null || options === void 0 ? void 0 : options.refreshOptions; - // Setup the refresh timeout outside of the authenticated fetch, so that - // an idle app will not get logged out if it doesn't issue a fetch before - // the first expiration date. - if (currentRefreshOptions !== undefined) { - const proactivelyRefreshToken = async () => { - var _a, _b, _c, _d; - try { - const { accessToken: refreshedAccessToken, refreshToken, expiresIn, } = await refreshAccessToken(currentRefreshOptions, - // If currentRefreshOptions is defined, options is necessarily defined too. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.dpopKey, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.eventEmitter); - // Update the tokens in the closure if appropriate. - currentAccessToken = refreshedAccessToken; - if (refreshToken !== undefined) { - currentRefreshOptions.refreshToken = refreshToken; - } - // Each time the access token is refreshed, we must plan fo the next - // refresh iteration. - clearTimeout(latestTimeout); - latestTimeout = setTimeout(proactivelyRefreshToken, computeRefreshDelay(expiresIn) * 1000); - // If currentRefreshOptions is defined, options is necessarily defined too. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout); - } - catch (e) { - // It is possible that an underlying library throws an error on refresh flow failure. - // If we used a log framework, the error could be logged at the `debug` level, - // but otherwise the failure of the refresh flow should not blow up in the user's - // face, so we just swallow the error. - if (e instanceof OidcProviderError) { - // The OIDC provider refused to refresh the access token and returned an error instead. - /* istanbul ignore next 100% coverage would require testing that nothing - happens here if the emitter is undefined, which is more cumbersome - than what it's worth. */ - (_b = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _b === void 0 ? void 0 : _b.emit(EVENTS.ERROR, e.error, e.errorDescription); - /* istanbul ignore next 100% coverage would require testing that nothing - happens here if the emitter is undefined, which is more cumbersome - than what it's worth. */ - (_c = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _c === void 0 ? void 0 : _c.emit(EVENTS.SESSION_EXPIRED); - } - if (e instanceof InvalidResponseError && - e.missingFields.includes("access_token")) { - // In this case, the OIDC provider returned a non-standard response, but - // did not specify that it was an error. We cannot refresh nonetheless. - /* istanbul ignore next 100% coverage would require testing that nothing - happens here if the emitter is undefined, which is more cumbersome - than what it's worth. */ - (_d = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _d === void 0 ? void 0 : _d.emit(EVENTS.SESSION_EXPIRED); - } - } - }; - latestTimeout = setTimeout(proactivelyRefreshToken, - // If currentRefreshOptions is defined, options is necessarily defined too. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - computeRefreshDelay(options.expiresIn) * 1000); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout); - } - else if (options !== undefined && options.eventEmitter !== undefined) { - // If no refresh options are provided, the session expires when the access token does. - const expirationTimeout = setTimeout(() => { - // The event emitter is always defined in our code, and it would be tedious - // to test for conditions when it is not. - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.eventEmitter.emit(EVENTS.SESSION_EXPIRED); - }, computeRefreshDelay(options.expiresIn) * 1000); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout); - } - return async (url, requestInit) => { - let response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, url, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey); - const failedButNotExpectedAuthError = !response.ok && !isExpectedAuthError(response.status); - if (response.ok || failedButNotExpectedAuthError) { - // If there hasn't been a redirection, or if there has been a non-auth related - // issue, it should be handled at the application level - return response; - } - const hasBeenRedirected = response.url !== url; - if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== undefined) { - // If the request failed for auth reasons, and has been redirected, we should - // replay it generating a DPoP header for the rediration target IRI. This - // doesn't apply to Bearer tokens, as the Bearer tokens aren't specific - // to a given resource and method, while the DPoP header (associated to a - // DPoP token) is. - response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, - // Replace the original target IRI (`url`) by the redirection target - response.url, requestInit, options.dpopKey); - } - return response; - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const StorageUtilityGetResponse = "getResponse"; -const StorageUtilityMock = { - /* eslint-disable @typescript-eslint/no-unused-vars */ - get: async (key, options) => StorageUtilityGetResponse, - set: async (key, value) => { - /* do nothing */ - }, - delete: async (key) => { - /* do nothing */ - }, - getForUser: async (userId, key, options) => StorageUtilityGetResponse, - setForUser: async (userId, values, options) => { - /* do nothing */ - }, - deleteForUser: async (userId, key, options) => { - /* do nothing */ - }, - deleteAllUserData: async (userId, options) => { - /* do nothing */ - }, -}; -const mockStorage = (stored) => { - const store = stored; - return { - get: async (key) => { - if (store[key] === undefined) { - return undefined; - } - if (typeof store[key] === "string") { - return store[key]; - } - return JSON.stringify(store[key]); - }, - set: async (key, value) => { - store[key] = value; - }, - delete: async (key) => { - delete store[key]; - }, - }; -}; -const mockStorageUtility = (stored, isSecure = false) => { - if (isSecure) { - return new StorageUtility(mockStorage(stored), mockStorage({})); - } - return new StorageUtility(mockStorage({}), mockStorage(stored)); -}; - - -//# sourceMappingURL=index.mjs.map - - -/***/ }), - -/***/ "./node_modules/@inrupt/solid-client/dist/index.js": -/*!*********************************************************!*\ - !*** ./node_modules/@inrupt/solid-client/dist/index.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -var jsonldStreamingParser = __webpack_require__(/*! jsonld-streaming-parser */ "./node_modules/jsonld-streaming-parser/index.js"); -var jsonldContextParser = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -var universalFetch = __webpack_require__(/*! @inrupt/universal-fetch */ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js"); -var LinkHeader = __webpack_require__(/*! http-link-header */ "./node_modules/http-link-header/lib/link.js"); -var n3 = __webpack_require__(/*! n3 */ "./node_modules/n3/src/index.js"); -var RdfJsDataFactory = __webpack_require__(/*! @rdfjs/data-model */ "./node_modules/@rdfjs/data-model/index.js"); -var rdfJsDatasetModule = __webpack_require__(/*! @rdfjs/dataset */ "./node_modules/@rdfjs/dataset/index.js"); -var uuid = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/commonjs-browser/index.js"); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Verify whether a given SolidDataset includes metadata about where it was sent to. - * - * @param dataset A [[SolidDataset]] that may have metadata attached about the Resource it was retrieved from. - * @returns True if `dataset` includes metadata about the Resource it was sent to, false if not. - * @since 0.2.0 - */ -function hasResourceInfo(resource) { - const potentialResourceInfo = resource; - return (typeof potentialResourceInfo === "object" && - typeof potentialResourceInfo.internal_resourceInfo === "object"); -} -/** - * Verify whether a given SolidDataset includes metadata about where it was retrieved from. - * - * @param dataset A [[SolidDataset]] that may have metadata attached about the Resource it was retrieved from. - * @returns True if `dataset` includes metadata about the Resource it was retrieved from, false if not. - * @since 0.6.0 - */ -function hasServerResourceInfo(resource) { - const potentialResourceInfo = resource; - return (typeof potentialResourceInfo === "object" && - typeof potentialResourceInfo.internal_resourceInfo === "object" && - typeof potentialResourceInfo.internal_resourceInfo.linkedResources === - "object"); -} -/** @internal */ -function hasChangelog(dataset) { - const potentialChangeLog = dataset; - return (typeof potentialChangeLog.internal_changeLog === "object" && - Array.isArray(potentialChangeLog.internal_changeLog.additions) && - Array.isArray(potentialChangeLog.internal_changeLog.deletions)); -} -/** - * Errors thrown by solid-client extend this class, and can thereby be distinguished from errors - * thrown in lower-level libraries. - * @since 1.2.0 - */ -class SolidClientError extends Error { -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @internal */ -function internal_toIriString(iri) { - return typeof iri === "string" ? iri : iri.value; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Make sure fetch can't be rebound, because it can cause errors in the browser. -// Namely, it causes the issue discussed in https://stackoverflow.com/questions/71822422/uncaught-in-promise-typeerror-fetch-called-on-an-object-that-does-not-imple. -// @see https://github.com/inrupt/solid-client-js/pull/1884#discussion_r1153872418 -const fetch = universalFetch.fetch.bind(globalThis); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @internal - */ -function internal_parseResourceInfo(response) { - var _a, _b, _c, _d, _e; - const contentTypeParts = (_b = (_a = response.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.split(";")) !== null && _b !== void 0 ? _b : []; - // If the server offers a Turtle or JSON-LD serialisation on its own accord, - // that tells us whether it is RDF data that the server can understand - // (and hence can be updated with a PATCH request with SPARQL INSERT and DELETE statements), - // in which case our SolidDataset-related functions should handle it. - // For more context, see https://github.com/inrupt/solid-client-js/pull/214. - const isSolidDataset = contentTypeParts.length > 0 && - ["text/turtle", "application/ld+json"].includes(contentTypeParts[0]); - const resourceInfo = { - sourceIri: response.url, - isRawData: !isSolidDataset, - contentLocation: (_c = response.headers.get("Content-Location")) !== null && _c !== void 0 ? _c : undefined, - contentType: (_d = response.headers.get("Content-Type")) !== null && _d !== void 0 ? _d : undefined, - linkedResources: {}, - location: (_e = response.headers.get("Location")) !== null && _e !== void 0 ? _e : undefined, - }; - const linkHeader = response.headers.get("Link"); - if (linkHeader) { - const parsedLinks = LinkHeader.parse(linkHeader); - // Set ACL link - const aclLinks = parsedLinks.get("rel", "acl"); - if (aclLinks.length === 1) { - resourceInfo.aclUrl = new URL(aclLinks[0].uri, resourceInfo.sourceIri).href; - } - // Parse all link headers and expose them in a standard way - // (this can replace the parsing of the ACL link above): - resourceInfo.linkedResources = parsedLinks.refs.reduce((rels, ref) => { - var _a; - var _b; - (_a = rels[_b = ref.rel]) !== null && _a !== void 0 ? _a : (rels[_b] = []); - rels[ref.rel].push(new URL(ref.uri, resourceInfo.sourceIri).href); - return rels; - }, resourceInfo.linkedResources); - } - const wacAllowHeader = response.headers.get("WAC-Allow"); - if (wacAllowHeader) { - resourceInfo.permissions = parseWacAllowHeader(wacAllowHeader); - } - return resourceInfo; -} -/** - * Parse a WAC-Allow header into user and public access booleans. - * - * @param wacAllowHeader A WAC-Allow header in the format `user="read append write control",public="read"` - * @see https://github.com/solid/solid-spec/blob/cb1373a369398d561b909009bd0e5a8c3fec953b/api-rest.md#wac-allow-headers - */ -function parseWacAllowHeader(wacAllowHeader) { - function parsePermissionStatement(permissionStatement) { - const permissions = permissionStatement.split(" "); - const writePermission = permissions.includes("write"); - return writePermission - ? { - read: permissions.includes("read"), - append: true, - write: true, - control: permissions.includes("control"), - } - : { - read: permissions.includes("read"), - append: permissions.includes("append"), - write: false, - control: permissions.includes("control"), - }; - } - function getStatementFor(header, scope) { - const relevantEntries = header - .split(",") - .map((rawEntry) => rawEntry.split("=")) - .filter((parts) => parts.length === 2 && parts[0].trim() === scope); - // There should only be one statement with the given scope: - if (relevantEntries.length !== 1) { - return ""; - } - const relevantStatement = relevantEntries[0][1].trim(); - // The given statement should be wrapped in double quotes to be valid: - if (relevantStatement.charAt(0) !== '"' || - relevantStatement.charAt(relevantStatement.length - 1) !== '"') { - return ""; - } - // Return the statment without the wrapping quotes, e.g.: read append write control - return relevantStatement.substring(1, relevantStatement.length - 1); - } - return { - user: parsePermissionStatement(getStatementFor(wacAllowHeader, "user")), - public: parsePermissionStatement(getStatementFor(wacAllowHeader, "public")), - }; -} -/** @hidden Used to instantiate a separate instance from input parameters */ -function internal_cloneResource(resource) { - let clonedResource; - if (typeof resource.slice === "function") { - // If given Resource is a File: - clonedResource = Object.assign(resource.slice(), { ...resource }); - } - else { - // If it is just a plain object containing metadata: - clonedResource = { ...resource }; - } - return clonedResource; -} -/** @internal */ -function internal_isUnsuccessfulResponse(response) { - return !response.ok; -} -function internal_isAuthenticationFailureResponse(response) { - return response.status === 401 || response.status === 403; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// TODO: These should be replaced by auto-generated constants, -// if we can ensure that unused constants will be excluded from bundles. -/** @hidden */ -const acl = { - Authorization: "http://www.w3.org/ns/auth/acl#Authorization", - AuthenticatedAgent: "http://www.w3.org/ns/auth/acl#AuthenticatedAgent", - accessTo: "http://www.w3.org/ns/auth/acl#accessTo", - agent: "http://www.w3.org/ns/auth/acl#agent", - agentGroup: "http://www.w3.org/ns/auth/acl#agentGroup", - agentClass: "http://www.w3.org/ns/auth/acl#agentClass", - default: "http://www.w3.org/ns/auth/acl#default", - defaultForNew: "http://www.w3.org/ns/auth/acl#defaultForNew", - mode: "http://www.w3.org/ns/auth/acl#mode", - origin: "http://www.w3.org/ns/auth/acl#origin", -}; -/** @hidden */ -const rdf = { - type: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", -}; -/** @hidden */ -const rdfs = { - seeAlso: "http://www.w3.org/2000/01/rdf-schema#seeAlso", -}; -/** @hidden */ -const ldp = { - BasicContainer: "http://www.w3.org/ns/ldp#BasicContainer", - Container: "http://www.w3.org/ns/ldp#Container", - Resource: "http://www.w3.org/ns/ldp#Resource", - contains: "http://www.w3.org/ns/ldp#contains", -}; -/** @hidden */ -const foaf = { - Agent: "http://xmlns.com/foaf/0.1/Agent", - primaryTopic: "http://xmlns.com/foaf/0.1/primaryTopic", - isPrimaryTopicOf: "http://xmlns.com/foaf/0.1/isPrimaryTopicOf", -}; -/** @hidden */ -const acp = { - AccessControlResource: "http://www.w3.org/ns/solid/acp#AccessControlResource", - Policy: "http://www.w3.org/ns/solid/acp#Policy", - AccessControl: "http://www.w3.org/ns/solid/acp#AccessControl", - Read: "http://www.w3.org/ns/solid/acp#Read", - Append: "http://www.w3.org/ns/solid/acp#Append", - Write: "http://www.w3.org/ns/solid/acp#Write", - /** @deprecated Removed from the ACP proposal, to be replaced by Matchers. */ - Rule: "http://www.w3.org/ns/solid/acp#Rule", - Matcher: "http://www.w3.org/ns/solid/acp#Matcher", - accessControl: "http://www.w3.org/ns/solid/acp#accessControl", - memberAccessControl: "http://www.w3.org/ns/solid/acp#memberAccessControl", - apply: "http://www.w3.org/ns/solid/acp#apply", - /** @deprecated Removed from the ACP proposal, to be replaced by memberAccessControls. */ - applyMembers: "http://www.w3.org/ns/solid/acp#applyMembers", - allow: "http://www.w3.org/ns/solid/acp#allow", - deny: "http://www.w3.org/ns/solid/acp#deny", - allOf: "http://www.w3.org/ns/solid/acp#allOf", - anyOf: "http://www.w3.org/ns/solid/acp#anyOf", - noneOf: "http://www.w3.org/ns/solid/acp#noneOf", - access: "http://www.w3.org/ns/solid/acp#access", - /** @deprecated Removed from the ACP proposal, to be replaced by memberAccessControls. */ - accessMembers: "http://www.w3.org/ns/solid/acp#accessMembers", - agent: "http://www.w3.org/ns/solid/acp#agent", - group: "http://www.w3.org/ns/solid/acp#group", - client: "http://www.w3.org/ns/solid/acp#client", - PublicAgent: "http://www.w3.org/ns/solid/acp#PublicAgent", - AuthenticatedAgent: "http://www.w3.org/ns/solid/acp#AuthenticatedAgent", - CreatorAgent: "http://www.w3.org/ns/solid/acp#CreatorAgent", -}; -/** @hidden */ -const solid = { - PublicOidcClient: "http://www.w3.org/ns/solid/terms#PublicOidcClient", -}; -/** @hidden */ -const security = { - publicKey: "https://w3id.org/security#publicKey", -}; -/** @hidden */ -const pim = { - storage: "http://www.w3.org/ns/pim/space#storage", -}; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @ignore For internal use only. */ -const internal_defaultFetchOptions = { - fetch, -}; -/** - * Retrieve the information about a resource (e.g. access permissions) without - * fetching the resource itself. - * - * @param url URL to fetch Resource metadata from. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters). - * @returns Promise resolving to the metadata describing the given Resource, or rejecting if fetching it failed. - * @since 0.4.0 - */ -async function getResourceInfo(url, options = { ...internal_defaultFetchOptions, ignoreAuthenticationErrors: false }) { - var _a; - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const response = await config.fetch(url, { method: "HEAD" }); - return responseToResourceInfo(response, { - ignoreAuthenticationErrors: (_a = options.ignoreAuthenticationErrors) !== null && _a !== void 0 ? _a : false, - }); -} -/** - * Parse Solid metadata from a Response obtained by fetching a Resource from a Solid Pod, - * - * @param response A Fetch API Response. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Response MDN}. - * @returns Resource metadata readable by functions such as [[getSourceUrl]]. - * @hidden This interface is not exposed yet until we've tried it out in practice. - */ -function responseToResourceInfo(response, options = { ignoreAuthenticationErrors: false }) { - if (internal_isUnsuccessfulResponse(response) && - (!internal_isAuthenticationFailureResponse(response) || - !options.ignoreAuthenticationErrors)) { - throw new FetchError(`Fetching the metadata of the Resource at [${response.url}] failed: [${response.status}] [${response.statusText}].`, response); - } - const resourceInfo = internal_parseResourceInfo(response); - return { internal_resourceInfo: resourceInfo }; -} -/** - * @param resource Resource for which to check whether it is a Container. - * @returns Whether `resource` is a Container. - */ -function isContainer(resource) { - const containerUrl = hasResourceInfo(resource) - ? getSourceUrl(resource) - : internal_toIriString(resource); - return containerUrl.endsWith("/"); -} -/** - * This function will tell you whether a given Resource contains raw data, or a SolidDataset. - * - * @param resource Resource for which to check whether it contains raw data. - * @return Whether `resource` contains raw data. - */ -function isRawData(resource) { - return resource.internal_resourceInfo.isRawData; -} -/** - * @param resource Resource for which to determine the Content Type. - * @returns The Content Type, if known, or null if not known. - */ -function getContentType$1(resource) { - var _a; - return (_a = resource.internal_resourceInfo.contentType) !== null && _a !== void 0 ? _a : null; -} -function getSourceUrl(resource) { - if (hasResourceInfo(resource)) { - return resource.internal_resourceInfo.sourceIri; - } - return null; -} -/** @hidden Alias of getSourceUrl for those who prefer to use IRI terminology. */ -const getSourceIri = getSourceUrl; -/** - * Given a Resource that exposes information about the owner of the Pod it is in, returns the WebID of that owner. - * - * Data about the owner of the Pod is exposed when the following conditions hold: - * - The Pod server supports exposing the Pod owner - * - The current user is allowed to see who the Pod owner is. - * - * If one or more of those conditions are false, this function will return `null`. - * - * @param resource A Resource that contains information about the owner of the Pod it is in. - * @returns The WebID of the owner of the Pod the Resource is in, if provided, or `null` if not. - * @since 0.6.0 - */ -function getPodOwner(resource) { - var _a; - if (!hasServerResourceInfo(resource)) { - return null; - } - const podOwners = (_a = getLinkedResourceUrlAll(resource)["http://www.w3.org/ns/solid/terms#podOwner"]) !== null && _a !== void 0 ? _a : []; - return podOwners.length === 1 ? podOwners[0] : null; -} -/** - * Given a WebID and a Resource that exposes information about the owner of the Pod it is in, returns whether the given WebID is the owner of the Pod. - * - * Data about the owner of the Pod is exposed when the following conditions hold: - * - The Pod server supports exposing the Pod owner - * - The current user is allowed to see who the Pod owner is. - * - * If one or more of those conditions are false, this function will return `null`. - * - * @param webId The WebID of which to check whether it is the Pod Owner's. - * @param resource A Resource that contains information about the owner of the Pod it is in. - * @returns Whether the given WebID is the Pod Owner's, if the Pod Owner is exposed, or `null` if it is not exposed. - * @since 0.6.0 - */ -function isPodOwner(webId, resource) { - const podOwner = getPodOwner(resource); - if (typeof podOwner !== "string") { - return null; - } - return podOwner === webId; -} -/** - * Get the URLs of Resources linked to the given Resource. - * - * Solid servers can link Resources to each other. For example, in servers - * implementing Web Access Control, Resources can have an Access Control List - * Resource linked to it via the `acl` relation. - * - * @param resource A Resource fetched from a Solid Pod. - * @returns The URLs of Resources linked to the given Resource, indexed by the key that links them. - * @since 1.7.0 - */ -function getLinkedResourceUrlAll(resource) { - return resource.internal_resourceInfo.linkedResources; -} -/** - * Get what access the current user has to the given Resource. - * - * This function can tell you what access the current user has for the given - * Resource, allowing you to e.g. determine that changes to it will be rejected - * before attempting to do so. - * Additionally, for servers adhering to the Web Access Control specification, - * it will tell you what access unauthenticated users have to the given Resource. - * - * @param resource A Resource fetched from a Solid Pod. - * @returns What access the current user and, if supported by the server, unauthenticated users have to the given Resource. - * @since 1.7.0 - */ -function getEffectiveAccess(resource) { - var _a, _b, _c, _d, _e, _f, _g; - if (typeof resource.internal_resourceInfo.permissions === "object") { - return { - user: { - read: resource.internal_resourceInfo.permissions.user.read, - append: resource.internal_resourceInfo.permissions.user.append, - write: resource.internal_resourceInfo.permissions.user.write, - }, - public: { - read: resource.internal_resourceInfo.permissions.public.read, - append: resource.internal_resourceInfo.permissions.public.append, - write: resource.internal_resourceInfo.permissions.public.write, - }, - }; - } - const linkedResourceUrls = getLinkedResourceUrlAll(resource); - return { - user: { - read: (_b = (_a = linkedResourceUrls[acp.allow]) === null || _a === void 0 ? void 0 : _a.includes(acp.Read)) !== null && _b !== void 0 ? _b : false, - append: (_e = (((_c = linkedResourceUrls[acp.allow]) === null || _c === void 0 ? void 0 : _c.includes(acp.Append)) || - ((_d = linkedResourceUrls[acp.allow]) === null || _d === void 0 ? void 0 : _d.includes(acp.Write)))) !== null && _e !== void 0 ? _e : false, - write: (_g = (_f = linkedResourceUrls[acp.allow]) === null || _f === void 0 ? void 0 : _f.includes(acp.Write)) !== null && _g !== void 0 ? _g : false, - }, - }; -} -/** - * Extends the regular JavaScript error object with access to the status code and status message. - * @since 1.2.0 - */ -class FetchError extends SolidClientError { - get statusCode() { - return this.response.status; - } - get statusText() { - return this.response.statusText; - } - constructor(message, errorResponse) { - super(message); - this.response = errorResponse; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} This function is still experimental and subject to change, even - * in a non-major release. - * ``` - * This returns a parser that transforms a JSON-LD string into a set of RDFJS quads. - * - * @returns A Parser object. - * @since 1.15.0 - */ -const getJsonLdParser$1 = () => { - const onQuadCallbacks = []; - const onCompleteCallbacks = []; - const onErrorCallbacks = []; - return { - onQuad: (callback) => { - onQuadCallbacks.push(callback); - }, - onError: (callback) => { - onErrorCallbacks.push(callback); - }, - onComplete: (callback) => { - onCompleteCallbacks.push(callback); - }, - // The following returns a Promise that can be awaited, which is undocumented - // behavior that doesn't match the type signature. It prevents a potentially - // breaking change, and will be updated on the next major release. - parse: async (source, resourceInfo) => new Promise((res) => { - const parser = new jsonldStreamingParser.JsonLdParser({ - baseIRI: getSourceUrl(resourceInfo), - documentLoader: new jsonldContextParser.FetchDocumentLoader(fetch), - }); - let endCalled = false; - function end() { - if (!endCalled) { - endCalled = true; - onCompleteCallbacks.forEach((callback) => callback()); - res(); - } - } - parser.on("end", end); - parser.on("error", (err) => { - onErrorCallbacks.forEach((callback) => callback(err)); - end(); - }); - onQuadCallbacks.forEach((callback) => parser.on("data", callback)); - parser.write(source); - parser.end(); - }), - }; -}; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// @rdfjs/dataset is a CommonJS module, so named imports break in Node. -// Thus, import the default export, then obtain the `dataset` property from there. -rdfJsDatasetModule.dataset; -const localNodeSkolemPrefix = "https://inrupt.com/.well-known/sdk-local-node/"; -/** - * Runtime freezing might be too much overhead; - * if so, this function allows us to replace it by a function - * that merely marks its input as Readonly<> for static analysis. - */ -const { freeze } = Object; -function isLocalNodeIri(iri) { - return (iri.substring(0, localNodeSkolemPrefix.length) === localNodeSkolemPrefix); -} -function getLocalNodeName(localNodeIri) { - return localNodeIri.substring(localNodeSkolemPrefix.length); -} -function getLocalNodeIri(localNodeName) { - return `${localNodeSkolemPrefix}${localNodeName}`; -} -function isBlankNodeId(value) { - return typeof value === "string" && value.substring(0, 2) === "_:"; -} -function getBlankNodeValue(blankNodeId) { - return blankNodeId.substring(2); -} -function getBlankNodeId(blankNode) { - return `_:${blankNode.value}`; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * IRIs of the XML Schema data types we support - */ -const xmlSchemaTypes = { - boolean: "http://www.w3.org/2001/XMLSchema#boolean", - dateTime: "http://www.w3.org/2001/XMLSchema#dateTime", - date: "http://www.w3.org/2001/XMLSchema#date", - time: "http://www.w3.org/2001/XMLSchema#time", - decimal: "http://www.w3.org/2001/XMLSchema#decimal", - integer: "http://www.w3.org/2001/XMLSchema#integer", - string: "http://www.w3.org/2001/XMLSchema#string", - langString: "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", -}; -/** - * @internal - * @param value Value to serialise. - * @returns String representation of `value`. - * @see https://www.w3.org/TR/xmlschema-2/#boolean-lexical-representation - */ -function serializeBoolean(value) { - return value ? "true" : "false"; -} -/** - * @internal - * @param value Value to deserialise. - * @returns Deserialized boolean, or null if the given value is not a valid serialised boolean. - * @see https://www.w3.org/TR/xmlschema-2/#boolean-lexical-representation - */ -function deserializeBoolean(value) { - if (value === "true" || value === "1") { - return true; - } - if (value === "false" || value === "0") { - return false; - } - return null; -} -/** - * @internal - * @param value Value to serialise. - * @returns String representation of `value` in UTC. - * @see https://www.w3.org/TR/xmlschema-2/#time-lexical-repr - */ -function serializeTime(value) { - let millisecondString; - let timezoneString; - if (value.millisecond) { - if (value.millisecond < 10) { - millisecondString = `00${value.millisecond}`; - } - else if (value.millisecond < 100) { - millisecondString = `0${value.millisecond}`; - } - else { - millisecondString = value.millisecond; - } - } - if (typeof value.timezoneHourOffset === "number") { - const timezoneFormatted = Math.abs(value.timezoneHourOffset) < 10 - ? `0${Math.abs(value.timezoneHourOffset)}` - : Math.abs(value.timezoneHourOffset); - timezoneString = - value.timezoneHourOffset >= 0 - ? `+${timezoneFormatted}` - : `-${timezoneFormatted}`; - if (value.timezoneMinuteOffset) { - timezoneString = `${timezoneString}:${value.timezoneMinuteOffset < 10 - ? `0${value.timezoneMinuteOffset}` - : value.timezoneMinuteOffset}`; - } - else { - timezoneString += ":00"; - } - } - return `${value.hour < 10 ? `0${value.hour}` : value.hour}:${value.minute < 10 ? `0${value.minute}` : value.minute}:${value.second < 10 ? `0${value.second}` : value.second}${value.millisecond ? `.${millisecondString}` : ""}${timezoneString || ""}`; -} -/** - * @internal - * @param literalString Value to deserialise. - * @returns Deserialized time, or null if the given value is not a valid serialised datetime. - * @see https://www.w3.org/TR/xmlschema-2/#time-lexical-repr - */ -function deserializeTime(literalString) { - // Time in the format described at - // https://www.w3.org/TR/xmlschema-2/#time-lexical-repr - // \d\d:\d\d:\d\d - Two digits for the hour, minute and second, respectively, separated by a `:`. - // Example: "13:37:42". - // (\.\d+)? - Optionally a `.` followed by one or more digits representing milliseconds. - // Example: ".1337". - // (Z|(\+|-)\d\d:\d\d) - The letter Z indicating UTC, or a `+` or `-` followed by two digits for - // the hour offset and two for the minute offset, separated by a `:`. - // Example: "+13:37". - const timeRegEx = /\d\d:\d\d:\d\d(\.\d+)?(Z|(\+|-)\d\d:\d\d)?/; - if (!timeRegEx.test(literalString)) { - return null; - } - const [timeString, timezoneString] = splitTimeFromTimezone(literalString); - const [hourString, minuteString, timeRest] = timeString.split(":"); - let utcHours = Number.parseInt(hourString, 10); - let utcMinutes = Number.parseInt(minuteString, 10); - const [secondString, optionalMillisecondString] = timeRest.split("."); - const utcSeconds = Number.parseInt(secondString, 10); - const utcMilliseconds = optionalMillisecondString - ? Number.parseInt(optionalMillisecondString, 10) - : undefined; - if (utcMinutes >= 60) { - utcHours += 1; - utcMinutes -= 60; - } - const deserializedTime = { - hour: utcHours, - minute: utcMinutes, - second: utcSeconds, - }; - if (typeof utcMilliseconds === "number") { - deserializedTime.millisecond = utcMilliseconds; - } - if (typeof timezoneString === "string") { - const [hourOffset, minuteOffset] = getTimezoneOffsets(timezoneString); - if (typeof hourOffset !== "number" || - hourOffset > 24 || - typeof minuteOffset !== "number" || - minuteOffset > 59) { - return null; - } - deserializedTime.timezoneHourOffset = hourOffset; - deserializedTime.timezoneMinuteOffset = minuteOffset; - } - return deserializedTime; -} -/** - * @internal - * @param value Value to serialise. - * @returns String representation of `value`. - * @see https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation - */ -function serializeDatetime(value) { - // Although the XML Schema DateTime is not _exactly_ an ISO 8601 string - // (see https://www.w3.org/TR/xmlschema-2/#deviantformats), - // the deviations only affect the parsing, not the serialisation. - // Therefore, we can just use .toISOString(): - return value.toISOString(); -} -/** - * @internal - * @param value Value to deserialise. - * @returns Deserialized datetime, or null if the given value is not a valid serialised datetime. - * @see https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation - */ -function deserializeDatetime(literalString) { - // DateTime in the format described at - // https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation - // (without constraints on the value). - // -? - An optional leading `-`. - // \d{4,}- - Four or more digits followed by a `-` representing the year. Example: "3000-". - // \d\d-\d\d - Two digits representing the month and two representing the day of the month, - // separated by a `-`. Example: "11-03". - // T - The letter T, separating the date from the time. - // \d\d:\d\d:\d\d - Two digits for the hour, minute and second, respectively, separated by a `:`. - // Example: "13:37:42". - // (\.\d+)? - Optionally a `.` followed by one or more digits representing milliseconds. - // Example: ".1337". - // (Z|(\+|-)\d\d:\d\d) - The letter Z indicating UTC, or a `+` or `-` followed by two digits for - // the hour offset and two for the minute offset, separated by a `:`. - // Example: "+13:37". - const datetimeRegEx = /-?\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(Z|(\+|-)\d\d:\d\d)?/; - if (!datetimeRegEx.test(literalString)) { - return null; - } - const [signedDateString, rest] = literalString.split("T"); - // The date string can optionally be prefixed with `-`, - // in which case the year is negative: - const [yearMultiplier, dateString] = signedDateString.charAt(0) === "-" - ? [-1, signedDateString.substring(1)] - : [1, signedDateString]; - const [yearString, monthString, dayString] = dateString.split("-"); - const utcFullYear = Number.parseInt(yearString, 10) * yearMultiplier; - const utcMonth = Number.parseInt(monthString, 10) - 1; - const utcDate = Number.parseInt(dayString, 10); - const [timeString, timezoneString] = splitTimeFromTimezone(rest); - const [hourOffset, minuteOffset] = typeof timezoneString === "string" - ? getTimezoneOffsets(timezoneString) - : [0, 0]; - const [hourString, minuteString, timeRest] = timeString.split(":"); - const utcHours = Number.parseInt(hourString, 10) + hourOffset; - const utcMinutes = Number.parseInt(minuteString, 10) + minuteOffset; - const [secondString, optionalMillisecondString] = timeRest.split("."); - const utcSeconds = Number.parseInt(secondString, 10); - const utcMilliseconds = optionalMillisecondString - ? Number.parseInt(optionalMillisecondString, 10) - : 0; - const date = new Date(Date.UTC(utcFullYear, utcMonth, utcDate, utcHours, utcMinutes, utcSeconds, utcMilliseconds)); - // For the year, values from 0 to 99 map to the years 1900 to 1999. Since the serialisation - // always writes out the years fully, we should correct this to actually map to the years 0 to 99. - // See - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#Individual_date_and_time_component_values - if (utcFullYear >= 0 && utcFullYear < 100) { - // Note that we base it on the calculated year, rather than the year that was actually read. - // This is because the year might actually differ from the value listed in the serialisation, - // i.e. when moving the timezone offset to UTC pushes it into a different year: - date.setUTCFullYear(date.getUTCFullYear() - 1900); - } - return date; -} -/** - * @internal - * @param value Value to serialise. - * @returns String representation of `value`. - * @see https://www.w3.org/TR/xmlschema-2/#date-lexical-representation - */ -function serializeDate(value) { - const year = value.getFullYear(); - const month = value.getMonth() + 1; - const day = value.getDate(); - const [, timezone] = splitTimeFromTimezone(value.toISOString()); - return `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")}${timezone}`; -} -/** - * @internal - * @param value Value to deserialise. - * @returns Deserialized datetime, or null if the given value is not a valid serialised datetime. - * @see https://www.w3.org/TR/xmlschema-2/#date-lexical-representation - */ -function deserializeDate(literalString) { - // Date in the format described at - // https://www.w3.org/TR/xmlschema-2/#date-lexical-representation - // (without constraints on the value). - // -? - An optional leading `-`. - // \d{4,}- - Four or more digits followed by a `-` representing the year. Example: "3000-". - // \d\d-\d\d - Two digits representing the month and two representing the day of the month, - // separated by a `-`. Example: "11-03". - // (Z|(\+|-)\d\d:\d\d) - Optionally, the letter Z indicating UTC, or a `+` or `-` followed by two digits for - // the hour offset and two for the minute offset, separated by a `:`. - // Example: "+13:37". - const dateRegEx = /-?\d{4,}-\d\d-\d\d(Z|(\+|-)\d\d:\d\d)?/; - if (!dateRegEx.test(literalString)) { - return null; - } - const signedDateString = literalString; - // The date string can optionally be prefixed with `-`, - // in which case the year is negative: - const [yearMultiplier, dateString] = signedDateString.charAt(0) === "-" - ? [-1, signedDateString.substring(1)] - : [1, signedDateString]; - const [yearString, monthString, dayAndTimezoneString] = dateString.split("-"); - const dayString = dayAndTimezoneString.length > 2 - ? dayAndTimezoneString.substring(0, 2) - : dayAndTimezoneString; - const utcFullYear = Number.parseInt(yearString, 10) * yearMultiplier; - const utcMonth = Number.parseInt(monthString, 10) - 1; - const utcDate = Number.parseInt(dayString, 10); - const hour = 12; - // setting at 12:00 avoids all timezones - const date = new Date(Date.UTC(utcFullYear, utcMonth, utcDate, hour)); - // For the year, values from 0 to 99 map to the years 1900 to 1999. Since the serialisation - // always writes out the years fully, we should correct this to actually map to the years 0 to 99. - // See - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#Individual_date_and_time_component_values - if (utcFullYear >= 0 && utcFullYear < 100) { - date.setUTCFullYear(date.getUTCFullYear() - 1900); - } - return date; -} -/** - * @param timeString An XML Schema time string. - * @returns A tuple [timeString, timezoneString]. - * @see https://www.w3.org/TR/xmlschema-2/#time-lexical-repr - */ -function splitTimeFromTimezone(timeString) { - if (timeString.endsWith("Z")) { - return [timeString.substring(0, timeString.length - 1), "Z"]; - } - const splitOnPlus = timeString.split("+"); - const splitOnMinus = timeString.split("-"); - if (splitOnPlus.length === 1 && splitOnMinus.length === 1) { - return [splitOnPlus[0], undefined]; - } - return splitOnPlus.length > splitOnMinus.length - ? [splitOnPlus[0], `+${splitOnPlus[1]}`] - : [splitOnMinus[0], `-${splitOnMinus[1]}`]; -} -/** - * @param timezoneString Lexical representation of a time zone in XML Schema. - * @returns A tuple of the hour and minute offset of the time zone. - * @see https://www.w3.org/TR/xmlschema-2/#dateTime-timezones - */ -function getTimezoneOffsets(timezoneString) { - if (timezoneString === "Z") { - return [0, 0]; - } - const multiplier = timezoneString.charAt(0) === "+" ? 1 : -1; - const [hourString, minuteString] = timezoneString.substring(1).split(":"); - const hours = Number.parseInt(hourString, 10); - const minutes = Number.parseInt(minuteString, 10); - return [hours * multiplier, minutes * multiplier]; -} -/** - * @internal - * @param value Value to serialise. - * @returns String representation of `value`. - * @see https://www.w3.org/TR/xmlschema-2/#decimal-lexical-representation - */ -function serializeDecimal(value) { - return value.toString(); -} -/** - * @internal - * @param value Value to deserialise. - * @returns Deserialized decimal, or null if the given value is not a valid serialised decimal. - * @see https://www.w3.org/TR/xmlschema-2/#decimal-lexical-representation - */ -function deserializeDecimal(literalString) { - const deserialized = Number.parseFloat(literalString); - if (Number.isNaN(deserialized)) { - return null; - } - return deserialized; -} -/** - * @internal - * @param value Value to serialise. - * @returns String representation of `value`. - */ -function serializeInteger(value) { - return value.toString(); -} -/** - * @internal - * @param value Value to deserialise. - * @returns Deserialized integer, or null if the given value is not a valid serialised integer. - */ -function deserializeInteger(literalString) { - const deserialized = Number.parseInt(literalString, 10); - if (Number.isNaN(deserialized)) { - return null; - } - return deserialized; -} -/** - * @internal - * @param locale Locale to transform into a consistent format. - */ -function normalizeLocale(locale) { - return locale.toLowerCase(); -} -/** - * @internal Library users shouldn't need to be exposed to raw NamedNodes. - * @param value The value that might or might not be a Named Node. - * @returns Whether `value` is a Named Node. - */ -function isNamedNode(value) { - return isTerm(value) && value.termType === "NamedNode"; -} -/** - * @internal Library users shouldn't need to be exposed to raw Literals. - * @param value The value that might or might not be a Literal. - * @returns Whether `value` is a Literal. - */ -function isLiteral(value) { - return isTerm(value) && value.termType === "Literal"; -} -/** - * @internal Library users shouldn't need to be exposed to raw Terms. - * @param value The value that might or might not be a Term. - * @returns Whether `value` is a Term. - */ -function isTerm(value) { - return (value !== null && - typeof value === "object" && - typeof value.termType === "string" && - typeof value.value === "string" && - typeof value.equals === "function"); -} -/** - * @internal Library users shouldn't need to be exposed to LocalNodes. - * @param value The value that might or might not be a Node with no known IRI yet. - * @returns Whether `value` is a Node with no known IRI yet. - */ -function isLocalNode(value) { - return isNamedNode(value) && isLocalNodeIri(value.value); -} -/** - * Ensure that a given value is a valid URL. - * - * @internal Library users shouldn't need to be exposed to raw URLs. - * @param iri The value of which to verify that it is a valid URL. - */ -function internal_isValidUrl(iri) { - const iriString = internal_toIriString(iri); - // If the runtime environment supports URL, instantiate one. - // If the given IRI is not a valid URL, it will throw an error. - // See: https://developer.mozilla.org/en-US/docs/Web/API/URL - /* istanbul ignore if [URL is available in our testing environment, so we cannot test the alternative] */ - if (typeof URL !== "function") { - // If we can't validate the URL, do not throw an error: - return true; - } - try { - // eslint-disable-next-line no-new - new URL(iriString); - return true; - } - catch (_a) { - return false; - } -} -/** - * @internal Utility method; library users should not need to interact with LocalNodes directly. - * @param localNode The LocalNode to resolve to a NamedNode. - * @param resourceIri The Resource in which the Node will be saved. - */ -function resolveIriForLocalNode(localNode, resourceIri) { - return DataFactory.namedNode(resolveLocalIri(getLocalNodeName(localNode.value), resourceIri)); -} -/** - * @internal API for internal use only. - * @param name The name identifying a Thing. - * @param resourceIri The Resource in which the Thing can be found. - */ -function resolveLocalIri(name, resourceIri) { - /* istanbul ignore if [The URL interface is available in the testing environment, so we cannot test this] */ - if (typeof URL !== "function") { - throw new Error("The URL interface is not available, so an IRI cannot be determined."); - } - const thingIri = new URL(resourceIri); - thingIri.hash = name; - return thingIri.href; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const DataFactory = RdfJsDataFactory; -function addRdfJsQuadToDataset(dataset, quad, quadParseOptions = {}) { - var _a; - const supportedGraphTypes = [ - "NamedNode", - "DefaultGraph", - ]; - if (!supportedGraphTypes.includes(quad.graph.termType)) { - throw new Error(`Cannot parse Quads with nodes of type [${quad.graph.termType}] as their Graph node.`); - } - const graphId = quad.graph.termType === "DefaultGraph" ? "default" : quad.graph.value; - const graph = (_a = dataset.graphs[graphId]) !== null && _a !== void 0 ? _a : {}; - return freeze({ - ...dataset, - graphs: freeze({ - ...dataset.graphs, - [graphId]: addRdfJsQuadToGraph(graph, quad, quadParseOptions), - }), - }); -} -function addRdfJsQuadToGraph(graph, quad, quadParseOptions) { - var _a; - const supportedSubjectTypes = [ - "NamedNode", - "BlankNode", - ]; - if (!supportedSubjectTypes.includes(quad.subject.termType)) { - throw new Error(`Cannot parse Quads with nodes of type [${quad.subject.termType}] as their Subject node.`); - } - const subjectIri = quad.subject.termType === "BlankNode" - ? `_:${quad.subject.value}` - : quad.subject.value; - const subject = (_a = graph[subjectIri]) !== null && _a !== void 0 ? _a : { - type: "Subject", - url: subjectIri, - predicates: {}, - }; - return freeze({ - ...graph, - [subjectIri]: addRdfJsQuadToSubject(subject, quad, quadParseOptions), - }); -} -function addRdfJsQuadToSubject(subject, quad, quadParseOptions) { - return freeze({ - ...subject, - predicates: addRdfJsQuadToPredicates(subject.predicates, quad, quadParseOptions), - }); -} -function addRdfJsQuadToPredicates(predicates, quad, quadParseOptions) { - var _a; - const supportedPredicateTypes = [ - "NamedNode", - ]; - if (!supportedPredicateTypes.includes(quad.predicate.termType)) { - throw new Error(`Cannot parse Quads with nodes of type [${quad.predicate.termType}] as their Predicate node.`); - } - const predicateIri = quad.predicate.value; - const objects = (_a = predicates[predicateIri]) !== null && _a !== void 0 ? _a : {}; - return freeze({ - ...predicates, - [predicateIri]: addRdfJsQuadToObjects(objects, quad, quadParseOptions), - }); -} -function addRdfJsQuadToObjects(objects, quad, quadParseOptions) { - var _a, _b, _c, _d, _e, _f, _g, _h; - if (quad.object.termType === "NamedNode") { - const namedNodes = freeze([ - ...((_a = objects.namedNodes) !== null && _a !== void 0 ? _a : []), - quad.object.value, - ]); - return freeze({ - ...objects, - namedNodes, - }); - } - if (quad.object.termType === "Literal") { - if (quad.object.datatype.value === xmlSchemaTypes.langString) { - const locale = quad.object.language.toLowerCase(); - const thisLocaleStrings = freeze([ - ...((_c = (_b = objects.langStrings) === null || _b === void 0 ? void 0 : _b[locale]) !== null && _c !== void 0 ? _c : []), - quad.object.value, - ]); - const langStrings = freeze({ - ...((_d = objects.langStrings) !== null && _d !== void 0 ? _d : {}), - [locale]: thisLocaleStrings, - }); - return freeze({ - ...objects, - langStrings, - }); - } - // If the Object is a non-langString Literal - const thisTypeValues = freeze([ - ...((_f = (_e = objects.literals) === null || _e === void 0 ? void 0 : _e[quad.object.datatype.value]) !== null && _f !== void 0 ? _f : []), - quad.object.value, - ]); - const literals = freeze({ - ...((_g = objects.literals) !== null && _g !== void 0 ? _g : {}), - [quad.object.datatype.value]: thisTypeValues, - }); - return freeze({ - ...objects, - literals, - }); - } - if (quad.object.termType === "BlankNode") { - const blankNodePredicates = getPredicatesForBlankNode(quad.object, quadParseOptions); - const blankNodes = freeze([ - ...((_h = objects.blankNodes) !== null && _h !== void 0 ? _h : []), - blankNodePredicates, - ]); - return freeze({ - ...objects, - blankNodes, - }); - } - throw new Error(`Objects of type [${quad.object.termType}] are not supported.`); -} -function getPredicatesForBlankNode(node, quadParseOptions) { - var _a, _b; - const chainBlankNodes = (_a = quadParseOptions.chainBlankNodes) !== null && _a !== void 0 ? _a : []; - if (chainBlankNodes.find((chainBlankNode) => chainBlankNode.equals(node)) === - undefined) { - // If this Blank Node is not used to provide nested values for another Subject, - // just return its identifier. - // That identifier will also be listed among the Subjects in the Graph. - return getBlankNodeId(node); - } - /* istanbul ignore next: If there are chain nodes, there will always be other Quads, so the `?? []` can't be reached: */ - const quads = (_b = quadParseOptions.otherQuads) !== null && _b !== void 0 ? _b : []; - const quadsWithNodeAsSubject = quads.filter((quad) => quad.subject.equals(node)); - // First add the Quads with regular Objects - const predicates = quadsWithNodeAsSubject - .filter((quad) => !isBlankNode(quad.object)) - .reduce((predicatesAcc, quad) => { - var _a; - const supportedPredicateTypes = [ - "NamedNode", - ]; - if (!supportedPredicateTypes.includes(quad.predicate.termType)) { - throw new Error(`Cannot parse Quads with nodes of type [${quad.predicate.termType}] as their Predicate node.`); - } - const objects = (_a = predicatesAcc[quad.predicate.value]) !== null && _a !== void 0 ? _a : {}; - return freeze({ - ...predicatesAcc, - [quad.predicate.value]: addRdfJsQuadToObjects(objects, quad, quadParseOptions), - }); - }, {}); - // And then also add the Quads that have another Blank Node as the Object - // in addition to the Blank Node `node` as the Subject: - const blankNodeObjectQuads = quadsWithNodeAsSubject.filter((quad) => isBlankNode(quad.object)); - return blankNodeObjectQuads.reduce((predicatesAcc, quad) => { - var _a, _b; - const supportedPredicateTypes = [ - "NamedNode", - ]; - if (!supportedPredicateTypes.includes(quad.predicate.termType)) { - throw new Error(`Cannot parse Quads with nodes of type [${quad.predicate.termType}] as their Predicate node.`); - } - /* istanbul ignore next: The `?? {}` doesn't get hit; presumably it's initialised above. */ - const objects = (_a = predicatesAcc[quad.predicate.value]) !== null && _a !== void 0 ? _a : {}; - /* istanbul ignore next: The `?? []` doesn't get hit; presumably it's initialised above. */ - const blankNodes = (_b = objects.blankNodes) !== null && _b !== void 0 ? _b : []; - return freeze({ - ...predicatesAcc, - // The BlankNode assertions are valid because we filtered on BlankNodes above: - [quad.predicate.value]: { - ...objects, - blankNodes: [ - ...blankNodes, - getPredicatesForBlankNode(quad.object, quadParseOptions), - ], - }, - }); - }, predicates); -} -/** - * Given an array of Quads, returns all Blank Nodes that are used in a single chain of Nodes. - * - * This allows you to obtain which Blank Nodes are involved in e.g. RDF lists. - * This is useful because those can be represented as nested data that will have - * a deterministic structure, whereas a representation of Blank Nodes that - * create a cycle or are re-used will need ad-hoc, non-deterministic identifiers - * to allow for representation without inifinite nesting. - */ -function getChainBlankNodes(quads) { - // All Blank Nodes that occur in Subject position: - const blankNodeSubjects = quads - .map((quad) => quad.subject) - .filter(isBlankNode); - // All Blank Nodes that occur in Object position: - const blankNodeObjects = quads.map((quad) => quad.object).filter(isBlankNode); - // Makes sure that all given Nodes are the same, - // which will be used to verify that a set of Quads all have the same Subject: - function everyNodeTheSame(nodes) { - // This could potentially be made more performant by mapping every term - // to their value and using native JS comparisons, assuming every node is - // either a Blank or a Named Node. - return nodes.every((otherNode) => nodes.every((anotherNode) => otherNode.equals(anotherNode))); - } - // Get all Blank Nodes that are part of a cycle in the graph: - const cycleBlankNodes = []; - blankNodeObjects.forEach((blankNodeObject) => { - cycleBlankNodes.push(...getCycleBlankNodes(blankNodeObject, quads)); - }); - // Get Blank Nodes that are used to provide nested values for a single Subject, - // which we'll represent as nested values as well - // (this allows us to avoid generating a non-deterministic, ad-hoc identifier - // for those Blank Nodes). - // We'll do this by taking all Blank Nodes in the given Quads... - const chainBlankNodes = blankNodeSubjects - .concat(blankNodeObjects) - .filter((blankNode) => { - // ....removing those Blank Nodes that are part of a cycle... - if (cycleBlankNodes.some((cycleBlankNode) => cycleBlankNode.equals(blankNode))) { - return false; - } - // ...and then returning only those Blank Nodes that only occur in the - // Object position for a single Subject, i.e. that are part of a single - // chain: - const subjectsWithThisNodeAsObject = quads - .filter((quad) => quad.object.equals(blankNode)) - .map((quad) => quad.subject); - return (subjectsWithThisNodeAsObject.length > 0 && - everyNodeTheSame(subjectsWithThisNodeAsObject)); - }); - return chainBlankNodes; -} -function toRdfJsQuads(dataset, options = {}) { - var _a; - const quads = []; - const dataFactory = (_a = options.dataFactory) !== null && _a !== void 0 ? _a : RdfJsDataFactory; - Object.keys(dataset.graphs).forEach((graphIri) => { - const graph = dataset.graphs[graphIri]; - const graphNode = graphIri === "default" - ? dataFactory.defaultGraph() - : dataFactory.namedNode(graphIri); - Object.keys(graph).forEach((subjectIri) => { - const { predicates } = graph[subjectIri]; - const subjectNode = isBlankNodeId(subjectIri) - ? dataFactory.blankNode(getBlankNodeValue(subjectIri)) - : dataFactory.namedNode(subjectIri); - quads.push(...subjectToRdfJsQuads(predicates, subjectNode, graphNode, options)); - }); - }); - return quads; -} -function subjectToRdfJsQuads(predicates, subjectNode, graphNode, options = {}) { - var _a; - const quads = []; - const dataFactory = (_a = options.dataFactory) !== null && _a !== void 0 ? _a : RdfJsDataFactory; - Object.keys(predicates).forEach((predicateIri) => { - var _a, _b, _c, _d; - const predicateNode = dataFactory.namedNode(predicateIri); - const langStrings = (_a = predicates[predicateIri].langStrings) !== null && _a !== void 0 ? _a : {}; - const namedNodes = (_b = predicates[predicateIri].namedNodes) !== null && _b !== void 0 ? _b : []; - const literals = (_c = predicates[predicateIri].literals) !== null && _c !== void 0 ? _c : {}; - const blankNodes = (_d = predicates[predicateIri].blankNodes) !== null && _d !== void 0 ? _d : []; - const literalTypes = Object.keys(literals); - literalTypes.forEach((typeIri) => { - const typeNode = dataFactory.namedNode(typeIri); - const literalValues = literals[typeIri]; - literalValues.forEach((value) => { - const literalNode = dataFactory.literal(value, typeNode); - quads.push(dataFactory.quad(subjectNode, predicateNode, literalNode, graphNode)); - }); - }); - const locales = Object.keys(langStrings); - locales.forEach((locale) => { - const localeValues = langStrings[locale]; - localeValues.forEach((value) => { - const langStringNode = dataFactory.literal(value, locale); - quads.push(dataFactory.quad(subjectNode, predicateNode, langStringNode, graphNode)); - }); - }); - namedNodes.forEach((namedNodeIri) => { - const node = dataFactory.namedNode(namedNodeIri); - quads.push(dataFactory.quad(subjectNode, predicateNode, node, graphNode)); - }); - blankNodes.forEach((blankNodeIdOrPredicates) => { - if (isBlankNodeId(blankNodeIdOrPredicates)) { - const blankNode = dataFactory.blankNode(getBlankNodeValue(blankNodeIdOrPredicates)); - quads.push(dataFactory.quad(subjectNode, predicateNode, blankNode, graphNode)); - } - else { - const node = dataFactory.blankNode(); - const blankNodeObjectQuad = dataFactory.quad(subjectNode, predicateNode, node, graphNode); - const blankNodeSubjectQuads = subjectToRdfJsQuads(blankNodeIdOrPredicates, node, graphNode); - quads.push(blankNodeObjectQuad); - quads.push(...blankNodeSubjectQuads); - } - }); - }); - return quads; -} -/** - * A recursive function that finds all Blank Nodes in an array of Quads that create a cycle in the graph. - * - * This function will traverse the graph starting from `currentNode`, keeping - * track of all the Blank Nodes it encounters twice while doing so, and - * returning those. - */ -function getCycleBlankNodes(currentNode, quads, traversedBlankNodes = []) { - // If we've encountered `currentNode` before, all the Blank Nodes we've - // encountered so far are part of a cycle. Return those. - if (traversedBlankNodes.find((traversedBlankNode) => traversedBlankNode.equals(currentNode)) !== undefined) { - return traversedBlankNodes; - } - // Find all Blank Nodes that are connected to `currentNode`: - const blankNodeObjects = quads - .filter((quad) => quad.subject.equals(currentNode) && isBlankNode(quad.object)) - .map((quad) => quad.object); - // If no Blank Nodes are connected to `currentNode`, and `currentNode` is not - // part of a cycle, we're done; the currently traversed Nodes do not form a - // cycle: - if (blankNodeObjects.length === 0) { - return []; - } - // Store that we've traversed `currentNode`, then move on to all the Blank - // Nodes connected to it, which will then take up the role of `currentNode`: - const nextTraversedNodes = [...traversedBlankNodes, currentNode]; - const cycleBlankNodeArrays = blankNodeObjects.map((nextNode) => getCycleBlankNodes(nextNode, quads, nextTraversedNodes)); - // Collect all the cycle Blank Nodes found in those traverals, - // then return them: - const allCycleBlankNodes = []; - for (const cycleBlankNodes of cycleBlankNodeArrays) { - allCycleBlankNodes.push(...cycleBlankNodes); - } - return allCycleBlankNodes; -} -function isBlankNode(term) { - return term.termType === "BlankNode"; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} This function is still experimental and subject to change, even - * in a non-major release. - * ``` - * This returns a parser that transforms a JSON-LD string into a set of RDFJS quads. - * - * @returns A Parser object. - * @since 1.15.0 - */ -const getTurtleParser$1 = () => { - const onQuadCallbacks = []; - const onCompleteCallbacks = []; - const onErrorCallbacks = []; - return { - onQuad: (callback) => { - onQuadCallbacks.push(callback); - }, - onError: (callback) => { - onErrorCallbacks.push(callback); - }, - onComplete: (callback) => { - onCompleteCallbacks.push(callback); - }, - parse: async (source, resourceInfo) => { - const parser = await getParser(getSourceUrl(resourceInfo)); - parser.parse(source, (error, quad) => { - if (error) { - onErrorCallbacks.forEach((callback) => callback(error)); - } - else if (quad) { - onQuadCallbacks.forEach((callback) => callback(quad)); - } - else { - onCompleteCallbacks.forEach((callback) => callback()); - } - }); - }, - }; -}; -async function getParser(baseIri) { - return new n3.Parser({ format: "text/turtle", baseIRI: baseIri }); -} -/** - * @param quads Triples that should be serialised to Turtle - * @internal Utility method for internal use; not part of the public API. - */ -async function triplesToTurtle(quads, options) { - const format = "text/turtle"; - const writer = new n3.Writer({ format, prefixes: options === null || options === void 0 ? void 0 : options.prefixes }); - // Remove any potentially lingering references to Named Graphs in Quads; - // they'll be determined by the URL the Turtle will be sent to: - const triples = quads.map((quad) => DataFactory.quad(quad.subject, quad.predicate, quad.object, undefined)); - writer.addQuads(triples); - const writePromise = new Promise((resolve, reject) => { - writer.end((error, result) => { - /* istanbul ignore if [n3.js doesn't actually pass an error nor a result, apparently: https://github.com/rdfjs/N3.js/blob/62682e48c02d8965b4d728cb5f2cbec6b5d1b1b8/src/N3Writer.js#L290] */ - if (error) { - reject(error); - } - else { - resolve(result); - } - }); - }); - const rawTurtle = await writePromise; - return rawTurtle; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const prefixes = { - acl: "http://www.w3.org/ns/auth/acl#", - acp: "http://www.w3.org/ns/solid/acp#", - cc: "http://creativecommons.org/ns#", - cert: "http://www.w3.org/ns/auth/cert#", - csvw: "http://www.w3.org/ns/csvw#", - current: "#", - dc: "http://purl.org/dc/terms/", - dcam: "http://purl.org/dc/dcam/", - dcat: "http://www.w3.org/ns/dcat#", - dctype: "http://purl.org/dc/dcmitype/", - foaf: "http://xmlns.com/foaf/0.1/", - ldp: "http://www.w3.org/ns/ldp#", - owl: "http://www.w3.org/2002/07/owl#", - posixstat: "http://www.w3.org/ns/posix/stat#", - rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - rdfs: "http://www.w3.org/2000/01/rdf-schema#", - schema: "https://schema.org/", - shacl: "http://www.w3.org/ns/shacl#", - skos: "http://www.w3.org/2004/02/skos/core#", - skosxl: "http://www.w3.org/2008/05/skos-xl#", - solid: "http://www.w3.org/ns/solid/terms#", - swapdoc: "http://www.w3.org/2000/10/swap/pim/doc#", - ui: "http://www.w3.org/ns/ui#", - vann: "http://purl.org/vocab/vann/", - vcard: "http://www.w3.org/2006/vcard/ns#", - ws: "http://www.w3.org/ns/pim/space#", - xsd: "http://www.w3.org/2001/XMLSchema#", -}; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const rdfJsDataset = rdfJsDatasetModule.dataset; -/** - * Convert an RDF/JS Dataset into a [[SolidDataset]] - * - * Parse an RDF/JS - * {@link https://rdf.js.org/dataset-spec/#datasetcore-interface DatasetCore}, - * into a [[SolidDataset]]. Note that, when saving the returned SolidDataset to - * a Solid Pod, only Quads in the Default Graph will be stored. - * - * @param rdfJsDataset The source RDF/JS Dataset. - * @returns A [[SolidDataset]] containing the same data as the given RDF/JS Dataset. - * @since 1.9.0 - */ -function fromRdfJsDataset(rdfJsDataset) { - const dataset = { - graphs: { default: {} }, - type: "Dataset", - }; - const quads = Array.from(rdfJsDataset); - const chainBlankNodes = getChainBlankNodes(quads); - // Quads with chain Blank Nodes as their Subject will be parsed when those - // Blank Nodes are referred to in an Object. See `addRdfJsQuadToObjects`. - const quadsWithoutChainBlankNodeSubjects = quads.filter((quad) => chainBlankNodes.every((chainBlankNode) => !chainBlankNode.equals(quad.subject))); - return quadsWithoutChainBlankNodeSubjects.reduce((datasetAcc, quad) => addRdfJsQuadToDataset(datasetAcc, quad, { - otherQuads: quads, - chainBlankNodes, - }), dataset); -} -/** - * Convert a [[SolidDataset]] into an RDF/JS Dataset - * - * Export a [[SolidDataset]] into an RDF/JS - * {@link https://rdf.js.org/dataset-spec/#datasetcore-interface DatasetCore}. - * - * @param set A [[SolidDataset]] to export into an RDF/JS Dataset. - * @param options Optional parameter that allows you to pass in your own RDF/JS DataFactory or DatasetCoreFactory. - * @returns An RDF/JS Dataset containing the data from the given SolidDataset. - * @since 1.9.0 - */ -function toRdfJsDataset(set, options = {}) { - var _a, _b; - const datasetFactory = (_b = (_a = options.datasetFactory) === null || _a === void 0 ? void 0 : _a.dataset) !== null && _b !== void 0 ? _b : rdfJsDataset; - return datasetFactory(toRdfJsQuads(set, options)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * A function to serialise a Solid Dataset as Turtle - * - * @param dataset The Dataset to serialize as Turtle - * @param options.prefixes The Prefixes to use for Turtle serialisation (defaulting to a set of well known prefixes) - * @param options.thing Restricts serialisation to the part of a dataset related to the thing - * @returns RDF serialised as Turtle - * @since 1.20.0 - */ -async function solidDatasetAsTurtle$1(dataset, options) { - const { prefixes: prefixes$1 = prefixes, thing } = { ...options }; - const writer = new n3.Writer({ format: "application/turtle", prefixes: prefixes$1 }); - const subject = thing ? new n3.NamedNode(thing) : undefined; - // If the subject is undefined, all the triples match. - for (const quad of toRdfJsDataset(dataset).match(subject)) { - writer.addQuad(quad); - } - return new Promise((resolve, reject) => { - writer.end((error, result) => { - /* istanbul ignore next */ - if (error) { - reject(error); - } - else { - resolve(result); - } - }); - }); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -var formats = /*#__PURE__*/Object.freeze({ - __proto__: null, - getJsonLdParser: getJsonLdParser$1, - getTurtleParser: getTurtleParser$1, - solidDatasetAsTurtle: solidDatasetAsTurtle$1 -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const defaultGetFileOptions = { - fetch, -}; -const RESERVED_HEADERS = ["Slug", "If-None-Match", "Content-Type"]; -/** - * Some of the headers must be set by the library, rather than directly. - */ -function containsReserved(header) { - return RESERVED_HEADERS.some((reserved) => header[reserved] !== undefined); -} -/** - * Retrieves a file from a URL and returns the file as a blob. - * - * For example: - * - * ``` - * const fileBlob = await getFile("https://pod.example.com/some/file", { fetch: fetch }); - * ``` - * - * For additional examples, see - * [Read/Write Files](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/read-write-files/#retrieve-a-file). - * - * @param fileUrl The URL of the file to return - * @param options Fetching options: a custom fetcher and/or headers. - * @returns The file as a blob. - */ -async function getFile(fileUrl, options = defaultGetFileOptions) { - const config = { - ...defaultGetFileOptions, - ...options, - }; - const url = internal_toIriString(fileUrl); - const response = await config.fetch(url, config.init); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Fetching the File failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } - const resourceInfo = internal_parseResourceInfo(response); - const data = await response.blob(); - const fileWithResourceInfo = Object.assign(data, { - internal_resourceInfo: resourceInfo, - }); - return fileWithResourceInfo; -} -/** - * Deletes a file at a given URL. - * - * For example: - * - * ``` - * await deleteFile( "https://pod.example.com/some/file", { fetch: fetch }); - * ``` - * - * For additional examples, see - * [Read/Write Files](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/read-write-files/#delete-a-file). - * - * @param file The URL of the file to delete or the file itself (if it has ResourceInfo). - */ -async function deleteFile(file, options = defaultGetFileOptions) { - const config = { - ...defaultGetFileOptions, - ...options, - }; - const url = hasResourceInfo(file) - ? internal_toIriString(getSourceIri(file)) - : internal_toIriString(file); - const response = await config.fetch(url, { - ...config.init, - method: "DELETE", - }); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Deleting the file at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } -} -async function saveFileInContainer(folderUrl, file, options = defaultGetFileOptions) { - const folderUrlString = internal_toIriString(folderUrl); - const response = await writeFile(folderUrlString, file, "POST", options); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Saving the file in [${folderUrl}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } - const locationHeader = response.headers.get("Location"); - if (locationHeader === null) { - throw new Error("Could not determine the location of the newly saved file."); - } - const fileIri = new URL(locationHeader, new URL(folderUrlString).origin).href; - const blobClone = internal_cloneResource(file); - const resourceInfo = { - internal_resourceInfo: { - isRawData: true, - sourceIri: fileIri, - contentType: getContentType(file, options.contentType), - }, - }; - return Object.assign(blobClone, resourceInfo); -} -async function overwriteFile(fileUrl, file, options = defaultGetFileOptions) { - const fileUrlString = internal_toIriString(fileUrl); - const response = await writeFile(fileUrlString, file, "PUT", options); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Overwriting the file at [${fileUrlString}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } - const blobClone = internal_cloneResource(file); - const resourceInfo = internal_parseResourceInfo(response); - resourceInfo.sourceIri = fileUrlString; - resourceInfo.isRawData = true; - return Object.assign(blobClone, { internal_resourceInfo: resourceInfo }); -} -function isHeadersArray(headers) { - return Array.isArray(headers); -} -/** - * The return type of this function is misleading: it should ONLY be used to check - * whether an object has a forEach method that returns pairs. - * - * @param headers A headers object that might have a forEach - */ -function hasHeadersObjectForEach(headers) { - return typeof headers.forEach === "function"; -} -/** - * @hidden - * This function feels unnecessarily complicated, but is required in order to - * have Headers according to type definitions in both Node and browser environments. - * This might require a fix upstream to be cleaned up. - * - * @param headersToFlatten A structure containing headers potentially in several formats - */ -function flattenHeaders(headersToFlatten) { - if (typeof headersToFlatten === "undefined") { - return {}; - } - let flatHeaders = {}; - if (isHeadersArray(headersToFlatten)) { - headersToFlatten.forEach(([key, value]) => { - flatHeaders[key] = value; - }); - // Note that the following line must be a elsif, because string[][] has a forEach, - // but it returns string[] instead of - } - else if (hasHeadersObjectForEach(headersToFlatten)) { - headersToFlatten.forEach((value, key) => { - flatHeaders[key] = value; - }); - } - else { - // If the headers are already a Record, - // they can directly be returned. - flatHeaders = headersToFlatten; - } - return flatHeaders; -} -async function writeFile(targetUrl, file, method, options) { - var _a, _b; - const config = { - ...defaultGetFileOptions, - ...options, - }; - const headers = flattenHeaders((_b = (_a = config.init) === null || _a === void 0 ? void 0 : _a.headers) !== null && _b !== void 0 ? _b : {}); - if (containsReserved(headers)) { - throw new Error(`No reserved header (${RESERVED_HEADERS.join(", ")}) should be set in the optional RequestInit.`); - } - // If a slug is in the parameters, set the request headers accordingly - if (config.slug !== undefined) { - headers.Slug = config.slug; - } - headers["Content-Type"] = getContentType(file, options.contentType); - const targetUrlString = internal_toIriString(targetUrl); - return config.fetch(targetUrlString, { - ...config.init, - headers, - method, - body: file, - }); -} -function getContentType(file, contentTypeOverride) { - if (typeof contentTypeOverride === "string") { - return contentTypeOverride; - } - const fileType = typeof file === "object" && - file !== null && - "type" in file && - typeof file.type === "string" && - file.type.length > 0 - ? file.type - : undefined; - return fileType !== null && fileType !== void 0 ? fileType : "application/octet-stream"; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden For internal use only. */ -function internal_getReadableValue(value) { - var _a, _b, _c, _d, _e, _f, _g, _h; - if (isNamedNode(value)) { - return `<${value.value}> (URL)`; - } - if (isLiteral(value)) { - /* istanbul ignore if: thingAsMarkdown always instantiates a NamedNode, so we can't hit this code path in tests. */ - if (!isNamedNode(value.datatype)) { - return `[${value.value}] (RDF/JS Literal of unknown type)`; - } - let val; - switch (value.datatype.value) { - case xmlSchemaTypes.boolean: - val = - (_b = (_a = deserializeBoolean(value.value)) === null || _a === void 0 ? void 0 : _a.valueOf()) !== null && _b !== void 0 ? _b : `Invalid data: \`${value.value}\``; - return `${val} (boolean)`; - case xmlSchemaTypes.dateTime: - val = - (_d = (_c = deserializeDatetime(value.value)) === null || _c === void 0 ? void 0 : _c.toUTCString()) !== null && _d !== void 0 ? _d : `Invalid data: \`${value.value}\``; - return `${val} (datetime)`; - case xmlSchemaTypes.decimal: - val = - (_f = (_e = deserializeDecimal(value.value)) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : `Invalid data: \`${value.value}\``; - return `${val} (decimal)`; - case xmlSchemaTypes.integer: - val = - (_h = (_g = deserializeInteger(value.value)) === null || _g === void 0 ? void 0 : _g.toString()) !== null && _h !== void 0 ? _h : `Invalid data: \`${value.value}\``; - return `${val} (integer)`; - case xmlSchemaTypes.langString: - return `"${value.value}" (${value.language} string)`; - case xmlSchemaTypes.string: - return `"${value.value}" (string)`; - default: - return `[${value.value}] (RDF/JS Literal of type: \`${value.datatype.value}\`)`; - } - } - /* istanbul ignore else: thingAsMarkdown doesn't generate other Nodes, so we can't hit this path in tests. */ - if (value.termType === "BlankNode") { - return `[${value.value}] (RDF/JS BlankNode)`; - } - /* istanbul ignore next: thingAsMarkdown doesn't generate Quad Nodes, so we can't hit this path in tests. */ - if (value.termType === "Quad") { - return `??? (nested RDF* Quad)`; - } - /* istanbul ignore else: The if statements are exhaustive; if not, TypeScript will complain. */ - /* istanbul ignore next: thingAsMarkdown doesn't generate Variable Nodes, so we can't hit this path in tests. */ - if (value.termType === "Variable") { - return `?${value.value} (RDF/JS Variable)`; - } - /* istanbul ignore next: The if statements are exhaustive; if not, TypeScript will complain. */ - return value; -} -/** - * @hidden - */ -function internal_throwIfNotThing(thing) { - if (!isThing(thing)) { - throw new ThingExpectedError(thing); - } -} -/** - * @hidden - * @param solidDataset - */ -function internal_addAdditionsToChangeLog(solidDataset, additions) { - const changeLog = hasChangelog(solidDataset) - ? solidDataset.internal_changeLog - : /* istanbul ignore next: This function always gets called after addDeletionsToChangeLog, so the ChangeLog always already exists in tests: */ - { additions: [], deletions: [] }; - const [newAdditions, newDeletions] = additions - .filter((addition) => !containsBlankNode(addition)) - .reduce(([additionsAcc, deletionsAcc], addition) => { - const existingDeletion = deletionsAcc.find((deletion) => deletion.equals(addition)); - if (typeof existingDeletion !== "undefined") { - return [ - additionsAcc, - deletionsAcc.filter((deletion) => !deletion.equals(addition)), - ]; - } - return [additionsAcc.concat(addition), deletionsAcc]; - }, [changeLog.additions, changeLog.deletions]); - return freeze({ - ...solidDataset, - internal_changeLog: { - additions: newAdditions, - deletions: newDeletions, - }, - }); -} -/** - * @hidden - * @param solidDataset - */ -function internal_addDeletionsToChangeLog(solidDataset, deletions) { - const changeLog = hasChangelog(solidDataset) - ? solidDataset.internal_changeLog - : { additions: [], deletions: [] }; - const [newAdditions, newDeletions] = deletions - .filter((deletion) => !containsBlankNode(deletion)) - .reduce(([additionsAcc, deletionsAcc], deletion) => { - const existingAddition = additionsAcc.find((addition) => addition.equals(deletion)); - if (typeof existingAddition !== "undefined") { - return [ - additionsAcc.filter((addition) => !addition.equals(deletion)), - deletionsAcc, - ]; - } - return [additionsAcc, deletionsAcc.concat(deletion)]; - }, [changeLog.additions, changeLog.deletions]); - return freeze({ - ...solidDataset, - internal_changeLog: { - additions: newAdditions, - deletions: newDeletions, - }, - }); -} -/** - * Enforces the presence of a Changelog for a given dataset. If a changelog is - * already present, it is unchanged. Otherwise, an empty changelog is created. - * @hidden - * @param solidDataset - */ -function internal_withChangeLog(solidDataset) { - const newSolidDataset = hasChangelog(solidDataset) - ? solidDataset - : freeze({ - ...solidDataset, - internal_changeLog: { additions: [], deletions: [] }, - }); - return newSolidDataset; -} -/** - * We don't currently support reading and writing Blank Nodes, so this function can be used to skip those Quads. - * - * This is needed because we cannot reconcile Blank Nodes in additions and - * deletions. Down the road, we should do a diff before saving a SolidDataset - * against a saved copy of the originally-fetched one, based on our own data - * structures, which should make it easier to reconcile. - */ -function containsBlankNode(quad) { - return (quad.subject.termType === "BlankNode" || - quad.object.termType === "BlankNode"); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Returns the URLs of all Properties that the given [[Thing ]]has values for.b - * - * @param thing The [[Thing]] of which to get that Property URLs that have a value. - * @returns The URLs of the Properties for which values are defined for the given Thing. - * @hidden This is an advanced API that should not be needed for most Solid use cases. If you do find yourself needing this, please file a feature request sharing your use case. - */ -function getPropertyAll(thing) { - return Object.keys(thing.predicates).filter((predicate) => getTerm(thing, predicate) !== null); -} -/** - * Returns the URL value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type URL, returns null. - * If the Property has multiple URL values, returns one of its URL values. - * - * @param thing The [[Thing]] to read a URL value from. - * @param property The Property whose URL value to return. - * @returns A URL value for the given Property if present, or null if the Property is not present or the value is not of type URL. - */ -function getUrl(thing, property) { - var _a, _b, _c; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateUrl = internal_toIriString(property); - const firstUrl = (_c = (_b = (_a = thing.predicates[predicateUrl]) === null || _a === void 0 ? void 0 : _a.namedNodes) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : null; - if (firstUrl === null) { - return null; - } - return isLocalNodeIri(firstUrl) ? `#${getLocalNodeName(firstUrl)}` : firstUrl; -} -/** @hidden Alias of [[getUrl]] for those who prefer IRI terminology. */ -const getIri = getUrl; -/** - * Returns the URL values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type URL, omits that value in the array. - * - * @param thing The [[Thing]] to read the URL values from. - * @param property The Property whose URL values to return. - * @returns An array of URL values for the given Property. - */ -function getUrlAll(thing, property) { - var _a, _b, _c; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateUrl = internal_toIriString(property); - return ((_c = (_b = (_a = thing.predicates[predicateUrl]) === null || _a === void 0 ? void 0 : _a.namedNodes) === null || _b === void 0 ? void 0 : _b.map((iri) => isLocalNodeIri(iri) ? `#${getLocalNodeName(iri)}` : iri)) !== null && _c !== void 0 ? _c : []); -} -/** @hidden Alias of [[getUrlAll]] for those who prefer IRI terminology. */ -const getIriAll = getUrlAll; -/** - * Returns the boolean value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type boolean, returns null. - * If the Property has multiple boolean values, returns one of its values. - * - * @param thing The [[Thing]] to read a boolean value from. - * @param property The Property whose boolean value to return. - * @returns A boolean value for the given Property if present, or null if the Property is not present or the value is not of type boolean. - */ -function getBoolean(thing, property) { - internal_throwIfNotThing(thing); - const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.boolean); - if (literalString === null) { - return null; - } - return deserializeBoolean(literalString); -} -/** - * Returns the boolean values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type boolean, omits that value in the array. - * - * @param thing The [[Thing]] to read the boolean values from. - * @param property The Property whose boolean values to return. - * @returns An array of boolean values for the given Property. - */ -function getBooleanAll(thing, property) { - internal_throwIfNotThing(thing); - const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.boolean); - return literalStrings - .map(deserializeBoolean) - .filter((possibleBoolean) => possibleBoolean !== null); -} -/** - * Returns the datetime value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type datetime, returns null. - * If the Property has multiple datetime values, returns one of its values. - * - * @param thing The [[Thing]] to read a datetime value from. - * @param property The Property whose datetime value to return. - * @returns A datetime value for the given Property if present, or null if the Property is not present or the value is not of type datetime. - */ -function getDatetime(thing, property) { - internal_throwIfNotThing(thing); - const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.dateTime); - if (literalString === null) { - return null; - } - return deserializeDatetime(literalString); -} -/** - * Returns the datetime values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type datetime, omits that value in the array. - * - * @param thing The [[Thing]] to read the datetime values from. - * @param property The Property whose datetime values to return. - * @returns An array of datetime values for the given Property. - */ -function getDatetimeAll(thing, property) { - internal_throwIfNotThing(thing); - const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.dateTime); - return literalStrings - .map(deserializeDatetime) - .filter((potentialDatetime) => potentialDatetime !== null); -} -/** - * Returns the date value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type date, returns null. - * If the Property has multiple date values, returns one of its values. - * - * @param thing The [[Thing]] to read a date value from. - * @param property The Property whose date value to return. - * @returns A date value for the given Property if present, or null if the Property is not present or the value is not of type date. - * @since 1.10.0 - */ -function getDate(thing, property) { - internal_throwIfNotThing(thing); - const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.date); - if (literalString === null) { - return null; - } - return deserializeDate(literalString); -} -/** - * Returns the date values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type date, omits that value in the array. - * - * @param thing The [[Thing]] to read the date values from. - * @param property The Property whose date values to return. - * @returns An array of date values for the given Property. - * @since 1.10.0 - */ -function getDateAll(thing, property) { - internal_throwIfNotThing(thing); - const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.date); - return literalStrings - .map(deserializeDate) - .filter((potentialDate) => potentialDate !== null); -} -/** - * Returns the time value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type time, returns null. - * If the Property has multiple time values, returns one of its values. - * - * @param thing The [[Thing]] to read a time value from. - * @param property The Property whose time value to return. - * @returns A time value for the given Property if present, or null if the Property is not present or the value is not of type time. - * @since 1.10.0 - */ -function getTime(thing, property) { - internal_throwIfNotThing(thing); - const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.time); - if (literalString === null) { - return null; - } - return deserializeTime(literalString); -} -/** - * Returns the time values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type time, omits that value in the array. - * - * @param thing The [[Thing]] to read the time values from. - * @param property The Property whose time values to return. - * @returns An array of time values for the given Property. - * @since 1.10.0 - */ -function getTimeAll(thing, property) { - internal_throwIfNotThing(thing); - const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.time); - return literalStrings - .map(deserializeTime) - .filter((potentialTime) => potentialTime !== null); -} -/** - * Returns the decimal value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type decimal, returns null. - * If the Property has multiple decimal values, returns one of its values. - * - * @param thing The [[Thing]] to read a decimal value from. - * @param property The Property whose decimal value to return. - * @returns A decimal value for the given Property if present, or null if the Property is not present or the value is not of type decimal. - */ -function getDecimal(thing, property) { - internal_throwIfNotThing(thing); - const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.decimal); - if (literalString === null) { - return null; - } - return deserializeDecimal(literalString); -} -/** - * Returns the decimal values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type decimal, omits that value in the array. - * - * @param thing The [[Thing]] to read the decimal values from. - * @param property The Property whose decimal values to return. - * @returns An array of decimal values for the given Property. - */ -function getDecimalAll(thing, property) { - internal_throwIfNotThing(thing); - const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.decimal); - return literalStrings - .map((literalString) => deserializeDecimal(literalString)) - .filter((potentialDecimal) => potentialDecimal !== null); -} -/** - * Returns the integer value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type integer, returns null. - * If the Property has multiple integer values, returns one of its values. - * - * @param thing The [[Thing]] to read an integer value from. - * @param property The Property whose integer value to return. - * @returns A integer value for the given Property if present, or null if the Property is not present or the value is not of type datetime. - */ -function getInteger(thing, property) { - internal_throwIfNotThing(thing); - const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.integer); - if (literalString === null) { - return null; - } - return deserializeInteger(literalString); -} -/** - * Returns the integer values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type integer, omits that value in the array. - * - * @param thing The [[Thing]] to read the integer values from. - * @param property The Property whose integer values to return. - * @returns An array of integer values for the given Property. - */ -function getIntegerAll(thing, property) { - internal_throwIfNotThing(thing); - const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.integer); - return literalStrings - .map((literalString) => deserializeInteger(literalString)) - .filter((potentialInteger) => potentialInteger !== null); -} -/** - * Returns the English (language tag "en") string value of the specified Property from a [[Thing]]. - * If the Property is not present as a string in English, returns null. - * If the Property has multiple English string values, returns one of its values. - * - * @param thing The [[Thing]] to read a localised string value from. - * @param property The Property whose localised string value to return. - * @returns An English string value for the given Property if present, or null otherwise. - * @since 1.13.0 - */ -function getStringEnglish(thing, property) { - return getStringWithLocale(thing, property, "en"); -} -/** - * Returns the localized string value of the specified Property from a [[Thing]]. - * If the Property is not present as a string in the specified locale, returns null. - * If the Property has multiple string values for the specified locale, returns one of its values. - * - * @param thing The [[Thing]] to read a localised string value from. - * @param property The Property whose localised string value to return. - * @param locale The desired locale for the string value. - * @returns A localised string value for the given Property if present in the specified `locale`, or null otherwise. - */ -function getStringWithLocale(thing, property, locale) { - var _a, _b; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {}; - const existingLocales = Object.keys(langStrings); - const matchingLocale = existingLocales.find((existingLocale) => existingLocale.toLowerCase() === locale.toLowerCase() && - Array.isArray(langStrings[existingLocale]) && - langStrings[existingLocale].length > 0); - return typeof matchingLocale === "string" - ? langStrings[matchingLocale][0] - : null; -} -/** - * Returns the English (language tag "en") string values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not an English string, omits that value in the array. - * - * @param thing The [[Thing]] to read a localised string value from. - * @param property The Property whose localised string value to return. - * @returns An array of English string values for the given Property. - */ -function getStringEnglishAll(thing, property) { - return getStringWithLocaleAll(thing, property, "en"); -} -/** - * Returns the localized string values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not a string of the specified locale, omits that value in the array. - * - * @param thing The [[Thing]] to read the localised string values from. - * @param property The Property whose localised string values to return. - * @param locale The desired locale for the string values. - * @returns An array of localised string values for the given Property. - */ -function getStringWithLocaleAll(thing, property, locale) { - var _a, _b; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {}; - const existingLocales = Object.keys(langStrings); - const matchingLocale = existingLocales.find((existingLocale) => existingLocale.toLowerCase() === locale.toLowerCase() && - Array.isArray(langStrings[existingLocale]) && - langStrings[existingLocale].length > 0); - return typeof matchingLocale === "string" - ? [...langStrings[matchingLocale]] - : []; -} -/** - * Returns all localized string values mapped by the locales for the specified property from the - * specified [[Thing]] (explicitly filters out non-language string literals). - * - * @param thing The [[Thing]] to read the localised string values from. - * @param property The Property whose localised string values to return. - * @returns A Map of objects, keyed on locale with the value an array of string values (for that locale). - */ -function getStringByLocaleAll(thing, property) { - var _a, _b; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const stringsByLocale = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {}; - return new Map(Object.entries(stringsByLocale).map(([locale, values]) => [ - locale, - [...values], - ])); -} -/** - * Returns the string value of the specified Property from a [[Thing]]. - * If the Property is not present or its value is not of type string, returns null. - * If the Property has multiple string values, returns one of its values. - * - * @param thing The [[Thing]] to read a string value from. - * @param property The Property whose string value to return. - * @returns A string value for the given Property if present, or null if the Property is not present or the value is not of type string. - */ -function getStringNoLocale(thing, property) { - internal_throwIfNotThing(thing); - const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.string); - return literalString; -} -/** - * Returns the string values of the specified Property from a [[Thing]]. - * If the Property is not present, returns an empty array. - * If the Property's value is not of type string, omits that value in the array. - * - * @param thing The [[Thing]] to read the string values from. - * @param property The Property whose string values to return. - * @returns An array of string values for the given Property. - */ -function getStringNoLocaleAll(thing, property) { - internal_throwIfNotThing(thing); - const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.string); - return literalStrings; -} -/** - * @param thing The [[Thing]] to read a NamedNode value from. - * @param property The given Property for which you want the NamedNode value. - * @returns A NamedNode value for the given Property, if present, or null otherwise. - * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @see https://rdf.js.org/data-model-spec/#namednode-interface - */ -function getNamedNode(thing, property) { - const iriString = getIri(thing, property); - if (iriString === null) { - return null; - } - return DataFactory.namedNode(iriString); -} -/** - * @param thing The [[Thing]] to read the NamedNode values from. - * @param property The given Property for which you want the NamedNode values. - * @returns The NamedNode values for the given Property. - * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @see https://rdf.js.org/data-model-spec/#namednode-interface - */ -function getNamedNodeAll(thing, property) { - const iriStrings = getIriAll(thing, property); - return iriStrings.map((iriString) => DataFactory.namedNode(iriString)); -} -/** - * @param thing The [[Thing]] to read a Literal value from. - * @param property The given Property for which you want the Literal value. - * @returns A Literal value for the given Property, if present, or null otherwise. - * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @see https://rdf.js.org/data-model-spec/#literal-interface - */ -function getLiteral(thing, property) { - var _a, _b, _c, _d; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {}; - const locales = Object.keys(langStrings); - if (locales.length > 0) { - const nonEmptyLocale = locales.find((locale) => Array.isArray(langStrings[locale]) && langStrings[locale].length > 0); - if (typeof nonEmptyLocale === "string") { - return DataFactory.literal(langStrings[nonEmptyLocale][0], nonEmptyLocale); - } - } - const otherLiterals = (_d = (_c = thing.predicates[predicateIri]) === null || _c === void 0 ? void 0 : _c.literals) !== null && _d !== void 0 ? _d : {}; - const dataTypes = Object.keys(otherLiterals); - if (dataTypes.length > 0) { - const nonEmptyDataType = dataTypes.find((dataType) => Array.isArray(otherLiterals[dataType]) && - otherLiterals[dataType].length > 0); - if (typeof nonEmptyDataType === "string") { - return DataFactory.literal(otherLiterals[nonEmptyDataType][0], DataFactory.namedNode(nonEmptyDataType)); - } - } - return null; -} -/** - * @param thing The [[Thing]] to read the Literal values from. - * @param property The given Property for which you want the Literal values. - * @returns The Literal values for the given Property. - * @ignore This should not be needed due to the other get*All() functions. If you do find yourself needing it, please file a feature request for your use case. - * @see https://rdf.js.org/data-model-spec/#literal-interface - */ -function getLiteralAll(thing, property) { - var _a, _b, _c, _d; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - let literals = []; - const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {}; - const locales = Object.keys(langStrings); - for (const locale of locales) { - const stringsInLocale = langStrings[locale]; - const localeLiterals = stringsInLocale.map((langString) => DataFactory.literal(langString, locale)); - literals = literals.concat(localeLiterals); - } - const otherLiterals = (_d = (_c = thing.predicates[predicateIri]) === null || _c === void 0 ? void 0 : _c.literals) !== null && _d !== void 0 ? _d : {}; - const dataTypes = Object.keys(otherLiterals); - for (const dataType of dataTypes) { - const values = otherLiterals[dataType]; - const typeNode = DataFactory.namedNode(dataType); - const dataTypeLiterals = values.map((value) => DataFactory.literal(value, typeNode)); - literals = literals.concat(dataTypeLiterals); - } - return literals; -} -/** - * @param thing The [[Thing]] to read a raw RDF/JS value from. - * @param property The given Property for which you want the raw value. - * @returns A Term for the given Property, if present, or null otherwise. - * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @see https://rdf.js.org/data-model-spec/ - * @since 0.3.0 - */ -function getTerm(thing, property) { - var _a, _b; - internal_throwIfNotThing(thing); - const namedNode = getNamedNode(thing, property); - if (namedNode !== null) { - return namedNode; - } - const literal = getLiteral(thing, property); - if (literal !== null) { - return literal; - } - const predicateIri = internal_toIriString(property); - const blankNodes = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.blankNodes) !== null && _b !== void 0 ? _b : []; - if (blankNodes.length > 0) { - const blankNodeValue = isBlankNodeId(blankNodes[0]) - ? getBlankNodeValue(blankNodes[0]) - : undefined; - return DataFactory.blankNode(blankNodeValue); - } - return null; -} -/** - * @param thing The [[Thing]] to read the raw RDF/JS values from. - * @param property The given Property for which you want the raw values. - * @returns The Terms for the given Property. - * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @see https://rdf.js.org/data-model-spec/ - * @since 0.3.0 - */ -function getTermAll(thing, property) { - var _a, _b; - internal_throwIfNotThing(thing); - const namedNodes = getNamedNodeAll(thing, property); - const literals = getLiteralAll(thing, property); - const predicateIri = internal_toIriString(property); - const blankNodeValues = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.blankNodes) !== null && _b !== void 0 ? _b : []; - const blankNodes = blankNodeValues.map((rawBlankNode) => { - const blankNodeName = isBlankNodeId(rawBlankNode) - ? getBlankNodeValue(rawBlankNode) - : undefined; - return DataFactory.blankNode(blankNodeName); - }); - const terms = namedNodes - .concat(literals) - .concat(blankNodes); - return terms; -} -/** - * @param thing The [Thing]] to read a Literal of the given type from. - * @param property The given Property for which you want the Literal value. - * @param literalType Set type of the Literal data. - * @returns The stringified value for the given Property and type, if present, or null otherwise. - */ -function getLiteralOfType(thing, property, literalType) { - var _a, _b, _c, _d; - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - return (_d = (_c = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.literals) === null || _b === void 0 ? void 0 : _b[literalType]) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : null; -} -/** - * @param thing The [Thing]] to read the Literals of the given type from. - * @param property The given Property for which you want the Literal values. - * @param literalType Set type of the Literal data. - * @returns The stringified values for the given Property and type. - */ -function getLiteralAllOfType(thing, property, literalType) { - var _a, _b, _c; - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const literalsOfType = (_c = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.literals) === null || _b === void 0 ? void 0 : _b[literalType]) !== null && _c !== void 0 ? _c : []; - return [...literalsOfType]; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Extract Quads with a given Subject from a [[SolidDataset]] into a [[Thing]]. - * - * @param solidDataset The [[SolidDataset]] to extract the [[Thing]] from. - * @param thingUrl The URL of the desired [[Thing]]. - * @param options Not yet implemented. - */ -function getThing(solidDataset, thingUrl, options = {}) { - var _a; - if (!internal_isValidUrl(thingUrl)) { - throw new ValidThingUrlExpectedError(thingUrl); - } - const graph = typeof options.scope !== "undefined" - ? internal_toIriString(options.scope) - : "default"; - const thingsByIri = (_a = solidDataset.graphs[graph]) !== null && _a !== void 0 ? _a : {}; - const thingIri = internal_toIriString(thingUrl); - const resolvedThingIri = isLocalNodeIri(thingIri) && hasServerResourceInfo(solidDataset) - ? resolveLocalIri(getLocalNodeName(thingIri), getSourceUrl(solidDataset)) - : thingIri; - const thing = thingsByIri[resolvedThingIri]; - if (typeof thing === "undefined") { - return null; - } - return thing; -} -/** - * Get all [[Thing]]s in a [[SolidDataset]]. - * - * @param solidDataset The [[SolidDataset]] to extract the [[Thing]]s from. - * @param options Not yet implemented. - */ -function getThingAll(solidDataset, options = { acceptBlankNodes: false }) { - var _a; - const graph = typeof options.scope !== "undefined" - ? internal_toIriString(options.scope) - : "default"; - const thingsByIri = (_a = solidDataset.graphs[graph]) !== null && _a !== void 0 ? _a : {}; - return Object.values(thingsByIri).filter((thing) => !isBlankNodeId(thing.url) || options.acceptBlankNodes); -} -/** - * Insert a [[Thing]] into a [[SolidDataset]], replacing previous instances of that Thing. - * - * @param solidDataset The SolidDataset to insert a Thing into. - * @param thing The Thing to insert into the given SolidDataset. - * @returns A new SolidDataset equal to the given SolidDataset, but with the given Thing. - */ -function setThing(solidDataset, thing) { - var _a; - const thingIri = isThingLocal(thing) && hasServerResourceInfo(solidDataset) - ? resolveLocalIri(getLocalNodeName(thing.url), getSourceUrl(solidDataset)) - : thing.url; - const defaultGraph = solidDataset.graphs.default; - const updatedDefaultGraph = freeze({ - ...defaultGraph, - [thingIri]: freeze({ ...thing, url: thingIri }), - }); - const updatedGraphs = freeze({ - ...solidDataset.graphs, - default: updatedDefaultGraph, - }); - const subjectNode = DataFactory.namedNode(thingIri); - const deletedThingPredicates = (_a = solidDataset.graphs.default[thingIri]) === null || _a === void 0 ? void 0 : _a.predicates; - const deletions = typeof deletedThingPredicates !== "undefined" - ? subjectToRdfJsQuads(deletedThingPredicates, subjectNode, DataFactory.defaultGraph()) - : []; - const additions = subjectToRdfJsQuads(thing.predicates, subjectNode, DataFactory.defaultGraph()); - return internal_addAdditionsToChangeLog(internal_addDeletionsToChangeLog(freeze({ - ...solidDataset, - graphs: updatedGraphs, - }), deletions), additions); -} -/** - * Remove a Thing from a SolidDataset. - * - * @param solidDataset The SolidDataset to remove a Thing from. - * @param thing The Thing to remove from `solidDataset`. - * @returns A new [[SolidDataset]] equal to the input SolidDataset, excluding the given Thing. - */ -function removeThing(solidDataset, thing) { - var _a; - let thingIri; - if (isNamedNode(thing)) { - thingIri = thing.value; - } - else if (typeof thing === "string") { - thingIri = - isLocalNodeIri(thing) && hasServerResourceInfo(solidDataset) - ? resolveLocalIri(getLocalNodeName(thing), getSourceUrl(solidDataset)) - : thing; - } - else if (isThingLocal(thing)) { - thingIri = thing.url; - } - else { - thingIri = asIri(thing); - } - const defaultGraph = solidDataset.graphs.default; - const updatedDefaultGraph = { ...defaultGraph }; - delete updatedDefaultGraph[thingIri]; - const updatedGraphs = freeze({ - ...solidDataset.graphs, - default: freeze(updatedDefaultGraph), - }); - const subjectNode = DataFactory.namedNode(thingIri); - const deletedThingPredicates = (_a = solidDataset.graphs.default[thingIri]) === null || _a === void 0 ? void 0 : _a.predicates; - const deletions = typeof deletedThingPredicates !== "undefined" - ? subjectToRdfJsQuads(deletedThingPredicates, subjectNode, DataFactory.defaultGraph()) - : []; - return internal_addDeletionsToChangeLog(freeze({ - ...solidDataset, - graphs: updatedGraphs, - }), deletions); -} -function createThing(options = {}) { - var _a; - if (typeof options.url !== "undefined") { - const { url } = options; - if (!internal_isValidUrl(url)) { - throw new ValidThingUrlExpectedError(url); - } - const thing = freeze({ - type: "Subject", - predicates: freeze({}), - url, - }); - return thing; - } - const name = (_a = options.name) !== null && _a !== void 0 ? _a : generateName(); - const localNodeIri = getLocalNodeIri(name); - const thing = freeze({ - type: "Subject", - predicates: freeze({}), - url: localNodeIri, - }); - return thing; -} -/** - * @param input An value that might be a [[Thing]]. - * @returns Whether `input` is a Thing. - * @since 0.2.0 - */ -function isThing(input) { - return (typeof input === "object" && - input !== null && - typeof input.type === "string" && - input.type === "Subject"); -} -function asUrl(thing, baseUrl) { - if (isThingLocal(thing)) { - if (typeof baseUrl === "undefined") { - throw new Error("The URL of a Thing that has not been persisted cannot be determined without a base URL."); - } - return resolveLocalIri(getLocalNodeName(thing.url), baseUrl); - } - return thing.url; -} -/** @hidden Alias of [[asUrl]] for those who prefer IRI terminology. */ -const asIri = asUrl; -/** - * Gets a human-readable representation of the given Thing to aid debugging. - * - * Note that changes to the exact format of the return value are not considered a breaking change; - * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed. - * - * @param thing The Thing to get a human-readable representation of. - * @since 0.3.0 - */ -function thingAsMarkdown(thing) { - let thingAsMarkdown = ""; - if (isThingLocal(thing)) { - thingAsMarkdown += `## Thing (no URL yet — identifier: \`#${getLocalNodeName(thing.url)}\`)\n`; - } - else { - thingAsMarkdown += `## Thing: ${thing.url}\n`; - } - const predicateIris = Object.keys(thing.predicates); - if (predicateIris.length === 0) { - thingAsMarkdown += "\n\n"; - } - else { - for (const predicate of predicateIris) { - thingAsMarkdown += `\nProperty: ${predicate}\n`; - const values = getTermAll(thing, predicate); - thingAsMarkdown += values.reduce((acc, value) => { - return `${acc}- ${internal_getReadableValue(value)}\n`; - }, ""); - } - } - return thingAsMarkdown; -} -/** - * @param thing The [[Thing]] of which a URL might or might not be known. - * @return `true` if `thing` has no known URL yet. - * @since 1.7.0 - */ -function isThingLocal(thing) { - return isLocalNodeIri(thing.url); -} -/** - * This error is thrown when a function expected to receive a [[Thing]] but received something else. - * @since 1.2.0 - */ -class ThingExpectedError extends SolidClientError { - constructor(receivedValue) { - const message = `Expected a Thing, but received: [${receivedValue}].`; - super(message); - this.receivedValue = receivedValue; - } -} -/** - * This error is thrown when a function expected to receive a valid URL to identify a property but received something else. - */ -class ValidPropertyUrlExpectedError extends SolidClientError { - constructor(receivedValue) { - const value = isNamedNode(receivedValue) - ? receivedValue.value - : receivedValue; - const message = `Expected a valid URL to identify a property, but received: [${value}].`; - super(message); - this.receivedProperty = value; - } -} -/** - * This error is thrown when a function expected to receive a valid URL value but received something else. - */ -class ValidValueUrlExpectedError extends SolidClientError { - constructor(receivedValue) { - const value = isNamedNode(receivedValue) - ? receivedValue.value - : receivedValue; - const message = `Expected a valid URL value, but received: [${value}].`; - super(message); - this.receivedValue = value; - } -} -/** - * This error is thrown when a function expected to receive a valid URL to identify a [[Thing]] but received something else. - */ -class ValidThingUrlExpectedError extends SolidClientError { - constructor(receivedValue) { - const value = isNamedNode(receivedValue) - ? receivedValue.value - : receivedValue; - const message = `Expected a valid URL to identify a Thing, but received: [${value}].`; - super(message); - this.receivedValue = value; - } -} -/** - * Generate a string that can be used as the unique identifier for a Thing - * - * This function works by starting with a date string (so that Things can be - * sorted chronologically), followed by a random number generated by taking a - * random number between 0 and 1, and cutting off the `0.`. - * - * @internal - * @returns An string that's likely to be unique - */ -const generateName = () => { - return uuid.v4(); -}; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * This function normalizes IRIs as managed by the server to ease accurate comparison. - * @param iri - * @hidden - */ -function normalizeServerSideIri(iri) { - const iriObj = new URL(iri); - iriObj.hash = ""; - return iriObj.href; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Initialise a new [[SolidDataset]] in memory. - * - * @returns An empty [[SolidDataset]]. - */ -function createSolidDataset() { - return freeze({ - type: "Dataset", - graphs: { - default: {}, - }, - }); -} -/** - * @hidden This interface is not exposed yet until we've tried it out in practice. - */ -async function responseToSolidDataset(response, parseOptions = {}) { - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Fetching the SolidDataset at [${response.url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } - const resourceInfo = responseToResourceInfo(response); - const parsers = { - "text/turtle": getTurtleParser$1(), - ...parseOptions.parsers, - }; - const contentType = getContentType$1(resourceInfo); - if (contentType === null) { - throw new Error(`Could not determine the content type of the Resource at [${getSourceUrl(resourceInfo)}].`); - } - const mimeType = contentType.split(";")[0]; - const parser = parsers[mimeType]; - if (typeof parser === "undefined") { - throw new Error(`The Resource at [${getSourceUrl(resourceInfo)}] has a MIME type of [${mimeType}], but the only parsers available are for the following MIME types: [${Object.keys(parsers).join(", ")}].`); - } - const data = await response.text(); - const parsingPromise = new Promise((resolve, reject) => { - let solidDataset = freeze({ - graphs: freeze({ default: freeze({}) }), - type: "Dataset", - }); - // While Quads without Blank Nodes can be added to the SolidDataset as we - // encounter them, to parse Quads with Blank Nodes, we'll have to wait until - // we've seen all the Quads, so that we can reconcile equal Blank Nodes. - const quadsWithBlankNodes = []; - const allQuads = []; - parser.onError((error) => { - reject(new Error(`Encountered an error parsing the Resource at [${getSourceUrl(resourceInfo)}] with content type [${contentType}]: ${error}`)); - }); - parser.onQuad((quad) => { - allQuads.push(quad); - if (quad.subject.termType === "BlankNode" || - quad.object.termType === "BlankNode") { - // Quads with Blank Nodes will be parsed when all Quads are known, - // so that equal Blank Nodes can be reconciled: - quadsWithBlankNodes.push(quad); - } - else { - solidDataset = addRdfJsQuadToDataset(solidDataset, quad); - } - }); - parser.onComplete(async () => { - // If a Resource contains more than this number of Blank Nodes, - // we consider the detection of chains (O(n^2), I think) to be too - // expensive, and just incorporate them as regular Blank Nodes with - // non-deterministic, ad-hoc identifiers into the SolidDataset: - const maxBlankNodesToDetectChainsFor = 20; - // Some Blank Nodes only serve to use a set of Quads as the Object for a - // single Subject. Those Quads will be added to the SolidDataset when - // their Subject's Blank Node is encountered in the Object position. - const chainBlankNodes = quadsWithBlankNodes.length <= maxBlankNodesToDetectChainsFor - ? getChainBlankNodes(quadsWithBlankNodes) - : []; - const quadsWithoutChainBlankNodeSubjects = quadsWithBlankNodes.filter((quad) => chainBlankNodes.every((chainBlankNode) => !chainBlankNode.equals(quad.subject))); - solidDataset = quadsWithoutChainBlankNodeSubjects.reduce((datasetAcc, quad) => addRdfJsQuadToDataset(datasetAcc, quad, { - otherQuads: allQuads, - chainBlankNodes, - }), solidDataset); - const solidDatasetWithResourceInfo = freeze({ - ...solidDataset, - ...resourceInfo, - }); - resolve(solidDatasetWithResourceInfo); - }); - parser.parse(data, resourceInfo); - }); - return parsingPromise; -} -/** - * Fetch a SolidDataset from the given URL. Currently requires the SolidDataset to be available as [Turtle](https://www.w3.org/TR/turtle/). - * - * Note that the URL of a container ends with a [trailing slash "/"](https://solidproject.org/TR/protocol#uri). - * If it is missing, some libraries will add it automatically, which may result in additional round-trips, possibly including - * authentication errors ([more information](https://github.com/inrupt/solid-client-js/issues/1216#issuecomment-904703695)). - * - * @param url URL to fetch a [[SolidDataset]] from. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns Promise resolving to a [[SolidDataset]] containing the data at the given Resource, or rejecting if fetching it failed. - */ -async function getSolidDataset(url, options = internal_defaultFetchOptions) { - var _a; - url = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const parserContentTypes = Object.keys((_a = options.parsers) !== null && _a !== void 0 ? _a : {}); - const acceptedContentTypes = parserContentTypes.length > 0 - ? parserContentTypes.join(", ") - : "text/turtle"; - const response = await config.fetch(url, { - headers: { - Accept: acceptedContentTypes, - }, - }); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Fetching the Resource at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } - const solidDataset = await responseToSolidDataset(response, options); - return solidDataset; -} -/** - * Create a SPARQL UPDATE Patch request from a [[SolidDataset]] with a changelog. - * @param solidDataset the [[SolidDataset]] that has been locally updated, and that should be persisted. - * @returns an HTTP PATCH request configuration object, aligned with the [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters), containing a SPARQL UPDATE. - * @hidden - */ -async function prepareSolidDatasetUpdate(solidDataset) { - const deleteStatement = solidDataset.internal_changeLog.deletions.length > 0 - ? `DELETE DATA {${(await triplesToTurtle(solidDataset.internal_changeLog.deletions.map(getNamedNodesForLocalNodes))).trim()}};` - : ""; - const insertStatement = solidDataset.internal_changeLog.additions.length > 0 - ? `INSERT DATA {${(await triplesToTurtle(solidDataset.internal_changeLog.additions.map(getNamedNodesForLocalNodes))).trim()}};` - : ""; - return { - method: "PATCH", - body: `${deleteStatement} ${insertStatement}`, - headers: { - "Content-Type": "application/sparql-update", - }, - }; -} -/** - * Create a Put request to write a locally created [[SolidDataset]] to a Pod. - * @param solidDataset the [[SolidDataset]] that has been locally updated, and that should be persisted. - * @returns an HTTP PUT request configuration object, aligned with the [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters), containing a serialization of the [[SolidDataset]]. - * @hidden - */ -async function prepareSolidDatasetCreation(solidDataset, options) { - return { - method: "PUT", - body: await triplesToTurtle(toRdfJsQuads(solidDataset).map(getNamedNodesForLocalNodes), options), - headers: { - "Content-Type": "text/turtle", - "If-None-Match": "*", - Link: `<${ldp.Resource}>; rel="type"`, - }, - }; -} -/** - * Given a SolidDataset, store it in a Solid Pod (overwriting the existing data at the given URL). - * - * A SolidDataset keeps track of the data changes compared to the data in the Pod; i.e., - * the changelog tracks both the old value and new values of the property being modified. This - * function applies the changes to the current SolidDataset. If the old value specified in the - * changelog does not correspond to the value currently in the Pod, this function will throw an - * error (common issues are listed in [the documentation](https://docs.inrupt.com/developer-tools/javascript/client-libraries/reference/error-codes/)). - * - * The SolidDataset returned by this function will contain the data sent to the Pod, and a ChangeLog - * up-to-date with the saved data. Note that if the data on the server was modified in between the - * first fetch and saving it, the updated data will not be reflected in the returned SolidDataset. - * To make sure you have the latest data, call [[getSolidDataset]] again after saving the data. - * - * The Solid server will create any intermediary Containers that do not exist yet, so they do not - * need to be created in advance. For example, if the target URL is - * https://example.pod/container/resource and https://example.pod/container/ does not exist yet, - * it will exist after this function resolves successfully. - * - * @param url URL to save `solidDataset` to. - * @param solidDataset The [[SolidDataset]] to save. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * `options.prefixes`: A prefix map to customize the serialization. Only applied on resource creation if the serialization allows it. - * @returns A Promise resolving to a [[SolidDataset]] containing the stored data, or rejecting if saving it failed. - */ -async function saveSolidDatasetAt(url, solidDataset, options = internal_defaultFetchOptions) { - url = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const datasetWithChangelog = internal_withChangeLog(solidDataset); - const requestInit = isUpdate(datasetWithChangelog, url) - ? await prepareSolidDatasetUpdate(datasetWithChangelog) - : await prepareSolidDatasetCreation(datasetWithChangelog, options); - const response = await config.fetch(url, requestInit); - if (internal_isUnsuccessfulResponse(response)) { - const diagnostics = isUpdate(datasetWithChangelog, url) - ? `The changes that were sent to the Pod are listed below.\n\n${changeLogAsMarkdown(datasetWithChangelog)}` - : `The SolidDataset that was sent to the Pod is listed below.\n\n${solidDatasetAsMarkdown(datasetWithChangelog)}`; - throw new FetchError(`Storing the Resource at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.\n\n${diagnostics}`, response); - } - const resourceInfo = { - ...internal_parseResourceInfo(response), - isRawData: false, - }; - const storedDataset = freeze({ - ...solidDataset, - internal_changeLog: { additions: [], deletions: [] }, - internal_resourceInfo: resourceInfo, - }); - const storedDatasetWithResolvedIris = resolveLocalIrisInSolidDataset(storedDataset); - return storedDatasetWithResolvedIris; -} -/** - * Deletes the SolidDataset at a given URL. - * - * If operating on a container, the container must be empty otherwise a 409 CONFLICT will be raised. - * - * @param solidDataset The URL of the SolidDataset to delete or the SolidDataset itself (if it has ResourceInfo). - * @since 0.6.0 - */ -async function deleteSolidDataset(solidDataset, options = internal_defaultFetchOptions) { - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const url = hasResourceInfo(solidDataset) - ? internal_toIriString(getSourceUrl(solidDataset)) - : internal_toIriString(solidDataset); - const response = await config.fetch(url, { method: "DELETE" }); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Deleting the SolidDataset at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } -} -/** - * Create a Container at the given URL. Some content may optionally be specified, - * e.g. to add metadata describing the container. - * - * Throws an error if creating the Container failed, e.g. because the current user does not have - * permissions to, or because the Container already exists. - * - * Note that a Solid server will automatically create the necessary Containers when storing a - * Resource; i.e. there is no need to call this function if it is immediately followed by - * [[saveSolidDatasetAt]] or [[overwriteFile]]. - * - * @param url URL of the empty Container that is to be created. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @param solidDataset Optional parameter - if provided we use this dataset as the body of the HTT request, meaning it's data is included in the Container resource. - * @since 0.2.0 - */ -async function createContainerAt(url, options = internal_defaultFetchOptions) { - var _a; - url = internal_toIriString(url); - url = url.endsWith("/") ? url : `${url}/`; - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const response = await config.fetch(url, { - method: "PUT", - body: config.initialContent - ? await triplesToTurtle(toRdfJsQuads(config.initialContent).map(getNamedNodesForLocalNodes)) - : undefined, - headers: { - Accept: "text/turtle", - "Content-Type": "text/turtle", - "If-None-Match": "*", - // This header should not be required to create a Container, - // but ESS currently expects it: - Link: `<${ldp.BasicContainer}>; rel="type"`, - }, - }); - if (internal_isUnsuccessfulResponse(response)) { - const containerType = config.initialContent === undefined ? "empty" : "non-empty"; - throw new FetchError(`Creating the ${containerType} Container at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } - const resourceInfo = internal_parseResourceInfo(response); - const containerDataset = freeze({ - ...((_a = options.initialContent) !== null && _a !== void 0 ? _a : createSolidDataset()), - internal_changeLog: { additions: [], deletions: [] }, - internal_resourceInfo: resourceInfo, - }); - return containerDataset; -} -function isSourceIriEqualTo(dataset, iri) { - return (normalizeServerSideIri(dataset.internal_resourceInfo.sourceIri) === - normalizeServerSideIri(iri)); -} -function isUpdate(solidDataset, url) { - return (hasChangelog(solidDataset) && - hasResourceInfo(solidDataset) && - typeof solidDataset.internal_resourceInfo.sourceIri === "string" && - isSourceIriEqualTo(solidDataset, url)); -} -/** - * Given a SolidDataset, store it in a Solid Pod in a new Resource inside a Container. - * - * The Container at the given URL should already exist; if it does not, you can initialise it first - * using [[createContainerAt]], or directly save the SolidDataset at the desired location using - * [[saveSolidDatasetAt]]. - * - * This function is primarily useful if the current user does not have access to change existing files in - * a Container, but is allowed to add new files; in other words, they have Append, but not Write - * access to a Container. This is useful in situations where someone wants to allow others to, - * for example, send notifications to their Pod, but not to view or delete existing notifications. - * You can pass a suggestion for the new Resource's name, but the server may decide to give it - * another name — for example, if a Resource with that name already exists inside the given - * Container. - * If the user does have access to write directly to a given location, [[saveSolidDatasetAt]] - * will do the job just fine, and does not require the parent Container to exist in advance. - * - * @param containerUrl URL of the Container in which to create a new Resource. - * @param solidDataset The [[SolidDataset]] to save to a new Resource in the given Container. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A Promise resolving to a [[SolidDataset]] containing the saved data. The Promise rejects if the save failed. - */ -async function saveSolidDatasetInContainer(containerUrl, solidDataset, options = internal_defaultFetchOptions) { - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - containerUrl = internal_toIriString(containerUrl); - const rawTurtle = await triplesToTurtle(toRdfJsQuads(solidDataset).map(getNamedNodesForLocalNodes)); - const headers = { - "Content-Type": "text/turtle", - Link: `<${ldp.Resource}>; rel="type"`, - }; - if (options.slugSuggestion) { - headers.slug = options.slugSuggestion; - } - const response = await config.fetch(containerUrl, { - method: "POST", - body: rawTurtle, - headers, - }); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Storing the Resource in the Container at [${containerUrl}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.\n\n` + - `The SolidDataset that was sent to the Pod is listed below.\n\n${solidDatasetAsMarkdown(solidDataset)}`, response); - } - const internalResourceInfo = internal_parseResourceInfo(response); - if (!internalResourceInfo.location) { - throw new Error("Could not determine the location of the newly saved SolidDataset."); - } - let resourceIri; - try { - // Try to parse the location header as a URL (safe if it's an absolute URL)`` - // This should help determine the container URL if normalisation happened on the server side. - resourceIri = new URL(internalResourceInfo.location).href; - } - catch (e) { - // If it's a relative URL then, rely on the response.url to construct the sourceIri - resourceIri = new URL(internalResourceInfo.location, response.url).href; - } - const resourceInfo = { - internal_resourceInfo: { - isRawData: false, - sourceIri: resourceIri, - }, - }; - const resourceWithResourceInfo = freeze({ - ...solidDataset, - ...resourceInfo, - }); - const resourceWithResolvedIris = resolveLocalIrisInSolidDataset(resourceWithResourceInfo); - return resourceWithResolvedIris; -} -/** - * Create an empty Container inside the Container at the given URL. - * - * Throws an error if creating the Container failed, e.g. because the current user does not have - * permissions to. - * - * The Container in which to create the new Container should itself already exist. - * - * This function is primarily useful if the current user does not have access to change existing files in - * a Container, but is allowed to add new files; in other words, they have Append, but not Write - * access to a Container. This is useful in situations where someone wants to allow others to, - * for example, send notifications to their Pod, but not to view or delete existing notifications. - * You can pass a suggestion for the new Resource's name, but the server may decide to give it - * another name — for example, if a Resource with that name already exists inside the given - * Container. - * If the user does have access to write directly to a given location, [[createContainerAt]] - * will do the job just fine, and does not require the parent Container to exist in advance. - * - * @param containerUrl URL of the Container in which the empty Container is to - * be created. - * @param options Optional parameter `options.fetch`: An alternative `fetch` - * function to make the HTTP request, compatible with the browser-native [fetch - * API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).`options.slugSuggestion` - * accepts a string for your new Container's name. - * @returns A promise that resolves to a SolidDataset with ResourceInfo if - * successful, and that rejects otherwise. - * @since 0.2.0 - */ -async function createContainerInContainer(containerUrl, options = internal_defaultFetchOptions) { - containerUrl = internal_toIriString(containerUrl); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const headers = { - "Content-Type": "text/turtle", - Link: `<${ldp.BasicContainer}>; rel="type"`, - }; - if (options.slugSuggestion) { - headers.slug = options.slugSuggestion; - } - const response = await config.fetch(containerUrl, { - method: "POST", - headers, - }); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Creating an empty Container in the Container at [${containerUrl}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } - const internalResourceInfo = internal_parseResourceInfo(response); - if (!internalResourceInfo.location) { - throw new Error("Could not determine the location of the newly created Container."); - } - try { - // Try to parse the location header as a URL (safe if it's an absolute URL)`` - // This should help determine the container URL if normalisation happened on the server side. - const sourceIri = new URL(internalResourceInfo.location).toString(); - return freeze({ - ...createSolidDataset(), - internal_resourceInfo: { - ...internalResourceInfo, - sourceIri, - }, - }); - } - catch (e) { - // If it's a relative URL then, rely on the response.url to construct the sourceIri - } - return freeze({ - ...createSolidDataset(), - internal_resourceInfo: { - ...internalResourceInfo, - sourceIri: new URL(internalResourceInfo.location, response.url).href, - }, - }); -} -/** - * Deletes the Container at a given URL. - * - * @param container The URL of the Container to delete or the Container Dataset itself (if it has ResourceInfo). - * @since 0.6.0 - */ -async function deleteContainer(container, options = internal_defaultFetchOptions) { - const url = hasResourceInfo(container) - ? internal_toIriString(getSourceUrl(container)) - : internal_toIriString(container); - if (!isContainer(container)) { - throw new Error(`You're trying to delete the Container at [${url}], but Container URLs should end in a \`/\`. Are you sure this is a Container?`); - } - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const response = await config.fetch(url, { method: "DELETE" }); - if (internal_isUnsuccessfulResponse(response)) { - throw new FetchError(`Deleting the Container at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response); - } -} -function isChildResource(a, b) { - const parent = new URL(b); - const child = new URL(a); - // Explicitly test on the whole URL to enforce similar origins. - const isAncestor = child.href.startsWith(parent.href); - const relativePath = child.pathname - .substring(parent.pathname.length, child.pathname.length) - .replace(/(^\/)|(\/$)/g, ""); - // The child path component that isn't present in the parent should only - // potentially include slashes at the end (if it is a container). - return isAncestor && relativePath.length >= 1 && !relativePath.includes("/"); -} -/** - * Given a [[SolidDataset]] representing a Container (see [[isContainer]]), fetch the URLs of all - * contained resources that respect [slash semantics](https://solidproject.org/TR/protocol#uri-slash-semantics) - * (see {@link validateContainedResourceAll}). - * If the solidDataset given is not a container, or is missing resourceInfo, throw an error. - * - * @param solidDataset The container from which to fetch all contained Resource URLs. - * @returns A list of URLs, each of which points to a contained Resource of the given SolidDataset. - * @since 1.3.0 - */ -function getContainedResourceUrlAll(solidDataset) { - const containerUrl = getSourceUrl(solidDataset); - const container = getThing(solidDataset, containerUrl); - if (container === null) { - return []; - } - // See https://www.w3.org/TR/2015/REC-ldp-20150226/#h-ldpc-http_post: - // > a containment triple MUST be added to the state of the LDPC whose subject is the LDPC URI, - // > whose predicate is ldp:contains and whose object is the URI for the newly created document - return (getIriAll(container, ldp.contains) - // See https://solidproject.org/TR/protocol#resource-containment - .filter((childUrl) => isChildResource(childUrl, containerUrl))); -} -/** - * Given a {@link SolidDataset} representing a [Container](https://solidproject.org/TR/protocol#resource-containment) - * (see {@link isContainer}), verify that all its containment claims are valid. Containment of a resource is valid if - * it respects [slash semantics](https://solidproject.org/TR/protocol#uri-slash-semantics). - * - * For the example, given a container at https://example.org/container/: - * - The following resources are valid: - * - https://example.org/container/resource - * - https://example.org/container/subcontainer/ - * - The following resources are invalid: - * - https://example.org/container/resource/invalid (not a direct child resource) - * - https://example.org/container2 (not a child resource) - * - https://domain2.example.org/container/resource (not a direct child resource) - * - * If a component claim is invalid, {@link validateContainedResourceAll} returns the invalid component's URL - * as part of its return object. - * - * Note: It is recommended that this function always be used before calling - * {@link getContainedResourceUrlAll} since {@link getContainedResourceUrlAll} does not - * return Resources for which containment is invalid. Using the function in conjunction - * with {@link getContainedResourceUrlAll} allows for the detection of unexpected behaviour from servers, - * including malicious containment triples that could appear. Because ESS conforms to the Solid Protocol, - * i.e., respects slash semantics for its containment triples, validateContainedResourceAll returns true for - * containers fetched from ESS. - * - * @param solidDataset The container from which containment claims are validated. - * @returns A validation report, including the offending contained resources URL if any. - * @since unreleased - */ -function validateContainedResourceAll(solidDataset) { - const containerUrl = getSourceUrl(solidDataset); - const container = getThing(solidDataset, containerUrl); - if (container === null) { - return { isValid: true, invalidContainedResources: [] }; - } - // See https://www.w3.org/TR/2015/REC-ldp-20150226/#h-ldpc-http_post: - // > a containment triple MUST be added to the state of the LDPC whose subject is the LDPC URI, - // > whose predicate is ldp:contains and whose object is the URI for the newly created document - const invalidChildren = getIriAll(container, ldp.contains) - // See https://solidproject.org/TR/protocol#resource-containment - .filter((childUrl) => !isChildResource(childUrl, containerUrl)); - if (invalidChildren.length > 0) { - return { isValid: false, invalidContainedResources: invalidChildren }; - } - return { isValid: true, invalidContainedResources: [] }; -} -/** - * Gets a human-readable representation of the given SolidDataset to aid debugging. - * - * Note that changes to the exact format of the return value are not considered a breaking change; - * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed. - * - * @param solidDataset The [[SolidDataset]] to get a human-readable representation of. - * @since 0.3.0 - */ -function solidDatasetAsMarkdown(solidDataset) { - let readableSolidDataset = ""; - if (hasResourceInfo(solidDataset)) { - readableSolidDataset += `# SolidDataset: ${getSourceUrl(solidDataset)}\n`; - } - else { - readableSolidDataset += `# SolidDataset (no URL yet)\n`; - } - const things = getThingAll(solidDataset); - if (things.length === 0) { - readableSolidDataset += "\n\n"; - } - else { - things.forEach((thing) => { - readableSolidDataset += `\n${thingAsMarkdown(thing)}`; - if (hasChangelog(solidDataset)) { - readableSolidDataset += `\n${getReadableChangeLogSummary(solidDataset, thing)}\n`; - } - }); - } - return readableSolidDataset; -} -/** - * Gets a human-readable representation of the local changes to a Resource to aid debugging. - * - * Note that changes to the exact format of the return value are not considered a breaking change; - * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed. - * - * @param solidDataset The Resource of which to get a human-readable representation of the changes applied to it locally. - * @since 0.3.0 - */ -function changeLogAsMarkdown(solidDataset) { - if (!hasResourceInfo(solidDataset)) { - return "This is a newly initialized SolidDataset, so there is no source to compare it to."; - } - if (!hasChangelog(solidDataset) || - (solidDataset.internal_changeLog.additions.length === 0 && - solidDataset.internal_changeLog.deletions.length === 0)) { - return (`## Changes compared to ${getSourceUrl(solidDataset)}\n\n` + - `This SolidDataset has not been modified since it was fetched from ${getSourceUrl(solidDataset)}.\n`); - } - let readableChangeLog = `## Changes compared to ${getSourceUrl(solidDataset)}\n`; - const changeLogsByThingAndProperty = sortChangeLogByThingAndProperty(solidDataset); - Object.keys(changeLogsByThingAndProperty).forEach((thingUrl) => { - readableChangeLog += `\n### Thing: ${thingUrl}\n`; - const changeLogByProperty = changeLogsByThingAndProperty[thingUrl]; - Object.keys(changeLogByProperty).forEach((propertyUrl) => { - readableChangeLog += `\nProperty: ${propertyUrl}\n`; - const { deleted } = changeLogByProperty[propertyUrl]; - const { added } = changeLogByProperty[propertyUrl]; - if (deleted.length > 0) { - readableChangeLog += "- Removed:\n"; - readableChangeLog += deleted.reduce((acc, deletedValue) => { - return `${acc} - ${internal_getReadableValue(deletedValue)}\n`; - }, ""); - } - if (added.length > 0) { - readableChangeLog += "- Added:\n"; - readableChangeLog += added.reduce((acc, addedValue) => { - return `${acc} - ${internal_getReadableValue(addedValue)}\n`; - }, ""); - } - }); - }); - return readableChangeLog; -} -function sortChangeLogByThingAndProperty(solidDataset) { - const changeLogsByThingAndProperty = Object.create(null); - solidDataset.internal_changeLog.deletions.forEach((deletion) => { - var _a, _b; - var _c; - const subjectNode = isLocalNode(deletion.subject) - ? /* istanbul ignore next: Unsaved deletions should be removed from the additions list instead, so this code path shouldn't be hit: */ - resolveIriForLocalNode(deletion.subject, getSourceUrl(solidDataset)) - : deletion.subject; - if (!isNamedNode(subjectNode) || !isNamedNode(deletion.predicate)) { - return; - } - const thingUrl = internal_toIriString(subjectNode); - const propertyUrl = internal_toIriString(deletion.predicate); - (_a = changeLogsByThingAndProperty[thingUrl]) !== null && _a !== void 0 ? _a : (changeLogsByThingAndProperty[thingUrl] = Object.create(null)); - (_b = (_c = changeLogsByThingAndProperty[thingUrl])[propertyUrl]) !== null && _b !== void 0 ? _b : (_c[propertyUrl] = { - added: [], - deleted: [], - }); - changeLogsByThingAndProperty[thingUrl][propertyUrl].deleted.push(deletion.object); - }); - solidDataset.internal_changeLog.additions.forEach((addition) => { - var _a, _b; - var _c; - const subjectNode = isLocalNode(addition.subject) - ? /* istanbul ignore next: setThing already resolves local Subjects when adding them, so this code path should never be hit. */ - resolveIriForLocalNode(addition.subject, getSourceUrl(solidDataset)) - : addition.subject; - if (!isNamedNode(subjectNode) || !isNamedNode(addition.predicate)) { - return; - } - const thingUrl = internal_toIriString(subjectNode); - const propertyUrl = internal_toIriString(addition.predicate); - (_a = changeLogsByThingAndProperty[thingUrl]) !== null && _a !== void 0 ? _a : (changeLogsByThingAndProperty[thingUrl] = Object.create(null)); - (_b = (_c = changeLogsByThingAndProperty[thingUrl])[propertyUrl]) !== null && _b !== void 0 ? _b : (_c[propertyUrl] = { - added: [], - deleted: [], - }); - changeLogsByThingAndProperty[thingUrl][propertyUrl].added.push(addition.object); - }); - return changeLogsByThingAndProperty; -} -function getReadableChangeLogSummary(solidDataset, thing) { - const subject = DataFactory.namedNode(thing.url); - const nrOfAdditions = solidDataset.internal_changeLog.additions.reduce((count, addition) => (addition.subject.equals(subject) ? count + 1 : count), 0); - const nrOfDeletions = solidDataset.internal_changeLog.deletions.reduce((count, deletion) => (deletion.subject.equals(subject) ? count + 1 : count), 0); - const additionString = nrOfAdditions === 1 - ? "1 new value added" - : `${nrOfAdditions} new values added`; - const deletionString = nrOfDeletions === 1 ? "1 value removed" : `${nrOfDeletions} values removed`; - return `(${additionString} / ${deletionString})`; -} -function getNamedNodesForLocalNodes(quad) { - const subject = isNamedNode(quad.subject) - ? getNamedNodeFromLocalNode(quad.subject) - : /* istanbul ignore next: We don't allow non-NamedNodes as the Subject, so this code path should never be hit: */ - quad.subject; - const object = isNamedNode(quad.object) - ? getNamedNodeFromLocalNode(quad.object) - : quad.object; - return DataFactory.quad(subject, quad.predicate, object, quad.graph); -} -function getNamedNodeFromLocalNode(node) { - if (isLocalNodeIri(node.value)) { - return DataFactory.namedNode(`#${getLocalNodeName(node.value)}`); - } - return node; -} -function resolveLocalIrisInSolidDataset(solidDataset) { - const resourceIri = getSourceUrl(solidDataset); - const defaultGraph = solidDataset.graphs.default; - const thingIris = Object.keys(defaultGraph); - const updatedDefaultGraph = thingIris.reduce((graphAcc, thingIri) => { - const resolvedThing = resolveLocalIrisInThing(graphAcc[thingIri], resourceIri); - const resolvedThingIri = isLocalNodeIri(thingIri) - ? `${resourceIri}#${getLocalNodeName(thingIri)}` - : thingIri; - const updatedGraph = { ...graphAcc }; - delete updatedGraph[thingIri]; - updatedGraph[resolvedThingIri] = resolvedThing; - return freeze(updatedGraph); - }, defaultGraph); - const updatedGraphs = freeze({ - ...solidDataset.graphs, - default: updatedDefaultGraph, - }); - return freeze({ - ...solidDataset, - graphs: updatedGraphs, - }); -} -function resolveLocalIrisInThing(thing, baseIri) { - const predicateIris = Object.keys(thing.predicates); - const updatedPredicates = predicateIris.reduce((predicatesAcc, predicateIri) => { - var _a; - const namedNodes = (_a = predicatesAcc[predicateIri].namedNodes) !== null && _a !== void 0 ? _a : []; - if (namedNodes.every((namedNode) => !isLocalNodeIri(namedNode))) { - // This Predicate has no local node Objects, so return it unmodified: - return predicatesAcc; - } - const updatedNamedNodes = freeze(namedNodes.map((namedNode) => isLocalNodeIri(namedNode) - ? `${baseIri}#${getLocalNodeName(namedNode)}` - : namedNode)); - const updatedPredicate = freeze({ - ...predicatesAcc[predicateIri], - namedNodes: updatedNamedNodes, - }); - return freeze({ - ...predicatesAcc, - [predicateIri]: updatedPredicate, - }); - }, thing.predicates); - return freeze({ - ...thing, - predicates: updatedPredicates, - url: isLocalNodeIri(thing.url) - ? `${baseIri}#${getLocalNodeName(thing.url)}` - : thing.url, - }); -} -/** - * @hidden - * - * Fetch a SolidDataset containing information about the capabilities of the - * storage server that hosts the given resource URL. For more information, - * please see the [ESS - * Documentation](https://docs.inrupt.com/ess/latest/services/discovery-endpoint/#well-known-solid). - * - * **Note:** The data contained in this dataset has changed between ESS 1.1 and - * ESS 2.0, as such you will need to check for multiple predicates to support - * both versions. - * - * ```typescript - * const wellKnown = await getWellKnownSolid(resource); - * - * // The wellKnown dataset uses a blank node for the subject all of it’s predicates, - * // such that we need to call getThingAll with acceptBlankNodes set to true to - * // retrieve back predicates contained within the dataset - * const wellKnownSubjects = getThingAll(wellKnown, { - * acceptBlankNodes: true, - * }); - * const wellKnownSubject = wellKnownSubjects[0]; - * - * // Retrieve a value from the wellKnown dataset: - * let notificationGateway = getIri( - * wellKnownSubject, - * "http://www.w3.org/ns/solid/terms#notificationGateway" - * ); - * ``` - * - * - * @param url URL of a Resource. - * @param options Optional parameter `options.fetch`: An alternative `fetch` - * function to make the HTTP request, compatible with the browser-native [fetch - * API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns Promise resolving to a [[SolidDataset]] containing the data at - * '.well-known/solid' for the given Resource, or rejecting if fetching it - * failed. - * @since 1.12.0 - */ -async function getWellKnownSolid(url, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(url); - // Try to fetch the well-known solid dataset from the server's root - try { - const wellKnownSolidUrl = new URL("/.well-known/solid", new URL(urlString).origin).href; - return await getSolidDataset(wellKnownSolidUrl, { - fetch: fetch, - }); - } - catch (e) { - // In case of error, do nothing and try to discover the .well-known - // at the pod's root. - } - // 1.1s implementation: - const resourceMetadata = await getResourceInfo(urlString, { - fetch: options.fetch, - // Discovering the .well-known/solid document is useful even for resources - // we don't have access to. - ignoreAuthenticationErrors: true, - }); - const linkedResources = getLinkedResourceUrlAll(resourceMetadata); - const rootResources = linkedResources[pim.storage]; - const rootResource = (rootResources === null || rootResources === void 0 ? void 0 : rootResources.length) === 1 ? rootResources[0] : null; - // If pod root (storage) was advertised, retrieve well known solid from pod's root - if (rootResource !== null) { - const wellKnownSolidUrl = new URL(".well-known/solid", rootResource.endsWith("/") ? rootResource : `${rootResource}/`).href; - return getSolidDataset(wellKnownSolidUrl, { - ...options, - parsers: { - "application/ld+json": getJsonLdParser$1(), - }, - }); - } - throw new Error("Could not determine storage root or well-known solid resource."); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{warning} - * Do not use this function in production code. For use in **unit tests**. - * ``` - * - * This function initialises a new [[SolidDataset]] with metadata as though the - * SolidDataset has been retrieved from the given URL. The mock SolidDataset can be used in - * unit tests that require persisted SolidDatasets; e.g., unit tests that call [[getSourceUrl]]. - * - * @param url The URL from which the returned SolidDataset appears to be retrieved. - * @returns A mock SolidDataset that appears to be retrieved from the `url`. - * @since 0.2.0 - */ -function mockSolidDatasetFrom(url) { - const solidDataset = createSolidDataset(); - const solidDatasetWithResourceInfo = { - ...solidDataset, - internal_resourceInfo: { - sourceIri: internal_toIriString(url), - isRawData: false, - contentType: "text/turtle", - linkedResources: {}, - }, - }; - return solidDatasetWithResourceInfo; -} -/** - * ```{warning} - * Do not use this function in production code. For use in **unit tests**. - * ``` - * - * This function initialises a new Container [[SolidDataset]] with metadata as though the - * Container has been retrieved from the given URL. The mock SolidDataset can be used in - * unit tests that require persisted Containers; e.g., unit tests that call [[isContainer]]. - * - * @param url The URL from which the returned Container appears to be retrieved. The `url` must end in a slash. - * @returns A mock SolidDataset that appears to be retrieved from the `url`. - * @since 0.2.0 - */ -function mockContainerFrom(url) { - const sourceIri = internal_toIriString(url); - if (!sourceIri.endsWith("/")) { - throw new Error("A Container's URL should end in a slash. Please update your tests."); - } - return mockSolidDatasetFrom(sourceIri); -} -/** - * ```{warning} - * Do not use this function in production code. For use in **unit tests**. - * ``` - * - * This function initialises a new File with metadata as though the - * File has been retrieved from the given URL. The mock File can be used in - * unit tests that require persisted Files; e.g. unit tests that call [[getSourceUrl]]. - * - * @param url The URL from which the returned File appears to be retrieved. - * @returns A mock File that appears to be retrieved from the `url`. - * @since 0.2.0 - */ -function mockFileFrom(url, options) { - const file = new Blob(); - const fileWithResourceInfo = Object.assign(file, { - internal_resourceInfo: { - sourceIri: internal_toIriString(url), - isRawData: true, - contentType: options === null || options === void 0 ? void 0 : options.contentType, - linkedResources: {}, - }, - }); - return fileWithResourceInfo; -} -/** - * ```{warning} - * Do not use this function in production code. For use in **unit tests**. - * ``` - * - * This function initialises a new Error object with metadata as though the - * it was the result of getting a 404 when trying to fetch the Resource at the - * given URL. The mock Error can be used in unit tests that require functions - * that fetch Resources (like [[getSolidDataset]]) to fail. - * - * @param url The URL of the Resource that could not be fetched according to the error. - * @param statusCode Optional status code (defaults to 404) that caused the error. - * @returns A mock Error that represents not having been able to fetch the Resource at `url` due to a 404 Response. - * @since 1.1.0 - */ -function mockFetchError(fetchedUrl, statusCode = 404, statusText = "Not Found") { - // The Response constructor in Node 14 makes an empty status text undefined. - const failedResponse = new universalFetch.Response(undefined, { - status: statusCode, - statusText, - }); - return new FetchError(`Fetching the Resource at [${fetchedUrl}] failed: [${failedResponse.status}] [${failedResponse.statusText}].`, failedResponse); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Create a new Thing with a URL added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setUrl]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a URL value to. - * @param property Property for which to add the given URL value. - * @param url URL to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -const addUrl = (thing, property, url) => { - var _a, _b; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - if (!isThing(url) && !internal_isValidUrl(url)) { - throw new ValidValueUrlExpectedError(url); - } - const predicateIri = internal_toIriString(property); - const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {}; - const existingNamedNodes = (_b = existingPredicate.namedNodes) !== null && _b !== void 0 ? _b : []; - let iriToAdd; - if (isNamedNode(url)) { - iriToAdd = url.value; - } - else if (typeof url === "string") { - iriToAdd = url; - } - else if (isThingLocal(url)) { - iriToAdd = url.url; - } - else { - iriToAdd = asIri(url); - } - const updatedNamedNodes = freeze(existingNamedNodes.concat(internal_toIriString(iriToAdd))); - const updatedPredicate = freeze({ - ...existingPredicate, - namedNodes: updatedNamedNodes, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - const updatedThing = freeze({ - ...thing, - predicates: updatedPredicates, - }); - return updatedThing; -}; -/** @hidden Alias for [[addUrl]] for those who prefer IRI terminology. */ -const addIri = addUrl; -/** - * Create a new Thing with a boolean added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setBoolean]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a boolean value to. - * @param property Property for which to add the given boolean value. - * @param value Boolean to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -const addBoolean = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addLiteralOfType(thing, property, serializeBoolean(value), xmlSchemaTypes.boolean); -}; -/** - * Create a new Thing with a datetime added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setDatetime]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a datetime value to. - * @param property Property for which to add the given datetime value. - * @param value Datetime to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -const addDatetime = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addLiteralOfType(thing, property, serializeDatetime(value), xmlSchemaTypes.dateTime); -}; -/** - * Create a new Thing with a date added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setDate]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a date value to. - * @param property Property for which to add the given date value. - * @param value Date to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - * @since 1.10.0 - */ -const addDate = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addLiteralOfType(thing, property, serializeDate(value), xmlSchemaTypes.date); -}; -/** - * Create a new Thing with a time added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setDatetime]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a datetime value to. - * @param property Property for which to add the given datetime value. - * @param value time to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - * @since 1.10.0 - */ -const addTime = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addLiteralOfType(thing, property, serializeTime(value), xmlSchemaTypes.time); -}; -/** - * Create a new Thing with a decimal added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setDecimal]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a decimal value to. - * @param property Property for which to add the given decimal value. - * @param value Decimal to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -const addDecimal = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addLiteralOfType(thing, property, serializeDecimal(value), xmlSchemaTypes.decimal); -}; -/** - * Create a new Thing with an integer added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setInteger]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add an integer value to. - * @param property Property for which to add the given integer value. - * @param value Integer to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -const addInteger = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addLiteralOfType(thing, property, serializeInteger(value), xmlSchemaTypes.integer); -}; -/** - * Create a new Thing with an English string added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setStringEnglish]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a localised string value to. - * @param property Property for which to add the given string value. - * @param value String to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - * @since 1.13.0 - */ -function addStringEnglish(thing, property, value) { - return addStringWithLocale(thing, property, value, "en"); -} -/** - * Create a new Thing with a localised string added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setStringWithLocale]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add a localised string value to. - * @param property Property for which to add the given string value. - * @param value String to add to `thing` for the given `property`. - * @param locale Locale of the added string. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -function addStringWithLocale(thing, property, value, locale) { - var _a, _b, _c; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const normalizedLocale = normalizeLocale(locale); - const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {}; - const existingLangStrings = (_b = existingPredicate.langStrings) !== null && _b !== void 0 ? _b : {}; - const existingStringsInLocale = (_c = existingLangStrings[normalizedLocale]) !== null && _c !== void 0 ? _c : []; - const updatedStringsInLocale = freeze(existingStringsInLocale.concat(value)); - const updatedLangStrings = freeze({ - ...existingLangStrings, - [normalizedLocale]: updatedStringsInLocale, - }); - const updatedPredicate = freeze({ - ...existingPredicate, - langStrings: updatedLangStrings, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - const updatedThing = freeze({ - ...thing, - predicates: updatedPredicates, - }); - return updatedThing; -} -/** - * Create a new Thing with an unlocalised string added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setStringNoLocale]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to add an unlocalised string value to. - * @param property Property for which to add the given string value. - * @param value String to add to `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -const addStringNoLocale = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addLiteralOfType(thing, property, value, xmlSchemaTypes.string); -}; -/** - * Create a new Thing with a Named Node added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setNamedNode]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing The [[Thing]] to add a Named Node to. - * @param property Property for which to add a value. - * @param value The Named Node to add. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -function addNamedNode(thing, property, value) { - return addUrl(thing, property, value.value); -} -/** - * Create a new Thing with a Literal added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setLiteral]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing The [[Thing]] to add a Literal to. - * @param property Property for which to add a value. - * @param value The Literal to add. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - */ -function addLiteral(thing, property, value) { - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const typeIri = value.datatype.value; - if (typeIri === xmlSchemaTypes.langString) { - return addStringWithLocale(thing, property, value.value, value.language); - } - return addLiteralOfType(thing, property, value.value, value.datatype.value); -} -/** - * Creates a new Thing with a Term added for a Property. - * - * This preserves existing values for the given Property. To replace them, see [[setTerm]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing The [[Thing]] to add a Term to. - * @param property Property for which to add a value. - * @param value The Term to add. - * @returns A new Thing equal to the input Thing with the given value added for the given Property. - * @since 0.3.0 - */ -function addTerm(thing, property, value) { - var _a, _b; - if (value.termType === "NamedNode") { - return addNamedNode(thing, property, value); - } - if (value.termType === "Literal") { - return addLiteral(thing, property, value); - } - if (value.termType === "BlankNode") { - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {}; - const existingBlankNodes = (_b = existingPredicate.blankNodes) !== null && _b !== void 0 ? _b : []; - const updatedBlankNodes = freeze(existingBlankNodes.concat(getBlankNodeId(value))); - const updatedPredicate = freeze({ - ...existingPredicate, - blankNodes: updatedBlankNodes, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - const updatedThing = freeze({ - ...thing, - predicates: updatedPredicates, - }); - return updatedThing; - } - throw new Error(`Term type [${value.termType}] is not supported by @inrupt/solid-client.`); -} -function addLiteralOfType(thing, property, value, type) { - var _a, _b, _c; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {}; - const existingLiterals = (_b = existingPredicate.literals) !== null && _b !== void 0 ? _b : {}; - const existingValuesOfType = (_c = existingLiterals[type]) !== null && _c !== void 0 ? _c : []; - const updatedValuesOfType = freeze(existingValuesOfType.concat(value)); - const updatedLiterals = freeze({ - ...existingLiterals, - [type]: updatedValuesOfType, - }); - const updatedPredicate = freeze({ - ...existingPredicate, - literals: updatedLiterals, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - const updatedThing = freeze({ - ...thing, - predicates: updatedPredicates, - }); - return updatedThing; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function removeAll(thing, property) { - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const newPredicates = { ...thing.predicates }; - delete newPredicates[predicateIri]; - return freeze({ - ...thing, - predicates: freeze(newPredicates), - }); -} -/** - * Create a new Thing with the given URL removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a URL value from. - * @param property Property for which to remove the given URL value. - * @param value URL to remove from `thing` for the given `Property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -const removeUrl = (thing, property, value) => { - var _a, _b, _c; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - if (!isThing(value) && !internal_isValidUrl(value)) { - throw new ValidValueUrlExpectedError(value); - } - const iriToRemove = isThing(value) - ? asIri(value) - : internal_toIriString(value); - const updatedNamedNodes = freeze((_c = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.namedNodes) === null || _b === void 0 ? void 0 : _b.filter((namedNode) => namedNode.toLowerCase() !== iriToRemove.toLowerCase())) !== null && _c !== void 0 ? _c : []); - const updatedPredicate = freeze({ - ...thing.predicates[predicateIri], - namedNodes: updatedNamedNodes, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - return freeze({ - ...thing, - predicates: updatedPredicates, - }); -}; -/** @hidden Alias of [[removeUrl]] for those who prefer IRI terminology. */ -const removeIri = removeUrl; -/** - * Create a new Thing with the given boolean removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a boolean value from. - * @param property Property for which to remove the given boolean value. - * @param value Boolean to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -const removeBoolean = (thing, property, value) => { - internal_throwIfNotThing(thing); - return removeLiteralMatching(thing, property, xmlSchemaTypes.boolean, (foundBoolean) => deserializeBoolean(foundBoolean) === value); -}; -/** - * Create a new Thing with the given datetime removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a datetime value from. - * @param property Property for which to remove the given datetime value. - * @param value Datetime to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -const removeDatetime = (thing, property, value) => { - internal_throwIfNotThing(thing); - return removeLiteralMatching(thing, property, xmlSchemaTypes.dateTime, (foundDatetime) => { var _a; return ((_a = deserializeDatetime(foundDatetime)) === null || _a === void 0 ? void 0 : _a.getTime()) === value.getTime(); }); -}; -/** - * Create a new Thing with the given date removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a date value from. - * @param property Property for which to remove the given date value. - * @param value Date to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - * @since 1.10.0 - */ -const removeDate = (thing, property, value) => { - internal_throwIfNotThing(thing); - return removeLiteralMatching(thing, property, xmlSchemaTypes.date, function (foundDate) { - const deserializedDate = deserializeDate(foundDate); - if (deserializedDate) { - return (deserializedDate.getFullYear() === value.getFullYear() && - deserializedDate.getMonth() === value.getMonth() && - deserializedDate.getUTCDate() === value.getUTCDate()); - } - return false; - }); -}; -/** - * Create a new Thing with the given datetime removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a datetime value from. - * @param property Property for which to remove the given datetime value. - * @param value Time to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - * @since 1.10.0 - */ -const removeTime = (thing, property, value) => { - internal_throwIfNotThing(thing); - return removeLiteralMatching(thing, property, xmlSchemaTypes.time, function (foundTime) { - const deserializedTime = deserializeTime(foundTime); - if (deserializedTime) { - return (deserializedTime.hour === value.hour && - deserializedTime.minute === value.minute && - deserializedTime.second === value.second && - deserializedTime.millisecond === value.millisecond && - deserializedTime.timezoneHourOffset === value.timezoneHourOffset && - deserializedTime.timezoneMinuteOffset === value.timezoneMinuteOffset); - } - return false; - }); -}; -/** - * Create a new Thing with the given decimal removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a decimal value from. - * @param property Property for which to remove the given decimal value. - * @param value Decimal to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -const removeDecimal = (thing, property, value) => { - internal_throwIfNotThing(thing); - return removeLiteralMatching(thing, property, xmlSchemaTypes.decimal, (foundDecimal) => deserializeDecimal(foundDecimal) === value); -}; -/** - * Create a new Thing with the given integer removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove an integer value from. - * @param property Property for which to remove the given integer value. - * @param value Integer to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -const removeInteger = (thing, property, value) => { - internal_throwIfNotThing(thing); - return removeLiteralMatching(thing, property, xmlSchemaTypes.integer, (foundInteger) => deserializeInteger(foundInteger) === value); -}; -/** - * Create a new Thing with the given English string removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a localised string value from. - * @param property Property for which to remove the given localised string value. - * @param value String to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - * @since 1.13.0 - */ -function removeStringEnglish(thing, property, value) { - return removeStringWithLocale(thing, property, value, "en"); -} -/** - * Create a new Thing with the given localised string removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove a localised string value from. - * @param property Property for which to remove the given localised string value. - * @param value String to remove from `thing` for the given `property`. - * @param locale Locale of the string to remove. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -function removeStringWithLocale(thing, property, value, locale) { - var _a, _b; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const existingLangStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {}; - const matchingLocale = Object.keys(existingLangStrings).find((existingLocale) => normalizeLocale(existingLocale) === normalizeLocale(locale) && - Array.isArray(existingLangStrings[existingLocale]) && - existingLangStrings[existingLocale].length > 0); - if (typeof matchingLocale !== "string") { - // Nothing to remove. - return thing; - } - const existingStringsInLocale = existingLangStrings[matchingLocale]; - const updatedStringsInLocale = freeze(existingStringsInLocale.filter((existingString) => existingString !== value)); - const updatedLangStrings = freeze({ - ...existingLangStrings, - [matchingLocale]: updatedStringsInLocale, - }); - const updatedPredicate = freeze({ - ...thing.predicates[predicateIri], - langStrings: updatedLangStrings, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - return freeze({ - ...thing, - predicates: updatedPredicates, - }); -} -/** - * Create a new Thing with the given unlocalised string removed for the given Property. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to remove an unlocalised string value from. - * @param property Property for which to remove the given string value. - * @param value String to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -const removeStringNoLocale = (thing, property, value) => { - internal_throwIfNotThing(thing); - return removeLiteralMatching(thing, property, xmlSchemaTypes.string, (foundString) => foundString === value); -}; -/** - * @ignore This should not be needed due to the other remove*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing Thing to remove a NamedNode value from. - * @param property Property for which to remove the given NamedNode value. - * @param value NamedNode to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -function removeNamedNode(thing, property, value) { - return removeUrl(thing, property, value.value); -} -/** - * @ignore This should not be needed due to the other remove*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing Thing to remove a Literal value from. - * @param property Property for which to remove the given Literal value. - * @param value Literal to remove from `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with the given value removed for the given Property. - */ -function removeLiteral(thing, property, value) { - var _a, _b, _c; - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const typeIri = value.datatype.value; - if (typeIri === xmlSchemaTypes.langString) { - return removeStringWithLocale(thing, property, value.value, value.language); - } - const predicateIri = internal_toIriString(property); - const existingPredicateValues = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {}; - const existingLiterals = (_b = existingPredicateValues.literals) !== null && _b !== void 0 ? _b : {}; - const existingValuesOfType = (_c = existingLiterals[typeIri]) !== null && _c !== void 0 ? _c : []; - const updatedValues = freeze(existingValuesOfType.filter((existingValue) => existingValue !== value.value)); - const updatedLiterals = freeze({ - ...existingLiterals, - [typeIri]: updatedValues, - }); - const updatedPredicate = freeze({ - ...existingPredicateValues, - literals: updatedLiterals, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - const updatedThing = freeze({ - ...thing, - predicates: updatedPredicates, - }); - return updatedThing; -} -/** - * @param thing Thing to remove a Literal value from. - * @param property Property for which to remove the given Literal value. - * @param type Data type that the Literal should be stored as. - * @param matcher Function that returns true if the given value is an equivalent serialisation of the value to remove. For example, when removing a `false` boolean, the matcher should return true for both "0" and "false". - */ -function removeLiteralMatching(thing, property, type, matcher) { - var _a, _b, _c; - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - const predicateIri = internal_toIriString(property); - const existingPredicateValues = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {}; - const existingLiterals = (_b = existingPredicateValues.literals) !== null && _b !== void 0 ? _b : {}; - const existingValuesOfType = (_c = existingLiterals[type]) !== null && _c !== void 0 ? _c : []; - const updatedValues = freeze(existingValuesOfType.filter((existingValue) => !matcher(existingValue))); - const updatedLiterals = freeze({ - ...existingLiterals, - [type]: updatedValues, - }); - const updatedPredicate = freeze({ - ...existingPredicateValues, - literals: updatedLiterals, - }); - const updatedPredicates = freeze({ - ...thing.predicates, - [predicateIri]: updatedPredicate, - }); - const updatedThing = freeze({ - ...thing, - predicates: updatedPredicates, - }); - return updatedThing; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Create a new Thing with existing values replaced by the given URL for the given Property. - * - * To preserve existing values, see [[addUrl]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set a URL value on. - * @param property Property for which to set the given URL value. - * @param url URL to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -const setUrl = (thing, property, url) => { - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - if (!isThing(url) && !internal_isValidUrl(url)) { - throw new ValidValueUrlExpectedError(url); - } - return addUrl(removeAll(thing, property), property, url); -}; -/** @hidden Alias of [[setUrl]] for those who prefer IRI terminology. */ -const setIri = setUrl; -/** - * Create a new Thing with existing values replaced by the given boolean for the given Property. - * - * To preserve existing values, see [[addBoolean]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set a boolean value on. - * @param property Property for which to set the given boolean value. - * @param value Boolean to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -const setBoolean = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addBoolean(removeAll(thing, property), property, value); -}; -/** - * Create a new Thing with existing values replaced by the given datetime for the given Property. - * - * To preserve existing values, see [[addDatetime]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set an datetime value on. - * @param property Property for which to set the given datetime value. - * @param value Datetime to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -const setDatetime = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addDatetime(removeAll(thing, property), property, value); -}; -/** - * Create a new Thing with existing values replaced by the given date for the given Property. - * - * To preserve existing values, see [[addDate]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set an date value on. - * @param property Property for which to set the given date value. - * @param value Date to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - * @since 1.10.0 - */ -const setDate = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addDate(removeAll(thing, property), property, value); -}; -/** - * Create a new Thing with existing values replaced by the given time for the given Property. - * - * To preserve existing values, see [[addTime]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set an time value on. - * @param property Property for which to set the given time value. - * @param value time to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - * @since 1.10.0 - */ -const setTime = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addTime(removeAll(thing, property), property, value); -}; -/** - * Create a new Thing with existing values replaced by the given decimal for the given Property. - * - * To preserve existing values, see [[addDecimal]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set a decimal value on. - * @param property Property for which to set the given decimal value. - * @param value Decimal to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -const setDecimal = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addDecimal(removeAll(thing, property), property, value); -}; -/** - * Create a new Thing with existing values replaced by the given integer for the given Property. - * - * To preserve existing values, see [[addInteger]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set an integer value on. - * @param property Property for which to set the given integer value. - * @param value Integer to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -const setInteger = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addInteger(removeAll(thing, property), property, value); -}; -/** - * Create a new Thing with existing values replaced by the given localised string for the given Property. - * - * To preserve existing values, see [[addStringWithLocale]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set a localised string value on. - * @param property Property for which to set the given localised string value. - * @param value Localised string to set on `thing` for the given `property`. - * @param locale Locale of the added string. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -function setStringWithLocale(thing, property, value, locale) { - internal_throwIfNotThing(thing); - return addStringWithLocale(removeAll(thing, property), property, value, locale); -} -/** - * Create a new Thing with existing values replaced by the given unlocalised string for the given Property. - * - * To preserve existing values, see [[addStringNoLocale]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @param thing Thing to set an unlocalised string value on. - * @param property Property for which to set the given unlocalised string value. - * @param value Unlocalised string to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -const setStringNoLocale = (thing, property, value) => { - internal_throwIfNotThing(thing); - return addStringNoLocale(removeAll(thing, property), property, value); -}; -/** - * Create a new Thing with existing values replaced by the given Named Node for the given Property. - * - * This replaces existing values for the given Property. To preserve them, see [[addNamedNode]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @ignore This should not be needed due to the other set*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing The [[Thing]] to set a NamedNode on. - * @param property Property for which to set the value. - * @param value The NamedNode to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -function setNamedNode(thing, property, value) { - internal_throwIfNotThing(thing); - return addNamedNode(removeAll(thing, property), property, value); -} -/** - * Create a new Thing with existing values replaced by the given Literal for the given Property. - * - * This replaces existing values for the given Property. To preserve them, see [[addLiteral]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @ignore This should not be needed due to the other set*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing The [[Thing]] to set a Literal on. - * @param property Property for which to set the value. - * @param value The Literal to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - */ -function setLiteral(thing, property, value) { - internal_throwIfNotThing(thing); - return addLiteral(removeAll(thing, property), property, value); -} -/** - * Creates a new Thing with existing values replaced by the given Term for the given Property. - * - * This replaces existing values for the given Property. To preserve them, see [[addTerm]]. - * - * The original `thing` is not modified; this function returns a cloned Thing with updated values. - * - * @ignore This should not be needed due to the other set*() functions. If you do find yourself needing it, please file a feature request for your use case. - * @param thing The [[Thing]] to set a Term on. - * @param property Property for which to set the value. - * @param value The raw RDF/JS value to set on `thing` for the given `property`. - * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property. - * @since 0.3.0 - */ -function setTerm(thing, property, value) { - internal_throwIfNotThing(thing); - if (!internal_isValidUrl(property)) { - throw new ValidPropertyUrlExpectedError(property); - } - return addTerm(removeAll(thing, property), property, value); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Create or modify a [[Thing]], setting multiple properties in a single expresssion. - * - * For example, you can create a new Thing and initialise several properties as follows: - * - * const me = buildThing() - * .addUrl(rdf.type, schema.Person) - * .addStringNoLocale(schema.givenName, "Vincent") - * .build(); - * - * Take note of the final call to `.build()` to obtain the actual Thing. - * - * @param init Optionally pass an existing [[Thing]] to modify the properties of. If left empty, `buildThing` will initialise a new Thing. - * @returns a [[ThingBuilder]], a Fluent API that allows you to set multiple properties in a single expression. - * @since 1.9.0 - */ -function buildThing(init = createThing()) { - let thing = isThing(init) ? init : createThing(init); - function getAdder(adder) { - return (property, value) => { - thing = adder(thing, property, value); - return builder; - }; - } - function getSetter(setter) { - return (property, value) => { - thing = setter(thing, property, value); - return builder; - }; - } - function getRemover(remover) { - return (property, value) => { - thing = remover(thing, property, value); - return builder; - }; - } - const builder = { - build: () => thing, - addUrl: getAdder(addUrl), - addIri: getAdder(addIri), - addBoolean: getAdder(addBoolean), - addDatetime: getAdder(addDatetime), - addDate: getAdder(addDate), - addTime: getAdder(addTime), - addDecimal: getAdder(addDecimal), - addInteger: getAdder(addInteger), - addStringNoLocale: getAdder(addStringNoLocale), - addStringEnglish: (property, value) => { - thing = addStringWithLocale(thing, property, value, "en"); - return builder; - }, - addStringWithLocale: (property, value, locale) => { - thing = addStringWithLocale(thing, property, value, locale); - return builder; - }, - addNamedNode: getAdder(addNamedNode), - addLiteral: getAdder(addLiteral), - addTerm: getAdder(addTerm), - setUrl: getSetter(setUrl), - setIri: getSetter(setIri), - setBoolean: getSetter(setBoolean), - setDatetime: getSetter(setDatetime), - setDate: getSetter(setDate), - setTime: getSetter(setTime), - setDecimal: getSetter(setDecimal), - setInteger: getSetter(setInteger), - setStringNoLocale: getSetter(setStringNoLocale), - setStringEnglish: (property, value) => { - thing = setStringWithLocale(thing, property, value, "en"); - return builder; - }, - setStringWithLocale: (property, value, locale) => { - thing = setStringWithLocale(thing, property, value, locale); - return builder; - }, - setNamedNode: getSetter(setNamedNode), - setLiteral: getSetter(setLiteral), - setTerm: getSetter(setTerm), - removeAll: (property) => { - thing = removeAll(thing, property); - return builder; - }, - removeUrl: getRemover(removeUrl), - removeIri: getRemover(removeIri), - removeBoolean: getRemover(removeBoolean), - removeDatetime: getRemover(removeDatetime), - removeDate: getRemover(removeDate), - removeTime: getRemover(removeTime), - removeDecimal: getRemover(removeDecimal), - removeInteger: getRemover(removeInteger), - removeStringNoLocale: getRemover(removeStringNoLocale), - removeStringEnglish: (property, value) => buildThing(removeStringWithLocale(thing, property, value, "en")), - removeStringWithLocale: (property, value, locale) => buildThing(removeStringWithLocale(thing, property, value, locale)), - removeNamedNode: getRemover(removeNamedNode), - removeLiteral: getRemover(removeLiteral), - }; - return builder; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Function for use in unit tests to mock a [[Thing]] with a given URL. - * - * Warning: do not use this function in actual production code. - * This function initialises a new empty Thing and sets its URL to a given URL. - * This is useful to mock a Thing in tests of code that call e.g. - * [[asUrl]]. - * - * @param url The URL that the mocked Thing pretends identifies it. - * @returns A new Thing, pretending to be identified by the given URL. - * @since 0.2.0 - */ -function mockThingFrom(url) { - const iri = internal_toIriString(url); - const thing = { - type: "Subject", - predicates: {}, - url: iri, - }; - return thing; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @param linkedAccessResource A Resource exposed via the Link header of another Resource with rel="acl". - * @returns Whether that Resource is an ACP ACR or not (in which case it's likely a WAC ACL). - */ -function isAcr(linkedAccessResource) { - const relTypeLinks = getLinkedResourceUrlAll(linkedAccessResource).type; - return (Array.isArray(relTypeLinks) && - relTypeLinks.includes(acp.AccessControlResource)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * This (currently internal) function fetches the ACL indicated in the [[WithServerResourceInfo]] - * attached to a resource. - * - * @internal - * @param resourceInfo The Resource info with the ACL URL - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters). - */ -async function internal_fetchAcl(resourceInfo, options = internal_defaultFetchOptions) { - if (!hasAccessibleAcl(resourceInfo)) { - return { - resourceAcl: null, - fallbackAcl: null, - }; - } - try { - const resourceAcl = await internal_fetchResourceAcl(resourceInfo, options); - const acl = resourceAcl === null - ? { - resourceAcl: null, - fallbackAcl: await internal_fetchFallbackAcl(resourceInfo, options), - } - : { resourceAcl, fallbackAcl: null }; - return acl; - } - catch (e) { - /* istanbul ignore else: fetchResourceAcl swallows all non-AclIsAcrErrors */ - if (e instanceof AclIsAcrError) { - return { - resourceAcl: null, - fallbackAcl: null, - }; - } - /* istanbul ignore next: fetchResourceAcl swallows all non-AclIsAcrErrors */ - throw e; - } -} -/** @internal */ -async function internal_fetchResourceAcl(dataset, options = internal_defaultFetchOptions) { - if (!hasAccessibleAcl(dataset)) { - return null; - } - try { - const aclSolidDataset = await getSolidDataset(dataset.internal_resourceInfo.aclUrl, options); - if (isAcr(aclSolidDataset)) { - throw new AclIsAcrError(dataset, aclSolidDataset); - } - return freeze({ - ...aclSolidDataset, - internal_accessTo: getSourceUrl(dataset), - }); - } - catch (e) { - if (e instanceof AclIsAcrError) { - throw e; - } - // Since a Solid server adds a `Link` header to an ACL even if that ACL does not exist, - // failure to fetch the ACL is expected to happen - we just return `null` and let callers deal - // with it. - return null; - } -} -/** @internal */ -async function internal_fetchFallbackAcl(resource, options = internal_defaultFetchOptions) { - const resourceUrl = new URL(getSourceUrl(resource)); - const resourcePath = resourceUrl.pathname; - // Note: we're currently assuming that the Origin is the root of the Pod. However, it is not yet - // set in stone that that will always be the case. We might need to check the Container's - // metadata at some point in time to check whether it is actually the root of the Pod. - // See: https://github.com/solid/specification/issues/153#issuecomment-624630022 - if (resourcePath === "/") { - // We're already at the root, so there's no Container we can retrieve: - return null; - } - const containerPath = internal_getContainerPath(resourcePath); - const containerIri = new URL(containerPath, resourceUrl.origin).href; - const containerInfo = await getResourceInfo(containerIri, options); - if (!hasAccessibleAcl(containerInfo)) { - // If the current user does not have access to this Container's ACL, - // we cannot determine whether its ACL is the one that applies. Thus, return null: - return null; - } - const containerAcl = await internal_fetchResourceAcl(containerInfo, options); - if (containerAcl === null) { - return internal_fetchFallbackAcl(containerInfo, options); - } - return containerAcl; -} -/** - * Given the path to a Resource, get the URL of the Container one level up in the hierarchy. - * @param resourcePath The path of the Resource of which we need to determine the Container's path. - * @hidden For internal use only. - */ -function internal_getContainerPath(resourcePath) { - const resourcePathWithoutTrailingSlash = resourcePath.substring(resourcePath.length - 1) === "/" - ? resourcePath.substring(0, resourcePath.length - 1) - : resourcePath; - const containerPath = `${resourcePath.substring(0, resourcePathWithoutTrailingSlash.lastIndexOf("/"))}/`; - return containerPath; -} -/** @internal */ -function internal_getAclRules(aclDataset) { - const things = getThingAll(aclDataset); - return things.filter(isAclRule); -} -function isAclRule(thing) { - return getIriAll(thing, rdf.type).includes(acl.Authorization); -} -/** @internal */ -function internal_getResourceAclRulesForResource(aclRules, resource) { - return aclRules.filter((rule) => appliesToResource(rule, resource)); -} -function appliesToResource(aclRule, resource) { - return getIriAll(aclRule, acl.accessTo).includes(resource); -} -/** @internal */ -function internal_getDefaultAclRulesForResource(aclRules, resource) { - return aclRules.filter((rule) => isDefaultForResource(rule, resource)); -} -function isDefaultForResource(aclRule, resource) { - return (getIriAll(aclRule, acl.default).includes(resource) || - getIriAll(aclRule, acl.defaultForNew).includes(resource)); -} -/** @internal */ -function internal_getAccess(rule) { - const ruleAccessModes = getIriAll(rule, acl.mode); - const writeAccess = ruleAccessModes.includes(internal_accessModeIriStrings.write); - return writeAccess - ? { - read: ruleAccessModes.includes(internal_accessModeIriStrings.read), - append: true, - write: true, - control: ruleAccessModes.includes(internal_accessModeIriStrings.control), - } - : { - read: ruleAccessModes.includes(internal_accessModeIriStrings.read), - append: ruleAccessModes.includes(internal_accessModeIriStrings.append), - write: false, - control: ruleAccessModes.includes(internal_accessModeIriStrings.control), - }; -} -/** @internal */ -function internal_combineAccessModes(modes) { - return modes.reduce((accumulator, current) => { - const writeAccess = accumulator.write || current.write; - return writeAccess - ? { - read: accumulator.read || current.read, - append: true, - write: true, - control: accumulator.control || current.control, - } - : { - read: accumulator.read || current.read, - append: accumulator.append || current.append, - write: false, - control: accumulator.control || current.control, - }; - }, { read: false, append: false, write: false, control: false }); -} -/** @internal */ -function internal_removeEmptyAclRules(aclDataset) { - const aclRules = internal_getAclRules(aclDataset); - const aclRulesToRemove = aclRules.filter(isEmptyAclRule); - // Is this too clever? It iterates over aclRulesToRemove, one by one removing them from aclDataset. - const updatedAclDataset = aclRulesToRemove.reduce(removeThing, aclDataset); - return updatedAclDataset; -} -function isEmptyAclRule(aclRule) { - // If there are Quads in there unrelated to Access Control, - // this is not an empty ACL rule that can be deleted: - if (subjectToRdfJsQuads(aclRule.predicates, DataFactory.namedNode(aclRule.url), DataFactory.defaultGraph()).some((quad) => !isAclQuad(quad))) { - return false; - } - // If the rule does not apply to any Resource, it is no longer working: - if (getIri(aclRule, acl.accessTo) === null && - getIri(aclRule, acl.default) === null && - getIri(aclRule, acl.defaultForNew) === null) { - return true; - } - // If the rule does not specify Access Modes, it is no longer working: - if (getIri(aclRule, acl.mode) === null) { - return true; - } - // If the rule does not specify whom it applies to, it is no longer working: - if (getIri(aclRule, acl.agent) === null && - getIri(aclRule, acl.agentGroup) === null && - getIri(aclRule, acl.agentClass) === null) { - return true; - } - return false; -} -function isAclQuad(quad) { - const { predicate } = quad; - const { object } = quad; - if (predicate.equals(DataFactory.namedNode(rdf.type)) && - object.equals(DataFactory.namedNode(acl.Authorization))) { - return true; - } - if (predicate.equals(DataFactory.namedNode(acl.accessTo)) || - predicate.equals(DataFactory.namedNode(acl.default)) || - predicate.equals(DataFactory.namedNode(acl.defaultForNew))) { - return true; - } - if (predicate.equals(DataFactory.namedNode(acl.mode)) && - Object.values(internal_accessModeIriStrings).some((mode) => object.equals(DataFactory.namedNode(mode)))) { - return true; - } - if (predicate.equals(DataFactory.namedNode(acl.agent)) || - predicate.equals(DataFactory.namedNode(acl.agentGroup)) || - predicate.equals(DataFactory.namedNode(acl.agentClass))) { - return true; - } - if (predicate.equals(DataFactory.namedNode(acl.origin))) { - return true; - } - return false; -} -/** - * IRIs of potential Access Modes - * @internal - */ -const internal_accessModeIriStrings = { - read: "http://www.w3.org/ns/auth/acl#Read", - append: "http://www.w3.org/ns/auth/acl#Append", - write: "http://www.w3.org/ns/auth/acl#Write", - control: "http://www.w3.org/ns/auth/acl#Control", -}; -/** @internal - * This function finds, among a set of ACL rules, the ones granting access to a given entity (the target) - * and identifying it with a specific property (`acl:agent` or `acl:agentGroup`). - * @param aclRules The set of rules to filter - * @param targetIri The IRI of the target - * @param targetType The property linking the rule to the target - */ -function internal_getAclRulesForIri(aclRules, targetIri, targetType) { - return aclRules.filter((rule) => getIriAll(rule, targetType).includes(targetIri)); -} -/** @internal - * This function transforms a given set of rules into a map associating the IRIs - * of the entities to which permissions are granted by these rules, and the permissions - * granted to them. Additionally, it filters these entities based on the predicate - * that refers to them in the rule. - */ -function internal_getAccessByIri(aclRules, targetType) { - const targetIriAccess = {}; - aclRules.forEach((rule) => { - const ruleTargetIri = getIriAll(rule, targetType); - const access = internal_getAccess(rule); - // A rule might apply to multiple agents. If multiple rules apply to the same agent, the Access - // Modes granted by those rules should be combined: - ruleTargetIri.forEach((targetIri) => { - targetIriAccess[targetIri] = - typeof targetIriAccess[targetIri] === "undefined" - ? access - : internal_combineAccessModes([targetIriAccess[targetIri], access]); - }); - }); - return targetIriAccess; -} -/** - * Initialises a new ACL Rule that grants some access - but does not yet specify to whom. - * - * @hidden This is an internal utility function that should not be used directly by downstreams. - * @param access Access mode that this Rule will grant - */ -function internal_initialiseAclRule(access) { - let newRule = createThing(); - newRule = setIri(newRule, rdf.type, acl.Authorization); - if (access.read) { - newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.read); - } - if (access.append && !access.write) { - newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.append); - } - if (access.write) { - newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.write); - } - if (access.control) { - newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.control); - } - return newRule; -} -/** - * Creates a new ACL Rule with the same ACL values as the input ACL Rule, but having a different IRI. - * - * Note that non-ACL values will not be copied over. - * - * @hidden This is an internal utility function that should not be used directly by downstreams. - * @param sourceRule ACL rule to duplicate. - */ -function internal_duplicateAclRule(sourceRule) { - let targetRule = createThing(); - targetRule = setIri(targetRule, rdf.type, acl.Authorization); - function copyIris(inputRule, outputRule, predicate) { - return getIriAll(inputRule, predicate).reduce((outputRule, iriTarget) => addIri(outputRule, predicate, iriTarget), outputRule); - } - targetRule = copyIris(sourceRule, targetRule, acl.accessTo); - targetRule = copyIris(sourceRule, targetRule, acl.default); - targetRule = copyIris(sourceRule, targetRule, acl.defaultForNew); - targetRule = copyIris(sourceRule, targetRule, acl.agent); - targetRule = copyIris(sourceRule, targetRule, acl.agentGroup); - targetRule = copyIris(sourceRule, targetRule, acl.agentClass); - targetRule = copyIris(sourceRule, targetRule, acl.origin); - targetRule = copyIris(sourceRule, targetRule, acl.mode); - return targetRule; -} -function internal_setAcl(resource, acl) { - return Object.assign(internal_cloneResource(resource), { internal_acl: acl }); -} -const supportedActorPredicates = [ - acl.agent, - acl.agentClass, - acl.agentGroup, - acl.origin, -]; -/** - * Given an ACL Rule, returns two new ACL Rules that cover all the input Rule's use cases, - * except for giving the given Actor access to the given Resource. - * - * @param rule The ACL Rule that should no longer apply for a given Actor to a given Resource. - * @param actor The Actor that should be removed from the Rule for the given Resource. - * @param resourceIri The Resource to which the Rule should no longer apply for the given Actor. - * @returns A tuple with the original ACL Rule without the given Actor, and a new ACL Rule for the given Actor for the remaining Resources, respectively. - */ -function internal_removeActorFromRule(rule, actor, actorPredicate, resourceIri, ruleType) { - // If the existing Rule does not apply to the given Actor, we don't need to split up. - // Without this check, we'd be creating a new rule for the given Actor (ruleForOtherTargets) - // that would give it access it does not currently have: - if (!getIriAll(rule, actorPredicate).includes(actor)) { - const emptyRule = internal_initialiseAclRule({ - read: false, - append: false, - write: false, - control: false, - }); - return [rule, emptyRule]; - } - // The existing rule will keep applying to Actors other than the given one: - const ruleWithoutActor = removeIri(rule, actorPredicate, actor); - // The actor might have been given other access in the existing rule, so duplicate it... - let ruleForOtherTargets = internal_duplicateAclRule(rule); - // ...but remove access to the original Resource... - ruleForOtherTargets = removeIri(ruleForOtherTargets, ruleType === "resource" ? acl.accessTo : acl.default, resourceIri); - // Prevents the legacy predicate 'acl:defaultForNew' to lead to privilege escalation - if (ruleType === "default") { - ruleForOtherTargets = removeIri(ruleForOtherTargets, acl.defaultForNew, resourceIri); - } - // ...and only apply the new Rule to the given Actor (because the existing Rule covers the others): - ruleForOtherTargets = setIri(ruleForOtherTargets, actorPredicate, actor); - supportedActorPredicates - .filter((predicate) => predicate !== actorPredicate) - .forEach((predicate) => { - ruleForOtherTargets = removeAll(ruleForOtherTargets, predicate); - }); - return [ruleWithoutActor, ruleForOtherTargets]; -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * Modifies the resource ACL (Access Control List) to set the Access Modes for the given Agent. - * Specifically, the function returns a new resource ACL initialised with the given ACL and - * new rules for the Actor's access. - * - * If rules for Actor's access already exist in the given ACL, in the returned ACL, - * they are replaced by the new rules. - * - * This function does not modify: - * - * - Access Modes granted indirectly to Actors through other ACL rules, e.g., public or group-specific permissions. - * - Access Modes granted to Actors for the child Resources if the associated Resource is a Container. - * - The original ACL. - * - * @param aclDataset The SolidDataset that contains Access-Control List rules. - * @param actor The Actor to grant specific Access Modes. - * @param access The Access Modes to grant to the Actor for the Resource. - * @returns A new resource ACL initialised with the given `aclDataset` and `access` for the `agent`. - */ -function internal_setActorAccess$2(aclDataset, access, actorPredicate, accessType, actor) { - // First make sure that none of the pre-existing rules in the given ACL SolidDataset - // give the Agent access to the Resource: - let filteredAcl = aclDataset; - getThingAll(aclDataset).forEach((aclRule) => { - // Obtain both the Rule that no longer includes the given Actor, - // and a new Rule that includes all ACL Quads - // that do not pertain to the given Actor-Resource combination. - // Note that usually, the latter will no longer include any meaningful statements; - // we'll clean them up afterwards. - const [filteredRule, remainingRule] = internal_removeActorFromRule(aclRule, actor, actorPredicate, aclDataset.internal_accessTo, accessType); - filteredAcl = setThing(filteredAcl, filteredRule); - filteredAcl = setThing(filteredAcl, remainingRule); - }); - // Create a new Rule that only grants the given Actor the given Access Modes: - let newRule = internal_initialiseAclRule(access); - newRule = setIri(newRule, accessType === "resource" ? acl.accessTo : acl.default, aclDataset.internal_accessTo); - newRule = setIri(newRule, actorPredicate, actor); - const updatedAcl = setThing(filteredAcl, newRule); - // Remove any remaining Rules that do not contain any meaningful statements: - return internal_removeEmptyAclRules(updatedAcl); -} -function internal_setResourceAcl(resource, acl) { - const newAcl = { - resourceAcl: acl, - fallbackAcl: null, - }; - return internal_setAcl(resource, newAcl); -} -function internal_getResourceAcl(resource) { - return resource.internal_acl.resourceAcl; -} -/** - * This error indicates that, if we're following a Link with rel="acl", - * it does not result in a WAC ACL, but in an ACP ACR. - */ -class AclIsAcrError extends Error { - constructor(sourceResource, aclResource) { - super(`[${getSourceIri(sourceResource)}] is governed by Access Control Policies in [${getSourceIri(aclResource)}] rather than by Web Access Control.`); - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Verify whether a given SolidDataset was fetched together with its Access Control List. - * - * @param dataset A [[SolidDataset]] that may have its ACLs attached. - * @returns True if `dataset` was fetched together with its ACLs. - */ -function hasAcl(dataset) { - const potentialAcl = dataset; - return typeof potentialAcl.internal_acl === "object"; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Verifies whether the given Resource has a resource ACL (Access Control List) attached. - * - * The [[hasResourceAcl]] function checks that: - * - a given Resource has a resource ACL attached, and - * - the user calling [[hasResourceAcl]] has Control access to the Resource. - * - * To retrieve a Resource with its ACLs, see [[getSolidDatasetWithAcl]]. - * - * @param resource A Resource that might have an ACL attached. - * @returns `true` if the Resource has a resource ACL attached that is accessible by the user. - */ -function hasResourceAcl(resource) { - return (resource.internal_acl.resourceAcl !== null && - getSourceUrl(resource) === - resource.internal_acl.resourceAcl.internal_accessTo && - resource.internal_resourceInfo.aclUrl === - getSourceUrl(resource.internal_acl.resourceAcl)); -} -/** - * Experimental: fetch a SolidDataset and its associated Access Control List. - * - * This is an experimental function that fetches both a Resource, the linked ACL Resource (if - * available), and the ACL that applies to it if the linked ACL Resource is not available. This can - * result in many HTTP requests being executed, in lieu of the Solid spec mandating servers to - * provide this info in a single request. Therefore, and because this function is still - * experimental, prefer [[getSolidDataset]] instead. - * - * If the Resource does not advertise the ACL Resource (because the authenticated user does not have - * access to it), the `acl` property in the returned value will be null. `acl.resourceAcl` will be - * undefined if the Resource's linked ACL Resource could not be fetched (because it does not exist), - * and `acl.fallbackAcl` will be null if the applicable Container's ACL is not accessible to the - * authenticated user. - * - * @param url URL of the SolidDataset to fetch. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A SolidDataset and the ACLs that apply to it, if available to the authenticated user. - */ -async function getSolidDatasetWithAcl(url, options = internal_defaultFetchOptions) { - const solidDataset = await getSolidDataset(url, options); - const acl = await internal_fetchAcl(solidDataset, options); - return internal_setAcl(solidDataset, acl); -} -/** - * ```{note} This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Retrieves a file, its resource ACL (Access Control List) if available, - * and its fallback ACL from a URL and returns them as a blob. - * - * If the user calling the function does not have access to the file's resource ACL, - * [[hasAccessibleAcl]] on the returned blob returns false. - * If the user has access to the file's resource ACL but the resource ACL does not exist, - * [[getResourceAcl]] on the returned blob returns null. - * If the fallback ACL is inaccessible by the user, - * [[getFallbackAcl]] on the returned blob returns null. - * - * ```{tip} - * To retrieve the ACLs, the function results in multiple HTTP requests rather than a single - * request as mandated by the Solid spec. As such, prefer [[getFile]] instead if you do not need the ACL. - * ``` - * - * @param url The URL of the fetched file - * @param options Fetching options: a custom fetcher and/or headers. - * @returns A file and its ACLs, if available to the authenticated user, as a blob. - * @since 0.2.0 - */ -async function getFileWithAcl(input, options = internal_defaultFetchOptions) { - const file = await getFile(input, options); - const acl = await internal_fetchAcl(file, options); - return internal_setAcl(file, acl); -} -/** - * Experimental: fetch a Resource's metadata and its associated Access Control List. - * - * This is an experimental function that fetches both a Resource's metadata, the linked ACL Resource (if - * available), and the ACL that applies to it if the linked ACL Resource is not available (if accessible). This can - * result in many HTTP requests being executed, in lieu of the Solid spec mandating servers to - * provide this info in a single request. - * - * If the Resource's linked ACL Resource could not be fetched (because it does not exist, or because - * the authenticated user does not have access to it), `acl.resourceAcl` will be `null`. If the - * applicable Container's ACL is not accessible to the authenticated user, `acl.fallbackAcl` will be - * `null`. - * - * @param url URL of the SolidDataset to fetch. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A Resource's metadata and the ACLs that apply to the Resource, if available to the authenticated user. - */ -async function getResourceInfoWithAcl(url, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfo(url, options); - const acl = await internal_fetchAcl(resourceInfo, options); - return internal_setAcl(resourceInfo, acl); -} -function getResourceAcl(resource) { - if (!hasResourceAcl(resource)) { - return null; - } - return resource.internal_acl.resourceAcl; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Verifies whether the given Resource has a fallback ACL (Access Control List) attached. - * - * A fallback ACL for a Resource is inherited from the Resource's parent Container - * (or another of its ancestor Containers) and applies if the Resource does - * not have its own resource ACL. - * - * The [[hasFallbackAcl]] function checks that: - * - a given Resource has a fallback ACL attached, and - * - the user calling [[hasFallbackAcl]] has Control access to the Container - * from which the Resource inherits its ACL. - * - * To retrieve a Resource with its ACLs, see [[getSolidDatasetWithAcl]]. - * - * @param resource A [[SolidDataset]] that might have a fallback ACL attached. - * - * @returns `true` if the Resource has a fallback ACL attached that is accessible to the user. - */ -function hasFallbackAcl(resource) { - return resource.internal_acl.fallbackAcl !== null; -} -function getFallbackAcl(dataset) { - if (!hasFallbackAcl(dataset)) { - return null; - } - return dataset.internal_acl.fallbackAcl; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Creates an empty resource ACL (Access Control List) for a given Resource. - * - * @param targetResource A Resource that does not have its own ACL yet (see [[hasResourceAcl]]). - * @returns An empty resource ACL for the given Resource. - */ -function createAcl(targetResource) { - const emptyResourceAcl = freeze({ - ...createSolidDataset(), - internal_accessTo: getSourceUrl(targetResource), - internal_resourceInfo: { - sourceIri: targetResource.internal_resourceInfo.aclUrl, - isRawData: false, - linkedResources: {}, - }, - }); - return emptyResourceAcl; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Creates a resource ACL (Access Control List), initialised from the fallback ACL - * inherited from the given Resource's Container (or another of its ancestor Containers). - * That is, the new ACL has the same rules/entries as the fallback ACL that currently - * applies to the Resource. - * - * @param resource A Resource without its own resource ACL (see [[hasResourceAcl]]) but with an accessible fallback ACL (see [[hasFallbackAcl]]). - * @returns A resource ACL initialised with the rules/entries from the Resource's fallback ACL. - */ -function createAclFromFallbackAcl(resource) { - const emptyResourceAcl = createAcl(resource); - const fallbackAclRules = internal_getAclRules(resource.internal_acl.fallbackAcl); - const defaultAclRules = internal_getDefaultAclRulesForResource(fallbackAclRules, resource.internal_acl.fallbackAcl.internal_accessTo); - const newAclRules = defaultAclRules.map((rule) => { - rule = removeAll(rule, acl.default); - rule = removeAll(rule, acl.defaultForNew); - rule = setIri(rule, acl.accessTo, getSourceUrl(resource)); - rule = setIri(rule, acl.default, getSourceUrl(resource)); - return rule; - }); - // Iterate over every ACL Rule we want to import, inserting them into `emptyResourceAcl` one by one: - const initialisedResourceAcl = newAclRules.reduce(setThing, emptyResourceAcl); - return initialisedResourceAcl; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Saves the resource ACL for a Resource. - * - * @param resource The Resource to which the given resource ACL applies. - * @param resourceAcl An [[AclDataset]] whose ACL Rules will apply to `resource`. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - */ -async function saveAclFor(resource, resourceAcl, options = internal_defaultFetchOptions) { - if (!hasAccessibleAcl(resource)) { - throw new Error(`Could not determine the location of the ACL for the Resource at [${getSourceUrl(resource)}]; possibly the current user does not have Control access to that Resource. Try calling \`hasAccessibleAcl()\` before calling \`saveAclFor()\`.`); - } - const savedDataset = await saveSolidDatasetAt(resource.internal_resourceInfo.aclUrl, resourceAcl, options); - const savedAclDataset = { - ...savedDataset, - internal_accessTo: getSourceUrl(resource), - }; - return savedAclDataset; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes the resource ACL (Access Control List) from a Resource. - * - * Once the resource ACL is removed from the Resource, the Resource relies on the - * fallback ACL inherited from the Resource's parent Container (or another of its ancestor Containers). - * - * @param resource The Resource for which you want to delete the ACL. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - */ -async function deleteAclFor(resource, options = internal_defaultFetchOptions) { - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const response = await config.fetch(resource.internal_resourceInfo.aclUrl, { - method: "DELETE", - }); - if (!response.ok) { - throw new Error(`Deleting the ACL of the Resource at [${getSourceUrl(resource)}] failed: [${response.status}] [${response.statusText}].`); - } - const storedResource = Object.assign(internal_cloneResource(resource), { - acl: { - resourceAcl: null, - }, - }); - return storedResource; -} -/** - * Given a [[SolidDataset]], verify whether its Access Control List is accessible to the current user. - * - * This should generally only be true for SolidDatasets fetched by - * [[getSolidDatasetWithAcl]]. - * - * Please note that the Web Access Control specification is not yet finalised, and hence, this - * function is still experimental and can change in a non-major release. - * - * @param dataset A [[SolidDataset]]. - * @returns Whether the given `dataset` has a an ACL that is accessible to the current user. - */ -function hasAccessibleAcl(dataset) { - return typeof dataset.internal_resourceInfo.aclUrl === "string"; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns an Agent's explicitly-granted Access Modes for the given Resource. - * - * The function does not return Access Modes granted indirectly to the Agent through other - * ACL rules, e.g., public or group-specific permissions. - * - * @param resourceInfo Information about the Resource to which the given Agent may have been granted access. - * @param agent WebID of the Agent for which to retrieve what access it has to the Resource. - * @returns Access Modes that have been explicitly granted to the Agent for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control access to a given Resource or its Container). - */ -function getAgentAccess$5(resourceInfo, agent) { - if (hasResourceAcl(resourceInfo)) { - return getAgentResourceAccess(resourceInfo.internal_acl.resourceAcl, agent); - } - if (hasFallbackAcl(resourceInfo)) { - return getAgentDefaultAccess(resourceInfo.internal_acl.fallbackAcl, agent); - } - return null; -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * Returns all explicitly-granted Access Modes per Agent for the given Resource. - * - * The function does not return Access Modes granted indirectly to Agents through other - * ACL rules, e.g., public or group-specific permissions. - * - * @param resourceInfo Information about the Resource to which Agents may have been granted access. - * @returns Access Modes per Agent that have been explicitly granted for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control access to a given Resource or its Container). - */ -function getAgentAccessAll$5(resourceInfo) { - if (hasResourceAcl(resourceInfo)) { - const resourceAcl = getResourceAcl(resourceInfo); - return getAgentResourceAccessAll(resourceAcl); - } - if (hasFallbackAcl(resourceInfo)) { - const fallbackAcl = getFallbackAcl(resourceInfo); - return getAgentDefaultAccessAll(fallbackAcl); - } - return null; -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the Access Modes explicitly granted to an Agent for the Resource - * associated with an ACL (Access ControlList). - * - * The function does not return: - * - * - Access Modes granted indirectly to the Agent through other ACL rules, e.g., public or group-specific permissions. - * - Access Modes granted to the Agent for the child Resources if the associated Resource is a Container (see [[getAgentDefaultAccess]] instead). - * - * @param aclDataset The SolidDataset that contains ACL rules. - * @param agent WebID of the Agent for which to retrieve what access it has to the Resource. - * @returns Access Modes that have been explicitly granted to an Agent for the Resource associated with an ACL SolidDataset. - */ -function getAgentResourceAccess(aclDataset, agent) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo); - const agentResourceRules = getAgentAclRulesForAgent(resourceRules, agent); - const agentAccessModes = agentResourceRules.map(internal_getAccess); - return internal_combineAccessModes(agentAccessModes); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the explicitly granted Access Modes per Agent for the Resource associated - * with an ACL (Access Control List). - * - * The function does not return: - * - * - Access Modes granted indirectly to Agents through other ACL rules, e.g., public or group-specific permissions. - * - Access Modes granted to Agents for the child Resources if the associated Resource is a Container. - * - * @param aclDataset The SolidDataset that contains ACL rules. - * @returns Access Modes per Agent that have been explicitly granted for the Resource associated with an ACL SolidDataset. - */ -function getAgentResourceAccessAll(aclDataset) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo); - const agentResourceRules = getAgentAclRules(resourceRules); - return getAccessByAgent(agentResourceRules); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * Modifies the resource ACL (Access Control List) to set the Access Modes for the given Agent. - * Specifically, the function returns a new resource ACL initialised with the given ACL and - * new rules for the Agent's access. - * - * If rules for Agent's access already exist in the given ACL, in the returned ACL, - * they are replaced by the new rules. - * - * This function does not modify: - * - * - Access Modes granted indirectly to Agents through other ACL rules, e.g., public or group-specific permissions. - * - Access Modes granted to Agents for the child Resources if the associated Resource is a Container. - * - The original ACL. - * - * @param aclDataset The SolidDataset that contains Access-Control List rules. - * @param agent The Agent to grant specific Access Modes. - * @param access The Access Modes to grant to the Agent for the Resource. - * @returns A new resource ACL initialised with the given `aclDataset` and `access` for the `agent`. - */ -function setAgentResourceAccess$1(aclDataset, agent, access) { - return internal_setActorAccess$2(aclDataset, access, acl.agent, "resource", agent); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns an Agent's Access Modes explicitly granted for the children of the - * Container associated with the given ACL (Access Control List). - * - * The function does not return: - * - Access Modes granted indirectly to the Agent through other ACL rules, e.g. public or group-specific permissions. - * - Access Modes granted to the Agent for the Container Resource itself (see [[getAgentResourceAccess]] instead). - * - * @param aclDataset The SolidDataset that contains Access-Control List rules for a certain Container. - * @param agent WebID of the Agent for which to retrieve what access it has to the Container's children. - * @returns Access Modes that have been explicitly granted to an Agent for the children of the Container associated with the given ACL. - */ -function getAgentDefaultAccess(aclDataset, agent) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo); - const agentResourceRules = getAgentAclRulesForAgent(resourceRules, agent); - const agentAccessModes = agentResourceRules.map(internal_getAccess); - return internal_combineAccessModes(agentAccessModes); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the Access Modes, per Agent, that have been explicitly granted for the children - * of the Container associated with the given ACL (Access Control List). - * - * The function does not return: - * - * - Access Modes granted indirectly to the Agents through other ACL rules, e.g. public or group-specific permissions. - * - Access Modes granted to the Agents for the Container Resource itself (see [[getAgentResourceAccessAll]] instead). - * - * @param aclDataset The SolidDataset that contains Access-Control List rules. - * @returns Access Modes, per Agent, that have been explicitly granted for the children of the Container associated with the given ACL. - */ -function getAgentDefaultAccessAll(aclDataset) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo); - const agentResourceRules = getAgentAclRules(resourceRules); - return getAccessByAgent(agentResourceRules); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Modifies the default ACL (Access Control List) to set an Agent's Access Modes for the Container's children. - * Specifically, the function returns a new default ACL initialised with the given ACL and - * new rules for the Agent's access. - * - * If rules already exist for the Agent in the given ACL, in the returned ACL, they are replaced by the new rules. - * - * This function does not modify: - * - Access Modes granted indirectly to the Agent through other ACL rules, e.g., public or group-specific permissions. - * - Access Modes granted to the Agent for the Container Resource itself. - * - The original ACL. - * - * @param aclDataset The SolidDataset that contains Access-Control List rules. - * @param agent The Agent to grant specific Access Modes. - * @param access The Access Modes to grant to the Agent. - * @returns A new default ACL initialised with the given `aclDataset` and `access` for the `agent`. - */ -function setAgentDefaultAccess(aclDataset, agent, access) { - return internal_setActorAccess$2(aclDataset, access, acl.agent, "default", agent); -} -function getAgentAclRulesForAgent(aclRules, agent) { - return internal_getAclRulesForIri(aclRules, agent, acl.agent); -} -function getAgentAclRules(aclRules) { - return aclRules.filter(isAgentAclRule); -} -function isAgentAclRule(aclRule) { - return getIri(aclRule, acl.agent) !== null; -} -function getAccessByAgent(aclRules) { - return internal_getAccessByIri(aclRules, acl.agent); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} This function is still experimental and subject to change, even in a non-major release. - * ``` - * Returns a Group's explicity-granted Access Modes for a given Resource. - * - * The function does not return Access Modes granted indirectly to the Group through other - * ACL rules, e.g., public permissions. - * - * @param resourceInfo Information about the Resource to which the given Group may have been granted access. - * @param group URL of the Group for which to retrieve what access it has to the Resource. - * @returns Access Modes that have been explicitly granted to the `group` for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control Access to a given Resource or its Container). - */ -function getGroupAccess$2(resourceInfo, group) { - if (hasResourceAcl(resourceInfo)) { - return getGroupResourceAccess(resourceInfo.internal_acl.resourceAcl, group); - } - if (hasFallbackAcl(resourceInfo)) { - return getGroupDefaultAccess(resourceInfo.internal_acl.fallbackAcl, group); - } - return null; -} -/** - * ```{note} This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns all explicitly-granted Access Modes per Group for the given Resource. - * - * The function does not return Access Modes granted indirectly to the Group through other - * ACL rules, e.g., public permissions. - * - * @param resourceInfo Information about the Resource to which the given Group may have been granted access. - * @returns Access Modes per Group that have been explicitly granted for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control Access to a given Resource or its Container). - */ -function getGroupAccessAll$2(resourceInfo) { - if (hasResourceAcl(resourceInfo)) { - const resourceAcl = getResourceAcl(resourceInfo); - return getGroupResourceAccessAll(resourceAcl); - } - if (hasFallbackAcl(resourceInfo)) { - const fallbackAcl = getFallbackAcl(resourceInfo); - return getGroupDefaultAccessAll(fallbackAcl); - } - return null; -} -/** - * ```{note} This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the Access Modes explicitly granted to a Group for the Resource - * associated with an ACL (Access Control List). - * - * The function does not return: - * - Access Modes granted indirectly to the Group through other ACL rules, e.g., public permissions. - * - Access Modes granted to the Group for the child Resources if the associated Resource is a Container - * (see [[getGroupDefaultAccess]] instead). - * - * @param aclDataset The SolidDataset that contains Access Control List rules. - * @param group URL of the Group for which to retrieve what access it has to the Resource. - * @returns Access Modes explicitly granted to a Group for the Resource associated with an ACL. - */ -function getGroupResourceAccess(aclDataset, group) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo); - const groupResourceRules = getGroupAclRuleForGroup(resourceRules, group); - const groupAccessModes = groupResourceRules.map(internal_getAccess); - return internal_combineAccessModes(groupAccessModes); -} -/** - * ```{note} This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the explicitly granted Access Modes per Group for the Resource associated - * with an ACL (Access Control List). - * - * The function does not return: - * - Access Modes granted indirectly to the Group through other ACL rules, e.g., public permissions. - * - Access Modes granted to Groups for the child Resources if the associated Resource is a Container. - * - * @param aclDataset The SolidDataset that contains Access Control List rules. - * @returns Access Modes per Group that have been explicitly granted for the Resource associated with an ACL. - */ -function getGroupResourceAccessAll(aclDataset) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo); - return getAccessByGroup(resourceRules); -} -/** - * ```{note} This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns a Group's Access Modes explicitly granted for the children of the - * Container associated with an ACL (Access ControlList). - * - * The function does not return: - * - Access Modes granted indirectly to the Group through other ACL rules, e.g. public permissions. - * - Access Modes granted to the Group for the Container Resource itself (see [[getGroupResourceAccess]] instead). - * - * @param aclDataset The SolidDataset that contains ACL rules for a certain Container. - * @param group URL of the Group for which to retrieve what access it has to the child Resources of the given Container. - * @returns Access Modes that have been explicitly granted to the Group for the children of the Container associated with the given ACL. - */ -function getGroupDefaultAccess(aclDataset, group) { - const allRules = internal_getAclRules(aclDataset); - const defaultRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo); - const groupDefaultRules = getGroupAclRuleForGroup(defaultRules, group); - const groupAccessModes = groupDefaultRules.map(internal_getAccess); - return internal_combineAccessModes(groupAccessModes); -} -/** - * ```{note} This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the Access Modes, per Group, that have been explicitly granted for the children - * of the Container associated with the given ACL (Access Control List). - * - * The function does not return: - * - Access Modes granted indirectly to the Groups through other ACL rules, e.g. public permissions. - * - Access Modes granted to the Groups for the Container Resource itself (see [[getGroupResourceAccessAll]] instead). - * - * @param aclDataset The SolidDataset that contains Access Control List rules for a certain Container. - * @returns Access Modes per Group that have been explicitly granted for the children of the Container associated with the given ACL SolidDataset. - */ -function getGroupDefaultAccessAll(aclDataset) { - const allRules = internal_getAclRules(aclDataset); - const defaultRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo); - return getAccessByGroup(defaultRules); -} -function getGroupAclRuleForGroup(rules, group) { - return internal_getAclRulesForIri(rules, group, acl.agentGroup); -} -function getAccessByGroup(aclRules) { - return internal_getAccessByIri(aclRules, acl.agentGroup); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * Modifies the resource ACL (Access Control List) to set the Access Modes for the given Group. - * Specifically, the function returns a new resource ACL initialised with the given ACL and - * new rules for the Group's access. - * - * If rules for Groups's access already exist in the given ACL, in the returned ACL, - * they are replaced by the new rules. - * - * This function does not modify: - * - * - Access Modes granted indirectly to Groups through other ACL rules, e.g., public or Agent-specific permissions. - * - Access Modes granted to Groups for the child Resources if the associated Resource is a Container. - * - The original ACL. - * - * @param aclDataset The SolidDataset that contains Access-Control List rules. - * @param group The Group to grant specific Access Modes. - * @param access The Access Modes to grant to the Group for the Resource. - * @returns A new resource ACL initialised with the given `aclDataset` and `access` for the `group`. - * @since 1.4.0 - */ -function setGroupResourceAccess$1(aclDataset, group, access) { - return internal_setActorAccess$2(aclDataset, access, acl.agentGroup, "resource", group); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Modifies the default ACL (Access Control List) to set a Group's Access Modes for the Container's children. - * Specifically, the function returns a new default ACL initialised with the given ACL and - * new rules for the Group's access. - * - * If rules already exist for the Group in the given ACL, in the returned ACL, they are replaced by the new rules. - * - * This function does not modify: - * - Access Modes granted indirectly to the Group through other ACL rules, e.g., public or Agent-specific permissions. - * - Access Modes granted to the Group for the Container Resource itself. - * - The original ACL. - * - * @param aclDataset The SolidDataset that contains Access-Control List rules. - * @param group The Group to grant specific Access Modes. - * @param access The Access Modes to grant to the Group. - * @returns A new default ACL initialised with the given `aclDataset` and `access` for the `group`. - * @since 1.4.0 - */ -function setGroupDefaultAccess(aclDataset, group, access) { - return internal_setActorAccess$2(aclDataset, access, acl.agentGroup, "default", group); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the Access Modes granted to the public in general for a Resource. - * - * This function does not return Access Modes granted to specific Agents - * through other ACL (Access Control List) rules, e.g., agent- or group-specific permissions. - * - * @param resourceInfo Information about the Resource to which the given Agent may have been granted access. - * @returns Access Modes granted to the public in general for the Resource, or `null` if it could not be determined (e.g. because the current user does not have Control Access to a given Resource or its Container). - */ -function getPublicAccess$5(resourceInfo) { - if (hasResourceAcl(resourceInfo)) { - return getPublicResourceAccess(resourceInfo.internal_acl.resourceAcl); - } - if (hasFallbackAcl(resourceInfo)) { - return getPublicDefaultAccess(resourceInfo.internal_acl.fallbackAcl); - } - return null; -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the Access Modes granted to the public in general for the Resource - * associated with an ACL (Access Control List). - * - * This function does not return: - * - Access Modes granted to specific Agents through other ACL rules, e.g., agent- or group-specific permissions. - * - Access Modes to child Resources if the associated Resource is a Container (see [[getPublicDefaultAccess]] instead). - * - * @param aclDataset The SolidDataset that contains Access Control List rules. - * @returns Access Modes granted to the public in general for the Resource associated with the `aclDataset`. - */ -function getPublicResourceAccess(aclDataset) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo); - const publicResourceRules = getClassAclRulesForClass(resourceRules, foaf.Agent); - const publicAccessModes = publicResourceRules.map(internal_getAccess); - return internal_combineAccessModes(publicAccessModes); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Returns the Access Modes granted to the public in general for the child Resources - * of the Container associated with an ACL (Access Control List). - * - * This function does not return: - * - Access Modes granted to Agents through other ACL rules, e.g., agent- or group-specific permissions. - * - Access Modes to the Container Resource itself (see [[getPublicResourceAccess]] instead). - * - * @param aclDataset The SolidDataset that contains Access Control List rules for a certain Container. - * @returns Access Modes granted to the public in general for the children of the Container associated with the given `aclDataset`. - */ -function getPublicDefaultAccess(aclDataset) { - const allRules = internal_getAclRules(aclDataset); - const resourceRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo); - const publicResourceRules = getClassAclRulesForClass(resourceRules, foaf.Agent); - const publicAccessModes = publicResourceRules.map(internal_getAccess); - return internal_combineAccessModes(publicAccessModes); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Modifies the resource ACL (Access Control List) to set the Access Modes for the public. - * Specifically, the function returns a new resource ACL (Access Control List) initialised - * with the given resource ACL and new rules for the given public access. - * - * If rules for public access already exist in the given ACL, in the *returned* ACL, - * they are replaced by the new rules. - * - * This function does not modify: - * - Access Modes granted to Agents through other ACL rules, e.g., agent- or group-specific permissions. - * - Access Modes to child Resources if the associated Resource is a Container. - * - The original ACL. - * - * @param aclDataset The SolidDataset that contains Access Control List rules. - * @param access The Access Modes to grant to the public. - * @returns A new resource ACL initialised with the given `aclDataset` and public `access`. - */ -function setPublicResourceAccess$1(aclDataset, access) { - return internal_setActorAccess$2(aclDataset, access, acl.agentClass, "resource", foaf.Agent); -} -/** - * ```{note} - * This function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Modifies the default ACL (Access Control List) to set the public's default Access Modes - * to child resources. Specifically, the function returns a new default ACL initialised - * with the given default ACL and new rules for the given public access. - * - * If rules for public access already exist in the given ACL, in the *returned* ACL, - * they are replaced by the new rules. - * - * This function does not modify: - * - Access Modes granted to Agents through other ACL rules, e.g., agent- or group-specific permissions. - * - Access Modes to Container Resource itself. - * - The original ACL. - * - * @param aclDataset The SolidDataset that contains Access Control List rules. - * @param access The Access Modes to grant to the public. - * @returns A new default ACL initialised with the given `aclDataset` and public `access`. - */ -function setPublicDefaultAccess(aclDataset, access) { - return internal_setActorAccess$2(aclDataset, access, acl.agentClass, "default", foaf.Agent); -} -function getClassAclRulesForClass(aclRules, agentClass) { - return aclRules.filter((rule) => appliesToClass(rule, agentClass)); -} -function appliesToClass(aclRule, agentClass) { - return getIriAll(aclRule, acl.agentClass).includes(agentClass); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function setMockAclUrl(resource, aclUrl) { - const resourceWithAclUrl = Object.assign(internal_cloneResource(resource), { - internal_resourceInfo: { - ...resource.internal_resourceInfo, - aclUrl, - }, - }); - return resourceWithAclUrl; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{warning} - * Do not use this function in production code. For use in **unit tests** that - * require a [[SolidDataset]] with a resource ACL (Access Control List). - * ``` - * - * Initialises a new empty ACL and attaches it to a given [[SolidDataset]] for use - * in **unit tests**; e.g., unit tests that call [[getResourceAcl]]. - * - * @param resource The Resource to mock up with a new resource ACL. - * @returns The input Resource with an empty resource ACL attached. - * @since 0.2.0 - */ -function addMockResourceAclTo(resource) { - var _a; - const aclUrl = (_a = resource.internal_resourceInfo.aclUrl) !== null && _a !== void 0 ? _a : "https://your.pod/mock-acl.ttl"; - const resourceWithAclUrl = Object.assign(internal_cloneResource(resource), { - internal_resourceInfo: { - ...resource.internal_resourceInfo, - aclUrl, - }, - }); - const aclDataset = createAcl(resourceWithAclUrl); - const resourceWithResourceAcl = internal_setAcl(resourceWithAclUrl, { - resourceAcl: aclDataset, - fallbackAcl: null, - }); - return resourceWithResourceAcl; -} -/** - * - * ```{warning} - * Do not use this function in production code. For use in **unit tests** that require a - * [[SolidDataset]] with a fallback ACL (Access Control List). - * ``` - * - * Initialises a new empty fallback ACL and attaches it to a given [[SolidDataset]] for use - * in **unit tests**; e.g., unit tests that call [[getFallbackAcl]]. - * - * @param resource The Resource to mock up with new fallback ACL. - * @returns The input Resource with an empty fallback ACL attached. - * @since 0.2.0 - */ -function addMockFallbackAclTo(resource) { - const containerUrl = internal_getContainerPath(getSourceIri(resource)); - const aclUrl = `${containerUrl}.acl`; - const mockContainer = setMockAclUrl(mockContainerFrom(containerUrl), aclUrl); - const aclDataset = createAcl(mockContainer); - const resourceWithFallbackAcl = internal_setAcl(internal_cloneResource(resource), { - resourceAcl: null, - fallbackAcl: aclDataset, - }); - return resourceWithFallbackAcl; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function getProfileFromProfileDoc(profileDataset, webId) { - const profile = getThing(profileDataset, webId); - if (profile === null) { - throw new Error(`Profile document [${getSourceUrl(profileDataset)}] does not include WebID [${webId}]`); - } - return profile; -} -/** - * Set a JWKS IRI associated with a WebID in a profile document. - * - * @param profileDocument The profile document dataset. - * @param webId The WebID associated with the profile document. - * @param jwksIri The JWKS IRI to be set. - * @returns A modified copy of the profile document, with the JWKS IRI set. - * @since 1.12.0 - */ -function setProfileJwks(profileDocument, webId, jwksIri) { - return setThing(profileDocument, setIri(getProfileFromProfileDoc(profileDocument, webId), security.publicKey, jwksIri)); -} -/** - * Look for a JWKS IRI optionally advertized from a profile document. - * - * @param profileDocument The profile document. - * @param webId The WebID featured in the profile document. - * @returns The JWKS IRI associated with the WebID, if any. - * @since 1.12.0 - */ -function getProfileJwksIri(profileDocument, webId) { - return getUrl(getProfileFromProfileDoc(profileDocument, webId), security.publicKey); -} -const isJwks = (jwksDocument) => { - return typeof jwksDocument.keys !== "undefined"; -}; -/** - * Fetch a JWKS at a given IRI, and add the given JWK to the obtained key set. - * - * @param jwk The JWK to add to the set. - * @param jwksIri The IRI where the key set should be looked up. - * @param options @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns Promise resolving to a JWKS where the given key has been added. - * @since 1.12.0 - */ -async function addJwkToJwks(jwk, jwksIri, options = internal_defaultFetchOptions) { - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const jwksResponse = await config.fetch(jwksIri); - if (!jwksResponse.ok) { - throw new Error(`Fetching [${jwksIri}] returned an error: ${jwksResponse.status} ${jwksResponse.statusText}`); - } - try { - const jwksDocument = await jwksResponse.json(); - if (!isJwks(jwksDocument)) { - throw new Error(`[${jwksIri}] does not dereference to a valid JWKS: ${JSON.stringify(jwksDocument)}`); - } - return { - keys: [...jwksDocument.keys, jwk], - }; - } - catch (e) { - throw new Error(`Parsing the document at [${jwksIri}] failed: ${e}`); - } -} -/** - * Adds a public key to the JWKS listed in the profile associated to the given WebID. - * Retrieves the profile document for the specified WebID and looks up the associated - * JWKS. Having added the given key to the JWKS, this function overwrites the - * previous JWKS so that the new version is saved. This assumes the JWKS is hosted - * at a read-write IRI, such as in a Solid Pod. - * - * @param publicKey The public key value to set. - * @param webId The WebID whose profile document references the key set to which we wish to add the specified public key. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @since 1.12.0 - */ -async function addPublicKeyToProfileJwks(publicKey, webId, options = internal_defaultFetchOptions) { - const profileDataset = await getSolidDataset(webId, { - fetch: options.fetch, - }); - if (profileDataset === null) { - throw new Error(`The profile document associated with WebID [${webId}] could not be retrieved.`); - } - const jwksIri = getProfileJwksIri(profileDataset, webId); - if (jwksIri === null) { - throw new Error(`No key set is declared for the property [${security.publicKey}] in the profile of [${webId}]`); - } - const updatedJwks = await addJwkToJwks(publicKey, jwksIri, options); - return overwriteFile(jwksIri, new Blob([JSON.stringify(updatedJwks)]), { - contentType: "application/json", - fetch: options.fetch, - }); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * List all the alternative profiles IRI found in a given WebID profile. - * - * Note that some of these profiles may be private, and you may not have access to - * the resulting resource. - * - * @param webId The WebID of the user's whose alternative profiles you are discovering. - * @param webIdProfile The WebID profile obtained dereferencing the provided WebID. - * @returns A list of URLs of the user's alternative profiles. - * @since 1.20.0 - */ -function getAltProfileUrlAllFrom(webId, webIdProfile) { - const webIdThing = getThing(webIdProfile, webId); - const altProfileUrlAll = getThingAll(webIdProfile) - .filter((thing) => getIriAll(thing, foaf.primaryTopic).length > 0) - .map(asIri) - .concat(webIdThing ? getIriAll(webIdThing, rdfs.seeAlso) : []) - .concat(webIdThing ? getIriAll(webIdThing, foaf.isPrimaryTopicOf) : []) - .filter((profileIri) => profileIri !== getSourceIri(webIdProfile)); - // Deduplicate the results. - return Array.from(new Set(altProfileUrlAll)); -} -async function getProfileAll(webId, options = internal_defaultFetchOptions) { - var _a, _b; - const authFetch = (_a = options.fetch) !== null && _a !== void 0 ? _a : fetch; - const webIdProfile = (_b = options.webIdProfile) !== null && _b !== void 0 ? _b : (await getSolidDataset(webId, { - // This should always use an unauthenticated fetch. - fetch: fetch, - })); - const altProfileAll = (await Promise.allSettled(getAltProfileUrlAllFrom(webId, webIdProfile).map((uniqueProfileIri) => getSolidDataset(uniqueProfileIri, { fetch: authFetch })))) - // Ignore the alternative profiles lookup which failed. - .filter((result) => result.status === "fulfilled") - .map((successfulResult) => successfulResult.value); - return { - webIdProfile, - altProfileAll, - }; -} -/** - * Discover the Pods an agent advertises for in their profile resources. Both the - * agent's WebID and alternative profiles are fetched. Note that this function will - * only return URLs of Pods linked to using the `pim:storage`, i.e. a triple - * looking like should appear in the profile - * resources. - * - * @param webId The WebID of the agent whose Pods should be discovered - * @param options Optional parameter - * - `options.fetch`: An alternative `fetch` function to make the HTTP request, - * compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns a Promise resolving to an array containing the URLs of all the Pods - * linked from the agent's profile resource using the `pim:storage` predicate. - * @since 1.18.0 - */ -async function getPodUrlAll(webId, options = internal_defaultFetchOptions) { - const profiles = await getProfileAll(webId, options); - return getPodUrlAllFrom(profiles, webId); -} -/** - * Discover the Pods advertised for in the provided profile resources. Note that - * this function will only return URLs of Pods linked to using the `pim:storage` - * predicate, i.e. a triple looking like - * should appear in the profile resources. - * - * @param profiles The profile resources in which the Pods should be discovered - * @param webId The WebID of the agent whose Pods should be discovered - * @returns An array containing the URLs of all the Pods linked from the agent's - * profile resource using the `pim:storage` predicate. - * @since 1.18.0 - */ -function getPodUrlAllFrom(profiles, webId) { - const result = new Set(); - [profiles.webIdProfile, ...profiles.altProfileAll].forEach((profileResource) => { - const webIdThing = getThing(profileResource, webId); - if (webIdThing !== null) { - getIriAll(webIdThing, pim.storage).forEach((podIri) => result.add(podIri)); - } - }); - return Array.from(result); -} -/** - * Get the WebID Profile document dataset. - * - * @example - * ``` - * const webId = "https://example.org/people/me"; - * const profile = await getWebIdDataset(webId); - * const podRoot = getPodUrlAllFrom({ webIdProfile: profile, altProfileAll: [] }, webId); - * const profileThing = getThing(profile, webId); - * const name = getStringNoLocale(profileThing, FOAF.name); - * ``` - * - * @param webId The WebID of the agent whose WebID Profile dataset is to be fetched. - * @returns a SolidDataset for the WebID Profile document. - * @since 1.24.0 - */ -async function getWebIdDataset(webId) { - return getSolidDataset(webId, { fetch: fetch }); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function internal_getAcr(resource) { - if (!hasAccessibleAcr(resource)) { - throw new Error(`An Access Control Resource for [${getSourceUrl(resource)}] is not available. This could be because the current user is not allowed to see it, or because their Pod Server does not support Access Control Resources.`); - } - return resource.internal_acp.acr; -} -/** @hidden */ -function internal_setAcr(resource, acr) { - return Object.assign(internal_cloneResource(resource), { - internal_acp: { - ...resource.internal_acp, - acr, - }, - }); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Initialise a new [[Control]]. - * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly. - * @deprecated - */ -function internal_createControl(options) { - let control = createThing(options); - control = setIri(control, rdf.type, acp.AccessControl); - return control; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Find an [[Control]] with a given URL in a given Resource with an Access Control Resource. - * - * @returns The requested Access Control, or `null` if it could not be found. - * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly. - * @deprecated - */ -function internal_getControl(withAccessControlResource, url, options) { - const acr = internal_getAcr(withAccessControlResource); - const foundThing = getThing(acr, url, options); - if (foundThing === null || - !getIriAll(foundThing, rdf.type).includes(acp.AccessControl)) { - return null; - } - return foundThing; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get all [[Control]]s in the Access Control Resource of a given Resource. - * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly. - * @deprecated - */ -function internal_getControlAll(withAccessControlResource, options) { - const acr = internal_getAcr(withAccessControlResource); - const foundThings = getThingAll(acr, options); - const explicitAccessControl = foundThings.filter((foundThing) => getIriAll(foundThing, rdf.type).includes(acp.AccessControl)); - const implicitAccessControl = foundThings - .filter((foundThing) => getIriAll(foundThing, acp.accessControl).length > 0) - .map((thingWithAccessControl) => { - // The initial filter ensures that at least one AccessControl will be found. - const controlIri = getIriAll(thingWithAccessControl, acp.accessControl)[0]; - // The found control is only an object in the current dataset, so we create the - // associated thing in order to possibly make it a subject. - return createThing({ url: controlIri }); - }); - return explicitAccessControl.concat(implicitAccessControl); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert an [[Control]] into the [[AccessControlResource]] of a Resource, replacing previous - * instances of that Access Control. - * - * @param withAccessControlResource A Resource with the Access Control Resource into which to insert an Access Control. - * @param control The Control to insert into the Access Control Resource. - * @returns The given Resource with a new Access Control Resource equal to the original Access Control Resource, but with the given Access Control. - * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly. - * @deprecated - */ -function internal_setControl(withAccessControlResource, control) { - const acr = internal_getAcr(withAccessControlResource); - const updatedAcr = setThing(acr, control); - const updatedResource = internal_setAcr(withAccessControlResource, updatedAcr); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a [[Policy]] to an [[Control]] such that that Policy applies to the Resource to which - * the [[Control]] is linked. - * - * @param accessControl The [[Control]] to which the Policy should be added. - * @param policyUrl URL of the Policy that should apply to the Resource to which the [[Control]] is linked. - * @returns A new [[Control]] equal to the given [[Control]], but with the given policy added to it. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_addPolicyUrl(accessControl, policyUrl) { - return addIri(accessControl, acp.apply, policyUrl); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get all Policies that apply to the Resource to which the given [[Control]] is linked, and - * which can be removed by anyone with Write access to the Access Control Resource that contains the - * [[Control]]. - * - * @param accessControl The [[Control]] of which to get the Policies. - * @returns The Policies that are listed in this [[Control]] as applying to the Resource it is linked to, and as removable by anyone with Write access to the Access Control Resource. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_getPolicyUrlAll(accessControl) { - return getIriAll(accessControl, acp.apply); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove a given Policy that applies to the Resource to which the given [[Control]] is linked, - * and which can be removed by anyone with Write access to the Access Control Resource that contains - * the Access Control. - * - * @param accessControl The [[Control]] of which to remove the Policies. - * @param policyUrl URL of the Policy that should no longer apply to the Resource to which the [[Control]] is linked. - * @returns A new [[Control]] equal to the given [[Control]], but with the given Policy removed from it. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_removePolicyUrl(accessControl, policyUrl) { - return removeIri(accessControl, acp.apply, policyUrl); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove all Policies that apply to the Resource to which the given [[Control]] is linked, and - * which can be removed by anyone with Write access to the Access Control Resource that contains the - * [[Control]]. - * - * @param accessControl The [[Control]] of which to remove the Policies. - * @returns A new [[Control]] equal to the given [[Control]], but with all Policies removed from it. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_removePolicyUrlAll(accessControl) { - return removeAll(accessControl, acp.apply); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a [[Policy]] to an [[Control]] such that that Policy applies to the children of the - * Resource to which the [[Control]] is linked. - * - * @param accessControl The [[Control]] to which the Policy should be added. - * @param policyUrl URL of the Policy that should apply to the children of the Resource to which the [[Control]] is linked. - * @returns A new [[Control]] equal to the given [[Control]], but with the given policy added to it as a Member Policy. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_addMemberPolicyUrl(accessControl, policyUrl) { - return addIri(accessControl, acp.applyMembers, policyUrl); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get all Policies that apply to the children of the Resource to which the given [[Control]] is - * linked, and which can be removed by anyone with Write access to the Access Control Resource that - * contains the [[Control]]. - * - * @param accessControl The [[Control]] of which to get the Policies. - * @returns The Policies that are listed in this [[Control]] as applying to the children of the Resource it is linked to, and as removable by anyone with Write access to the Access Control Resource. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_getMemberPolicyUrlAll(accessControl) { - return getIriAll(accessControl, acp.applyMembers); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove a given Policy that applies to the children of the Resource to which the given Access - * Control is linked, and which can be removed by anyone with Write access to the Access Control - * Resource that contains the Access Control. - * - * @param accessControl The [[Control]] of which to remove the Member Policy. - * @param policyUrl URL of the Member Policy that should no longer apply to the Resource to which the [[Control]] is linked. - * @returns A new [[Control]] equal to the given [[Control]], but with the given Member Policy removed from it. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_removeMemberPolicyUrl(accessControl, policyUrl) { - return removeIri(accessControl, acp.applyMembers, policyUrl); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove all Policies that apply to the children of the Resource to which the given Access Control - * is linked, and which can be removed by anyone with Write access to the Access Control Resource - * that contains the Access Control. - * - * @param accessControl The [[Control]] of which to remove the Member Policies. - * @returns A new [[Control]] equal to the given [[Control]], but with all Member Policies removed from it. - * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly. - * @deprecated - */ -function internal_removeMemberPolicyUrlAll(accessControl) { - return removeAll(accessControl, acp.applyMembers); -} -function internal_getInitialisedControl(resourceWithAcr) { - const allControls = internal_getControlAll(resourceWithAcr); - return allControls.length === 0 ? internal_createControl() : allControls[0]; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a Resource, check whether it is governed by Access Policies. - * (Specifically, a Resource that is governed by Access Policies will refer to exactly one Access - * Control Resource, and expose that to users who are allowed to see or modify access to the given - * Resource.) - * - * @param resource Resource which may or may not be governed by Access Policies. - * @returns True if the Resource refers to an Access Control Resource and is hence governed by Access Policies, or false if it does not. - * @since 1.6.0 - */ -function hasLinkedAcr(resource) { - return (hasServerResourceInfo(resource) && - Array.isArray(resource.internal_resourceInfo.linkedResources[acp.accessControl]) && - resource.internal_resourceInfo.linkedResources[acp.accessControl].length === - 1); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a [[Policy]] to an Access Control Resource such that that [[Policy]] applies to the Access - * Control Resource itself, rather than the Resource it governs. - * - * @param resourceWithAcr The Resource with an Access Control Resource to which the ACR Policy should be added. - * @param policyUrl URL of the Policy that should apply to the given Access Control Resource. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given ACR Policy added to it. - * @since 1.6.0 - */ -function addAcrPolicyUrl$1(resourceWithAcr, policyUrl) { - var _a; - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - let acrThing = (_a = getThing(acr, acrUrl)) !== null && _a !== void 0 ? _a : createThing({ url: acrUrl }); - acrThing = addIri(acrThing, acp.access, policyUrl); - const updatedAcr = setThing(acr, acrThing); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a [[Policy]] to a Resource's Access Control Resource such that that - * Policy applies to the Access Control Resources of child Resources. - * - * @param resourceWithAcr The Resource with an Access Control Resource to which the ACR Policy should be added. - * @param policyUrl URL of the Policy that should apply to the given Access Control Resources of children of the Resource. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given ACR Policy added to it. - * @since 1.6.0 - */ -function addMemberAcrPolicyUrl$1(resourceWithAcr, policyUrl) { - var _a; - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - let acrThing = (_a = getThing(acr, acrUrl)) !== null && _a !== void 0 ? _a : createThing({ url: acrUrl }); - acrThing = addIri(acrThing, acp.accessMembers, policyUrl); - const updatedAcr = setThing(acr, acrThing); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the URLs of the Access Policies that apply to an Access Control Resource itself, rather than - * to the Resource it governs. - * - * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to it. - * @returns URLs of the Policies that govern access to the given Access Control Resource. - * @since 1.6.0 - */ -function getAcrPolicyUrlAll$1(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const acrThing = getThing(acr, acrUrl); - if (acrThing === null) { - return []; - } - return getIriAll(acrThing, acp.access); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the URLs of the Access Policies that apply to the Access Control Resources of the Resource's - * children. - * - * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to its children. - * @returns URLs of the Policies that govern access to the Access Control Resources of the given Resource's children. - * @since 1.6.0 - */ -function getMemberAcrPolicyUrlAll$1(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const acrThing = getThing(acr, acrUrl); - if (acrThing === null) { - return []; - } - return getIriAll(acrThing, acp.accessMembers); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop the URL of a given [[Policy]] from applying to an Access Control Resource itself. - * - * @param resourceWithAcr The Resource with the Access Control Resource to which the given URL of a Policy should no longer apply. - * @param policyUrl The URL of the Policy that should no longer apply. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given ACR Policy removed from it. - * @since 1.6.0 - */ -function removeAcrPolicyUrl$1(resourceWithAcr, policyUrl) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const acrThing = getThing(acr, acrUrl); - if (acrThing === null) { - return resourceWithAcr; - } - const updatedAcrThing = removeIri(acrThing, acp.access, policyUrl); - const updatedAcr = setThing(acr, updatedAcrThing); - return internal_setAcr(resourceWithAcr, updatedAcr); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop the URL of a given [[Policy]] from applying to the Access Control Resources of the - * Resource's children. - * - * @param resourceWithAcr The Resource with the Access Control Resource to whose children's ACRs the given URL of a Policy should no longer apply. - * @param policyUrl The URL of the Policy that should no longer apply. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given member ACR Policy removed from it. - * @since 1.6.0 - */ -function removeMemberAcrPolicyUrl$1(resourceWithAcr, policyUrl) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const acrThing = getThing(acr, acrUrl); - if (acrThing === null) { - return resourceWithAcr; - } - const updatedAcrThing = removeIri(acrThing, acp.accessMembers, policyUrl); - const updatedAcr = setThing(acr, updatedAcrThing); - return internal_setAcr(resourceWithAcr, updatedAcr); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop all URL of Access Policies from applying to an Access Control Resource itself. - * - * @param resourceWithAcr The Resource with the Access Control Resource to which no more Policies should apply. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to it. - * @since 1.6.0 - */ -function removeAcrPolicyUrlAll(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const acrThing = getThing(acr, acrUrl); - if (acrThing === null) { - return resourceWithAcr; - } - const updatedAcrThing = removeAll(acrThing, acp.access); - const updatedAcr = setThing(acr, updatedAcrThing); - return internal_setAcr(resourceWithAcr, updatedAcr); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop all URL of Access Policies from applying to the Access Control Resources of the Resource's - * children. - * - * @param resourceWithAcr The Resource with the Access Control Resource that should no longer apply Policies to its children's ACRs. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to its children's ACRs. - * @since 1.6.0 - */ -function removeMemberAcrPolicyUrlAll(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const acrThing = getThing(acr, acrUrl); - if (acrThing === null) { - return resourceWithAcr; - } - const updatedAcrThing = removeAll(acrThing, acp.accessMembers); - const updatedAcr = setThing(acr, updatedAcrThing); - return internal_setAcr(resourceWithAcr, updatedAcr); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a [[Policy]] to an Access Control Resource such that that [[Policy]] applies to that Resource. - * - * @param resourceWithAcr The Resource to which the ACR Policy should be added. - * @param policyUrl URL of the Policy that should apply to the given Resource. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given Policy added to it. - * @since 1.6.0 - */ -function addPolicyUrl$1(resourceWithAcr, policyUrl) { - const control = internal_getInitialisedControl(resourceWithAcr); - const updatedControl = internal_addPolicyUrl(control, policyUrl); - const updatedResource = internal_setControl(resourceWithAcr, updatedControl); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a [[Policy]] to a Resource's Access Control Resource such that that - * Policy applies to that Resource's children. - * - * @param resourceWithAcr The Resource to whose Access Control Resource the Policy should be added. - * @param policyUrl URL of the Policy that should apply to the given Resource's children. - * @returns A new Resource equal to the given Resource, but with the given Member Policy added to its Access Control Resource. - * @since 1.6.0 - */ -function addMemberPolicyUrl$1(resourceWithAcr, policyUrl) { - const control = internal_getInitialisedControl(resourceWithAcr); - const updatedControl = internal_addMemberPolicyUrl(control, policyUrl); - const updatedResource = internal_setControl(resourceWithAcr, updatedControl); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the URLs of the Access Policies that apply to a Resource. - * - * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to it. - * @returns URLs of the Policies that govern access to the given Resource. - * @since 1.6.0 - */ -function getPolicyUrlAll$1(resourceWithAcr) { - const controls = internal_getControlAll(resourceWithAcr); - const policyUrlsByControl = controls.map((control) => internal_getPolicyUrlAll(control)); - const uniquePolicyUrls = new Set(); - policyUrlsByControl.forEach((policyUrls) => { - policyUrls.forEach((url) => uniquePolicyUrls.add(url)); - }); - return Array.from(uniquePolicyUrls); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the URLs of the Access Policies that apply to a Resource's children. - * - * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to its children. - * @returns URLs of the Policies that govern access to the given Resource's children. - * @since 1.6.0 - */ -function getMemberPolicyUrlAll$1(resourceWithAcr) { - const controls = internal_getControlAll(resourceWithAcr); - const memberPolicyUrlsByControl = controls.map((control) => internal_getMemberPolicyUrlAll(control)); - const uniquePolicyUrls = new Set(); - memberPolicyUrlsByControl.forEach((policyUrls) => { - policyUrls.forEach((url) => uniquePolicyUrls.add(url)); - }); - return Array.from(uniquePolicyUrls); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop the URL of a given [[Policy]] from applying to a Resource. - * - * @param resourceWithAcr The Resource, with its Access Control Resource, to which the given URL of a Policy should no longer apply. - * @param policyUrl The URL of the Policy that should no longer apply. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given Policy removed from it. - * @since 1.6.0 - */ -function removePolicyUrl$1(resourceWithAcr, policyUrl) { - const controls = internal_getControlAll(resourceWithAcr); - const updatedControls = controls.map((control) => internal_removePolicyUrl(control, policyUrl)); - const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop the URL of a given [[Policy]] from applying to the Resource's children. - * - * @param resourceWithAcr The Resource with the Access Control Resource to whose children the given URL of a Policy should no longer apply. - * @param policyUrl The URL of the Policy that should no longer apply. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given Member Policy removed from it. - * @since 1.6.0 - */ -function removeMemberPolicyUrl$1(resourceWithAcr, policyUrl) { - const controls = internal_getControlAll(resourceWithAcr); - const updatedControls = controls.map((control) => internal_removeMemberPolicyUrl(control, policyUrl)); - const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop all URL of Access Policies from applying to a Resource. - * - * @param resourceWithAcr The Resource, with its Access Control Resource, to which no more Policies should apply. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to the Resource. - * @since 1.6.0 - */ -function removePolicyUrlAll(resourceWithAcr) { - const controls = internal_getControlAll(resourceWithAcr); - const updatedControls = controls.map((control) => internal_removePolicyUrlAll(control)); - const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr); - return updatedResource; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Stop all URL of Access Policies from applying to the Resource's children. - * - * @param resourceWithAcr The Resource with the Access Control Resource that should no longer apply Policies to its children. - * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to the Resource's children. - * @since 1.6.0 - */ -function removeMemberPolicyUrlAll(resourceWithAcr) { - const controls = internal_getControlAll(resourceWithAcr); - const updatedControls = controls.map((control) => internal_removeMemberPolicyUrlAll(control)); - const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr); - return updatedResource; -} -/** - * Gets a human-readable representation of the given [[Control]] to aid debugging. - * - * Note that changes to the exact format of the return value are not considered a breaking change; - * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed. - * - * @param resourceWithAcr The Resource with an attached Access Control Resource of which you want to get a human-readable representation. - * @since 1.6.0 - * @deprecated - */ -function acrAsMarkdown(resourceWithAcr) { - let markdown = `# Access controls for ${getSourceUrl(resourceWithAcr)}\n`; - const policyUrls = getPolicyUrlAll$1(resourceWithAcr); - const memberPolicyUrls = getMemberPolicyUrlAll$1(resourceWithAcr); - const acrPolicyUrls = getAcrPolicyUrlAll$1(resourceWithAcr); - const memberAcrPolicyUrls = getMemberAcrPolicyUrlAll$1(resourceWithAcr); - if (policyUrls.length === 0 && - memberPolicyUrls.length === 0 && - acrPolicyUrls.length === 0 && - memberAcrPolicyUrls.length === 0) { - markdown += "\n\n"; - } - if (policyUrls.length > 0) { - markdown += "\nThe following policies apply to this resource:\n- "; - markdown += `${policyUrls.join("\n- ")}\n`; - } - if (acrPolicyUrls.length > 0) { - markdown += - "\nThe following policies apply to the access control resource for this resource:\n- "; - markdown += `${acrPolicyUrls.join("\n- ")}\n`; - } - if (memberPolicyUrls.length > 0) { - markdown += - "\nThe following policies apply to the children of this resource:\n- "; - markdown += `${memberPolicyUrls.join("\n- ")}\n`; - } - if (memberAcrPolicyUrls.length > 0) { - markdown += - "\nThe following policies apply to the access control resources for children of this resource:\n- "; - markdown += `${memberAcrPolicyUrls.join("\n- ")}\n`; - } - return markdown; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -const ACP_NAMESPACE = "http://www.w3.org/ns/solid/acp#"; -/** @hidden */ -const ACP = { - AccessControl: ACP_NAMESPACE.concat("AccessControl"), - AccessControlResource: ACP_NAMESPACE.concat("AccessControlResource"), - AuthenticatedAgent: ACP_NAMESPACE.concat("AuthenticatedAgent"), - CreatorAgent: ACP_NAMESPACE.concat("CreatorAgent"), - Matcher: ACP_NAMESPACE.concat("Matcher"), - Policy: ACP_NAMESPACE.concat("Policy"), - PublicAgent: ACP_NAMESPACE.concat("PublicAgent"), - access: ACP_NAMESPACE.concat("access"), - accessControl: ACP_NAMESPACE.concat("accessControl"), - agent: ACP_NAMESPACE.concat("agent"), - allOf: ACP_NAMESPACE.concat("allOf"), - allow: ACP_NAMESPACE.concat("allow"), - anyOf: ACP_NAMESPACE.concat("anyOf"), - apply: ACP_NAMESPACE.concat("apply"), - client: ACP_NAMESPACE.concat("client"), - deny: ACP_NAMESPACE.concat("deny"), - memberAccessControl: ACP_NAMESPACE.concat("memberAccessControl"), - noneOf: ACP_NAMESPACE.concat("noneOf"), - vc: ACP_NAMESPACE.concat("vc"), -}; -/** @hidden */ -const ACL_NAMESPACE = "http://www.w3.org/ns/auth/acl#"; -/** @hidden */ -const ACL = { - Append: ACL_NAMESPACE.concat("Append"), - Control: ACL_NAMESPACE.concat("Control"), - Read: ACL_NAMESPACE.concat("Read"), - Write: ACL_NAMESPACE.concat("Write"), -}; -/** @hidden */ -const VC_ACCESS_GRANT = "http://www.w3.org/ns/solid/vc#SolidAccessGrant"; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function getAccessControlResourceThing(resource) { - const acr = internal_getAcr(resource); - const acrUrl = getSourceUrl(acr); - return getThing(acr, acrUrl); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -const DEFAULT_ACCESS_CONTROL = "defaultAccessControl"; -/** @hidden */ -const DEFAULT_ACR_ACCESS_CONTROL = "defaultAcrAccessControl"; -/** @hidden */ -const DEFAULT_MEMBER_ACCESS_CONTROL = "defaultMemberAccessControl"; -/** @hidden */ -const DEFAULT_MEMBER_ACR_ACCESS_CONTROL = "defaultMemberAcrAccessControl"; -/** @hidden */ -function getDefaultAccessControlUrl(resource, name) { - const acr = internal_getAcr(resource); - const acrUrl = getSourceUrl(acr); - return acrUrl.concat("#").concat(name); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function getDefaultAccessControlThing(resource, name) { - const acr = internal_getAcr(resource); - const defaultAccessControlUrl = getDefaultAccessControlUrl(resource, name); - const accessControlThing = getThing(acr, defaultAccessControlUrl); - if (accessControlThing === null || - typeof accessControlThing === "undefined") { - return createThing({ url: defaultAccessControlUrl }); - } - return accessControlThing; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function getModes(policy, type) { - const modes = getIriAll(policy, type); - return { - read: modes.includes(ACL.Read), - append: modes.includes(ACL.Append), - write: modes.includes(ACL.Write), - controlRead: false, - controlWrite: false, - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @hidden - * - * Internal function that attaches an ACR to a Resource. Prefer using this than - * setting the internal values manually (easier to refactor when changing the internals). - */ -function setAcr(resource, acr) { - return Object.assign(internal_cloneResource(resource), { - internal_acp: { - acr, - }, - }); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function setModes(policy, modes, type) { - let newPolicy = removeAll(policy, type); - if (modes.read || modes.controlRead) { - newPolicy = addIri(newPolicy, type, ACL.Read); - } - if (modes.append) { - newPolicy = addIri(newPolicy, type, ACL.Append); - } - if (modes.write || modes.controlWrite) { - newPolicy = addIri(newPolicy, type, ACL.Write); - } - return newPolicy; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const DEFAULT_VC_POLICY_NAME = "defaultVcPolicy"; -const DEFAULT_VC_MATCHER_NAME = "defaultVcMatcher"; -function createVcPolicy(acr, policyIri, matcherIri, access) { - var _a; - let vcPolicy = getThing(acr, policyIri); - if (vcPolicy === null) { - // If the policy does not exist, create it and link the default Access Control to it. - vcPolicy = buildThing({ url: policyIri }) - .addIri(rdf.type, ACP.Policy) - .addIri(ACP.anyOf, matcherIri) - .build(); - } - const vcMatcher = (_a = getThing(acr, matcherIri)) !== null && _a !== void 0 ? _a : buildThing({ url: matcherIri }) - .addIri(rdf.type, ACP.Matcher) - .addIri(ACP.vc, VC_ACCESS_GRANT) - .build(); - const currentModes = getModes(vcPolicy, ACP.allow); - // Only change the modes which are set in `access`, and preserve the others. - vcPolicy = setModes(vcPolicy, { ...currentModes, ...access }, ACP.allow); - return { - matcher: vcMatcher, - policy: vcPolicy, - }; -} -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Set the maximum access modes that are allowed for a VC holder for a given resource. - * If the resource owner issued an Access Grant for the resource, the agent that - * has been granted access will have at most the permissions set by this function. - * The Access Grant may be more restrictive. - * - * Note that additional access may have been set if the ACR has been manipulated - * not using this library, which is currently out of scope. In this case, the access - * set by this function may not apply. - * - * @param resourceWithAcr The resource for which the access modes are being set for VC holders. - * @param access The access modes to set. Setting a mode to `true` will enable it, to `false` - * will disable it, and to `undefined` will leave it unchanged compared to what was previously - * set. - * @param options An option object to customize the function behavior: - * - inherit: if set to `true`, the access set to the target resource cascades - * to its contained resources. - * @returns A copy of the resource and its attached ACR, updated to the new access modes. - * @since 1.17.0 - */ -function setVcAccess(resourceWithAcr, access, options = { inherit: false }) { - var _a; - let acr = internal_getAcr(resourceWithAcr); - const defaultVcPolicyIri = `${getSourceIri(acr)}#${DEFAULT_VC_POLICY_NAME}`; - const defaultVcMatcherIri = `${getSourceIri(acr)}#${DEFAULT_VC_MATCHER_NAME}`; - const { policy, matcher } = createVcPolicy(acr, defaultVcPolicyIri, defaultVcMatcherIri, access); - let accessControl = getDefaultAccessControlThing(resourceWithAcr, "defaultAccessControl"); - if (!getIriAll(accessControl, ACP.apply).includes(asIri(policy))) { - // Case when the ACR Thing existed, but did not include a link to the default Access Control. - accessControl = addIri(accessControl, ACP.apply, policy); - } - let memberAccessControl = getDefaultAccessControlThing(resourceWithAcr, "defaultMemberAccessControl"); - let acrThing = (_a = getAccessControlResourceThing(resourceWithAcr)) !== null && _a !== void 0 ? _a : createThing({ url: getSourceIri(acr) }); - if (!getIriAll(acrThing, ACP.accessControl).includes(asIri(accessControl))) { - // Case when the ACR Thing existed, but did not include a link to the default Access Control. - acrThing = addIri(acrThing, ACP.accessControl, accessControl); - } - // Write the changed access control, policy and matchers in the ACR - acr = [acrThing, accessControl, policy, matcher].reduce(setThing, acr); - if (options.inherit) { - // Add triples to the member access control and link it to the ACR only - // if the VC access is recursive if they don't exist already. - if (!getIriAll(memberAccessControl, ACP.apply).includes(asIri(policy))) { - memberAccessControl = addIri(memberAccessControl, ACP.apply, policy); - } - if (!getIriAll(acrThing, ACP.memberAccessControl).includes(asIri(memberAccessControl))) { - acrThing = addIri(acrThing, ACP.memberAccessControl, memberAccessControl); - } - acr = [acrThing, memberAccessControl].reduce(setThing, acr); - } - return setAcr(resourceWithAcr, acr); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const DEFAULT_NO_ACCESS = { - read: false, - append: false, - write: false, - controlRead: false, - controlWrite: false, -}; -const linkExists = (subject, predicate, object) => getIriAll(subject, predicate).includes(asIri(object)); -// TODO: It should be possible to write a `chainExists` function, taking in a chain -// of Thing, predicate, Thing, predicate... and checks whether such chain exists -// in a given dataset. It would make the following function much easier to read, -// instead of checking at each link that it isn't null and it is connected to the -// next link. -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Get the maximum access modes that are allowed for a VC holder for a given resource. - * If the resource owner issued an Access Grant for the resource, the agent that - * has been granted access will have at most the permissions returned by this function. - * The Access Grant may be more restrictive. - * - * Note that only the modes set using [[setVcAccess]] will be returned by this function. - * Additional access may have been set if the ACR has been manipulated not using this - * library, which is currently out of scope. - * - * @param resourceWithAcr The resource for which the VC access modes are looked up. - * @returns The access modes available to a VC holder. - * @since 1.17.0 - */ -function getVcAccess(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const accessControl = getDefaultAccessControlThing(resourceWithAcr, "defaultAccessControl"); - const acrThing = getAccessControlResourceThing(resourceWithAcr); - if (acrThing === null || - !linkExists(acrThing, ACP.accessControl, accessControl)) { - return DEFAULT_NO_ACCESS; - } - const defaultVcPolicyIri = `${getSourceIri(acr)}#${DEFAULT_VC_POLICY_NAME}`; - const vcPolicy = getThing(acr, defaultVcPolicyIri); - if (vcPolicy === null || !linkExists(accessControl, ACP.apply, vcPolicy)) { - return DEFAULT_NO_ACCESS; - } - const defaultVcMatcherIri = `${getSourceIri(acr)}#${DEFAULT_VC_MATCHER_NAME}`; - const vcMatcher = getThing(acr, defaultVcMatcherIri); - if (vcMatcher === null || !linkExists(vcPolicy, ACP.anyOf, vcMatcher)) { - return DEFAULT_NO_ACCESS; - } - return getModes(vcPolicy, ACP.allow); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Fetch a SolidDataset and its associated Access Control Resource (if available to the current user). - * - * @param url URL of the SolidDataset to fetch. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A SolidDataset and the ACR that applies to it, if available to the authenticated user. - * @since 1.6.0 - */ -async function getSolidDatasetWithAcr(url, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const solidDataset = await getSolidDataset(urlString, config); - const acp = await fetchAcr(solidDataset, config); - return { ...solidDataset, ...acp }; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Fetch a file and its associated Access Control Resource (if available to the current user). - * - * @param url URL of the file to fetch. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A file and the ACR that applies to it, if available to the authenticated user. - * @since 1.6.0 - */ -async function getFileWithAcr(url, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const file = await getFile(urlString, config); - const acp = await fetchAcr(file, config); - return Object.assign(file, acp); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Retrieve information about a Resource and its associated Access Control Resource (if available to - * the current user), without fetching the Resource itself. - * - * @param url URL of the Resource about which to fetch its information. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns Metadata describing a Resource, and the ACR that applies to it, if available to the authenticated user. - * @since 1.6.0 - */ -async function getResourceInfoWithAcr(url, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const resourceInfo = await getResourceInfo(urlString, config); - const acp = await fetchAcr(resourceInfo, config); - return { ...resourceInfo, ...acp }; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Fetch a SolidDataset, and: - * - if the Resource is governed by an ACR: its associated Access Control Resource (if available to - * the current user), and all the Access Control Policies - * referred to therein, if available to the current user. - * - if the Resource is governed by an ACL: its associated Resource ACL (if available to the current - * user), or its Fallback ACL if it does not exist. - * - * @param url URL of the SolidDataset to fetch. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A SolidDataset and either the ACL access data or the ACR access data, if available to the current user. - * @since 1.6.0 - */ -async function getSolidDatasetWithAccessDatasets(url, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const solidDataset = await getSolidDataset(urlString, config); - if (hasAccessibleAcl(solidDataset)) { - const acl = await internal_fetchAcl(solidDataset, config); - return internal_setAcl(solidDataset, acl); - } - const acr = await fetchAcr(solidDataset, config); - return { ...solidDataset, ...acr }; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Fetch a File, and: - * - if the Resource is governed by an ACR: its associated Access Control Resource (if available to - * the current user), and all the Access Control Policies - * referred to therein, if available to the current user. - * - if the Resource is governed by an ACL: its associated Resource ACL (if available to the current - * user), or its Fallback ACL if it does not exist. - * - * @param url URL of the File to fetch. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A File and either the ACL access data or the ACR access data, if available to the current user. - * @since 1.6.0 - */ -async function getFileWithAccessDatasets(url, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const file = await getFile(urlString, config); - if (hasAccessibleAcl(file)) { - const acl = await internal_fetchAcl(file, config); - return internal_setAcl(file, acl); - } - const acr = await fetchAcr(file, config); - return Object.assign(file, acr); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Fetch information about a Resource, and: - * - if the Resource is governed by an ACR: its associated Access Control Resource (if available to - * the current user), and all the Access Control Policies - * referred to therein, if available to the current user. - * - if the Resource is governed by an ACL: its associated Resource ACL (if available to the current - * user), or its Fallback ACL if it does not exist. - * - * @param url URL of the Resource information about which to fetch. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns Information about a Resource and either the ACL access data or the ACR access data, if available to the current user. - * @since 1.6.0 - */ -async function getResourceInfoWithAccessDatasets(url, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(url); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const resourceInfo = await getResourceInfo(urlString, config); - if (hasAccessibleAcl(resourceInfo)) { - const acl = await internal_fetchAcl(resourceInfo, config); - return internal_setAcl(resourceInfo, acl); - } - const acr = await fetchAcr(resourceInfo, config); - return { ...resourceInfo, ...acr }; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Save a Resource's Access Control Resource. - * - * @param resource Resource with an Access Control Resource that should be saved. - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @since 1.6.0 - */ -async function saveAcrFor(resource, options = internal_defaultFetchOptions) { - const acr = internal_getAcr(resource); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const savedAcr = await saveSolidDatasetAt(getSourceUrl(acr), acr, config); - return internal_setAcr(resource, savedAcr); -} -/** - * @param resource Resource of which to check whether it has an Access Control Resource attached. - * @returns Boolean representing whether the given Resource has an Access Control Resource attached for use in e.g. [[getPolicyUrlAll]]. - * @since 1.6.0 - */ -function hasAccessibleAcr(resource) { - return (typeof resource.internal_acp === "object" && - resource.internal_acp !== null && - typeof resource.internal_acp.acr === "object" && - resource.internal_acp.acr !== null); -} -async function fetchAcr(resource, options) { - let acrUrl; - if (hasLinkedAcr(resource)) { - // Whereas a Resource can generally have multiple linked Resources for the same relation, - // it can only have one Access Control Resource for that ACR to be valid. - // Hence the accessing of [0] directly: - const { linkedResources } = resource.internal_resourceInfo; - [acrUrl] = linkedResources[acp.accessControl]; - } - else if (hasAccessibleAcl(resource)) { - // The ACP proposal will be updated to expose the Access Control Resource - // via a Link header with rel="acl", just like WAC. That means that if - // an ACL is advertised, we can still fetch its metadata — if that indicates - // that it's actually an ACP Access Control Resource, then we can fetch that - // instead. - let aclResourceInfo; - try { - aclResourceInfo = await getResourceInfo(resource.internal_resourceInfo.aclUrl, options); - } - catch (e) { - // Since both ACL and ACR will be discovered through the same header, we - // need to ignore errors here so that in the case of ACL not found, the - // code can resume and a new ACL can be initialized. The case for ACR is - // covered in the code below, since in this case the ACR is always present - } - if (aclResourceInfo && isAcr(aclResourceInfo)) { - acrUrl = getSourceUrl(aclResourceInfo); - } - } - // If the Resource doesn't advertise an ACR via the old Link header, - // nor via a rel="acl" header, then return, indicating that no ACR could be - // fetched: - if (typeof acrUrl !== "string") { - return { - internal_acp: { - acr: null, - }, - }; - } - let acr; - try { - acr = await getSolidDataset(acrUrl, options); - } - catch (e) { - return { - internal_acp: { - acr: null, - }, - }; - } - const acrDataset = { - ...acr, - accessTo: getSourceUrl(resource), - }; - const acpInfo = { - internal_acp: { - acr: acrDataset, - }, - }; - return acpInfo; -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * To make it easy to fetch all the relevant Access Policy Resources, - * this function returns all referenced Access Policy Resources referenced in an - * Access Control Resource. - * In other words, if Access Controls refer to different Policies in the same - * Access Policy Resource, this function will only return that Access Policy - * Resource's URL once. - * - * @param withAcr A Resource with an Access Control Resource attached. - * @returns List of all unique Access Policy Resources that are referenced in the given Access Control Resource. - * @since 1.6.0 - */ -function getReferencedPolicyUrlAll(withAcr) { - const policyUrls = getPolicyUrlAll$1(withAcr) - .map(normalizeServerSideIri) - .concat(getMemberPolicyUrlAll$1(withAcr).map(normalizeServerSideIri)) - .concat(getAcrPolicyUrlAll$1(withAcr).map(normalizeServerSideIri)) - .concat(getMemberAcrPolicyUrlAll$1(withAcr).map(normalizeServerSideIri)); - const uniqueUrls = Array.from(new Set(policyUrls)); - return uniqueUrls; -} -/** - * Verify whether the access to the given resource is controlled using the ACP - * system. - * @param resource The target resource - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns True if the access to the resource is controlled using ACP, false otherwise. - * @since 1.14.0. - */ -async function isAcpControlled(resource, options = internal_defaultFetchOptions) { - const urlString = internal_toIriString(resource); - const config = { - ...internal_defaultFetchOptions, - ...options, - }; - const resourceInfo = await getResourceInfo(urlString, config); - return hasAccessibleAcr(await fetchAcr(resourceInfo, config)); -} -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a Resource, find out the URL of its governing Access Control Resource. - * - * @param resource Resource which should be governed by Access Policies. - * @returns The URL of the Access Control Resource, or undefined if not ACR is found. - * @since 1.15.0 - */ -function getLinkedAcrUrl(resource) { - if (!hasServerResourceInfo(resource)) { - return undefined; - } - // Two rels types are acceptable to indicate a link to an ACR. - const acrLinks = [acp.accessControl, "acl"].map((rel) => { - if (Array.isArray(resource.internal_resourceInfo.linkedResources[rel]) && - resource.internal_resourceInfo.linkedResources[rel].length === 1) { - return resource.internal_resourceInfo.linkedResources[rel][0]; - } - return undefined; - }); - return acrLinks.find((x) => x !== undefined); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * NOTE: Don't export for now (i.e. if exported, should this be `isAcpRule()` so - * as not to clash with `isAclRule()`. - * - * @param thing the [[Thing]] to check to see if it's an ACP rule or not - */ -function isRule(thing) { - return getIriAll(thing, rdf.type).includes(acp.Rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a rule that refines the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is **not** present in **any** of the "All Of" rules, - * they will not be granted access. - * - * Also see [[addAnyOfRuleUrl]] and [[addNoneOfRuleUrl]]. - * - * @param policy The [[Policy]] to which the rule should be added. - * @param rule The rule to add to the policy. - * @returns A new [[Policy]] clone of the original one, with the new rule added. - * @since 1.6.0 - */ -function addAllOfRuleUrl(policy, rule) { - return addIri(policy, acp.allOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes a rule that refines the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is **not** present in **any** of the "All Of" rules, - * they will not be granted access. - * @param policy The [[Policy]] from which the rule should be removed. - * @param rule The rule to remove from the policy. - * @returns A new [[Policy]] clone of the original one, with the rule removed. - * @since 1.6.0 - */ -function removeAllOfRuleUrl(policy, rule) { - return removeIri(policy, acp.allOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrites the rule refining the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is **not** present in **any** of the "All Of" rules, - * they will not be granted access. - * @param policy The [[Policy]] to which the rule should be added. - * @param rules The rules the policy requires. - * @returns A new [[Policy]] clone of the original one, with the "All Of" rules replaced. - * @since 1.6.0 - */ -function setAllOfRuleUrl(policy, rule) { - return setIri(policy, acp.allOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the "All Of" [[Rule]]s for the given [[Policy]] - * @param policy The [[policy]] from which the rules should be read. - * @returns A list of the "All Of" [[Rule]]s - * @since 1.6.0 - */ -function getAllOfRuleUrlAll(policy) { - return getIriAll(policy, acp.allOf); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a rule that extends the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the "Any Of" rules, - * they will be granted access. - * - * Also see [[addAllOfRuleUrl]] and [[addNoneOfRuleUrl]]. - * - * @param policy The [[Policy]] to which the rule should be added. - * @param rule The rule to add to the policy. - * @returns A new [[Policy]] clone of the original one, with the new rule added. - * @since 1.6.0 - */ -function addAnyOfRuleUrl(policy, rule) { - return addIri(policy, acp.anyOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes a rule that extends the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the "Any Of" rules, - * they will be granted access. - * @param policy The [[Policy]] from which the rule should be removed. - * @param rule The rule to remove from the policy. - * @returns A new [[Policy]] clone of the original one, with the rule removed. - * @since 1.6.0 - */ -function removeAnyOfRuleUrl(policy, rule) { - return removeIri(policy, acp.anyOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrite the rule extending the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the "Any Of" rules, - * they will be granted access. - * @param policy The [[Policy]] to which the rule should be added. - * @param rules The rules the policy accepts. - * @returns A new [[Policy]] clone of the original one, with the "Any Of" rules replaced. - * @since 1.6.0 - */ -function setAnyOfRuleUrl(policy, rule) { - return setIri(policy, acp.anyOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the "Any Of" [[Rule]]s for the given [[Policy]] - * @param policy The [[policy]] from which the rules should be read. - * @returns A list of the "Any Of" [[Rule]]s - * @since 1.6.0 - */ -function getAnyOfRuleUrlAll(policy) { - return getIriAll(policy, acp.anyOf); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a rule that restricts the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the forbidden rules, - * they will **not** be granted access. - * - * Also see [[addAllOfRuleUrl]] and [[addAnyOfRuleUrl]]. - * - * @param policy The [[Policy]] to which the rule should be added. - * @param rule The rule to add to the policy. - * @returns A new [[Policy]] clone of the original one, with the new rule added. - * @since 1.6.0 - */ -function addNoneOfRuleUrl(policy, rule) { - return addIri(policy, acp.noneOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes a rule that restricts the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the forbidden rules, - * they will **not** be granted access. - * @param policy The [[Policy]] from which the rule should be removed. - * @param rule The rule to remove from the policy. - * @returns A new [[Policy]] clone of the original one, with the rule removed. - * @since 1.6.0 - */ -function removeNoneOfRuleUrl(policy, rule) { - return removeIri(policy, acp.noneOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set the rules restrincting the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the "None Of" rules, - * they will not be granted access. - * @param policy The [[Policy]] to which the rule should be added. - * @param rules The rules the policy accepts. - * @returns A new [[Policy]] clone of the original one, with the "Any Of" rules replaced. - * @since 1.6.0 - */ -function setNoneOfRuleUrl(policy, rule) { - return setIri(policy, acp.noneOf, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the "None Of" [[Rule]]s for the given [[Policy]] - * @param policy The [[policy]] from which the rules should be read. - * @returns A list of the forbidden [[Rule]]s - * @since 1.6.0 - */ -function getNoneOfRuleUrlAll(policy) { - return getIriAll(policy, acp.noneOf); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Initialise a new, empty [[Rule]]. - * - * @param url URL that identifies this [[Rule]]. - * @since 1.6.0 - */ -function createRule(url) { - const stringUrl = internal_toIriString(url); - let ruleThing = createThing({ url: stringUrl }); - ruleThing = setUrl(ruleThing, rdf.type, acp.Rule); - return ruleThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Initialise a new, empty [[ResourceRule]] for the given Resource. - * - * @param resourceWithAcr The Resource to which the new Rule is to apply. - * @param name Name that identifies this [[Rule]]. - * @since 1.6.0 - */ -function createResourceRuleFor(resourceWithAcr, name) { - const acr = internal_getAcr(resourceWithAcr); - const url = new URL(getSourceUrl(acr)); - url.hash = `#${name}`; - let ruleThing = createThing({ url: url.href }); - ruleThing = setUrl(ruleThing, rdf.type, acp.Rule); - return ruleThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the [[Rule]] with the given URL from an [[SolidDataset]]. - * - * @param ruleResource The Resource that contains the given [[Rule]]. - * @param url URL that identifies this [[Rule]]. - * @returns The requested [[Rule]], if it exists, or `null` if it does not. - * @since 1.6.0 - */ -function getRule(ruleResource, url) { - const foundThing = getThing(ruleResource, url); - if (foundThing === null || getUrl(foundThing, rdf.type) !== acp.Rule) { - return null; - } - return foundThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the [[ResourceRule]] with the given name from an Resource's Access Control - * Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains the given [[ResourceRule]]. - * @param name Name that identifies this [[ResourceRule]]. - * @returns The requested [[ResourceRule]], if it exists, or `null` if it does not. - * @since 1.6.0 - */ -function getResourceRule(resourceWithAcr, name) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const url = new URL(acrUrl); - url.hash = `#${name}`; - const foundThing = getThing(acr, url.href); - if (foundThing === null || !isRule(foundThing)) { - return null; - } - return foundThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Gets the [[Rule]]s from a [[SolidDataset]]. - * - * @param ruleResource The Resource that contains (zero or more) [[Rule]]s. - * @returns The [[Rule]]s contained in this resource. - * @since 1.6.0 - */ -function getRuleAll(ruleResource) { - const things = getThingAll(ruleResource); - return things.filter(isRule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Gets the [[ResourceRule]]s from a Resource's Access Control Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceRule]]s. - * @returns The [[ResourceRule]]s contained in this Resource's Access Control Resource. - * @since 1.6.0 - */ -function getResourceRuleAll(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const things = getThingAll(acr); - return things.filter(isRule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes the given [[Rule]] from the given [[SolidDataset]]. - * - * @param ruleResource The Resource that contains (zero or more) [[Rule]]s. - * @returns A new SolidDataset equal to the given Rule Resource, but without the given Rule. - * @since 1.6.0 - */ -function removeRule(ruleResource, rule) { - return removeThing(ruleResource, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes the given [[ResourceRule]] from the given Resource's Access Control Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceRule]]s. - * @returns A new Resource equal to the given Resource, but without the given Rule in its ACR. - * @since 1.6.0 - */ -function removeResourceRule(resourceWithAcr, rule) { - const acr = internal_getAcr(resourceWithAcr); - let ruleToRemove; - if (typeof rule === "string") { - if (internal_isValidUrl(rule)) { - ruleToRemove = rule; - } - else { - // If the given Rule to remove is the name of the Rule, - // resolve it to its full URL — developers usually refer to either the - // Rule itself, or by its name, as they do not have access to the ACR - // directly. - const ruleUrl = new URL(getSourceUrl(acr)); - ruleUrl.hash = `#${rule}`; - ruleToRemove = ruleUrl.href; - } - } - else if (isNamedNode(rule)) { - ruleToRemove = internal_toIriString(rule); - } - else { - ruleToRemove = asUrl(rule); - } - // Check whether the actual Rule (i.e. with the Rule type) exists: - const matchingRule = getResourceRule(resourceWithAcr, new URL(ruleToRemove).hash.substring(1)); - if (matchingRule === null) { - // No such Rule exists yet, so return the Resource+ACR unchanged: - return resourceWithAcr; - } - const updatedAcr = removeThing(acr, matchingRule); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return updatedResource; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert the given [[Rule]] into the given [[SolidDataset]], replacing previous - * instances of that Rule. - * - * @param ruleResource The Resource that contains (zero or more) [[Rule]]s. - * @returns A new SolidDataset equal to the given Rule Resource, but with the given Rule. - * @since 1.6.0 - */ -function setRule(ruleResource, rule) { - return setThing(ruleResource, rule); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert the given [[ResourceRule]] into the given Resource's Access Control Resource, - * replacing previous instances of that Rule. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceRule]]s. - * @returns A new Resource equal to the given Resource, but with the given Rule in its ACR. - * @since 1.6.0 - */ -function setResourceRule(resourceWithAcr, rule) { - const acr = internal_getAcr(resourceWithAcr); - const updatedAcr = setThing(acr, rule); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return updatedResource; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * List all the agents a [[Rule]] applies **directly** to. This will not include agents - * that are part of a group the [[Rule]] applies to, nor will it include specific agent - * classes, such as authenticated or public agents. - * - * @param rule The rule from which agents are read. - * @returns A list of the WebIDs of agents included in the rule. - * @since 1.6.0 - */ -function getAgentAll$1(rule) { - return getIriAll(rule, acp.agent).filter((agent) => agent !== acp.PublicAgent && - agent !== acp.AuthenticatedAgent && - agent !== acp.CreatorAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrite the agents the [[Rule]] applies to with the provided agents. - * - * @param rule The rule for which agents are set. - * @param agent The agent the rule should apply to. - * @returns A copy of the input rule, applying to a different set of agents. - * @since 1.6.0 - */ -function setAgent$1(rule, agent) { - // Preserve the special agent classes authenticated and public, which we - // don't want to overwrite with this function. - const isPublic = hasPublic$1(rule); - const isAuthenticated = hasAuthenticated$1(rule); - const isCreator = hasCreator$1(rule); - let result = setIri(rule, acp.agent, agent); - // Restore public and authenticated - if (isPublic) { - result = setPublic$1(result); - } - if (isAuthenticated) { - result = setAuthenticated$1(result); - } - if (isCreator) { - result = setCreator$1(result); - } - return result; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Apply the [[Rule]] to an additional agent. - * - * @param rule The [[Rule]] to be applied to an additional agent. - * @param agent The agent the [[Rule]] should apply to. - * @returns A copy of the [[Rule]], applying to an additional agent. - * @since 1.6.0 - */ -function addAgent$1(rule, agent) { - return addIri(rule, acp.agent, agent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Prevent the [[Rule]] from applying to a given agent directly. This will not - * remove the agent from any groups the rule applies to. - * - * @param rule The [[Rule]] that should no longer apply to a given agent. - * @param agent The agent the rule should no longer apply to. - * @returns A copy of the rule, not applying to the given agent. - * @since 1.6.0 - */ -function removeAgent$1(rule, agent) { - return removeIri(rule, acp.agent, agent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Lists all the groups a [[Rule]] applies to. - * - * @param rule The rule from which groups are read. - * @returns A list of the [[URL]]'s of groups included in the rule. - * @since 1.6.0 - * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality. - */ -function getGroupAll(rule) { - return getIriAll(rule, acp.group); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrite the groups the [[Rule]] applies to with the provided groups. - * - * @param rule The rule for which groups are set. - * @param group The group the rule should apply to. - * @returns A copy of the input rule, applying to a different set of groups. - * @since 1.6.0 - * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality. - */ -function setGroup(rule, group) { - return setIri(rule, acp.group, group); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Apply the [[Rule]] to an additional group. - * - * @param rule The [[Rule]] to be applied to an additional group. - * @param agent The group the [[Rule]] should apply to. - * @returns A copy of the [[Rule]], applying to an additional group. - * @since 1.6.0 - * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality. - */ -function addGroup(rule, group) { - return addIri(rule, acp.group, group); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Prevent the [[Rule]] from applying to a given group. - * - * @param rule The [[Rule]] that should no longer apply to a given group. - * @param agent The group the rule should no longer apply to. - * @returns A copy of the rule, not applying to the given group. - * @since 1.6.0 - * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality. - */ -function removeGroup(rule, group) { - return removeIri(rule, acp.group, group); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the rule applies to any agent. - * - * @param rule The rule checked for public access. - * @returns Whether the rule applies to any agent or not. - * @since 1.6.0 - */ -function hasPublic$1(rule) { - return (getIriAll(rule, acp.agent).filter((agent) => agent === acp.PublicAgent) - .length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Rule to apply to any Agent. - * - * @param rule The rule being modified. - * @returns A copy of the rule, updated to apply to any agent. - * @since 1.6.0 - */ -function setPublic$1(rule) { - // The second argument should not be part of the function signature, - // so it's not in the parameter list: - // eslint-disable-next-line prefer-rest-params - if (typeof arguments === "object" && typeof arguments[1] === "boolean") { - throw new Error("The function `setPublic` no longer takes a second parameter. It is now used together with `removePublic` instead."); - } - return addIri(rule, acp.agent, acp.PublicAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Rule to no longer apply to any Agent. - * - * @param rule The rule being modified. - * @returns A copy of the rule, updated to no longer apply to any agent. - * @since 1.6.0 - */ -function removePublic$1(rule) { - return removeIri(rule, acp.agent, acp.PublicAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the rule applies to any authenticated agent. - * - * @param rule The rule checked for authenticated access. - * @returns Whether the rule applies to any authenticated agent or not. - * @since 1.6.0 - */ -function hasAuthenticated$1(rule) { - return (getIriAll(rule, acp.agent).filter((agent) => agent === acp.AuthenticatedAgent).length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Rule to apply to any authenticated Agent. - * - * @param rule The rule being modified. - * @returns A copy of the rule, updated to apply to any authenticated Agent. - * @since 1.6.0 - */ -function setAuthenticated$1(rule) { - // The second argument should not be part of the function signature, - // so it's not in the parameter list: - // eslint-disable-next-line prefer-rest-params - if (typeof arguments === "object" && typeof arguments[1] === "boolean") { - throw new Error("The function `setAuthenticated` no longer takes a second parameter. It is now used together with `removeAuthenticated` instead."); - } - return addIri(rule, acp.agent, acp.AuthenticatedAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Rule to no longer apply to any authenticated Agent. - * - * @param rule The rule being modified. - * @returns A copy of the rule, updated to apply/not apply to any authenticated agent. - * @since 1.6.0 - */ -function removeAuthenticated$1(rule) { - return removeIri(rule, acp.agent, acp.AuthenticatedAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the rule applies to the creator of the Resource. - * - * @param rule The rule checked for authenticated access. - * @returns Whether the rule applies to the creator of the Resource or not. - * @since 1.6.0 - */ -function hasCreator$1(rule) { - return (getIriAll(rule, acp.agent).filter((agent) => agent === acp.CreatorAgent) - .length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Rule to apply to the creator of a Resource. - * - * @param rule The rule being modified. - * @returns A copy of the rule, updated to apply to the creator of a Resource. - * @since 1.6.0 - */ -function setCreator$1(rule) { - // The second argument should not be part of the function signature, - // so it's not in the parameter list: - // eslint-disable-next-line prefer-rest-params - if (typeof arguments === "object" && typeof arguments[1] === "boolean") { - throw new Error("The function `setCreator` no longer takes a second parameter. It is now used together with `removeCreator` instead."); - } - return addIri(rule, acp.agent, acp.CreatorAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Rule to no longer apply to the creator of a Resource. - * - * @param rule The rule being modified. - * @returns A copy of the rule, updated to apply/not apply to the creator of a Resource. - * @since 1.6.0 - */ -function removeCreator$1(rule) { - return removeIri(rule, acp.agent, acp.CreatorAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * List all the clients a [[Rule]] applies **directly** to. This will not include - * specific client classes, such as public clients. - * - * @param rule The rule from which clients are read. - * @returns A list of the WebIDs of clients included in the rule. - * @since 1.6.0 - */ -function getClientAll$1(rule) { - return getIriAll(rule, acp.client).filter((client) => client !== solid.PublicOidcClient); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrite the clients the [[Rule]] applies to with the provided Client. - * - * @param rule The rule for which clients are set. - * @param client The Client the rule should apply to. - * @returns A copy of the input rule, applying to a different set of Clients. - * @since 1.6.0 - */ -function setClient$1(rule, client) { - // Preserve the special "any client" class, which we - // don't want to overwrite with this function. - const anyClientEnabled = hasAnyClient$1(rule); - let result = setIri(rule, acp.client, client); - // Restore the "any client" class - if (anyClientEnabled) { - result = setAnyClient$1(result); - } - return result; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Apply the [[Rule]] to an additional Client. - * - * @param rule The [[Rule]] to be applied to an additional Client. - * @param client The Client the [[Rule]] should apply to. - * @returns A copy of the [[Rule]], applying to an additional Client. - * @since 1.6.0 - */ -function addClient$1(rule, client) { - return addIri(rule, acp.client, client); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Prevent the [[Rule]] from applying to a given Client directly. - * - * @param rule The [[Rule]] that should no longer apply to a given Client. - * @param client The Client the rule should no longer apply to. - * @returns A copy of the rule, not applying to the given Client. - * @since 1.6.0 - */ -function removeClient$1(rule, client) { - return removeIri(rule, acp.client, client); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the rule applies to any client, i.e. all the applications - * regardless of their identifier. - * - * @param rule The rule checked for authenticated access. - * @returns Whether the rule applies to public clients. - * @since 1.6.0 - */ -function hasAnyClient$1(rule) { - return (getIriAll(rule, acp.client).filter((client) => client === solid.PublicOidcClient).length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Make the [[Rule]] apply to any client application. - * - * @param rule The rule for which clients are set. - * @returns A copy of the rule, updated to apply to any client - * @since 1.6.0 - */ -function setAnyClient$1(rule) { - return addIri(rule, acp.client, solid.PublicOidcClient); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Make the [[Rule]] no longer apply to any client application. - * - * @param rule The rule for which clients are set. - * @returns A copy of the rule, updated to no longer apply to any client - * @since 1.6.0 - */ -function removeAnyClient$1(rule) { - return removeIri(rule, acp.client, solid.PublicOidcClient); -} -/** - * Gets a human-readable representation of the given [[Rule]] to aid debugging. - * - * Note that changes to the exact format of the return value are not considered a breaking change; - * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed. - * - * @param rule The Rule to get a human-readable representation of. - * @since 1.6.0 - */ -function ruleAsMarkdown(rule) { - let markdown = `## Rule: ${asUrl(rule)}\n\n`; - let targetEnumeration = ""; - if (hasPublic$1(rule)) { - targetEnumeration += "- Everyone\n"; - } - if (hasAuthenticated$1(rule)) { - targetEnumeration += "- All authenticated agents\n"; - } - if (hasCreator$1(rule)) { - targetEnumeration += "- The creator of this resource\n"; - } - if (hasAnyClient$1(rule)) { - targetEnumeration += "- Users of any client application\n"; - } - const targetAgents = getAgentAll$1(rule); - if (targetAgents.length > 0) { - targetEnumeration += "- The following agents:\n - "; - targetEnumeration += `${targetAgents.join("\n - ")}\n`; - } - const targetGroups = getGroupAll(rule); - if (targetGroups.length > 0) { - targetEnumeration += "- Members of the following groups:\n - "; - targetEnumeration += `${targetGroups.join("\n - ")}\n`; - } - const targetClients = getClientAll$1(rule); - if (targetClients.length > 0) { - targetEnumeration += "- Users of the following client applications:\n - "; - targetEnumeration += `${targetClients.join("\n - ")}\n`; - } - markdown += - targetEnumeration.length > 0 - ? `This rule applies to:\n${targetEnumeration}` - : "\n"; - return markdown; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @param thing the [[Thing]] to check to see if it's an ACP Policy or not - */ -function isPolicy(thing) { - return getIriAll(thing, rdf.type).includes(acp.Policy); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Initialise a new, empty [[Policy]]. - * - * @param url URL that identifies this Policy. - * @since 1.6.0 - */ -function createPolicy(url) { - const stringUrl = internal_toIriString(url); - let policyThing = createThing({ url: stringUrl }); - policyThing = setUrl(policyThing, rdf.type, acp.Policy); - return policyThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the [[Policy]] with the given URL from an [[SolidDataset]]. - * - * @param policyResource The Resource that contains the given Policy. - * @param url URL that identifies this Policy. - * @returns The requested Policy, if it exists, or `null` if it does not. - * @since 1.6.0 - */ -function getPolicy(policyResource, url) { - const foundThing = getThing(policyResource, url); - if (foundThing === null || !isPolicy(foundThing)) { - return null; - } - return foundThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get all [[Policy]]'s in a given [[SolidDataset]]. - * - * @param policyResource The Resource that contains Access Policies. - * @since 1.6.0 - */ -function getPolicyAll(policyResource) { - const foundThings = getThingAll(policyResource); - const foundPolicies = foundThings.filter((thing) => !isThingLocal(thing) && isPolicy(thing)); - return foundPolicies; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove the given [[Policy]] from the given [[SolidDataset]]. - * - * @param policyResource The Resource that contains Access Policies. - * @param policy The Policy to remove from the resource. - * @since 1.6.0 - */ -function removePolicy(policyResource, policy) { - return removeThing(policyResource, policy); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert the given [[Policy]] into the given [[SolidDataset]], replacing previous instances of that Policy. - * - * @param policyResource The Resource that contains Access Policies. - * @param policy The Policy to insert into the Resource. - * @returns A new dataset equal to the given resource, but with the given Policy. - * @since 1.6.0 - */ -function setPolicy(policyResource, policy) { - return setThing(policyResource, policy); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given - * Policy, but with the given Access Modes allowed on it. - * - * @param policy The Policy on which to set the modes to allow. - * @param modes Modes to allow for this Policy. - * @since Not released yet. - */ -function setAllowModesV2(policy, modes) { - let newPolicy = removeAll(policy, acp.allow); - if (modes.read === true) { - newPolicy = addIri(newPolicy, acp.allow, internal_accessModeIriStrings.read); - } - if (modes.append === true) { - newPolicy = addIri(newPolicy, acp.allow, internal_accessModeIriStrings.append); - } - if (modes.write === true) { - newPolicy = addIri(newPolicy, acp.allow, internal_accessModeIriStrings.write); - } - return newPolicy; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given - * Policy, but with the given Access Modes allowed on it. - * - * @param policy The Policy on which to set the modes to allow. - * @param modes Modes to allow for this Policy. - * @since 1.6.0 - * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[setAllowModesV2]]. - */ -function setAllowModesV1(policy, modes) { - let newPolicy = removeAll(policy, acp.allow); - if (modes.read === true) { - newPolicy = addIri(newPolicy, acp.allow, acp.Read); - } - if (modes.append === true) { - newPolicy = addIri(newPolicy, acp.allow, acp.Append); - } - if (modes.write === true) { - newPolicy = addIri(newPolicy, acp.allow, acp.Write); - } - return newPolicy; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]], return which [[AccessModes]] it allows. - * - * @param policy The Policy for which you want to know the Access Modes it allows. - * @since Not released yet. - */ -function getAllowModesV2(policy) { - const allowedModes = getIriAll(policy, acp.allow); - return { - read: allowedModes.includes(internal_accessModeIriStrings.read), - append: allowedModes.includes(internal_accessModeIriStrings.append), - write: allowedModes.includes(internal_accessModeIriStrings.write), - }; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]], return which [[AccessModes]] it allows. - * - * @param policy The Policy for which you want to know the Access Modes it allows. - * @since 1.6.0 - * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[getAllowModesV2]]. - */ -function getAllowModesV1(policy) { - const allowedModes = getIriAll(policy, acp.allow); - return { - read: allowedModes.includes(acp.Read), - append: allowedModes.includes(acp.Append), - write: allowedModes.includes(acp.Write), - }; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given - * Policy, but with the given Access Modes disallowed on it. - * - * @param policy The Policy on which to set the modes to disallow. - * @param modes Modes to disallow for this Policy. - * @since Not released yet. - */ -function setDenyModesV2(policy, modes) { - let newPolicy = removeAll(policy, acp.deny); - if (modes.read === true) { - newPolicy = addIri(newPolicy, acp.deny, internal_accessModeIriStrings.read); - } - if (modes.append === true) { - newPolicy = addIri(newPolicy, acp.deny, internal_accessModeIriStrings.append); - } - if (modes.write === true) { - newPolicy = addIri(newPolicy, acp.deny, internal_accessModeIriStrings.write); - } - return newPolicy; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given - * Policy, but with the given Access Modes disallowed on it. - * - * @param policy The Policy on which to set the modes to disallow. - * @param modes Modes to disallow for this Policy. - * @since 1.6.0 - * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[setDenyModesV2]]. - */ -function setDenyModesV1(policy, modes) { - let newPolicy = removeAll(policy, acp.deny); - if (modes.read === true) { - newPolicy = addIri(newPolicy, acp.deny, acp.Read); - } - if (modes.append === true) { - newPolicy = addIri(newPolicy, acp.deny, acp.Append); - } - if (modes.write === true) { - newPolicy = addIri(newPolicy, acp.deny, acp.Write); - } - return newPolicy; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]], return which [[AccessModes]] it disallows. - * - * @param policy The Policy on which you want to know the Access Modes it disallows. - * @since Not released yet. - */ -function getDenyModesV2(policy) { - const deniedModes = getIriAll(policy, acp.deny); - return { - read: deniedModes.includes(internal_accessModeIriStrings.read), - append: deniedModes.includes(internal_accessModeIriStrings.append), - write: deniedModes.includes(internal_accessModeIriStrings.write), - }; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Given a [[Policy]], return which [[AccessModes]] it disallows. - * - * @param policy The Policy on which you want to know the Access Modes it disallows. - * @since 1.6.0 - * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[getDenyModesV2]]. - */ -function getDenyModesV1(policy) { - const deniedModes = getIriAll(policy, acp.deny); - return { - read: deniedModes.includes(acp.Read), - append: deniedModes.includes(acp.Append), - write: deniedModes.includes(acp.Write), - }; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Initialise a new, empty [[ResourcePolicy]] for the given Resource. - * - * @param resourceWithAcr The Resource to which the Policy is to apply. - * @param name The name that identifies this Policy. - * @since 1.6.0 - */ -function createResourcePolicyFor(resourceWithAcr, name) { - const acr = internal_getAcr(resourceWithAcr); - const url = new URL(getSourceUrl(acr)); - url.hash = `#${name}`; - let policyThing = createThing({ url: url.href }); - policyThing = setUrl(policyThing, rdf.type, acp.Policy); - return policyThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the [[ResourcePolicy]] with the given name that applies to a Resource - * from its Access Control Resource. - * - * @param resourceWithAcr The Resource whose ACR contains the given Policy. - * @param name The name that identifies this Policy. - * @returns The requested Policy, if it exists and applies to the given Resource, or `null` if it does not. - * @since 1.6.0 - */ -function getResourcePolicy(resourceWithAcr, name) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const url = new URL(acrUrl); - url.hash = `#${name}`; - const foundThing = getThing(acr, url.href); - if (!getPolicyUrlAll$1(resourceWithAcr).includes(url.href) || - foundThing === null || - !isPolicy(foundThing)) { - return null; - } - return foundThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the [[ResourcePolicy]] with the given name that applies to a Resource's - * Access Control Resource from that Access Control Resource. - * - * @param resourceWithAcr The Resource whose ACR contains the given Policy. - * @param name The name that identifies this Policy. - * @returns The requested Policy, if it exists and applies to the Resource's ACR, or `null` if it does not. - * @since 1.6.0 - */ -function getResourceAcrPolicy(resourceWithAcr, name) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const url = new URL(acrUrl); - url.hash = `#${name}`; - const foundThing = getThing(acr, url.href); - if (!getAcrPolicyUrlAll$1(resourceWithAcr).includes(url.href) || - foundThing === null || - !isPolicy(foundThing)) { - return null; - } - return foundThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get all [[ResourcePolicy]]'s that apply to a Resource in its Access Control - * Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies applying to it. - * @since 1.6.0 - */ -function getResourcePolicyAll(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const policyUrls = getPolicyUrlAll$1(resourceWithAcr); - const foundThings = policyUrls.map((policyUrl) => getThing(acr, policyUrl)); - const foundPolicies = foundThings.filter((thing) => thing !== null && isPolicy(thing)); - return foundPolicies; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get all [[ResourcePolicy]]'s that apply to a given Resource's Access Control - * Resource from that Access Control Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies. - * @since 1.6.0 - */ -function getResourceAcrPolicyAll(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const policyUrls = getAcrPolicyUrlAll$1(resourceWithAcr); - const foundThings = policyUrls.map((policyUrl) => getThing(acr, policyUrl)); - const foundPolicies = foundThings.filter((thing) => thing !== null && isPolicy(thing)); - return foundPolicies; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove the given [[ResourcePolicy]] from the given Resource's Access Control - * Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies. - * @param policy The Policy to remove from the Resource's Access Control Resource. - * @since 1.6.0 - */ -function removeResourcePolicy(resourceWithAcr, policy) { - const acr = internal_getAcr(resourceWithAcr); - let policyToRemove = policy; - if (typeof policyToRemove === "string") { - if (internal_isValidUrl(policyToRemove) === false) { - // If the given Policy to remove is the name of the Policy, - // resolve it to its full URL — developers usually refer to either the - // Policy itself, or by its name, as they do not have access to the ACR - // directly. - const policyUrl = new URL(getSourceUrl(acr)); - policyUrl.hash = `#${policy}`; - policyToRemove = policyUrl.href; - } - } - let policyUrlString; - if (typeof policyToRemove === "string") { - policyUrlString = policyToRemove; - } - else if (isNamedNode(policyToRemove)) { - policyUrlString = internal_toIriString(policyToRemove); - } - else { - policyUrlString = asUrl(policyToRemove, getSourceUrl(acr)); - } - // Check whether the actual Policy (i.e. with the Policy type) exists: - const matchingRule = getResourcePolicy(resourceWithAcr, new URL(policyUrlString).hash.substring(1)); - if (matchingRule === null) { - // No such Policy exists yet, so return the Resource+ACR unchanged: - return resourceWithAcr; - } - const updatedAcr = removeThing(acr, policyToRemove); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return removePolicyUrl$1(updatedResource, policyUrlString); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove the given [[ResourcePolicy]] that applies to a given Resource's Access - * Control Resource from that Access Control Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies. - * @param policy The ACR Policy to remove from the Resource's Access Control Resource. - * @since 1.6.0 - */ -function removeResourceAcrPolicy(resourceWithAcr, policy) { - const acr = internal_getAcr(resourceWithAcr); - let policyToRemove = policy; - if (typeof policyToRemove === "string") { - if (internal_isValidUrl(policyToRemove) === false) { - // If the given Policy to remove is the name of the Policy, - // resolve it to its full URL — developers usually refer to either the - // Policy itself, or by its name, as they do not have access to the ACR - // directly. - const policyUrl = new URL(getSourceUrl(acr)); - policyUrl.hash = `#${policy}`; - policyToRemove = policyUrl.href; - } - } - let policyUrlString; - if (typeof policyToRemove === "string") { - policyUrlString = policyToRemove; - } - else if (isNamedNode(policyToRemove)) { - policyUrlString = internal_toIriString(policyToRemove); - } - else { - policyUrlString = asUrl(policyToRemove, getSourceUrl(acr)); - } - // Check whether the actual Policy (i.e. with the Policy type) exists: - const matchingRule = getResourceAcrPolicy(resourceWithAcr, new URL(policyUrlString).hash.substring(1)); - if (matchingRule === null) { - // No such Policy exists yet, so return the Resource+ACR unchanged: - return resourceWithAcr; - } - const updatedAcr = removeThing(acr, policyToRemove); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return removeAcrPolicyUrl$1(updatedResource, policyUrlString); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert the given [[ResourcePolicy]] into the given Resource's Acccess Control - * Resource, replacing previous instances of that Policy. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies. - * @param policy The Policy to insert into the Resource's Access Control Resource. - * @returns A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource. - * @since 1.6.0 - */ -function setResourcePolicy$1(resourceWithAcr, policy) { - const acr = internal_getAcr(resourceWithAcr); - const updatedAcr = setThing(acr, policy); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - const policyUrl = asUrl(policy, getSourceUrl(acr)); - return addPolicyUrl$1(updatedResource, policyUrl); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert the given [[ResourcePolicy]] into the given Resource's Acccess Control - * Resource, replacing previous instances of that Policy, to apply to the Access - * Control Resource itself. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies. - * @param policy The Policy to insert into the Resource's Access Control Resource. - * @returns A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource, applying to that Access Control Resource. - * @since 1.6.0 - */ -function setResourceAcrPolicy(resourceWithAcr, policy) { - const acr = internal_getAcr(resourceWithAcr); - const updatedAcr = setThing(acr, policy); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - const policyUrl = asUrl(policy, getSourceUrl(acr)); - return addAcrPolicyUrl$1(updatedResource, policyUrl); -} -/** - * Gets a human-readable representation of the given [[Policy]] to aid debugging. - * - * Note that changes to the exact format of the return value are not considered a breaking change; - * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed. - * - * @param policy The Policy to get a human-readable representation of. - * @since 1.6.0 - * @deprecated - */ -function policyAsMarkdown(policy) { - function getStatus(allow, deny) { - if (deny) { - return "denied"; - } - if (allow) { - return "allowed"; - } - return "unspecified"; - } - const allowModes = getAllowModesV1(policy); - const denyModes = getDenyModesV1(policy); - let markdown = `## Policy: ${asUrl(policy)}\n\n`; - markdown += `- Read: ${getStatus(allowModes.read, denyModes.read)}\n`; - markdown += `- Append: ${getStatus(allowModes.append, denyModes.append)}\n`; - markdown += `- Write: ${getStatus(allowModes.write, denyModes.write)}\n`; - const allOfRules = getAllOfRuleUrlAll(policy); - const anyOfRules = getAnyOfRuleUrlAll(policy); - const noneOfRules = getNoneOfRuleUrlAll(policy); - if (allOfRules.length === 0 && - anyOfRules.length === 0 && - noneOfRules.length === 0) { - markdown += "\n\n"; - } - if (allOfRules.length > 0) { - markdown += "\nAll of these rules should match:\n"; - markdown += `- ${allOfRules.join("\n- ")}\n`; - } - if (anyOfRules.length > 0) { - markdown += "\nAt least one of these rules should match:\n"; - markdown += `- ${anyOfRules.join("\n- ")}\n`; - } - if (noneOfRules.length > 0) { - markdown += "\nNone of these rules should match:\n"; - markdown += `- ${noneOfRules.join("\n- ")}\n`; - } - return markdown; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * - * ```{warning} - * Do not use this function in production code. For use in **unit tests** that require a - * [[AccessControlResource]]. - * ``` - * - * Initialises a new empty Access Control Resource for a given Resource for use - * in **unit tests**. - * - * @param resourceUrl The URL of the Resource to which the mocked ACR should apply. - * @returns The mocked empty Access Control Resource for the given Resource. - * @since 1.6.0 - */ -function mockAcrFor(resourceUrl) { - const acrUrl = new URL("access-control-resource", resourceUrl).href; - const acr = { - ...mockSolidDatasetFrom(acrUrl), - accessTo: resourceUrl, - }; - return acr; -} -/** - * ```{warning} - * Do not use this function in production code. For use in **unit tests** that require a - * Resource with an [[AccessControlResource]]. - * ``` - * - * Attaches an Access Control Resource to a given [[SolidDataset]] for use - * in **unit tests**; e.g., unit tests that call [[getPolicyUrlAll]]. - * - * @param resource The Resource to mock up with a new resource ACL. - * @param accessControlResource The Access Control Resource to attach to the given Resource. - * @returns The input Resource with an empty resource ACL attached. - * @since 1.6.0 - */ -function addMockAcrTo(resource, accessControlResource = mockAcrFor(getSourceUrl(resource))) { - const resourceWithAcr = Object.assign(internal_cloneResource(resource), { - internal_acp: { - acr: accessControlResource, - aprs: {}, - }, - }); - return resourceWithAcr; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const v2AcpFunctions = { - getFileWithAccessDatasets, - getFileWithAcr, - getReferencedPolicyUrlAll, - getResourceInfoWithAccessDatasets, - getResourceInfoWithAcr, - getSolidDatasetWithAccessDatasets, - getSolidDatasetWithAcr, - hasAccessibleAcr, - saveAcrFor, -}; -const v2ControlFunctions = { - acrAsMarkdown, - addAcrPolicyUrl: addAcrPolicyUrl$1, - addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1, - addMemberPolicyUrl: addMemberPolicyUrl$1, - addPolicyUrl: addPolicyUrl$1, - getAcrPolicyUrlAll: getAcrPolicyUrlAll$1, - getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1, - getMemberPolicyUrlAll: getMemberPolicyUrlAll$1, - getPolicyUrlAll: getPolicyUrlAll$1, - hasLinkedAcr, - removeAcrPolicyUrl: removeAcrPolicyUrl$1, - removeAcrPolicyUrlAll, - removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1, - removeMemberAcrPolicyUrlAll, - removeMemberPolicyUrl: removeMemberPolicyUrl$1, - removeMemberPolicyUrlAll, - removePolicyUrl: removePolicyUrl$1, - removePolicyUrlAll, -}; -const v2PolicyFunctions = { - createPolicy, - getAllowModes: getAllowModesV1, - getDenyModes: getDenyModesV1, - getPolicy, - getPolicyAll, - policyAsMarkdown, - removePolicy, - setAllowModes: setAllowModesV1, - setDenyModes: setDenyModesV1, - setPolicy, -}; -const v2RuleFunctions = { - addAgent: addAgent$1, - addForbiddenRuleUrl: addNoneOfRuleUrl, - addGroup, - addOptionalRuleUrl: addAnyOfRuleUrl, - addRequiredRuleUrl: addAllOfRuleUrl, - createRule, - getAgentAll: getAgentAll$1, - getForbiddenRuleUrlAll: getNoneOfRuleUrlAll, - getGroupAll, - getOptionalRuleUrlAll: getAnyOfRuleUrlAll, - getRequiredRuleUrlAll: getAllOfRuleUrlAll, - getRule, - getRuleAll, - hasAuthenticated: hasAuthenticated$1, - hasCreator: hasCreator$1, - hasPublic: hasPublic$1, - removeAgent: removeAgent$1, - removeForbiddenRuleUrl: removeNoneOfRuleUrl, - removeGroup, - removeOptionalRuleUrl: removeAnyOfRuleUrl, - removeRequiredRuleUrl: removeAllOfRuleUrl, - removeRule, - ruleAsMarkdown, - setAgent: setAgent$1, - setForbiddenRuleUrl: setNoneOfRuleUrl, - setGroup, - setOptionalRuleUrl: setAnyOfRuleUrl, - setRequiredRuleUrl: setAllOfRuleUrl, - setRule, -}; -const v2MockFunctions = { - addMockAcrTo, - mockAcrFor, -}; -/* istanbul ignore next Not a supported public API: */ -/** @deprecated Replaced by [[setPublic]] */ -function previousSetPublicSignature(rule, enable) { - return enable ? setPublic$1(rule) : removePublic$1(rule); -} -/* istanbul ignore next Not a supported public API: */ -/** @deprecated Replaced by [[setAuthenticated]] */ -function previousSetAuthenticatedSignature(rule, enable) { - return enable ? setAuthenticated$1(rule) : removeAuthenticated$1(rule); -} -/* istanbul ignore next Not a supported public API: */ -/** @deprecated Replaced by [[setCreator]] */ -function previousSetCreatorSignature(rule, enable) { - return enable ? setCreator$1(rule) : removeCreator$1(rule); -} -const deprecatedFunctions$1 = { - /** @deprecated This misspelling was included accidentally. The correct function is [[getForbiddenRuleUrlAll]]. */ - getForbiddenRuleurlAll: getNoneOfRuleUrlAll, - setPublic: previousSetPublicSignature, - setAuthenticated: previousSetAuthenticatedSignature, - setCreator: previousSetCreatorSignature, -}; -/** - * @hidden - * @deprecated Replaced by [[acp_v3]]. - */ -const acp_v2 = { - ...v2AcpFunctions, - ...v2ControlFunctions, - ...v2PolicyFunctions, - ...v2RuleFunctions, - ...v2MockFunctions, - ...deprecatedFunctions$1, -}; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const v1AcpFunctions = { - getFileWithAccessDatasets, - getFileWithAcr, - getReferencedPolicyUrlAll, - getResourceInfoWithAccessDatasets, - getResourceInfoWithAcr, - getSolidDatasetWithAccessDatasets, - getSolidDatasetWithAcr, - hasAccessibleAcr, - saveAcrFor, -}; -const v1PolicyFunctions = { - createPolicy, - getAllowModes: getAllowModesV1, - getDenyModes: getDenyModesV1, - getPolicy, - getPolicyAll, - policyAsMarkdown, - removePolicy, - setAllowModes: setAllowModesV1, - setDenyModes: setDenyModesV1, - setPolicy, -}; -const v1RuleFunctions = { - addAgent: addAgent$1, - addForbiddenRuleUrl: addNoneOfRuleUrl, - addGroup, - addOptionalRuleUrl: addAnyOfRuleUrl, - addRequiredRuleUrl: addAllOfRuleUrl, - createRule, - getAgentAll: getAgentAll$1, - getForbiddenRuleUrlAll: getNoneOfRuleUrlAll, - getGroupAll, - getOptionalRuleUrlAll: getAnyOfRuleUrlAll, - getRequiredRuleUrlAll: getAllOfRuleUrlAll, - getRule, - getRuleAll, - hasAuthenticated: hasAuthenticated$1, - hasCreator: hasCreator$1, - hasPublic: hasPublic$1, - removeAgent: removeAgent$1, - removeForbiddenRuleUrl: removeNoneOfRuleUrl, - removeGroup, - removeOptionalRuleUrl: removeAnyOfRuleUrl, - removeRequiredRuleUrl: removeAllOfRuleUrl, - removeRule, - ruleAsMarkdown, - setAgent: setAgent$1, - setForbiddenRuleUrl: setNoneOfRuleUrl, - setGroup, - setOptionalRuleUrl: setAnyOfRuleUrl, - setRequiredRuleUrl: setAllOfRuleUrl, - setRule, -}; -const v1MockFunctions = { - addMockAcrTo, - mockAcrFor, -}; -const v1ControlFunctions = { - hasLinkedAcr, - addAcrPolicyUrl: addAcrPolicyUrl$1, - addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1, - getAcrPolicyUrlAll: getAcrPolicyUrlAll$1, - getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1, - removeAcrPolicyUrl: removeAcrPolicyUrl$1, - removeAcrPolicyUrlAll, - removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1, - removeMemberAcrPolicyUrlAll, -}; -const deprecatedFunctions = { - createControl: internal_createControl, - getControl: internal_getControl, - getAllControl: internal_getControlAll, - getControlAll: internal_getControlAll, - setControl: internal_setControl, - removeControl, - addPolicyUrl: internal_addPolicyUrl, - getPolicyUrlAll: internal_getPolicyUrlAll, - removePolicyUrl: internal_removePolicyUrl, - removePolicyUrlAll: internal_removePolicyUrlAll, - addMemberPolicyUrl: internal_addMemberPolicyUrl, - getMemberPolicyUrlAll: internal_getMemberPolicyUrlAll, - removeMemberPolicyUrl: internal_getMemberPolicyUrlAll, - removeMemberPolicyUrlAll: internal_removeMemberPolicyUrlAll, - /** @deprecated This misspelling was included accidentally. The correct function is [[getForbiddenRuleUrlAll]]. */ - getForbiddenRuleurlAll: getNoneOfRuleUrlAll, - setPublic: previousSetPublicSignature, - setAuthenticated: previousSetAuthenticatedSignature, - setCreator: previousSetCreatorSignature, -}; -/** - * @hidden - * @deprecated Replaced by [[acp_v2]]. - */ -const acp_v1 = { - ...v1AcpFunctions, - ...v1PolicyFunctions, - ...v1RuleFunctions, - ...v1MockFunctions, - ...v1ControlFunctions, - ...deprecatedFunctions, -}; -/** - * ```{note} The Web Access Control specification is not yet finalised. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Remove an [[Control]] from the [[AccessControlResource]] of a Resource. - * - * @param withAccessControlResource A Resource with the Access Control Resource from which to remove an Access Control. - * @param control The [[Control]] to remove from the given Access Control Resource. - * @returns The given Resource with a new Access Control Resource equal to the original Access Control Resource, excluding the given Access Control. - * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly. - * @deprecated - */ -function removeControl(withAccessControlResource, control) { - const acr = internal_getAcr(withAccessControlResource); - const updatedAcr = removeThing(acr, control); - const updatedResource = internal_setAcr(withAccessControlResource, updatedAcr); - return updatedResource; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const v3AcpFunctions = { - getFileWithAccessDatasets, - getFileWithAcr, - getLinkedAcrUrl, - getReferencedPolicyUrlAll, - getResourceInfoWithAccessDatasets, - getResourceInfoWithAcr, - getSolidDatasetWithAccessDatasets, - getSolidDatasetWithAcr, - hasAccessibleAcr, - saveAcrFor, - isAcpControlled, -}; -const v3ControlFunctions = { - acrAsMarkdown, - addAcrPolicyUrl: addAcrPolicyUrl$1, - addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1, - addMemberPolicyUrl: addMemberPolicyUrl$1, - addPolicyUrl: addPolicyUrl$1, - getAcrPolicyUrlAll: getAcrPolicyUrlAll$1, - getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1, - getMemberPolicyUrlAll: getMemberPolicyUrlAll$1, - getPolicyUrlAll: getPolicyUrlAll$1, - hasLinkedAcr, - removeAcrPolicyUrl: removeAcrPolicyUrl$1, - removeAcrPolicyUrlAll, - removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1, - removeMemberAcrPolicyUrlAll, - removeMemberPolicyUrl: removeMemberPolicyUrl$1, - removeMemberPolicyUrlAll, - removePolicyUrl: removePolicyUrl$1, - removePolicyUrlAll, -}; -const v3PolicyFunctions = { - createPolicy, - getAllowModes: getAllowModesV1, - getDenyModes: getDenyModesV1, - getPolicy, - getPolicyAll, - policyAsMarkdown, - removePolicy, - setAllowModes: setAllowModesV1, - setDenyModes: setDenyModesV1, - setPolicy, - createResourcePolicyFor, - getResourceAcrPolicy, - getResourceAcrPolicyAll, - getResourcePolicy, - getResourcePolicyAll, - removeResourceAcrPolicy, - removeResourcePolicy, - setResourceAcrPolicy, - setResourcePolicy: setResourcePolicy$1, -}; -const v3RuleFunctions = { - addAgent: addAgent$1, - addGroup, - createRule, - getAgentAll: getAgentAll$1, - getGroupAll, - getRule, - getRuleAll, - removeAgent: removeAgent$1, - removeGroup, - removeRule, - ruleAsMarkdown, - setAgent: setAgent$1, - setGroup, - setRule, - addClient: addClient$1, - getClientAll: getClientAll$1, - hasAnyClient: hasAnyClient$1, - removeClient: removeClient$1, - setAnyClient: setAnyClient$1, - setClient: setClient$1, - removeAnyClient: removeAnyClient$1, - hasAuthenticated: hasAuthenticated$1, - hasCreator: hasCreator$1, - hasPublic: hasPublic$1, - setAuthenticated: setAuthenticated$1, - setCreator: setCreator$1, - setPublic: setPublic$1, - removeAuthenticated: removeAuthenticated$1, - removeCreator: removeCreator$1, - removePublic: removePublic$1, - getAnyOfRuleUrlAll, - addAnyOfRuleUrl, - removeAnyOfRuleUrl, - setAnyOfRuleUrl, - getAllOfRuleUrlAll, - addAllOfRuleUrl, - removeAllOfRuleUrl, - setAllOfRuleUrl, - getNoneOfRuleUrlAll, - addNoneOfRuleUrl, - removeNoneOfRuleUrl, - setNoneOfRuleUrl, - createResourceRuleFor, - getResourceRule, - getResourceRuleAll, - removeResourceRule, - setResourceRule, -}; -const v3MockFunctions = { - addMockAcrTo, - mockAcrFor, -}; -/** - * @hidden - * @deprecated Please import "acp_ess_1" directly. - */ -const acp_v3 = { - ...v3AcpFunctions, - ...v3ControlFunctions, - ...v3PolicyFunctions, - ...v3RuleFunctions, - ...v3MockFunctions, -}; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function setAccessControlResourceThing(resource, thing) { - return Object.assign(internal_cloneResource(resource), { - internal_acp: { - ...resource.internal_acp, - acr: setThing(resource.internal_acp.acr, thing), - }, - }); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function getAccessControlTypeFromDefaultAccessControlName(name) { - if (name.includes("Member")) { - return ACP.memberAccessControl; - } - return ACP.accessControl; -} -/** @hidden */ -function setDefaultAccessControlThingIfNotExist(resource, name) { - const defaultAccessControlThingUrl = getDefaultAccessControlUrl(resource, name); - const acr = internal_getAcr(resource); - // Get the Access Control Resource Thing or create it - let accessControlResourceThing = getAccessControlResourceThing(resource); - if (accessControlResourceThing === null || - typeof accessControlResourceThing === "undefined") { - accessControlResourceThing = createThing({ url: getSourceUrl(acr) }); - } - // Get the Default Access Control Thing or create it and return - const accessControlUrlAll = getIriAll(accessControlResourceThing, getAccessControlTypeFromDefaultAccessControlName(name)); - if (!accessControlUrlAll.includes(defaultAccessControlThingUrl)) { - accessControlResourceThing = buildThing(accessControlResourceThing) - .addUrl(getAccessControlTypeFromDefaultAccessControlName(name), defaultAccessControlThingUrl) - .build(); - return setAccessControlResourceThing(resource, accessControlResourceThing); - } - // Return the original resource if the ACR and Default AC exist - return resource; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Add a policy applying to the ACR of the given resource. - * - * @param resourceWithAcr The resource for which to add the URL of a policy - * applying to its access control resource. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function addAcrPolicyUrl(resourceWithAcr, policyUrl) { - const resourceWithAcrContainingDefaultAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_ACR_ACCESS_CONTROL); - const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultAccessControl, DEFAULT_ACR_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcrContainingDefaultAccessControl, buildThing(defaultAccessControlThing).addUrl(ACP.access, policyUrl).build()); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Add a policy applying to the ACRs of the given resource's children. - * - * @param resourceWithAcr The resource for which to add the URL of a policy - * applying to its children's access control resources. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function addMemberAcrPolicyUrl(resourceWithAcr, policyUrl) { - const resourceWithAcrContainingDefaultAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_MEMBER_ACR_ACCESS_CONTROL); - const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultAccessControl, DEFAULT_MEMBER_ACR_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcrContainingDefaultAccessControl, buildThing(defaultAccessControlThing).addUrl(ACP.access, policyUrl).build()); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Add a policy applying to the given resource's children. - * - * @param resourceWithAcr The resource for which to add the URL of a policy - * applying to its children. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function addMemberPolicyUrl(resourceWithAcr, policyUrl) { - const resourceWithAcrContainingDefaultMemberAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_MEMBER_ACCESS_CONTROL); - const defaultMemberAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultMemberAccessControl, DEFAULT_MEMBER_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcrContainingDefaultMemberAccessControl, buildThing(defaultMemberAccessControlThing) - .addUrl(ACP.apply, policyUrl) - .build()); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Add a policy applying to the given resource. - * - * @param resourceWithAcr The resource for which to add the URL of a policy - * applying to it. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function addPolicyUrl(resourceWithAcr, policyUrl) { - const resourceWithAcrContainingDefaultAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_ACCESS_CONTROL); - const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultAccessControl, DEFAULT_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcrContainingDefaultAccessControl, buildThing(defaultAccessControlThing).addUrl(ACP.apply, policyUrl).build()); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Get the URL of all access controls linked to the given resource's ACR. - * - * @param resourceWithAcr The resource for which to retrieve URLs of access - * controls applying to it. - * @returns Access Control URL array - * @since 1.6.0 - */ -function getAccessControlUrlAll(resourceWithAcr) { - const acrThing = getAccessControlResourceThing(resourceWithAcr); - if (acrThing === null) { - return []; - } - return getIriAll(acrThing, ACP.accessControl); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function getPolicyUrls(resource, accessControlUrls, type) { - const acr = internal_getAcr(resource); - return Array.from(new Set(accessControlUrls - .map((accessControlUrl) => { - const accessControlThing = getThing(acr, accessControlUrl); - // istanbul ignore next - if (accessControlThing !== null) { - return getIriAll(accessControlThing, type); - } - // istanbul ignore next - return []; - }) - .reduce((previousValue, currentValue) => previousValue.concat(currentValue), []))); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Get the URLs of policies applying to the ACR of the given resource. - * - * @param resourceWithAcr The resource for which to retrieve URLs of policies - * applying to its access control resource. - * @returns Policy URL array. - * @since 1.16.1 - */ -function getAcrPolicyUrlAll(resourceWithAcr) { - return getPolicyUrls(resourceWithAcr, getAccessControlUrlAll(resourceWithAcr), ACP.access); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Get the URL of all member access controls linked to the given resource's ACR. - * - * @param resourceWithAcr The resource for which to retrieve URLs of access - * controls inherited by its children. - * @returns Access Control URL array - * @since 1.6.0 - */ -function getMemberAccessControlUrlAll(resourceWithAcr) { - const acrThing = getAccessControlResourceThing(resourceWithAcr); - if (acrThing === null) { - return []; - } - return getIriAll(acrThing, ACP.memberAccessControl); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Get the URLs of policies applying to the ACRs of the given resource's - * children. - * - * @param resourceWithAcr The resource for which to retrieve URLs of policies - * applying to its children's access control resources. - * @returns Policy URL array. - * @since 1.16.1 - */ -function getMemberAcrPolicyUrlAll(resourceWithAcr) { - return getPolicyUrls(resourceWithAcr, getMemberAccessControlUrlAll(resourceWithAcr), ACP.access); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Get the URLs of policies applying to the given resource's children. - * - * @param resourceWithAcr The resource for which to retrieve URLs policies - * applying to its children. - * @returns Policy URL array. - * @since 1.16.1 - */ -function getMemberPolicyUrlAll(resourceWithAcr) { - return getPolicyUrls(resourceWithAcr, getMemberAccessControlUrlAll(resourceWithAcr), ACP.apply); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Get the URLs of policies applying to the given resource. - * - * @param resourceWithAcr The resource for which to retrieve URLs of policies - * applying to it. - * @returns Policy URL array. - * @since 1.16.1 - */ -function getPolicyUrlAll(resourceWithAcr) { - return getPolicyUrls(resourceWithAcr, getAccessControlUrlAll(resourceWithAcr), ACP.apply); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Remove a policy applying to the ACR of the given resource. - * - * @param resourceWithAcr The resource for which to remove the URL of a policy - * applying to its access control resource. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function removeAcrPolicyUrl(resourceWithAcr, policyUrl) { - const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_ACR_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.access, policyUrl)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Remove a policy applying to the ACRs of the given resource's children. - * - * @param resourceWithAcr The resource for which to remove the URL of a policy - * applying to its children's access control resources. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function removeMemberAcrPolicyUrl(resourceWithAcr, policyUrl) { - const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_MEMBER_ACR_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.access, policyUrl)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Remove a policy applying to the given resource's children. - * - * @param resourceWithAcr The resource for which to remove the URL of a policy - * applying to its children. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function removeMemberPolicyUrl(resourceWithAcr, policyUrl) { - const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_MEMBER_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.apply, policyUrl)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Remove a policy applying to the given resource. - * - * @param resourceWithAcr The resource for which to remove the URL of a policy - * applying to it. - * @param policyUrl A Policy URL. - * @returns The resource with its ammended access control resource. - * @since 1.16.1 - */ -function removePolicyUrl(resourceWithAcr, policyUrl) { - const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_ACCESS_CONTROL); - return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.apply, policyUrl)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Insert the given [[ResourcePolicy]] into the given Resource's Acccess Control - * Resource, replacing previous instances of that Policy. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies. - * @param policy The Policy to insert into the Resource's Access Control Resource. - * @returns A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource. - * @since 1.18.0 - */ -function setResourcePolicy(resourceWithAcr, policy) { - return setAccessControlResourceThing(resourceWithAcr, policy); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * @param thing the [[Thing]] to check to see if it's an ACP Matcher or not - */ -function isMatcher(thing) { - return getIriAll(thing, rdf.type).includes(acp.Matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a Matcher that refines the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is **not** present in **any** of the "All Of" Matchers, - * they will not be granted access. - * - * Also see [[addAnyOfMatcherUrl]] and [[addNoneOfMatcherUrl]]. - * - * @param policy The [[Policy]] to which the Matcher should be added. - * @param matcher The Matcher to add to the policy. - * @returns A new [[Policy]] clone of the original one, with the new Matcher added. - * @since Not released yet. - */ -function addAllOfMatcherUrl(policy, matcher) { - return addIri(policy, acp.allOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes a Matcher that refines the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is **not** present in **any** of the "All Of" Matchers, - * they will not be granted access. - * @param policy The [[Policy]] from which the Matcher should be removed. - * @param matcher The Matcher to remove from the policy. - * @returns A new [[Policy]] clone of the original one, with the Matcher removed. - * @since Not released yet. - */ -function removeAllOfMatcherUrl(policy, matcher) { - return removeIri(policy, acp.allOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrites the Matcher refining the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is **not** present in **any** of the "All Of" Matchers, - * they will not be granted access. - * @param policy The [[Policy]] to which the Matcher should be added. - * @param matcher The Matcher to set for the Policy. - * @returns A new [[Policy]] clone of the original one, with the "All Of" Matchers replaced. - * @since Not released yet. - */ -function setAllOfMatcherUrl(policy, matcher) { - return setIri(policy, acp.allOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the "All Of" [[Matcher]]s for the given [[Policy]] - * @param policy The [[policy]] from which the Matchers should be read. - * @returns A list of the "All Of" [[Matcher]]s - * @since Not released yet. - */ -function getAllOfMatcherUrlAll(policy) { - return getIriAll(policy, acp.allOf); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a Matcher that extends the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the "Any Of" Matchers, - * they will be granted access. - * - * Also see [[addAllOfMatcherUrl]] and [[addNoneOfMatcherUrl]]. - * - * @param policy The [[Policy]] to which the Matcher should be added. - * @param matcher The Matcher to add to the policy. - * @returns A new [[Policy]] clone of the original one, with the new Matcher added. - * @since Not released yet. - */ -function addAnyOfMatcherUrl(policy, matcher) { - return addIri(policy, acp.anyOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes a Matcher that extends the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the "Any Of" Matchers, - * they will be granted access. - * @param policy The [[Policy]] from which the Matcher should be removed. - * @param matcher The Matcher to remove from the policy. - * @returns A new [[Policy]] clone of the original one, with the Matcher removed. - * @since Not released yet. - */ -function removeAnyOfMatcherUrl(policy, matcher) { - return removeIri(policy, acp.anyOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrite the Matcher extending the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is present in **any** of the "Any Of" Matchers, - * they will be granted access. - * @param policy The [[Policy]] to which the Matcher should be added. - * @param matcher The Matcher to set for the Policy. - * @returns A new [[Policy]] clone of the original one, with the "Any Of" Matchers replaced. - * @since Not released yet. - */ -function setAnyOfMatcherUrl(policy, matcher) { - return setIri(policy, acp.anyOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the "Any Of" [[Matcher]]s for the given [[Policy]] - * @param policy The [[policy]] from which the Matchers should be read. - * @returns A list of the "Any Of" [[Matcher]]s - * @since Not released yet. - */ -function getAnyOfMatcherUrlAll(policy) { - return getIriAll(policy, acp.anyOf); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Add a Matcher that restricts the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is matched by another Matcher, but **also** - * by the given Matcher, they will **not** be granted access. - * - * Also see [[addAllOfMatcherUrl]] and [[addAnyOfMatcherUrl]]. - * - * @param policy The [[Policy]] to which the Matcher should be added. - * @param matcher The Matcher to add to the policy. - * @returns A new [[Policy]] clone of the original one, with the new Matcher added. - * @since Not released yet. - */ -function addNoneOfMatcherUrl(policy, matcher) { - return addIri(policy, acp.noneOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes a Matcher that restricts the scope of a given the [[Policy]]. If an agent - * requesting access to a resource is matched by another Matcher, but **also** - * in any of the "None Of" Matchers, they will **not** be granted access. - * - * @param policy The [[Policy]] from which the Matcher should be removed. - * @param matcher The Matcher to remove from the policy. - * @returns A new [[Policy]] clone of the original one, with the Matcher removed. - * @since Not released yet. - */ -function removeNoneOfMatcherUrl(policy, matcher) { - return removeIri(policy, acp.noneOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set the Matchers restricting the scope of a given [[Policy]]. If an agent - * requesting access to a resource is matched by another Matcher, but **also** - * by any of the "None Of" Matchers, they will not be granted access. - * - * @param policy The [[Policy]] to which the Matcher should be added. - * @param matcher The Matcher to set for the Policy. - * @returns A new [[Policy]] clone of the original one, with the "None Of" Matchers replaced. - * @since Not released yet. - */ -function setNoneOfMatcherUrl(policy, matcher) { - return setIri(policy, acp.noneOf, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the "None Of" [[Matcher]]s for the given [[Policy]] - * @param policy The [[policy]] from which the Matchers should be read. - * @returns A list of the forbidden [[Matcher]]s - * @since Not released yet. - */ -function getNoneOfMatcherUrlAll(policy) { - return getIriAll(policy, acp.noneOf); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Initialise a new, empty [[Matcher]]. - * - * @param url URL that identifies this [[Matcher]]. - * @since Not released yet. - */ -function createMatcher(url) { - const stringUrl = internal_toIriString(url); - let matcherThing = createThing({ url: stringUrl }); - matcherThing = setUrl(matcherThing, rdf.type, acp.Matcher); - return matcherThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Initialise a new, empty [[ResourceMatcher]] for the given Resource. - * - * @param resourceWithAcr The Resource to which the new Matcher is to apply. - * @param name Name that identifies this [[Matcher]]. - * @since Not released yet. - */ -function createResourceMatcherFor(resourceWithAcr, name) { - const acr = internal_getAcr(resourceWithAcr); - const url = new URL(getSourceUrl(acr)); - url.hash = `#${name}`; - let matcherThing = createThing({ url: url.href }); - matcherThing = setUrl(matcherThing, rdf.type, acp.Matcher); - return matcherThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the [[Matcher]] with the given URL from an [[SolidDataset]]. - * - * @param matcherResource The Resource that contains the given [[Matcher]]. - * @param url URL that identifies this [[Matcher]]. - * @returns The requested [[Matcher]], if it exists, or `null` if it does not. - * @since Not released yet. - */ -function getMatcher(matcherResource, url) { - const foundThing = getThing(matcherResource, url); - if (foundThing === null || !isMatcher(foundThing)) { - return null; - } - return foundThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Get the [[ResourceMatcher]] with the given name from an Resource's Access Control - * Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains the given [[ResourceMatcher]]. - * @param name Name that identifies this [[ResourceMatcher]]. - * @returns The requested [[ResourceMatcher]], if it exists, or `null` if it does not. - * @since Not released yet. - */ -function getResourceMatcher(resourceWithAcr, name) { - const acr = internal_getAcr(resourceWithAcr); - const acrUrl = getSourceUrl(acr); - const url = new URL(acrUrl); - url.hash = `#${name}`; - const foundThing = getThing(acr, url.href); - if (foundThing === null || !isMatcher(foundThing)) { - return null; - } - return foundThing; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Gets the [[Matcher]]s from a [[SolidDataset]]. - * - * @param matcherResource The Resource that contains (zero or more) [[Matcher]]s. - * @returns The [[Matcher]]s contained in this resource. - * @since Not released yet. - */ -function getMatcherAll(matcherResource) { - const things = getThingAll(matcherResource); - return things.filter(isMatcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Gets the [[ResourceMatcher]]s from a Resource's Access Control Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceMatcher]]s. - * @returns The [[ResourceMatcher]]s contained in this Resource's Access Control Resource. - * @since Not released yet. - */ -function getResourceMatcherAll(resourceWithAcr) { - const acr = internal_getAcr(resourceWithAcr); - const things = getThingAll(acr); - return things.filter(isMatcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes the given [[Matcher]] from the given [[SolidDataset]]. - * - * @param matcherResource The Resource that contains (zero or more) [[Matcher]]s. - * @returns A new SolidDataset equal to the given Matcher Resource, but without the given Matcher. - * @since Not released yet. - */ -function removeMatcher(matcherResource, matcher) { - return removeThing(matcherResource, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Removes the given [[ResourceMatcher]] from the given Resource's Access Control Resource. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceMatcher]]s. - * @returns A new Resource equal to the given Resource, but without the given Matcher in its ACR. - * @since Not released yet. - */ -function removeResourceMatcher(resourceWithAcr, matcher) { - const acr = internal_getAcr(resourceWithAcr); - let matcherToRemove; - if (typeof matcher === "string") { - if (internal_isValidUrl(matcher)) { - matcherToRemove = matcher; - } - else { - // If the given Matcher to remove is the name of the Matcher, - // resolve it to its full URL — developers usually refer to either the - // Matcher itself, or by its name, as they do not have access to the ACR - // directly. - const matcherUrl = new URL(getSourceUrl(acr)); - matcherUrl.hash = `#${matcher}`; - matcherToRemove = matcherUrl.href; - } - } - else if (isNamedNode(matcher)) { - matcherToRemove = internal_toIriString(matcher); - } - else { - matcherToRemove = asUrl(matcher); - } - // Check whether the actual Matcher (i.e. with the Matcher type) exists: - const matchingMatcher = getResourceMatcher(resourceWithAcr, new URL(matcherToRemove).hash.substring(1)); - if (matchingMatcher === null) { - // No such Matcher exists yet, so return the Resource+ACR unchanged: - return resourceWithAcr; - } - const updatedAcr = removeThing(acr, matchingMatcher); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return updatedResource; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert the given [[Matcher]] into the given [[SolidDataset]], replacing previous - * instances of that Matcher. - * - * @param matcherResource The Resource that contains (zero or more) [[Matcher]]s. - * @returns A new SolidDataset equal to the given Matcher Resource, but with the given Matcher. - * @since Not released yet. - */ -function setMatcher(matcherResource, matcher) { - return setThing(matcherResource, matcher); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Insert the given [[ResourceMatcher]] into the given Resource's Access Control Resource, - * replacing previous instances of that Matcher. - * - * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceMatcher]]s. - * @returns A new Resource equal to the given Resource, but with the given Matcher in its ACR. - * @since Not released yet. - */ -function setResourceMatcher(resourceWithAcr, matcher) { - const acr = internal_getAcr(resourceWithAcr); - const updatedAcr = setThing(acr, matcher); - const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr); - return updatedResource; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * List all the agents a [[Matcher]] applies **directly** to. This will not include agents - * that are matched on a property other than their WebID. - * - * @param matcher The matcher from which agents are read. - * @returns A list of the WebIDs of agents included in the matcher. - * @since Not released yet. - */ -function getAgentAll(matcher) { - return getIriAll(matcher, acp.agent).filter((agent) => agent !== acp.PublicAgent && - agent !== acp.AuthenticatedAgent && - agent !== acp.CreatorAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrite the agents the [[Matcher]] applies to with the provided agents. - * - * @param matcher The matcher for which agents are set. - * @param agent The agent the matcher should apply to. - * @returns A copy of the input matcher, applying to a different set of agents. - * @since Not released yet. - */ -function setAgent(matcher, agent) { - // Preserve the special agent classes authenticated and public, which we - // don't want to overwrite with this function. - const isPublic = hasPublic(matcher); - const isAuthenticated = hasAuthenticated(matcher); - const isCreator = hasCreator(matcher); - let result = setIri(matcher, acp.agent, agent); - // Restore public and authenticated - if (isPublic) { - result = setPublic(result); - } - if (isAuthenticated) { - result = setAuthenticated(result); - } - if (isCreator) { - result = setCreator(result); - } - return result; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Apply the [[Matcher]] to an additional agent. - * - * @param matcher The [[Matcher]] to be applied to an additional agent. - * @param agent The agent the [[Matcher]] should apply to. - * @returns A copy of the [[Matcher]], applying to an additional agent. - * @since Not released yet. - */ -function addAgent(matcher, agent) { - return addIri(matcher, acp.agent, agent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Prevent the [[Matcher]] from applying to a given agent directly. This will not - * prevent the agent from matching on other properties than its WebID. - * - * @param matcher The [[Matcher]] that should no longer apply to a given agent. - * @param agent The agent the Matcher should no longer apply to. - * @returns A copy of the Matcher, not applying to the given agent. - * @since Not released yet. - */ -function removeAgent(matcher, agent) { - return removeIri(matcher, acp.agent, agent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the Matcher applies to any agent. - * - * @param matcher The Matcher checked for public access. - * @returns Whether the Matcher applies to any agent or not. - * @since Not released yet. - */ -function hasPublic(matcher) { - return (getIriAll(matcher, acp.agent).filter((agent) => agent === acp.PublicAgent) - .length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Matcher to apply to any Agent. - * - * @param matcher The Matcher being modified. - * @returns A copy of the Matcher, updated to apply to any agent. - * @since Not released yet. - */ -function setPublic(matcher) { - // The second argument should not be part of the function signature, - // so it's not in the parameter list: - // eslint-disable-next-line prefer-rest-params - if (typeof arguments === "object" && typeof arguments[1] === "boolean") { - throw new Error("The function `setPublic` no longer takes a second parameter. It is now used together with `removePublic` instead."); - } - return addIri(matcher, acp.agent, acp.PublicAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Matcher to no longer apply to any Agent. - * - * @param matcher The Matcher being modified. - * @returns A copy of the Matcher, updated to no longer apply to any agent. - * @since Not released yet. - */ -function removePublic(matcher) { - return removeIri(matcher, acp.agent, acp.PublicAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the Matcher applies to any authenticated agent. - * - * @param matcher The Matcher checked for authenticated access. - * @returns Whether the Matcher applies to any authenticated agent or not. - * @since Not released yet. - */ -function hasAuthenticated(matcher) { - return (getIriAll(matcher, acp.agent).filter((agent) => agent === acp.AuthenticatedAgent).length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Matcher to apply to any authenticated Agent. - * - * @param matcher The Matcher being modified. - * @returns A copy of the Matcher, updated to apply to any authenticated Agent. - * @since Not released yet. - */ -function setAuthenticated(matcher) { - // The second argument should not be part of the function signature, - // so it's not in the parameter list: - // eslint-disable-next-line prefer-rest-params - if (typeof arguments === "object" && typeof arguments[1] === "boolean") { - throw new Error("The function `setAuthenticated` no longer takes a second parameter. It is now used together with `removeAuthenticated` instead."); - } - return addIri(matcher, acp.agent, acp.AuthenticatedAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Matcher to no longer apply to any authenticated Agent. - * - * @param matcher The Matcher being modified. - * @returns A copy of the Matcher, updated to apply/not apply to any authenticated agent. - * @since Not released yet. - */ -function removeAuthenticated(matcher) { - return removeIri(matcher, acp.agent, acp.AuthenticatedAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the Matcher applies to the creator of the Resource. - * - * @param matcher The Matcher checked for authenticated access. - * @returns Whether the Matcher applies to the creator of the Resource or not. - * @since Not released yet. - */ -function hasCreator(matcher) { - return (getIriAll(matcher, acp.agent).filter((agent) => agent === acp.CreatorAgent) - .length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Matcher to apply to the creator of a Resource. - * - * @param matcher The Matcher being modified. - * @returns A copy of the Matcher, updated to apply to the creator of a Resource. - * @since Not released yet. - */ -function setCreator(matcher) { - // The second argument should not be part of the function signature, - // so it's not in the parameter list: - // eslint-disable-next-line prefer-rest-params - if (typeof arguments === "object" && typeof arguments[1] === "boolean") { - throw new Error("The function `setCreator` no longer takes a second parameter. It is now used together with `removeCreator` instead."); - } - return addIri(matcher, acp.agent, acp.CreatorAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Set a Matcher to no longer apply to the creator of a Resource. - * - * @param matcher The Matcher being modified. - * @returns A copy of the Matcher, updated to apply/not apply to the creator of a Resource. - * @since Not released yet. - */ -function removeCreator(matcher) { - return removeIri(matcher, acp.agent, acp.CreatorAgent); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * List all the clients a [[Matcher]] applies **directly** to. This will not include - * specific client classes, such as public clients. - * - * @param matcher The Matcher from which clients are read. - * @returns A list of the WebIDs of clients included in the Matcher. - * @since Not released yet. - */ -function getClientAll(matcher) { - return getIriAll(matcher, acp.client) - .filter((client) => client !== solid.PublicOidcClient) - .concat(getStringNoLocaleAll(matcher, acp.client)); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Overwrite the clients the [[Matcher]] applies to with the provided Client. - * - * @param matcher The Matcher for which clients are set. - * @param client The Client the Matcher should apply to. - * @returns A copy of the input Matcher, applying to a different set of Clients. - */ -function setClient(matcher, client) { - // Preserve the special "any client" class, which we - // don't want to overwrite with this function. - const anyClientEnabled = hasAnyClient(matcher); - let result = setIri(matcher, acp.client, client); - // Restore the "any client" class - if (anyClientEnabled) { - result = setAnyClient(result); - } - return result; -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Apply the [[Matcher]] to an additional Client. - * - * @param matcher The [[Matcher]] to be applied to an additional Client. - * @param client The Client the [[Matcher]] should apply to. - * @returns A copy of the [[Matcher]], applying to an additional Client. - * @since Not released yet. - */ -function addClient(matcher, client) { - if (!internal_isValidUrl(client)) { - return addStringNoLocale(matcher, acp.client, client); - } - return addIri(matcher, acp.client, client); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Prevent the [[Matcher]] from applying to a given Client directly. - * - * @param matcher The [[Matcher]] that should no longer apply to a given Client. - * @param client The Client the Matcher should no longer apply to. - * @returns A copy of the Matcher, not applying to the given Client. - * @since Not released yet. - */ -function removeClient(matcher, client) { - if (!internal_isValidUrl(client)) { - return removeStringNoLocale(matcher, acp.client, client); - } - return removeIri(matcher, acp.client, client); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Check if the Matcher applies to any client, i.e. all the applications - * regardless of their identifier. - * - * @param matcher The Matcher checked for authenticated access. - * @returns Whether the Matcher applies to public clients. - * @since Not released yet. - * @deprecated - */ -function hasAnyClient(matcher) { - return (getIriAll(matcher, acp.client).filter((client) => client === solid.PublicOidcClient).length > 0); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Make the [[Matcher]] apply to any client application. - * - * @param matcher The Matcher for which clients are set. - * @returns A copy of the Matcher, updated to apply to any client - * @since Not released yet. - * @deprecated - */ -function setAnyClient(matcher) { - return addIri(matcher, acp.client, solid.PublicOidcClient); -} -/** - * ```{note} There is no Access Control Policies specification yet. As such, this - * function is still experimental and subject to change, even in a non-major release. - * ``` - * - * Make the [[Matcher]] no longer apply to any client application. - * - * @param matcher The Matcher for which clients are set. - * @returns A copy of the Matcher, updated to no longer apply to any client - * @since Not released yet. - * @deprecated - */ -function removeAnyClient(matcher) { - return removeIri(matcher, acp.client, solid.PublicOidcClient); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const v4AcpFunctions = { - getFileWithAccessDatasets, - getFileWithAcr, - getReferencedPolicyUrlAll, - getResourceInfoWithAccessDatasets, - getResourceInfoWithAcr, - getSolidDatasetWithAccessDatasets, - getSolidDatasetWithAcr, - hasAccessibleAcr, - saveAcrFor, - isAcpControlled, - getVcAccess, - setVcAccess, -}; -const v4ControlFunctions = { - addAcrPolicyUrl, - addMemberAcrPolicyUrl, - addMemberPolicyUrl, - addPolicyUrl, - getAcrPolicyUrlAll, - getMemberAcrPolicyUrlAll, - getMemberPolicyUrlAll, - getPolicyUrlAll, - hasLinkedAcr, - removeAcrPolicyUrl, - removeAcrPolicyUrlAll, - removeMemberAcrPolicyUrl, - removeMemberAcrPolicyUrlAll, - removeMemberPolicyUrl, - removeMemberPolicyUrlAll, - removePolicyUrl, - removePolicyUrlAll, -}; -const v4PolicyFunctions = { - createPolicy, - getAllowModes: getAllowModesV2, - getDenyModes: getDenyModesV2, - getPolicy, - getPolicyAll, - removePolicy, - setAllowModes: setAllowModesV2, - setDenyModes: setDenyModesV2, - setPolicy, - createResourcePolicyFor, - getResourceAcrPolicy, - getResourceAcrPolicyAll, - getResourcePolicy, - getResourcePolicyAll, - removeResourceAcrPolicy, - removeResourcePolicy, - setResourcePolicy, -}; -const v4MatcherFunctions = { - addAgent, - createMatcher, - getAgentAll, - getMatcher, - getMatcherAll, - removeAgent, - removeMatcher, - setAgent, - setMatcher, - addClient, - getClientAll, - hasAnyClient, - removeClient, - setAnyClient, - setClient, - removeAnyClient, - hasAuthenticated, - hasCreator, - hasPublic, - setAuthenticated, - setCreator, - setPublic, - removeAuthenticated, - removeCreator, - removePublic, - getAnyOfMatcherUrlAll, - addAnyOfMatcherUrl, - removeAnyOfMatcherUrl, - setAnyOfMatcherUrl, - getAllOfMatcherUrlAll, - addAllOfMatcherUrl, - removeAllOfMatcherUrl, - setAllOfMatcherUrl, - getNoneOfMatcherUrlAll, - addNoneOfMatcherUrl, - removeNoneOfMatcherUrl, - setNoneOfMatcherUrl, - createResourceMatcherFor, - getResourceMatcher, - getResourceMatcherAll, - removeResourceMatcher, - setResourceMatcher, -}; -const v4MockFunctions = { - addMockAcrTo, - mockAcrFor, -}; -/** - * @hidden - * @deprecated Please import "acp_ess_2" directly. - */ -const acp_v4 = { - ...v4AcpFunctions, - ...v4ControlFunctions, - ...v4PolicyFunctions, - ...v4MatcherFunctions, - ...v4MockFunctions, -}; - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const knownActorRelations$1 = [acp.agent, acp.group]; -/** - * Get an overview of what access is defined for a given actor in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to this actor. - * - * Additionally, this only considers access given _explicitly_ to the given actor, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setActorAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param actorRelation What type of actor (e.g. acp:agent or acp:group) you want to get the access for. - * @param actor Which instance of the given actor type you want to get the access for. - * @returns What Access modes are granted to the given actor explicitly, or null if it could not be determined. - */ -function internal_getActorAccess$1(acpData, actorRelation, actor) { - if (acpData.inaccessibleUrls.length > 0) { - // If we can't see all access data, - // we can't reliably determine what access the given actor has: - return null; - } - const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData)); - const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData)); - const initialAccess = { - read: false, - append: false, - write: false, - controlRead: false, - controlWrite: false, - }; - // All allowed reading and writing defined in ACR policies - // determines whether the `controlRead` and `controlWrite` statuses are `true`. - const allowedAcrAccess = applicableAcrPolicies.reduce((acc, policy) => { - const allAllowedAccess = { ...acc }; - const allowModes = getAllowModesV1(policy); - if (allowModes.read) { - allAllowedAccess.controlRead = true; - } - if (allowModes.write) { - allAllowedAccess.controlWrite = true; - } - return allAllowedAccess; - }, initialAccess); - // Then allowed reading, appending and writing in regular policies - // determines whether the respective status is `true`. - const withAllowedAccess = applicablePolicies.reduce((acc, policy) => { - const allAllowedAccess = { ...acc }; - const allowModes = getAllowModesV1(policy); - if (allowModes.read) { - allAllowedAccess.read = true; - } - if (allowModes.append) { - allAllowedAccess.append = true; - } - if (allowModes.write) { - allAllowedAccess.write = true; - } - return allAllowedAccess; - }, allowedAcrAccess); - // At this point, everything that has been explicitly allowed is true. - // However, it could still be overridden by access that is explicitly denied. - // Starting with `controlRead` and `controlWrite`, - // by inspecting denied reading and writing defined in the ACR policies. - const withAcrDeniedAccess = applicableAcrPolicies.reduce((acc, policy) => { - const allDeniedAccess = { ...acc }; - const denyModes = getDenyModesV1(policy); - if (denyModes.read === true) { - allDeniedAccess.controlRead = false; - } - if (denyModes.write === true) { - allDeniedAccess.controlWrite = false; - } - return allDeniedAccess; - }, withAllowedAccess); - // And finally, we set to `false` those access modes that are explicitly denied - // in the regular policies: - const withDeniedAccess = applicablePolicies.reduce((acc, policy) => { - const allDeniedAccess = { ...acc }; - const denyModes = getDenyModesV1(policy); - if (denyModes.read === true) { - allDeniedAccess.read = false; - } - if (denyModes.append === true) { - allDeniedAccess.append = false; - } - if (denyModes.write === true) { - allDeniedAccess.write = false; - } - return allDeniedAccess; - }, withAcrDeniedAccess); - return withDeniedAccess; -} -/** - * Get an overview of what access is defined for a given Agent in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to this Agent. - * - * Additionally, this only considers access given _explicitly_ to the given Agent, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setAgentAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param webId WebID of the Agent you want to get the access for. - * @returns What Access modes are granted to the given Agent explicitly, or null if it could not be determined. - */ -function internal_getAgentAccess$1(acpData, webId) { - return internal_getActorAccess$1(acpData, acp.agent, webId); -} -/** - * Get an overview of what access is defined for a given Group in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to this Group. - * - * Additionally, this only considers access given _explicitly_ to the given Group, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setGroupAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param groupUrl URL of the Group you want to get the access for. - * @returns What Access modes are granted to the given Group explicitly, or null if it could not be determined. - */ -function internal_getGroupAccess(acpData, groupUrl) { - return internal_getActorAccess$1(acpData, acp.group, groupUrl); -} -/** - * Get an overview of what access is defined for everybody in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to everybody. - * - * Additionally, this only considers access given _explicitly_ to everybody, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setPublicAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @returns What Access modes are granted to everyone explicitly, or null if it could not be determined. - */ -function internal_getPublicAccess$1(acpData) { - return internal_getActorAccess$1(acpData, acp.agent, acp.PublicAgent); -} -function policyAppliesTo$1(policy, actorRelation, actor, acpData) { - const allowModes = getIriAll(policy, acp.allow); - const denyModes = getIriAll(policy, acp.deny); - if (allowModes.length + denyModes.length === 0) { - // A Policy that does not specify access modes does not do anything: - return false; - } - // Note: the non-null assertions (`!`) here should be valid because - // the caller of `policyAppliesTo` should already have validated that - // the return value of internal_getPoliciesAndRules() did not have any - // inaccessible URLs, so we should be able to find every Rule. - const allOfRules = getAllOfRuleUrlAll(policy).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl)); - const anyOfRules = getAnyOfRuleUrlAll(policy).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl)); - const noneOfRules = getNoneOfRuleUrlAll(policy).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl)); - // We assume that this Policy applies if this specific actor is mentioned - // and no further restrictions are in place. - // (In other words, the Policy may apply to others *in addition to* this - // actor, but if it applies to this actor *unless* some other condition holds, - // we cannot be sure whether it will apply to this actor.) - // This means that: - return ( - // Every existing allOf Rule explicitly applies explicitly to this given actor: - allOfRules.every((rule) => ruleAppliesTo(rule, actorRelation, actor)) && - // If there are anyOf Rules, at least one applies explicitly to this actor: - (anyOfRules.length === 0 || - anyOfRules.some((rule) => ruleAppliesTo(rule, actorRelation, actor))) && - // No further restrictions are in place that make this sometimes not apply - // to the given actor: - noneOfRules.length === 0); -} -function policyConflictsWith$1(policy, otherAccess) { - const allowModes = getIriAll(policy, acp.allow); - const denyModes = getIriAll(policy, acp.deny); - return ((otherAccess.read === true && denyModes.includes(acp.Read)) || - (otherAccess.read === false && - allowModes.includes(acp.Read) && - !denyModes.includes(acp.Read)) || - (otherAccess.append === true && denyModes.includes(acp.Append)) || - (otherAccess.append === false && - allowModes.includes(acp.Append) && - !denyModes.includes(acp.Append)) || - (otherAccess.write === true && denyModes.includes(acp.Write)) || - (otherAccess.write === false && - allowModes.includes(acp.Write) && - !denyModes.includes(acp.Write))); -} -function ruleAppliesTo(rule, actorRelation, actor) { - // A Rule that does not list *any* actor matches for everyone: - let isEmpty = true; - knownActorRelations$1.forEach((knownActorRelation) => { - isEmpty && (isEmpty = getIri(rule, knownActorRelation) === null); - }); - return isEmpty || getIriAll(rule, actorRelation).includes(actor); -} -/** - * Get a set of all actors mentioned in an ACR by active Rules (i.e. that are - * referenced by Policies referenced by the ACR Control, and therefore that - * effectively apply). - * - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param actorRelation - */ -function internal_findActorAll$1(acpData, actorRelation) { - const actors = new Set(); - // This code could be prettier using flat(), which isn't supported by nodeJS 10. - // If you read this comment after April 2021, feel free to refactor. - acpData.rules.forEach((rule) => { - getIriAll(rule, actorRelation) - .filter((iri) => ![ - acp.PublicAgent, - acp.CreatorAgent, - acp.AuthenticatedAgent, - ].includes(iri) || actorRelation !== acp.agent) - .forEach((iri) => actors.add(iri)); - }); - return actors; -} -/** - * Iterate through all the actors active for an ACR, and list all of their access. - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param actorRelation The type of actor we want to list access for - * @returns A map with each actor access indexed by their URL, or null if some - * external policies are referenced. - */ -function internal_getActorAccessAll$1(acpData, actorRelation) { - if (acpData.inaccessibleUrls.length > 0) { - // If we can't see all access data, - // we can't reliably determine what access actors of the given type have: - return null; - } - const result = {}; - const actors = internal_findActorAll$1(acpData, actorRelation); - actors.forEach((iri) => { - // The type assertion holds, because if internal_getActorAccess were null, - // we would have returned {} already. - const access = internal_getActorAccess$1(acpData, actorRelation, iri); - result[iri] = access; - }); - return result; -} -/** - * Get an overview of what access are defined for all Groups in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to the mentionned - * Groups. - * - * Additionally, this only considers access given _explicitly_ to individual Groups, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setAgentAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @returns A map with each Group's access indexed by their URL, or null if some - * external policies are referenced. - */ -function internal_getGroupAccessAll(acpData) { - return internal_getActorAccessAll$1(acpData, acp.group); -} -/** - * Get an overview of what access are defined for all Agents in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to the mentionned - * Agents. - * - * Additionally, this only considers access given _explicitly_ to individual Agents, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setAgentAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @returns A map with each Agent's access indexed by their WebID, or null if some - * external policies are referenced. - */ -function internal_getAgentAccessAll$1(acpData) { - return internal_getActorAccessAll$1(acpData, acp.agent); -} -/** - * Set access to a Resource for a specific actor. - * - * This function adds the relevant Access Control Policies and Rules to a - * Resource's Access Control Resource to define the given access for the given - * actor specifically. In other words, it can, for example, add Policies that - * give a particular Group Read access to the Resource. However, if other - * Policies specify that everyone in that Group is *denied* Read access *except* - * for a particular Agent, then that will be left intact. - * This means that, unless *only* this module's functions are used to manipulate - * access to this Resource, the set access might not be equal to the effective - * access for an agent matching the given actor. - * - * There are a number of preconditions that have to be fulfilled for this - * function to work: - * - Access to the Resource is determined via an Access Control Resource. - * - The Resource's Access Control Resource does not refer to (Policies or Rules - * in) other Resources. - * - The current user has access to the Resource's Access Control Resource. - * - * If those conditions do not hold, this function will return `null`. - * - * Additionally, take note that the given access will only be applied to the - * given Resource; if that Resource is a Container, access will have to be set - * for its contained Resources independently. - * - * @param resource Resource that was fetched together with its linked Access Control Resource. - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param actorRelation What type of actor (e.g. acp:agent or acp:group) you want to set the access for. - * @param actor Which instance of the given actor type you want to set the access for. - * @param access What access (read, append, write, controlRead, controlWrite) to set for the given actor. `true` to allow, `false` to deny, and `undefined` to leave unchanged. - * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not. - */ -function internal_setActorAccess$1(resource, acpData, actorRelation, actor, access) { - var _a, _b, _c, _d, _e; - if (!hasAccessibleAcr(resource) || acpData.inaccessibleUrls.length > 0) { - return null; - } - // Get the access that currently applies to the given actor - const existingAccess = internal_getActorAccess$1(acpData, actorRelation, actor); - /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that above. */ - if (existingAccess === null) { - return null; - } - // Get all Policies that apply specifically to the given actor - const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData)); - const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData)); - // We only need to override Policies that define access other than what we want: - const conflictingAcrPolicies = applicableAcrPolicies.filter((policy) => policyConflictsWith$1(policy, { - read: access.controlRead, - write: access.controlWrite, - })); - const conflictingPolicies = applicablePolicies.filter((policy) => policyConflictsWith$1(policy, { - read: access.read, - append: access.append, - write: access.write, - })); - // For every Policy that applies specifically to the given Actor, but _also_ - // to another actor (i.e. that applies using an anyOf Rule, or a Rule that - // mentions both the given and another actor)... - const otherActorAcrPolicies = conflictingAcrPolicies.filter((acrPolicy) => policyHasOtherActors$1(acrPolicy, actorRelation, actor, acpData)); - const otherActorPolicies = conflictingPolicies.filter((policy) => policyHasOtherActors$1(policy, actorRelation, actor, acpData)); - // ...check what access the current actor would have if we removed them... - const acpDataWithPoliciesExcluded = { - ...acpData, - acrPolicies: acpData.acrPolicies.filter((acrPolicy) => !otherActorAcrPolicies.includes(acrPolicy)), - policies: acpData.policies.filter((policy) => !otherActorPolicies.includes(policy)), - }; - const remainingAccess = internal_getActorAccess$1(acpDataWithPoliciesExcluded, actorRelation, actor); - /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that at the start. */ - if (remainingAccess === null) { - return null; - } - // ...add copies of those Policies and their Rules, but excluding the given actor... - let updatedResource = resource; - otherActorAcrPolicies.forEach((acrPolicy) => { - const [policyCopy, ruleCopies] = copyPolicyExcludingActor$1(acrPolicy, resource, acpData, actorRelation, actor); - updatedResource = setResourceAcrPolicy(updatedResource, policyCopy); - updatedResource = ruleCopies.reduce(setResourceRule, updatedResource); - }); - otherActorPolicies.forEach((policy) => { - const [policyCopy, ruleCopies] = copyPolicyExcludingActor$1(policy, resource, acpData, actorRelation, actor); - updatedResource = setResourcePolicy$1(updatedResource, policyCopy); - updatedResource = ruleCopies.reduce(setResourceRule, updatedResource); - }); - // ...add a new Policy that applies the given access, - // and the previously applying access for access modes that were undefined... - const newRuleName = `rule_${encodeURIComponent(`${actorRelation}_${actor}`)}`; - let newRule = createResourceRuleFor(resource, newRuleName); - newRule = setIri(newRule, actorRelation, actor); - const newControlReadAccess = (_a = access.controlRead) !== null && _a !== void 0 ? _a : existingAccess.controlRead; - const newControlWriteAccess = (_b = access.controlWrite) !== null && _b !== void 0 ? _b : existingAccess.controlWrite; - let acrPoliciesToUnapply = otherActorAcrPolicies; - // Only replace existing Policies if the defined access actually changes: - if (newControlReadAccess !== remainingAccess.controlRead || - newControlWriteAccess !== remainingAccess.controlWrite) { - const newAcrPolicyName = uuid.v4(); - let newAcrPolicy = createResourcePolicyFor(resource, newAcrPolicyName); - newAcrPolicy = setAllowModesV1(newAcrPolicy, { - read: newControlReadAccess === true, - append: false, - write: newControlWriteAccess === true, - }); - newAcrPolicy = addIri(newAcrPolicy, acp.allOf, newRule); - updatedResource = setResourceAcrPolicy(updatedResource, newAcrPolicy); - updatedResource = setResourceRule(updatedResource, newRule); - // If we don't have to set new access, we only need to unapply the - // ACR Policies that applied to both the given actor and other actors - // (because they have been replaced by clones not mentioning the given - // actor). Hence `policiesToUnApply` is initialised to `otherActorPolicies`. - // However, if we're in this if branch, that means we also had to replace - // Policies that defined access for just this actor, so we'll have to remove - // all Policies mentioning this actor: - acrPoliciesToUnapply = conflictingAcrPolicies; - } - const newReadAccess = (_c = access.read) !== null && _c !== void 0 ? _c : existingAccess.read; - const newAppendAccess = (_d = access.append) !== null && _d !== void 0 ? _d : existingAccess.append; - const newWriteAccess = (_e = access.write) !== null && _e !== void 0 ? _e : existingAccess.write; - let policiesToUnapply = otherActorPolicies; - // Only replace existing Policies if the defined access actually changes: - if (newReadAccess !== remainingAccess.read || - newAppendAccess !== remainingAccess.append || - newWriteAccess !== remainingAccess.write) { - const newPolicyName = uuid.v4(); - let newPolicy = createResourcePolicyFor(resource, newPolicyName); - newPolicy = setAllowModesV1(newPolicy, { - read: newReadAccess === true, - append: newAppendAccess === true, - write: newWriteAccess === true, - }); - newPolicy = addIri(newPolicy, acp.allOf, newRule); - updatedResource = setResourcePolicy$1(updatedResource, newPolicy); - updatedResource = setResourceRule(updatedResource, newRule); - // If we don't have to set new access, we only need to unapply the - // Policies that applied to both the given actor and other actors (because - // they have been replaced by clones not mentioning the given actor). Hence - // `policiesToUnApply` is initialised to `otherActorPolicies`. - // However, if we're in this if branch, that means we also had to replace - // Policies that defined access for just this actor, so we'll have to remove - // all Policies mentioning this actor: - policiesToUnapply = conflictingPolicies; - } - // ...then remove existing Policy URLs that mentioned both the given actor - // and other actors from the given Resource and apply the new ones (but do not - // remove the actual old Policies - they might still apply to other Resources!). - acrPoliciesToUnapply.forEach((previouslyApplicableAcrPolicy) => { - updatedResource = removeAcrPolicyUrl$1(updatedResource, asIri(previouslyApplicableAcrPolicy)); - }); - policiesToUnapply.forEach((previouslyApplicablePolicy) => { - updatedResource = removePolicyUrl$1(updatedResource, asIri(previouslyApplicablePolicy)); - }); - return updatedResource; -} -/** - * Set access to a Resource for a specific Agent. - * - * This function adds the relevant Access Control Policies and Rules to a - * Resource's Access Control Resource to define the given access for the given - * Agent specifically. In other words, it can, for example, add Policies that - * give a particular Agent Read access to the Resource. However, if other - * Policies specify that that Agent is *denied* Read access *except* if they're - * in a particular Group, then that will be left intact. - * This means that, unless *only* this function is used to manipulate access to - * this Resource, the set access might not be equal to the effective access for - * the given Agent. - * - * There are a number of preconditions that have to be fulfilled for this - * function to work: - * - Access to the Resource is determined via an Access Control Resource. - * - The Resource's Access Control Resource does not refer to (Policies or Rules - * in) other Resources. - * - The current user has access to the Resource's Access Control Resource. - * - * If those conditions do not hold, this function will return `null`. - * - * Additionally, take note that the given access will only be applied to the - * given Resource; if that Resource is a Container, access will have to be set - * for its contained Resources independently. - * - * @param resource Resource that was fetched together with its linked Access Control Resource. - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param webId Which Agent you want to set the access for. - * @param access What access (read, append, write, controlRead, controlWrite) to set for the given Agent. `true` to allow, `false` to deny, and `undefined` to leave unchanged. - * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not. - */ -function internal_setAgentAccess$1(resource, acpData, webId, access) { - return internal_setActorAccess$1(resource, acpData, acp.agent, webId, access); -} -/** - * Set access to a Resource for a specific Group. - * - * This function adds the relevant Access Control Policies and Rules to a - * Resource's Access Control Resource to define the given access for the given - * Group specifically. In other words, it can, for example, add Policies that - * give a particular Group Read access to the Resource. However, if other - * Policies specify that it is *denied* Read access *except* if they're a - * particular Agent, then that will be left intact. - * This means that, unless *only* this module's functions are used to manipulate - * access to this Resource, the set access might not be equal to the effective - * access for Agents in the given Group. - * - * There are a number of preconditions that have to be fulfilled for this - * function to work: - * - Access to the Resource is determined via an Access Control Resource. - * - The Resource's Access Control Resource does not refer to (Policies or Rules - * in) other Resources. - * - The current user has access to the Resource's Access Control Resource. - * - * If those conditions do not hold, this function will return `null`. - * - * Additionally, take note that the given access will only be applied to the - * given Resource; if that Resource is a Container, access will have to be set - * for its contained Resources independently. - * - * @param resource Resource that was fetched together with its linked Access Control Resource. - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param groupUrl Which Group you want to set the access for. - * @param access What access (read, append, write, controlRead, controlWrite) to set for the given Group. `true` to allow, `false` to deny, and `undefined` to leave unchanged. - * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not. - */ -function internal_setGroupAccess(resource, acpData, groupUrl, access) { - return internal_setActorAccess$1(resource, acpData, acp.group, groupUrl, access); -} -/** - * Set access to a Resource for everybody. - * - * This function adds the relevant Access Control Policies and Rules to a - * Resource's Access Control Resource to define the given access for everybody - * specifically. In other words, it can, for example, add Policies that - * give everybody Read access to the Resource. However, if other - * Policies specify that everybody is *denied* Read access *except* if they're - * in a particular Group, then that will be left intact. - * This means that, unless *only* this module's functions are used to manipulate - * access to this Resource, the set access might not be equal to the effective - * access for a particular Agent. - * - * There are a number of preconditions that have to be fulfilled for this - * function to work: - * - Access to the Resource is determined via an Access Control Resource. - * - The Resource's Access Control Resource does not refer to (Policies or Rules - * in) other Resources. - * - The current user has access to the Resource's Access Control Resource. - * - * If those conditions do not hold, this function will return `null`. - * - * Additionally, take note that the given access will only be applied to the - * given Resource; if that Resource is a Container, access will have to be set - * for its contained Resources independently. - * - * @param resource Resource that was fetched together with its linked Access Control Resource. - * @param acpData All Access Control Policies and Rules that apply to a particular Resource. - * @param access What access (read, append, write, controlRead, controlWrite) to set for everybody. `true` to allow, `false` to deny, and `undefined` to leave unchanged. - * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not. - */ -function internal_setPublicAccess$1(resource, acpData, access) { - return internal_setActorAccess$1(resource, acpData, acp.agent, acp.PublicAgent, access); -} -function policyHasOtherActors$1(policy, actorRelation, actor, acpData) { - // Note: the non-null assertions (`!`) here should be valid because - // the caller of `policyHasOtherActors` should already have validated - // that the return value of internal_getPoliciesAndRules() did not have - // any inaccessible URLs, so we should be able to find every Rule. - const allOfRules = getIriAll(policy, acp.allOf).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl)); - const allOfRulesHaveOtherActors = allOfRules.some((rule) => { - return ruleHasOtherActors(rule, actorRelation, actor); - }); - const anyOfRules = getIriAll(policy, acp.anyOf).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl)); - const anyOfRulesHaveOtherActors = anyOfRules.some((rule) => { - return ruleHasOtherActors(rule, actorRelation, actor); - }); - /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Rules */ - const noneOfRules = getIriAll(policy, acp.noneOf).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl)); - /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Rules */ - const noneOfRulesHaveOtherActors = noneOfRules.some((rule) => { - return ruleHasOtherActors(rule, actorRelation, actor); - }); - return (allOfRulesHaveOtherActors || - anyOfRulesHaveOtherActors || - noneOfRulesHaveOtherActors); -} -function ruleHasOtherActors(rule, actorRelation, actor) { - const otherActors = []; - knownActorRelations$1.forEach((knownActorRelation) => { - const otherActorsWithThisRelation = getIriAll(rule, knownActorRelation).filter((applicableActor) => applicableActor !== actor || knownActorRelation !== actorRelation); - // Unfortunately Node 10 does not support `.flat()` yet, hence the use of `push`: - otherActors.push(...otherActorsWithThisRelation); - }); - return otherActors.length > 0; -} -function copyPolicyExcludingActor$1(inputPolicy, resourceWithAcr, acpData, actorRelationToExclude, actorToExclude) { - const newIriSuffix = uuid.v4(); - // Create new Rules for the Policy, excluding the given Actor - const newAllOfRules = copyRulesExcludingActor(getIriAll(inputPolicy, acp.allOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude); - const newAnyOfRules = copyRulesExcludingActor(getIriAll(inputPolicy, acp.anyOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude); - const newNoneOfRules = copyRulesExcludingActor(getIriAll(inputPolicy, acp.noneOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude); - // Create a new Policy with the new Rules - let newPolicy = createResourcePolicyFor(resourceWithAcr, encodeURI(asIri(inputPolicy)) + newIriSuffix); - getIriAll(inputPolicy, acp.allow).forEach((allowMode) => { - newPolicy = addIri(newPolicy, acp.allow, allowMode); - }); - getIriAll(inputPolicy, acp.deny).forEach((denyMode) => { - newPolicy = addIri(newPolicy, acp.deny, denyMode); - }); - newAllOfRules.forEach((newRule) => { - newPolicy = addIri(newPolicy, acp.allOf, newRule); - }); - newAnyOfRules.forEach((newRule) => { - newPolicy = addIri(newPolicy, acp.anyOf, newRule); - }); - /* istanbul ignore next Policies listing noneOf Rules are left alone (because they do not unambiguously apply to the given actor always), so there will usually not be any noneOf Rules to copy. */ - newNoneOfRules.forEach((newRule) => { - newPolicy = addIri(newPolicy, acp.noneOf, newRule); - }); - return [ - newPolicy, - newAllOfRules.concat(newAnyOfRules).concat(newNoneOfRules), - ]; -} -/** Creates clones of all the Rules identified by `ruleIris` in `acpData`, excluding the given Actor */ -function copyRulesExcludingActor(ruleIris, resourceWithAcr, acpData, iriSuffix, actorRelationToExclude, actorToExclude) { - return ruleIris - .map((ruleIri) => { - const rule = acpData.rules.find((rule) => asIri(rule) === ruleIri); - /* istanbul ignore if: getPoliciesAndRules should already have fetched all referenced Rules, so this should never be true: */ - if (typeof rule === "undefined") { - return null; - } - let newRule = createResourceRuleFor(resourceWithAcr, encodeURI(asIri(rule)) + iriSuffix); - let listsOtherActors = false; - knownActorRelations$1.forEach((knownActorRelation) => { - getIriAll(rule, knownActorRelation).forEach((targetActor) => { - if (knownActorRelation === actorRelationToExclude && - targetActor === actorToExclude) { - return; - } - listsOtherActors = true; - newRule = addIri(newRule, knownActorRelation, targetActor); - }); - }); - return listsOtherActors ? newRule : null; - }) - .filter(isNotNull$1); -} -function isNotNull$1(value) { - return value !== null; -} -async function internal_getPoliciesAndRules(resource, options = internal_defaultFetchOptions) { - const acrPolicyUrls = getAcrPolicyUrlAll$1(resource); - const policyUrls = getPolicyUrlAll$1(resource); - const allPolicyResourceUrls = getResourceUrls$1(acrPolicyUrls).concat(getResourceUrls$1(policyUrls)); - const policyResources = await getResources$1(allPolicyResourceUrls, options); - const acrPolicies = getThingsFromResources$1(acrPolicyUrls, policyResources).filter(isNotNull$1); - const policies = getThingsFromResources$1(policyUrls, policyResources).filter(isNotNull$1); - const ruleUrlSet = new Set(); - acrPolicies.forEach((acrPolicy) => { - const referencedRuleUrls = getReferencedRuleUrls(acrPolicy); - referencedRuleUrls.forEach((ruleUrl) => { - ruleUrlSet.add(ruleUrl); - }); - }); - policies.forEach((policy) => { - const referencedRuleUrls = getReferencedRuleUrls(policy); - referencedRuleUrls.forEach((ruleUrl) => { - ruleUrlSet.add(ruleUrl); - }); - }); - const ruleUrls = Array.from(ruleUrlSet); - const ruleResourceUrls = ruleUrls.map((ruleUrl) => getResourceUrl$1(ruleUrl)); - const unfetchedRuleResourceUrls = ruleResourceUrls.filter((ruleResourceUrl) => !allPolicyResourceUrls.includes(ruleResourceUrl)); - const ruleResources = await getResources$1(unfetchedRuleResourceUrls, options); - const allResources = { - ...policyResources, - ...ruleResources, - }; - const rules = getThingsFromResources$1(ruleUrls, allResources).filter(isNotNull$1); - const inaccessibleUrls = Object.keys(allResources).filter((resourceUrl) => allResources[resourceUrl] === null); - return { - inaccessibleUrls, - acrPolicies, - policies, - rules, - }; -} -function getResourceUrl$1(thingUrl) { - const thingUrlObject = new URL(thingUrl); - thingUrlObject.hash = ""; - return thingUrlObject.href; -} -function getResourceUrls$1(thingUrls) { - const resourceUrls = []; - thingUrls.forEach((thingUrl) => { - const resourceUrl = getResourceUrl$1(thingUrl); - if (!resourceUrls.includes(resourceUrl)) { - resourceUrls.push(resourceUrl); - } - }); - return resourceUrls; -} -async function getResources$1(resourceUrls, options) { - const uniqueResourceUrls = Array.from(new Set(resourceUrls)); - const resources = {}; - await Promise.all(uniqueResourceUrls.map(async (resourceUrl) => { - try { - const resource = await getSolidDataset(resourceUrl, options); - resources[resourceUrl] = resource; - } - catch (e) { - resources[resourceUrl] = null; - } - })); - return resources; -} -function getThingsFromResources$1(thingUrls, resources) { - return thingUrls.map((thingUrl) => { - const resourceUrl = getResourceUrl$1(thingUrl); - const resource = resources[resourceUrl]; - if (!resource) { - return null; - } - return getThing(resource, thingUrl); - }); -} -function getReferencedRuleUrls(policy) { - return getAllOfRuleUrlAll(policy) - .concat(getAnyOfRuleUrlAll(policy)) - .concat(getNoneOfRuleUrlAll(policy)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -function universalAccessToAcl(newAccess, previousAccess) { - var _a, _b, _c, _d; - // Universal access is aligned on ACP, which means there is a distinction between - // controlRead and controlWrite. This split doesn't exist in WAC, which is why - // the type for the input variable of this function is a restriction on the - // universal Access type. - if (newAccess.controlRead !== newAccess.controlWrite) { - throw new Error("For Pods using Web Access Control, controlRead and controlWrite must be equal."); - } - return { - read: (_a = newAccess.read) !== null && _a !== void 0 ? _a : previousAccess.read, - append: (_b = newAccess.append) !== null && _b !== void 0 ? _b : previousAccess.append, - write: (_c = newAccess.write) !== null && _c !== void 0 ? _c : previousAccess.write, - control: (_d = newAccess.controlRead) !== null && _d !== void 0 ? _d : previousAccess.control, - }; -} -function aclAccessToUniversal(access) { - // In ACL, denying access to an actor is a notion that doesn't exist, so an - // access is either granted or not for a given mode. - // This creates a misalignment with the ACP notion of an access being granted, - // denied, or simply not mentioned. Here, we convert the boolean vision of - // ACL into the boolean or undefined vision of ACP. - return { - read: access.read, - write: access.write, - append: access.append, - controlRead: access.control, - controlWrite: access.control, - }; -} -async function getActorAccess(resource, actor, accessEvaluationCallback, options) { - const resourceAcl = await internal_fetchAcl(resource, options); - const wacAccess = accessEvaluationCallback(internal_setAcl(resource, resourceAcl), actor); - if (wacAccess === null) { - return null; - } - return aclAccessToUniversal(wacAccess); -} -async function getActorClassAccess(resource, accessEvaluationCallback, options) { - const resourceAcl = await internal_fetchAcl(resource, options); - const wacAccess = accessEvaluationCallback(internal_setAcl(resource, resourceAcl)); - if (wacAccess === null) { - return null; - } - return aclAccessToUniversal(wacAccess); -} -async function getActorAccessAll(resource, accessEvaluationCallback, options) { - const resourceAcl = await internal_fetchAcl(resource, options); - const wacAgentAccess = accessEvaluationCallback(internal_setAcl(resource, resourceAcl)); - if (wacAgentAccess === null) { - return null; - } - const result = {}; - for (const [webId, wacAccess] of Object.entries(wacAgentAccess)) { - result[webId] = aclAccessToUniversal(wacAccess); - } - return result; -} -/** - * For a given Resource, look up its metadata, and read the Access permissions - * granted to the given Agent. - * - * Note that this only lists permissions granted to the given Agent individually, - * and will not exhaustively list modes the given Agent may have access to because - * they apply to everyone, or because they apply to the Agent through a group for - * instance. - * - * @param resource The URL of the Resource for which we want to list Access - * @param agent The Agent for which the Access is granted - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns What Access modes are granted to the given Agent explicitly, or null if it could not be determined. - */ -function getAgentAccess$4(resource, agent, options = internal_defaultFetchOptions) { - return getActorAccess(resource, agent, getAgentAccess$5, options); -} -/** - * For a given Resource, look up its metadata, and read the Access permissions - * granted to the given Group. - * - * Note that this only lists permissions granted to the given Group individually, - * and will not exhaustively list modes the given Group may have access to because - * they apply to everyone, or because they apply to the Group through another - * Group that may contain it for instance. - * - * @param resource The URL of the Resource for which we want to list Access - * @param group The Group for which the Access is granted - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns What Access modes are granted to the given Group explicitly, or null if it could not be determined. - */ -function getGroupAccess$1(resource, group, options = internal_defaultFetchOptions) { - return getActorAccess(resource, group, getGroupAccess$2, options); -} -/** - * For a given Resource, look up its metadata, and read the Access permissions - * granted to everyone. - * - * Note that this only lists permissions explicitly granted to everyone as a whole, - * and will not exhaustively list modes any individual Agent or Group may have - * access to because they specifically apply to them only. - * - * @param resource The URL of the Resource for which we want to list public Access - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns What Access modes are granted to the everyone explicitly, or null if it could not be determined. - */ -function getPublicAccess$4(resource, options = internal_defaultFetchOptions) { - return getActorClassAccess(resource, getPublicAccess$5, options); -} -/** - * For a given Resource, look up its metadata, and read the Access permissions - * granted explicitly to each individual Agent. - * - * Note that this only lists permissions granted to each Agent individually, - * and will not exhaustively list modes any Agent may have access to because - * they apply to everyone, or because they apply to an Agent through a group for - * instance. - * - * @param resource The URL of the Resource for which we want to list Agents Access - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A map of Agent WebIDs and the access granted to them, or null if it could not be determined. - */ -function getAgentAccessAll$4(resource, options = internal_defaultFetchOptions) { - return getActorAccessAll(resource, getAgentAccessAll$5, options); -} -/** - * For a given Resource, look up its metadata, and read the Access permissions - * granted explicitly to each individual Group. - * - * Note that this only lists permissions granted to each Group individually, - * and will not exhaustively list modes any Group may have access to because - * they apply individually to all of the Agents in the Group, or to everyone - * for instance. - * - * @param resource The URL of the Resource for which we want to list Agents Access - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns A map of Group URLs and the access granted to them, or null if it could not be determined. - */ -function getGroupAccessAll$1(resource, options = internal_defaultFetchOptions) { - return getActorAccessAll(resource, getGroupAccessAll$2, options); -} -async function prepareResourceAcl(resource, options) { - if (!hasAccessibleAcl(resource)) { - return null; - } - const acl = await internal_fetchAcl(resource, options); - const resourceWithAcl = internal_setAcl(resource, acl); - let resourceAcl; - if (hasResourceAcl(resourceWithAcl)) { - // This is the simple case, where the Resource ACL we need to update already - // exists. - resourceAcl = internal_getResourceAcl(resourceWithAcl); - } - else if (hasFallbackAcl(resourceWithAcl)) { - // In this case, the Resource ACL needs to be created first, and then updated. - resourceAcl = createAclFromFallbackAcl(resourceWithAcl); - } - else { - return null; - } - return internal_setResourceAcl(resourceWithAcl, resourceAcl); -} -async function saveUpdatedAcl(resource, acl, options) { - let savedAcl = null; - try { - savedAcl = await saveAclFor(resource, acl, options); - return internal_setResourceAcl(resource, savedAcl); - } - catch (e) { - return null; - } -} -async function setActorClassAccess(resource, access, getAccess, setAccess, options) { - const resourceWithOldAcl = await prepareResourceAcl(resource, options); - if (resourceWithOldAcl === null) { - return null; - } - const resourceAcl = getResourceAcl(resourceWithOldAcl); - const currentAccess = getAccess(resourceWithOldAcl); - const wacAccess = universalAccessToAcl(access, currentAccess); - const updatedResourceAcl = setAccess(resourceAcl, wacAccess); - return saveUpdatedAcl(resourceWithOldAcl, updatedResourceAcl, options); -} -async function setActorAccess(resource, actor, access, getAccess, setAccess, options) { - const resourceWithOldAcl = await prepareResourceAcl(resource, options); - if (resourceWithOldAcl === null) { - return null; - } - const currentAccess = getAccess(resourceWithOldAcl, actor); - const resourceAcl = getResourceAcl(resourceWithOldAcl); - const wacAccess = universalAccessToAcl(access, currentAccess); - const updatedResourceAcl = setAccess(resourceAcl, actor, wacAccess); - return saveUpdatedAcl(resourceWithOldAcl, updatedResourceAcl, options); -} -/** - * Set the Access modes for a given Agent to a given Resource. - * - * Important note: if the target resource did not have a Resource ACL, and its - * Access was regulated by its Fallback ACL, said Fallback ACL is copied to create - * a new Resource ACL. This has the side effect that the next time the Fallback - * ACL is updated, the changes _will not impact_ the target resource. - * - * If the target Resource's Access mode cannot be determined, e.g. the user does - * not have Read and Write access to the target Resource's ACL, or to its - * fallback ACL if it does not have a Resource ACL, then `null` is returned. - * - * @param resource The Resource for which Access is being set - * @param agent The Agent for whom Access is being set - * @param access The Access being set - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns The Resource, with its ACL updated, or null if the new Access could not - * be set. - */ -async function setAgentResourceAccess(resource, agent, access, options = internal_defaultFetchOptions) { - return setActorAccess(resource, agent, access, getAgentAccess$5, setAgentResourceAccess$1, options); -} -/** - * Set the Access modes for a given Group to a given Resource. - * - * Important note: if the target resource did not have a Resource ACL, and its - * Access was regulated by its Fallback ACL, said Fallback ACL is copied to create - * a new Resource ACL. This has the side effect that the next time the Fallback - * ACL is updated, the changes _will not impact_ the target resource. - * - * If the target Resource's Access mode cannot be determined, e.g. the user does - * not have Read and Write access to the target Resource's ACL, or to its - * fallback ACL if it does not have a Resource ACL, then `null` is returned. - * - * @param resource The Resource for which Access is being set - * @param agent The Group for which Access is being set - * @param access The Access being set - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns The Resource, with its ACL updated, or null if the new Access could not - * be set. - */ -async function setGroupResourceAccess(resource, group, access, options = internal_defaultFetchOptions) { - return setActorAccess(resource, group, access, getGroupAccess$2, setGroupResourceAccess$1, options); -} -/** - * Set the Access modes for everyone to a given Resource. - * - * Important note: if the target resource did not have a Resource ACL, and its - * Access was regulated by its Fallback ACL, said Fallback ACL is copied to create - * a new Resource ACL. This has the side effect that the next time the Fallback - * ACL is updated, the changes _will not impact_ the target resource. - * - * If the target Resource's Access mode cannot be determined, e.g. the user does - * not have Read and Write access to the target Resource's ACL, or to its - * fallback ACL if it does not have a Resource ACL, then `null` is returned. - * - * @param resource The Resource for which Access is being set - * @param access The Access being set - * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters). - * @returns The Resource, with its ACL updated, or null if the new Access could not - * be set. - */ -async function setPublicResourceAccess(resource, access, options = internal_defaultFetchOptions) { - return setActorClassAccess(resource, access, getPublicAccess$5, setPublicResourceAccess$1, options); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// This file exists to maintain backwards compatibility with the old API as long -// as possible. Once pod.inrupt.com implements the breaking changes to Access -// Control Policies, this will be updated to point to _v2. -/** - * @hidden - * @deprecated Please import from the "universal" modules. - */ - -var universal = /*#__PURE__*/Object.freeze({ - __proto__: null, - getAccessFor: getAccessFor, - getAccessForAll: getAccessForAll, - getAgentAccess: getAgentAccess$3, - getAgentAccessAll: getAgentAccessAll$3, - getGroupAccess: getGroupAccess, - getGroupAccessAll: getGroupAccessAll, - getPublicAccess: getPublicAccess$3, - setAccessFor: setAccessFor, - setAgentAccess: setAgentAccess$3, - setGroupAccess: setGroupAccess, - setPublicAccess: setPublicAccess$3 -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -async function getAccessFor(resourceUrl, actorType, actor = internal_defaultFetchOptions, options = internal_defaultFetchOptions) { - if (actorType === "agent") { - if (typeof actor !== "string") { - throw new Error("When reading Agent-specific access, the given agent cannot be left undefined."); - } - return getAgentAccess$3(resourceUrl, actor, options); - } - if (actorType === "group") { - if (typeof actor !== "string") { - throw new Error("When reading Group-specific access, the given group cannot be left undefined."); - } - return getGroupAccess(resourceUrl, actor, options); - } - if (actorType === "public") { - if (typeof actor === "string") { - throw new Error(`When reading public access, no actor type should be specified (here [${actor}]).`); - } - return getPublicAccess$3(resourceUrl, actor); - } - return null; -} -/** - * Get an overview of what access is defined for a given set of actors: all Agents - * or all Groups. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for the given actor (Agent - * or Group). If additional restrictions are set up to apply to the given Agent - * in a particular situation, those will not be reflected in the return value - * of this function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param actorType type of actor whose access is being read. - * @returns What access is set for the given resource, grouped by resp. Agent or Group. - * @since 1.5.0 - * - * @hidden - * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people. - */ -async function getAccessForAll(resourceUrl, actorType, options = internal_defaultFetchOptions) { - if (actorType === "agent") { - return getAgentAccessAll$3(resourceUrl, options); - } - if (actorType === "group") { - return getGroupAccessAll(resourceUrl, options); - } - return null; -} -async function setAccessFor(resourceUrl, actorType, access, actor = internal_defaultFetchOptions, options = internal_defaultFetchOptions) { - if (actorType === "agent") { - if (typeof actor !== "string") { - throw new Error("When writing Agent-specific access, the given agent cannot be left undefined."); - } - return setAgentAccess$3(resourceUrl, actor, access, options); - } - if (actorType === "group") { - if (typeof actor !== "string") { - throw new Error("When writing Group-specific access, the given group cannot be left undefined."); - } - return setGroupAccess(resourceUrl, actor, access, options); - } - if (actorType === "public") { - if (typeof actor === "string") { - throw new Error(`When writing public access, no actor type should be specified (here [${actor}]).`); - } - return setPublicAccess$3(resourceUrl, access, actor); - } - return null; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Get an overview of what access is defined for a given Agent. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for the given Agent. If - * additional restrictions are set up to apply to the given Agent in a - * particular situation, those will not be reflected in the return value of - * this function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param webId WebID of the Agent you want to get the access for. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function getAgentAccess$3(resourceUrl, webId, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - return internal_getAgentAccess$1(acpData, webId); - } - if (hasAccessibleAcl(resourceInfo)) { - return getAgentAccess$4(resourceInfo, webId, options); - } - return null; -} -/** - * Set access to a Resource for a specific Agent. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably setting access, in which case it will - * resolve to `null`. - * - It will only set access explicitly for the given Agent. In other words, - * additional restrictions could be present that further restrict or loosen - * what access the given Agent has in particular circumstances. - * - The provided access will only apply to the given Resource. In other words, - * if the Resource is a Container, the configured Access may not apply to - * contained Resources. - * - If the current user does not have permission to view or change access for - * the given Resource, this function will resolve to `null`. - * - * Additionally, two caveats apply to users with a Pod server that uses WAC: - * - If the Resource did not have an ACL yet, a new one will be initialised. - * This means that changes to the ACL of a parent Container can no longer - * affect access people have to this Resource, although existing access will - * be preserved. - * - Setting different values for `controlRead` and `controlWrite` is not - * supported, and **will throw an error**. If you expect (some of) your users - * to have Pods implementing WAC, be sure to pass the same value for both. - * - * @param resourceUrl URL of the Resource you want to change the Agent's access to. - * @param webId WebID of the Agent you want to set access for. - * @param access What access permissions you want to set for the given Agent to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error. - * @returns What access has been set for the given Agent explicitly. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function setAgentAccess$3(resourceUrl, webId, access, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - const updatedResource = internal_setAgentAccess$1(resourceInfo, acpData, webId, access); - if (updatedResource) { - try { - await saveAcrFor(updatedResource, options); - return await getAgentAccess$3(resourceUrl, webId, options); - } - catch (e) { - return null; - } - } - return null; - } - if (hasAccessibleAcl(resourceInfo)) { - if (access.controlRead !== access.controlWrite) { - throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \`controlRead\` and \`controlWrite\` should have the same value.`); - } - const wacAccess = access; - await setAgentResourceAccess(resourceInfo, webId, wacAccess, options); - return getAgentAccess$4(resourceInfo, webId, options); - } - return null; -} -/** - * Get an overview of what access is defined for all Agents with respect to a given - * Resource. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for the returned Agents. If - * additional restrictions are set up to apply to the listed Agents in a - * particular situation, those will not be reflected in the return value of - * this function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @returns The access information to the Resource, grouped by Agent. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function getAgentAccessAll$3(resourceUrl, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - return internal_getAgentAccessAll$1(acpData); - } - if (hasAccessibleAcl(resourceInfo)) { - return getAgentAccessAll$4(resourceInfo, options); - } - return null; -} -/** - * Get an overview of what access is defined for a given Group. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for the given Group. If - * additional restrictions are set up to apply to the given Group in a - * particular situation, those will not be reflected in the return value of - * this function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param webId WebID of the Group you want to get the access for. - * @since 1.5.0 - * @hidden - * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people. - */ -async function getGroupAccess(resourceUrl, webId, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - return internal_getGroupAccess(acpData, webId); - } - if (hasAccessibleAcl(resourceInfo)) { - return getGroupAccess$1(resourceInfo, webId, options); - } - return null; -} -/** - * Get an overview of what access is defined for all Groups with respect to a given - * Resource. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for the returned Groups. If - * additional restrictions are set up to apply to the listed Groups in a - * particular situation, those will not be reflected in the return value of - * this function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @returns The access information to the Resource, sorted by Group. - * @since 1.5.0 - * @hidden - * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people. - */ -async function getGroupAccessAll(resourceUrl, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - return internal_getGroupAccessAll(acpData); - } - if (hasAccessibleAcl(resourceInfo)) { - return getGroupAccessAll$1(resourceInfo, options); - } - return null; -} -/** - * Set access to a Resource for a specific Group. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably setting access, in which case it will - * resolve to `null`. - * - It will only set access explicitly for the given Group. In other words, - * additional restrictions could be present that further restrict or loosen - * what access the given Group has in particular circumstances. - * - The provided access will only apply to the given Resource. In other words, - * if the Resource is a Container, the configured Access may not apply to - * contained Resources. - * - If the current user does not have permission to view or change access for - * the given Resource, this function will resolve to `null`. - * - * Additionally, two caveats apply to users with a Pod server that uses WAC: - * - If the Resource did not have an ACL yet, a new one will be initialised. - * This means that changes to the ACL of a parent Container can no longer - * affect access people have to this Resource, although existing access will - * be preserved. - * - Setting different values for `controlRead` and `controlWrite` is not - * supported, and **will throw an error**. If you expect (some of) your users - * to have Pods implementing WAC, be sure to pass the same value for both. - * - * @param resourceUrl URL of the Resource you want to change the Group's access to. - * @param groupUrl URL of the Group you want to set access for. - * @param access What access permissions you want to set for the given Group to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error. - * @returns What access has been set for the given Group explicitly. - * @since 1.5.0 - * @hidden - * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people. - */ -async function setGroupAccess(resourceUrl, groupUrl, access, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - const updatedResource = internal_setGroupAccess(resourceInfo, acpData, groupUrl, access); - if (updatedResource) { - try { - await saveAcrFor(updatedResource, options); - return await getGroupAccess(resourceUrl, groupUrl, options); - } - catch (e) { - return null; - } - } - return null; - } - if (hasAccessibleAcl(resourceInfo)) { - if (access.controlRead !== access.controlWrite) { - throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \`controlRead\` and \`controlWrite\` should have the same value.`); - } - const wacAccess = access; - await setGroupResourceAccess(resourceInfo, groupUrl, wacAccess, options); - return getGroupAccess$1(resourceInfo, groupUrl, options); - } - return null; -} -/** - * Get an overview of what access is defined for everyone. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for everyone. If - * additional restrictions are set up to apply to users in a particular - * situation, those will not be reflected in the return value of this - * function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @since 1.5.0 - * - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function getPublicAccess$3(resourceUrl, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - return internal_getPublicAccess$1(acpData); - } - if (hasAccessibleAcl(resourceInfo)) { - return getPublicAccess$4(resourceInfo, options); - } - return null; -} -/** - * Set access to a Resource for everybody. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably setting access, in which case it will - * resolve to `null`. - * - It will only set access explicitly for everybody. In other words, - * additional restrictions could be present that further restrict or loosen - * what access a user has in particular circumstances. - * - The provided access will only apply to the given Resource. In other words, - * if the Resource is a Container, the configured Access may not apply to - * contained Resources. - * - If the current user does not have permission to view or change access for - * the given Resource, this function will resolve to `null`. - * - * Additionally, two caveats apply to users with a Pod server that uses WAC: - * - If the Resource did not have an ACL yet, a new one will be initialised. - * This means that changes to the ACL of a parent Container can no longer - * affect access people have to this Resource, although existing access will - * be preserved. - * - Setting different values for `controlRead` and `controlWrite` is not - * supported, and **will throw an error**. If you expect (some of) your users - * to have Pods implementing WAC, be sure to pass the same value for both. - * - * @param resourceUrl URL of the Resource you want to change public access to. - * @param access What access permissions you want to set for everybody to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error. - * @returns What access has been set for everybody explicitly. - * @since 1.5.0 - * - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function setPublicAccess$3(resourceUrl, access, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndRules(resourceInfo, options); - const updatedResource = internal_setPublicAccess$1(resourceInfo, acpData, access); - if (updatedResource) { - try { - await saveAcrFor(updatedResource, options); - return await getPublicAccess$3(resourceUrl, options); - } - catch (e) { - return null; - } - } - return null; - } - if (hasAccessibleAcl(resourceInfo)) { - if (access.controlRead !== access.controlWrite) { - throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \`controlRead\` and \`controlWrite\` should have the same value.`); - } - const wacAccess = access; - await setPublicResourceAccess(resourceInfo, wacAccess, options); - return getPublicAccess$4(resourceInfo, options); - } - return null; -} - -var universal_v1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - getAccessFor: getAccessFor, - getAccessForAll: getAccessForAll, - getAgentAccess: getAgentAccess$3, - getAgentAccessAll: getAgentAccessAll$3, - getGroupAccess: getGroupAccess, - getGroupAccessAll: getGroupAccessAll, - getPublicAccess: getPublicAccess$3, - setAccessFor: setAccessFor, - setAgentAccess: setAgentAccess$3, - setGroupAccess: setGroupAccess, - setPublicAccess: setPublicAccess$3 -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -const knownActorRelations = [acp.agent]; -/** - * Get an overview of what access is defined for a given actor in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to this actor. - * - * Additionally, this only considers access given _explicitly_ to the given actor, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setActorAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @param actorRelation What type of actor (e.g. acp:agent) you want to get the access for. - * @param actor Which instance of the given actor type you want to get the access for. - * @returns What Access modes are granted to the given actor explicitly, or null if it could not be determined. - */ -function internal_getActorAccess(acpData, actorRelation, actor) { - if (acpData.inaccessibleUrls.length > 0) { - // If we can't see all access data, - // we can't reliably determine what access the given actor has: - return null; - } - const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData)); - const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData)); - const initialAccess = { - read: false, - append: false, - write: false, - controlRead: false, - controlWrite: false, - }; - // All allowed reading and writing defined in ACR policies - // determines whether the `controlRead` and `controlWrite` statuses are `true`. - const allowedAcrAccess = applicableAcrPolicies.reduce((acc, policy) => { - const allAllowedAccess = { ...acc }; - const allowModes = getAllowModesV2(policy); - if (allowModes.read) { - allAllowedAccess.controlRead = true; - } - if (allowModes.write) { - allAllowedAccess.controlWrite = true; - } - return allAllowedAccess; - }, initialAccess); - // Then allowed reading, appending and writing in regular policies - // determines whether the respective status is `true`. - const withAllowedAccess = applicablePolicies.reduce((acc, policy) => { - const allAllowedAccess = { ...acc }; - const allowModes = getAllowModesV2(policy); - if (allowModes.read) { - allAllowedAccess.read = true; - } - if (allowModes.append) { - allAllowedAccess.append = true; - } - if (allowModes.write) { - allAllowedAccess.write = true; - } - return allAllowedAccess; - }, allowedAcrAccess); - // At this point, everything that has been explicitly allowed is true. - // However, it could still be overridden by access that is explicitly denied. - // Starting with `controlRead` and `controlWrite`, - // by inspecting denied reading and writing defined in the ACR policies. - const withAcrDeniedAccess = applicableAcrPolicies.reduce((acc, policy) => { - const allDeniedAccess = { ...acc }; - const denyModes = getDenyModesV2(policy); - if (denyModes.read === true) { - allDeniedAccess.controlRead = false; - } - if (denyModes.write === true) { - allDeniedAccess.controlWrite = false; - } - return allDeniedAccess; - }, withAllowedAccess); - // And finally, we set to `false` those access modes that are explicitly denied - // in the regular policies: - const withDeniedAccess = applicablePolicies.reduce((acc, policy) => { - const allDeniedAccess = { ...acc }; - const denyModes = getDenyModesV2(policy); - if (denyModes.read === true) { - allDeniedAccess.read = false; - } - if (denyModes.append === true) { - allDeniedAccess.append = false; - } - if (denyModes.write === true) { - allDeniedAccess.write = false; - } - return allDeniedAccess; - }, withAcrDeniedAccess); - return withDeniedAccess; -} -/** - * Get an overview of what access is defined for a given Agent in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to this Agent. - * - * Additionally, this only considers access given _explicitly_ to the given Agent, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setAgentAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @param webId WebID of the Agent you want to get the access for. - * @returns What Access modes are granted to the given Agent explicitly, or null if it could not be determined. - */ -function internal_getAgentAccess(acpData, webId) { - return internal_getActorAccess(acpData, acp.agent, webId); -} -/** - * Get an overview of what access is defined for everybody in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to everybody. - * - * Additionally, this only considers access given _explicitly_ to everybody, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setPublicAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @returns What Access modes are granted to everyone explicitly, or null if it could not be determined. - */ -function internal_getPublicAccess(acpData) { - return internal_getActorAccess(acpData, acp.agent, acp.PublicAgent); -} -function policyAppliesTo(policy, actorRelation, actor, acpData) { - const allowModes = getIriAll(policy, acp.allow); - const denyModes = getIriAll(policy, acp.deny); - if (allowModes.length + denyModes.length === 0) { - // A Policy that does not specify access modes does not do anything: - return false; - } - // Note: the non-null assertions (`!`) here should be valid because - // the caller of `policyAppliesTo` should already have validated that - // the return value of internal_getPoliciesAndMatchers() did not have any - // inaccessible URLs, so we should be able to find every Matcher. - const allOfMatchers = getAllOfMatcherUrlAll(policy).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl)); - const anyOfMatchers = getAnyOfMatcherUrlAll(policy).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl)); - const noneOfMatchers = getNoneOfMatcherUrlAll(policy).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl)); - // We assume that this Policy applies if this specific actor is mentioned - // and no further restrictions are in place. - // (In other words, the Policy may apply to others *in addition to* this - // actor, but if it applies to this actor *unless* some other condition holds, - // we cannot be sure whether it will apply to this actor.) - // This means that: - return ( - // Every existing allOf Matcher explicitly applies explicitly to this given actor: - allOfMatchers.every((matcher) => matcherAppliesTo(matcher, actorRelation, actor)) && - // If there are anyOf Matchers, at least one applies explicitly to this actor: - (anyOfMatchers.length === 0 || - anyOfMatchers.some((matcher) => matcherAppliesTo(matcher, actorRelation, actor))) && - // There is at least one allOf or anyOf Matcher: - allOfMatchers.length + anyOfMatchers.length > 0 && - // No further restrictions are in place that make this sometimes not apply - // to the given actor: - noneOfMatchers.length === 0); -} -function policyConflictsWith(policy, otherAccess) { - const allowModes = getIriAll(policy, acp.allow); - const denyModes = getIriAll(policy, acp.deny); - return ((otherAccess.read === true && - denyModes.includes(internal_accessModeIriStrings.read)) || - (otherAccess.read === false && - allowModes.includes(internal_accessModeIriStrings.read) && - !denyModes.includes(internal_accessModeIriStrings.read)) || - (otherAccess.append === true && - denyModes.includes(internal_accessModeIriStrings.append)) || - (otherAccess.append === false && - allowModes.includes(internal_accessModeIriStrings.append) && - !denyModes.includes(internal_accessModeIriStrings.append)) || - (otherAccess.write === true && - denyModes.includes(internal_accessModeIriStrings.write)) || - (otherAccess.write === false && - allowModes.includes(internal_accessModeIriStrings.write) && - !denyModes.includes(internal_accessModeIriStrings.write))); -} -function matcherAppliesTo(matcher, actorRelation, actor) { - return getIriAll(matcher, actorRelation).includes(actor); -} -/** - * Get a set of all actors mentioned in an ACR by active Matchers (i.e. that are - * referenced by Policies referenced by the ACR Control, and therefore that - * effectively apply). - * - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @param actorRelation - */ -function internal_findActorAll(acpData, actorRelation) { - const actors = new Set(); - // This code could be prettier using flat(), which isn't supported by nodeJS 10. - // If you read this comment after April 2021, feel free to refactor. - acpData.matchers.forEach((matcher) => { - getIriAll(matcher, actorRelation) - .filter((iri) => ![ - acp.PublicAgent, - acp.CreatorAgent, - acp.AuthenticatedAgent, - ].includes(iri) || actorRelation !== acp.agent) - .forEach((iri) => actors.add(iri)); - }); - return actors; -} -/** - * Iterate through all the actors active for an ACR, and list all of their access. - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @param actorRelation The type of actor we want to list access for - * @returns A map with each actor access indexed by their URL, or null if some - * external policies are referenced. - */ -function internal_getActorAccessAll(acpData, actorRelation) { - if (acpData.inaccessibleUrls.length > 0) { - // If we can't see all access data, - // we can't reliably determine what access actors of the given type have: - return null; - } - const result = {}; - const actors = internal_findActorAll(acpData, actorRelation); - actors.forEach((iri) => { - // The type assertion holds, because if internal_getActorAccess were null, - // we would have returned {} already. - const access = internal_getActorAccess(acpData, actorRelation, iri); - result[iri] = access; - }); - return result; -} -/** - * Get an overview of what access are defined for all Agents in a Resource's Access Control Resource. - * - * This will only return a value if all relevant access is defined in just the Resource's Access - * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for - * other Resources, this function will not be able to determine the access relevant to the mentionned - * Agents. - * - * Additionally, this only considers access given _explicitly_ to individual Agents, i.e. without - * additional conditions. - * - * In other words, this function will generally understand and return the access as set by - * [[internal_setAgentAccess]], but not understand more convoluted Policies. - * - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @returns A map with each Agent's access indexed by their WebID, or null if some - * external policies are referenced. - */ -function internal_getAgentAccessAll(acpData) { - return internal_getActorAccessAll(acpData, acp.agent); -} -/** - * Set access to a Resource for a specific actor. - * - * This function adds the relevant Access Control Policies and Matchers to a - * Resource's Access Control Resource to define the given access for the given - * actor specifically. In other words, it can, for example, add Policies that - * give the general Public Read access to the Resource. However, if other - * Policies specify that everyone is *denied* Read access *except* for a - * particular Agent, then that will be left intact. - * This means that, unless *only* this module's functions are used to manipulate - * access to this Resource, the set access might not be equal to the effective - * access for an agent matching the given actor. - * - * There are a number of preconditions that have to be fulfilled for this - * function to work: - * - Access to the Resource is determined via an Access Control Resource. - * - The Resource's Access Control Resource does not refer to (Policies or Matchers - * in) other Resources. - * - The current user has access to the Resource's Access Control Resource. - * - * If those conditions do not hold, this function will return `null`. - * - * Additionally, take note that the given access will only be applied to the - * given Resource; if that Resource is a Container, access will have to be set - * for its contained Resources independently. - * - * @param resource Resource that was fetched together with its linked Access Control Resource. - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @param actorRelation What type of actor (e.g. acp:agent) you want to set the access for. - * @param actor Which instance of the given actor type you want to set the access for. - * @param access What access (read, append, write, controlRead, controlWrite) to set for the given actor. `true` to allow, `false` to deny, and `undefined` to leave unchanged. - * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not. - */ -function internal_setActorAccess(resource, acpData, actorRelation, actor, access) { - var _a, _b, _c, _d, _e; - if (!hasAccessibleAcr(resource) || acpData.inaccessibleUrls.length > 0) { - return null; - } - // Get the access that currently applies to the given actor - const existingAccess = internal_getActorAccess(acpData, actorRelation, actor); - /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that above. */ - if (existingAccess === null) { - return null; - } - // Get all Policies that apply specifically to the given actor - const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData)); - const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData)); - // We only need to override Policies that define access other than what we want: - const conflictingAcrPolicies = applicableAcrPolicies.filter((policy) => policyConflictsWith(policy, { - read: access.controlRead, - write: access.controlWrite, - })); - const conflictingPolicies = applicablePolicies.filter((policy) => policyConflictsWith(policy, { - read: access.read, - append: access.append, - write: access.write, - })); - // For every Policy that applies specifically to the given Actor, but _also_ - // to another actor (i.e. that applies using an anyOf Matcher, or a Matcher that - // mentions both the given and another actor)... - const otherActorAcrPolicies = conflictingAcrPolicies.filter((acrPolicy) => policyHasOtherActors(acrPolicy, actorRelation, actor, acpData)); - const otherActorPolicies = conflictingPolicies.filter((policy) => policyHasOtherActors(policy, actorRelation, actor, acpData)); - // ...check what access the current actor would have if we removed them... - const acpDataWithPoliciesExcluded = { - ...acpData, - acrPolicies: acpData.acrPolicies.filter((acrPolicy) => !otherActorAcrPolicies.includes(acrPolicy)), - policies: acpData.policies.filter((policy) => !otherActorPolicies.includes(policy)), - }; - const remainingAccess = internal_getActorAccess(acpDataWithPoliciesExcluded, actorRelation, actor); - /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that at the start. */ - if (remainingAccess === null) { - return null; - } - // ...add copies of those Policies and their Matchers, but excluding the given actor... - let updatedResource = resource; - otherActorAcrPolicies.forEach((acrPolicy) => { - const [policyCopy, matcherCopies] = copyPolicyExcludingActor(acrPolicy, resource, acpData, actorRelation, actor); - updatedResource = setResourceAcrPolicy(updatedResource, policyCopy); - updatedResource = matcherCopies.reduce(setResourceMatcher, updatedResource); - }); - otherActorPolicies.forEach((policy) => { - const [policyCopy, matcherCopies] = copyPolicyExcludingActor(policy, resource, acpData, actorRelation, actor); - updatedResource = setResourcePolicy$1(updatedResource, policyCopy); - updatedResource = matcherCopies.reduce(setResourceMatcher, updatedResource); - }); - // ...add a new Policy that applies the given access, - // and the previously applying access for access modes that were undefined... - const newMatcherName = `matcher_${encodeURIComponent(`${actorRelation}_${actor}`)}`; - let newMatcher = createResourceMatcherFor(resource, newMatcherName); - newMatcher = setIri(newMatcher, actorRelation, actor); - const newControlReadAccess = (_a = access.controlRead) !== null && _a !== void 0 ? _a : existingAccess.controlRead; - const newControlWriteAccess = (_b = access.controlWrite) !== null && _b !== void 0 ? _b : existingAccess.controlWrite; - let acrPoliciesToUnapply = otherActorAcrPolicies; - // Only replace existing Policies if the defined access actually changes: - if (newControlReadAccess !== remainingAccess.controlRead || - newControlWriteAccess !== remainingAccess.controlWrite) { - const newAcrPolicyName = uuid.v4(); - let newAcrPolicy = createResourcePolicyFor(resource, newAcrPolicyName); - newAcrPolicy = setAllowModesV2(newAcrPolicy, { - read: newControlReadAccess === true, - append: false, - write: newControlWriteAccess === true, - }); - newAcrPolicy = addIri(newAcrPolicy, acp.allOf, newMatcher); - updatedResource = setResourceAcrPolicy(updatedResource, newAcrPolicy); - updatedResource = setResourceMatcher(updatedResource, newMatcher); - // If we don't have to set new access, we only need to unapply the - // ACR Policies that applied to both the given actor and other actors - // (because they have been replaced by clones not mentioning the given - // actor). Hence `policiesToUnApply` is initialised to `otherActorPolicies`. - // However, if we're in this if branch, that means we also had to replace - // Policies that defined access for just this actor, so we'll have to remove - // all Policies mentioning this actor: - acrPoliciesToUnapply = conflictingAcrPolicies; - } - const newReadAccess = (_c = access.read) !== null && _c !== void 0 ? _c : existingAccess.read; - const newAppendAccess = (_d = access.append) !== null && _d !== void 0 ? _d : existingAccess.append; - const newWriteAccess = (_e = access.write) !== null && _e !== void 0 ? _e : existingAccess.write; - let policiesToUnapply = otherActorPolicies; - // Only replace existing Policies if the defined access actually changes: - if (newReadAccess !== remainingAccess.read || - newAppendAccess !== remainingAccess.append || - newWriteAccess !== remainingAccess.write) { - const newPolicyName = uuid.v4(); - let newPolicy = createResourcePolicyFor(resource, newPolicyName); - newPolicy = setAllowModesV2(newPolicy, { - read: newReadAccess === true, - append: newAppendAccess === true, - write: newWriteAccess === true, - }); - newPolicy = addIri(newPolicy, acp.allOf, newMatcher); - updatedResource = setResourcePolicy$1(updatedResource, newPolicy); - updatedResource = setResourceMatcher(updatedResource, newMatcher); - // If we don't have to set new access, we only need to unapply the - // Policies that applied to both the given actor and other actors (because - // they have been replaced by clones not mentioning the given actor). Hence - // `policiesToUnApply` is initialised to `otherActorPolicies`. - // However, if we're in this if branch, that means we also had to replace - // Policies that defined access for just this actor, so we'll have to remove - // all Policies mentioning this actor: - policiesToUnapply = conflictingPolicies; - } - // ...then remove existing Policy URLs that mentioned both the given actor - // and other actors from the given Resource and apply the new ones (but do not - // remove the actual old Policies - they might still apply to other Resources!). - acrPoliciesToUnapply.forEach((previouslyApplicableAcrPolicy) => { - updatedResource = removeAcrPolicyUrl$1(updatedResource, asIri(previouslyApplicableAcrPolicy)); - }); - policiesToUnapply.forEach((previouslyApplicablePolicy) => { - updatedResource = removePolicyUrl$1(updatedResource, asIri(previouslyApplicablePolicy)); - }); - return updatedResource; -} -/** - * Set access to a Resource for a specific Agent. - * - * This function adds the relevant Access Control Policies and Matchers to a - * Resource's Access Control Resource to define the given access for the given - * Agent specifically. In other words, it can, for example, add Policies that - * give a particular Agent Read access to the Resource. However, if other - * Policies specify that that Agent is *denied* Read access *except* if they - * match on some other characteristic, then that will be left intact. - * This means that, unless *only* this function is used to manipulate access to - * this Resource, the set access might not be equal to the effective access for - * the given Agent. - * - * There are a number of preconditions that have to be fulfilled for this - * function to work: - * - Access to the Resource is determined via an Access Control Resource. - * - The Resource's Access Control Resource does not refer to (Policies or Matchers - * in) other Resources. - * - The current user has access to the Resource's Access Control Resource. - * - * If those conditions do not hold, this function will return `null`. - * - * Additionally, take note that the given access will only be applied to the - * given Resource; if that Resource is a Container, access will have to be set - * for its contained Resources independently. - * - * @param resource Resource that was fetched together with its linked Access Control Resource. - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @param webId Which Agent you want to set the access for. - * @param access What access (read, append, write, controlRead, controlWrite) to set for the given Agent. `true` to allow, `false` to deny, and `undefined` to leave unchanged. - * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not. - */ -function internal_setAgentAccess(resource, acpData, webId, access) { - return internal_setActorAccess(resource, acpData, acp.agent, webId, access); -} -/** - * Set access to a Resource for everybody. - * - * This function adds the relevant Access Control Policies and Matchers to a - * Resource's Access Control Resource to define the given access for everybody - * specifically. In other words, it can, for example, add Policies that - * give everybody Read access to the Resource. However, if other - * Policies specify that everybody is *denied* Read access *except* if they're - * a particular Agent, then that will be left intact. - * This means that, unless *only* this module's functions are used to manipulate - * access to this Resource, the set access might not be equal to the effective - * access for a particular Agent. - * - * There are a number of preconditions that have to be fulfilled for this - * function to work: - * - Access to the Resource is determined via an Access Control Resource. - * - The Resource's Access Control Resource does not refer to (Policies or Matchers - * in) other Resources. - * - The current user has access to the Resource's Access Control Resource. - * - * If those conditions do not hold, this function will return `null`. - * - * Additionally, take note that the given access will only be applied to the - * given Resource; if that Resource is a Container, access will have to be set - * for its contained Resources independently. - * - * @param resource Resource that was fetched together with its linked Access Control Resource. - * @param acpData All Access Control Policies and Matchers that apply to a particular Resource. - * @param access What access (read, append, write, controlRead, controlWrite) to set for everybody. `true` to allow, `false` to deny, and `undefined` to leave unchanged. - * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not. - */ -function internal_setPublicAccess(resource, acpData, access) { - return internal_setActorAccess(resource, acpData, acp.agent, acp.PublicAgent, access); -} -function policyHasOtherActors(policy, actorRelation, actor, acpData) { - // Note: the non-null assertions (`!`) here should be valid because - // the caller of `policyHasOtherActors` should already have validated - // that the return value of internal_getPoliciesAndMatchers() did not have - // any inaccessible URLs, so we should be able to find every Matcher. - const allOfMatchers = getIriAll(policy, acp.allOf).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl)); - const allOfMatchersHaveOtherActors = allOfMatchers.some((matcher) => { - return matcherHasOtherActors(matcher, actorRelation, actor); - }); - const anyOfMatchers = getIriAll(policy, acp.anyOf).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl)); - const anyOfMatchersHaveOtherActors = anyOfMatchers.some((matcher) => { - return matcherHasOtherActors(matcher, actorRelation, actor); - }); - /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Matchers */ - const noneOfMatchers = getIriAll(policy, acp.noneOf).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl)); - /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Matchers */ - const noneOfMatchersHaveOtherActors = noneOfMatchers.some((matcher) => { - return matcherHasOtherActors(matcher, actorRelation, actor); - }); - return (allOfMatchersHaveOtherActors || - anyOfMatchersHaveOtherActors || - noneOfMatchersHaveOtherActors); -} -function matcherHasOtherActors(matcher, actorRelation, actor) { - const otherActors = []; - knownActorRelations.forEach((knownActorRelation) => { - const otherActorsWithThisRelation = getIriAll(matcher, knownActorRelation).filter((applicableActor) => applicableActor !== actor || knownActorRelation !== actorRelation); - // Unfortunately Node 10 does not support `.flat()` yet, hence the use of `push`: - otherActors.push(...otherActorsWithThisRelation); - }); - return otherActors.length > 0; -} -function copyPolicyExcludingActor(inputPolicy, resourceWithAcr, acpData, actorRelationToExclude, actorToExclude) { - const newIriSuffix = uuid.v4(); - // Create new Matchers for the Policy, excluding the given Actor - const newAllOfMatchers = copyMatchersExcludingActor(getIriAll(inputPolicy, acp.allOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude); - const newAnyOfMatchers = copyMatchersExcludingActor(getIriAll(inputPolicy, acp.anyOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude); - const newNoneOfMatchers = copyMatchersExcludingActor(getIriAll(inputPolicy, acp.noneOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude); - // Create a new Policy with the new Matchers - let newPolicy = createResourcePolicyFor(resourceWithAcr, encodeURI(asIri(inputPolicy)) + newIriSuffix); - getIriAll(inputPolicy, acp.allow).forEach((allowMode) => { - newPolicy = addIri(newPolicy, acp.allow, allowMode); - }); - getIriAll(inputPolicy, acp.deny).forEach((denyMode) => { - newPolicy = addIri(newPolicy, acp.deny, denyMode); - }); - newAllOfMatchers.forEach((newMatcher) => { - newPolicy = addIri(newPolicy, acp.allOf, newMatcher); - }); - newAnyOfMatchers.forEach((newMatcher) => { - newPolicy = addIri(newPolicy, acp.anyOf, newMatcher); - }); - /* istanbul ignore next Policies listing noneOf Matchers are left alone (because they do not unambiguously apply to the given actor always), so there will usually not be any noneOf Matchers to copy. */ - newNoneOfMatchers.forEach((newMatcher) => { - newPolicy = addIri(newPolicy, acp.noneOf, newMatcher); - }); - return [ - newPolicy, - newAllOfMatchers.concat(newAnyOfMatchers).concat(newNoneOfMatchers), - ]; -} -/** Creates clones of all the Matchers identified by `matcherIris` in `acpData`, excluding the given Actor */ -function copyMatchersExcludingActor(matcherIris, resourceWithAcr, acpData, iriSuffix, actorRelationToExclude, actorToExclude) { - return matcherIris - .map((matcherIri) => { - const matcher = acpData.matchers.find((matcher) => asIri(matcher) === matcherIri); - /* istanbul ignore if: getPoliciesAndMatchers should already have fetched all referenced Matchers, so this should never be true: */ - if (typeof matcher === "undefined") { - return null; - } - let newMatcher = createResourceMatcherFor(resourceWithAcr, encodeURI(asIri(matcher)) + iriSuffix); - let listsOtherActors = false; - knownActorRelations.forEach((knownActorRelation) => { - getIriAll(matcher, knownActorRelation).forEach((targetActor) => { - if (knownActorRelation === actorRelationToExclude && - targetActor === actorToExclude) { - return; - } - listsOtherActors = true; - newMatcher = addIri(newMatcher, knownActorRelation, targetActor); - }); - }); - return listsOtherActors ? newMatcher : null; - }) - .filter(isNotNull); -} -function isNotNull(value) { - return value !== null; -} -async function internal_getPoliciesAndMatchers(resource, options = internal_defaultFetchOptions) { - const acrPolicyUrls = getAcrPolicyUrlAll$1(resource); - const policyUrls = getPolicyUrlAll$1(resource); - const allPolicyResourceUrls = getResourceUrls(acrPolicyUrls).concat(getResourceUrls(policyUrls)); - const policyResources = await getResources(allPolicyResourceUrls, options); - const acrPolicies = getThingsFromResources(acrPolicyUrls, policyResources).filter(isNotNull); - const policies = getThingsFromResources(policyUrls, policyResources).filter(isNotNull); - const matcherUrlSet = new Set(); - acrPolicies.forEach((acrPolicy) => { - const referencedMatcherUrls = getReferencedMatcherUrls(acrPolicy); - referencedMatcherUrls.forEach((matcherUrl) => { - matcherUrlSet.add(matcherUrl); - }); - }); - policies.forEach((policy) => { - const referencedMatcherUrls = getReferencedMatcherUrls(policy); - referencedMatcherUrls.forEach((matcherUrl) => { - matcherUrlSet.add(matcherUrl); - }); - }); - const matcherUrls = Array.from(matcherUrlSet); - const matcherResourceUrls = matcherUrls.map((matcherUrl) => getResourceUrl(matcherUrl)); - const unfetchedMatcherResourceUrls = matcherResourceUrls.filter((matcherResourceUrl) => !allPolicyResourceUrls.includes(matcherResourceUrl)); - const matcherResources = await getResources(unfetchedMatcherResourceUrls, options); - const allResources = { - ...policyResources, - ...matcherResources, - }; - const matchers = getThingsFromResources(matcherUrls, allResources).filter(isNotNull); - const inaccessibleUrls = Object.keys(allResources).filter((resourceUrl) => allResources[resourceUrl] === null); - return { - inaccessibleUrls, - acrPolicies, - policies, - matchers, - }; -} -function getResourceUrl(thingUrl) { - const thingUrlObject = new URL(thingUrl); - thingUrlObject.hash = ""; - return thingUrlObject.href; -} -function getResourceUrls(thingUrls) { - const resourceUrls = []; - thingUrls.forEach((thingUrl) => { - const resourceUrl = getResourceUrl(thingUrl); - if (!resourceUrls.includes(resourceUrl)) { - resourceUrls.push(resourceUrl); - } - }); - return resourceUrls; -} -async function getResources(resourceUrls, options) { - const uniqueResourceUrls = Array.from(new Set(resourceUrls)); - const resources = {}; - await Promise.all(uniqueResourceUrls.map(async (resourceUrl) => { - try { - const resource = await getSolidDataset(resourceUrl, options); - resources[resourceUrl] = resource; - } - catch (e) { - resources[resourceUrl] = null; - } - })); - return resources; -} -function getThingsFromResources(thingUrls, resources) { - return thingUrls.map((thingUrl) => { - const resourceUrl = getResourceUrl(thingUrl); - const resource = resources[resourceUrl]; - if (!resource) { - return null; - } - return getThing(resource, thingUrl); - }); -} -function getReferencedMatcherUrls(policy) { - return getAllOfMatcherUrlAll(policy) - .concat(getAnyOfMatcherUrlAll(policy)) - .concat(getNoneOfMatcherUrlAll(policy)); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Get an overview of what access is defined for a given Agent. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for the given Agent. If - * additional restrictions are set up to apply to the given Agent in a - * particular situation, those will not be reflected in the return value of - * this function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param webId WebID of the Agent you want to get the access for. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function getAgentAccess$2(resourceUrl, webId, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options); - return internal_getAgentAccess(acpData, webId); - } - if (hasAccessibleAcl(resourceInfo)) { - return getAgentAccess$4(resourceInfo, webId, options); - } - return null; -} -/** - * Set access to a Resource for a specific Agent. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably setting access, in which case it will - * resolve to `null`. - * - It will only set access explicitly for the given Agent. In other words, - * additional restrictions could be present that further restrict or loosen - * what access the given Agent has in particular circumstances. - * - The provided access will only apply to the given Resource. In other words, - * if the Resource is a Container, the configured Access may not apply to - * contained Resources. - * - If the current user does not have permission to view or change access for - * the given Resource, this function will resolve to `null`. - * - * Additionally, two caveats apply to users with a Pod server that uses WAC: - * - If the Resource did not have an ACL yet, a new one will be initialised. - * This means that changes to the ACL of a parent Container can no longer - * affect access people have to this Resource, although existing access will - * be preserved. - * - Setting different values for `controlRead` and `controlWrite` is not - * supported, and **will throw an error**. If you expect (some of) your users - * to have Pods implementing WAC, be sure to pass the same value for both. - * - * @param resourceUrl URL of the Resource you want to change the Agent's access to. - * @param webId WebID of the Agent you want to set access for. - * @param access What access permissions you want to set for the given Agent to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error. - * @returns What access has been set for the given Agent explicitly. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function setAgentAccess$2(resourceUrl, webId, access, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options); - const updatedResource = internal_setAgentAccess(resourceInfo, acpData, webId, access); - if (updatedResource) { - try { - await saveAcrFor(updatedResource, options); - return await getAgentAccess$2(resourceUrl, webId, options); - } - catch (e) { - return null; - } - } - return null; - } - if (hasAccessibleAcl(resourceInfo)) { - if (access.controlRead !== access.controlWrite) { - throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \`controlRead\` and \`controlWrite\` should have the same value.`); - } - const wacAccess = access; - await setAgentResourceAccess(resourceInfo, webId, wacAccess, options); - return getAgentAccess$4(resourceInfo, webId, options); - } - return null; -} -/** - * Get an overview of what access is defined for all Agents with respect to a given - * Resource. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for the returned Agents. If - * additional restrictions are set up to apply to the listed Agents in a - * particular situation, those will not be reflected in the return value of - * this function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @returns The access information to the Resource, grouped by Agent. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function getAgentAccessAll$2(resourceUrl, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options); - return internal_getAgentAccessAll(acpData); - } - if (hasAccessibleAcl(resourceInfo)) { - return getAgentAccessAll$4(resourceInfo, options); - } - return null; -} -/** - * Get an overview of what access is defined for everyone. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access, in which case it will - * resolve to `null`. - * - It will only return access specified explicitly for everyone. If - * additional restrictions are set up to apply to users in a particular - * situation, those will not be reflected in the return value of this - * function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function getPublicAccess$2(resourceUrl, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options); - return internal_getPublicAccess(acpData); - } - if (hasAccessibleAcl(resourceInfo)) { - return getPublicAccess$4(resourceInfo, options); - } - return null; -} -/** - * Set access to a Resource for everybody. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably setting access, in which case it will - * resolve to `null`. - * - It will only set access explicitly for everybody. In other words, - * additional restrictions could be present that further restrict or loosen - * what access a user has in particular circumstances. - * - The provided access will only apply to the given Resource. In other words, - * if the Resource is a Container, the configured Access may not apply to - * contained Resources. - * - If the current user does not have permission to view or change access for - * the given Resource, this function will resolve to `null`. - * - * Additionally, two caveats apply to users with a Pod server that uses WAC: - * - If the Resource did not have an ACL yet, a new one will be initialised. - * This means that changes to the ACL of a parent Container can no longer - * affect access people have to this Resource, although existing access will - * be preserved. - * - Setting different values for `controlRead` and `controlWrite` is not - * supported, and **will throw an error**. If you expect (some of) your users - * to have Pods implementing WAC, be sure to pass the same value for both. - * - * @param resourceUrl URL of the Resource you want to change public access to. - * @param access What access permissions you want to set for everybody to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error. - * @returns What access has been set for everybody explicitly. - * @since 1.5.0 - * @hidden - * @deprecated Please import from the "universal" modules. - */ -async function setPublicAccess$2(resourceUrl, access, options = internal_defaultFetchOptions) { - const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options); - if (hasAccessibleAcr(resourceInfo)) { - const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options); - const updatedResource = internal_setPublicAccess(resourceInfo, acpData, access); - if (updatedResource) { - try { - await saveAcrFor(updatedResource, options); - return await getPublicAccess$2(resourceUrl, options); - } - catch (e) { - return null; - } - } - return null; - } - if (hasAccessibleAcl(resourceInfo)) { - if (access.controlRead !== access.controlWrite) { - throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \`controlRead\` and \`controlWrite\` should have the same value.`); - } - const wacAccess = access; - await setPublicResourceAccess(resourceInfo, wacAccess, options); - return getPublicAccess$4(resourceInfo, options); - } - return null; -} - -var universal_v2 = /*#__PURE__*/Object.freeze({ - __proto__: null, - getAccessFor: getAccessFor, - getAccessForAll: getAccessForAll, - getAgentAccess: getAgentAccess$2, - getAgentAccessAll: getAgentAccessAll$2, - getPublicAccess: getPublicAccess$2, - setAccessFor: setAccessFor, - setAgentAccess: setAgentAccess$2, - setPublicAccess: setPublicAccess$2 -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Retrieve the Server Resource Info of Resource expressing access control over - * another resource it is linked to. It applies in both ACP and WAC contexts: - * the Access Control Resource is discovered consistently using a Link header - * with `rel=acl`. - * - * @param {WithServerResourceInfo} resource The Resource for which ACL we want - * to retrieve the Server Resource Info. - * @param {DefaultOptions} options - * @returns The Server Resource Info if available, null otherwise. - * @since 1.19.0 - */ -async function getAclServerResourceInfo(resource, options) { - if (typeof resource.internal_resourceInfo.aclUrl !== "string") { - return null; - } - try { - return await getResourceInfo(resource.internal_resourceInfo.aclUrl, options); - } - catch (_a) { - // A WAC-governed resource may have a link to a non-existant ACL (by design). - // The absence of an ACL at the target URL is a useful information that is - // used by the universal API to pick between ACR and WAC. - return null; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Policies allow or deny access modes over resources and their associated - * access control resource. - * - * @param policy The Policy Thing which allows retrieved access modes. - * @returns Policy URL array. - * @since 1.16.1 - */ -function getAllowModes(policy) { - return getModes(policy, ACP.allow); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * ```{note} - * The ACP specification is a draft. As such, this function is experimental and - * subject to change, even in a non-major release. - * See also: https://solid.github.io/authorization-panel/acp-specification/ - * ``` - * - * Policies allow or deny access modes over resources and their associated - * access control resource. - * - * @param policy The Policy Thing which denies retrieved access modes. - * @returns Policy URL array. - * @since 1.16.1 - */ -function getDenyModes(policy) { - return getModes(policy, ACP.deny); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function isAgentMatched(acr, policy, webId) { - // TODO: Proper solution - // Finalise, release and use the TypeScript ACP Solid library - // internal_getActorAccess in acp_v2:96 doesn't reduce the policies properly - // policyAppliesTo in acp_v2:256 assumes that every matcher is an agent matcher - // - // TODO: Stopgap solution - // Implement a simplistic reduce function that - // matches policies where the agent is present in the matchers - const allOfMatchers = getUrlAll(policy, ACP.allOf) - .map((url) => getThing(internal_getAcr(acr), url)) - .filter((thing) => thing !== null); - const allOfMatched = allOfMatchers.every((thing) => { - return getUrlAll(thing, ACP.agent).includes(webId); - }); - const anyOfMatchers = getUrlAll(policy, ACP.anyOf) - .map((url) => getThing(internal_getAcr(acr), url)) - .filter((thing) => thing !== null); - const anyOfMatched = anyOfMatchers.some((thing) => { - return getUrlAll(thing, ACP.agent).includes(webId); - }); - const noneOfMatchers = getUrlAll(policy, ACP.noneOf) - .map((url) => getThing(internal_getAcr(acr), url)) - .filter((thing) => thing !== null); - const noneOfMatched = noneOfMatchers.some((thing) => { - return getUrlAll(thing, ACP.agent).includes(webId); - }); - return (allOfMatchers.length + anyOfMatchers.length > 0 && - (allOfMatchers.length === 0 || allOfMatched) && - (anyOfMatchers.length === 0 || anyOfMatched) && - (noneOfMatchers.length === 0 || !noneOfMatched)); -} -/** @hidden */ -function reduceModes(policy, modes, type) { - const allowed = getAllowModes(policy); - const denied = getDenyModes(policy); - if (type === "control") { - return { - read: modes.read, - append: modes.append, - write: modes.write, - controlRead: (modes.controlRead || allowed.read) && !denied.read, - controlWrite: (modes.controlWrite || allowed.write) && !denied.write, - }; - } - return { - read: (modes.read || allowed.read) && !denied.read, - append: (modes.append || allowed.append) && !denied.append, - write: (modes.write || allowed.write) && !denied.write, - controlRead: modes.controlRead, - controlWrite: modes.controlWrite, - }; -} -/** - * Get an overview of what access is defined for a given Agent. - * - * @param resourceWithAcr URL of the Resource you want to read the access for. - * @param webId WebID of the Agent you want to get the access for. - * @since 1.16.0 - */ -async function getAgentAccess$1(resourceWithAcr, webId) { - // TODO: add support for external resources - let resourceAccess = { - read: false, - append: false, - write: false, - controlRead: false, - controlWrite: false, - }; - const policyAll = getPolicyUrlAll(resourceWithAcr) - .map((url) => getThing(internal_getAcr(resourceWithAcr), url)) - .filter((policy) => policy !== null); - policyAll.forEach((policy) => { - if (isAgentMatched(resourceWithAcr, policy, webId)) { - resourceAccess = reduceModes(policy, resourceAccess, "resource"); - } - }); - const acrPolicyAll = getAcrPolicyUrlAll(resourceWithAcr) - .map((url) => getThing(internal_getAcr(resourceWithAcr), url)) - .filter((policy) => policy !== null); - acrPolicyAll.forEach((policy) => { - if (isAgentMatched(resourceWithAcr, policy, webId)) { - resourceAccess = reduceModes(policy, resourceAccess, "control"); - } - }); - return resourceAccess; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Retrieve the URL of an Access Control Resource as per pre-draft versions of - * the ACP specification. - * - * @param resource The Resource for which to retrieve the URL of the Access - * Control Resource if it is accessible. - * @returns The URL of the ACR or null. - * @deprecated - */ -function getAcrUrl$1(resource) { - const linkedAccessControlResource = resource.internal_resourceInfo.linkedResources[ACP.accessControl]; - if (Array.isArray(linkedAccessControlResource) && - linkedAccessControlResource.length === 1) { - return linkedAccessControlResource[0]; - } - return null; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Retrieve the URL of an Access Control Resource as per the ACP Draft - * specification. - * - * @param resource The Resource for which to retrieve the URL of the Access - * Control Resource if it is accessible. - * @returns The URL of the ACR or null. - */ -async function getAcrUrl(resource, options) { - // TODO: Remove as soon as ESS 1.1 is phased out - const legacyAcrUrl = getAcrUrl$1(resource); - if (legacyAcrUrl !== null) { - return legacyAcrUrl; - } - // The ACP Draft mandates a link rel="type" header identifies Access Control Resources - const aclServerResourceInfo = await getAclServerResourceInfo(resource, options); - if (aclServerResourceInfo === null) { - return null; - } - const relTypeLinks = getLinkedResourceUrlAll(aclServerResourceInfo).type; - if (Array.isArray(relTypeLinks) && - relTypeLinks.includes(ACP.AccessControlResource)) { - return getSourceUrl(aclServerResourceInfo); - } - return null; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Retrieve the Access Control Resource of a Resource as per the ACP Draft - * specification. - * - * @param resource The Resource for which to retrieve the URL of the Access - * Control Resource if it is accessible. - * @param options Default Options such as a fetch function. - * @returns The URL of the ACR or null. - */ -async function getResourceAcr(resource, options) { - const acrUrl = await getAcrUrl(resource, options); - if (acrUrl === null) { - return null; - } - let acr; - try { - acr = await getSolidDataset(acrUrl, options); - } - catch (e) { - return null; - } - return { - ...resource, - internal_acp: { - acr: { - ...acr, - accessTo: getSourceUrl(resource), - }, - }, - }; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Get an overview of what access is defined for a given Agent. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access. - * - It will only return access specified explicitly for the given Agent within - * the ACL linked to the resource. If additional restrictions or external - * resources are used, those will not be reflected in the return value of this - * function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param webId WebID of the Agent you want to get the access for. - * @param options Default Options such as a fetch function. - * @since 1.19.0 - */ -async function getAgentAccess(resourceUrl, webId, options) { - const resourceInfo = await getResourceInfo(resourceUrl, options); - const acr = await getResourceAcr(resourceInfo, options); - if (acr === null) { - return getAgentAccess$4(resourceInfo, webId, options); - } - return getAgentAccess$1(acr, webId); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function getAgentUrlAll(acr) { - return Array.from(new Set(getThingAll(internal_getAcr(acr)) - .map((thing) => { - return getUrlAll(thing, ACP.agent); - }) - .reduce((flatArray, agentArray) => { - return flatArray.concat(agentArray); - }, []))); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Get an overview of what access is defined for agents. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access. - * - It will only return access specified explicitly for the given Agent within - * the ACL linked to the resource. If additional restrictions or external - * resources are used, those will not be reflected in the return value of this - * function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param options Default Options such as a fetch function. - * @since 1.21.0 - */ -async function getAgentAccessAll$1(resourceWithAcr) { - return (await Promise.all(getAgentUrlAll(resourceWithAcr).map(async (agent) => ({ - [agent]: await getAgentAccess$1(resourceWithAcr, agent), - })))).reduce((agentAccessAll, currentAgentAccess) => ({ - ...agentAccessAll, - ...currentAgentAccess, - }), {}); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Get an overview of what access is defined for agents. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access. - * - It will only return access specified explicitly for the given Agent within - * the ACL linked to the resource. If additional restrictions or external - * resources are used, those will not be reflected in the return value of this - * function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param options Default Options such as a fetch function. - * @since 1.21.0 - */ -async function getAgentAccessAll(resourceUrl, options) { - const resourceInfo = await getResourceInfo(resourceUrl, options); - const acr = await getResourceAcr(resourceInfo, options); - if (acr === null) { - return getAgentAccessAll$4(resourceInfo, options); - } - return getAgentAccessAll$1(acr); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Get an overview of what access is given to the public. - * - * @param resourceWithAcr URL of the Resource you want to read the access for. - * @since 1.16.0 - */ -async function getPublicAccess$1(resourceWithAcr) { - return getAgentAccess$1(resourceWithAcr, ACP.PublicAgent); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Get an overview of what access is defined for the Public. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably reading access. - * - It will only return access specified explicitly for the given Agent within - * the ACL linked to the resource. If additional restrictions or external - * resources are used, those will not be reflected in the return value of this - * function. - * - It will only return access specified explicitly for the given Resource. - * In other words, if the Resource is a Container, the returned Access may not - * apply to contained Resources. - * - If the current user does not have permission to view access for the given - * Resource, this function will resolve to `null`. - * - * @param resourceUrl URL of the Resource you want to read the access for. - * @param options Default Options such as a fetch function. - * @since 1.19.0 - */ -async function getPublicAccess(resourceUrl, options) { - const resourceInfo = await getResourceInfo(resourceUrl, options); - const acr = await getResourceAcr(resourceInfo, options); - if (acr === null) { - return getPublicAccess$4(resourceInfo, options); - } - return getPublicAccess$1(acr); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function getDefaultAgentMatcherPolicyUrl(resource, name, mode) { - return getDefaultAccessControlUrl(resource, name) - .concat("AgentMatcher") - .concat(mode.charAt(0).toUpperCase() + mode.slice(1)) - .concat("Policy"); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function setDefaultAgentMatcherPolicyThingIfNotExist(resource, name, mode) { - const policyUrl = getDefaultAgentMatcherPolicyUrl(resource, name, mode); - // TODO: Re-enable when we support setting agent access on member resources - // if (policyUrl.includes("Member") && policyUrl.includes("Acr")) { - // return addMemberAcrPolicyUrl(resource, policyUrl); - // } - // if (policyUrl.includes("Member")) { - // return addMemberPolicyUrl(resource, policyUrl); - // } - if (policyUrl.includes("Acr")) { - return addAcrPolicyUrl(resource, policyUrl); - } - return addPolicyUrl(resource, policyUrl); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function getDefaultAgentMatcherPolicyMatcherUrl(resource, name, mode) { - return getDefaultAgentMatcherPolicyUrl(resource, name, mode).concat("Matcher"); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -const DEFAULT_POLICY_MATCHER_PREDICATE = ACP.anyOf; -/** - * This functions scaffolds the default elements required for giving access to - * an agent: - * 1. If the Access Control Resource is empty, create the AccessControlResource - * element; - * 2. If the current default Access Control doesn't exist (the one applying to - * one of: the Resource, the ACR, the Member Resources or the ACR of members) - * create it; - * 3. If the default Policy for allowing the Access Modes for the current - * default Access Control doesn't exist, create it; - * 4. If the default "anyOf" Agent Matcher for the current Policy creates it; - * 5. Returns an ACR with a Matcher ready to add to. - * @hidden - * */ -function setDefaultAgentMatcherPolicyMatcherThingIfNotExist(resource, name, mode) { - const policyUrl = getDefaultAgentMatcherPolicyUrl(resource, name, mode); - const matcherUrl = getDefaultAgentMatcherPolicyMatcherUrl(resource, name, mode); - let defaultAgentMatcherPolicyThing = getThing(internal_getAcr(resource), policyUrl); - if (!defaultAgentMatcherPolicyThing) { - resource = setDefaultAgentMatcherPolicyThingIfNotExist(resource, name, mode); - defaultAgentMatcherPolicyThing = createThing({ url: policyUrl }); - defaultAgentMatcherPolicyThing = setModes(defaultAgentMatcherPolicyThing, { [mode]: true }, ACP.allow); - } - // Get the Default Access Control Agent Matcher Policy Matcher Thing or create it and return - const agentMatcherPolicyUrlAll = getIriAll(defaultAgentMatcherPolicyThing, DEFAULT_POLICY_MATCHER_PREDICATE); - if (!agentMatcherPolicyUrlAll.includes(matcherUrl)) { - defaultAgentMatcherPolicyThing = buildThing(defaultAgentMatcherPolicyThing) - .addUrl(DEFAULT_POLICY_MATCHER_PREDICATE, matcherUrl) - .build(); - return setAccessControlResourceThing(resource, defaultAgentMatcherPolicyThing); - } - return resource; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** @hidden */ -function setAgentAccessMode(resourceWithAcr, webId, name, mode, operation) { - var _a; - const matcherUrl = getDefaultAgentMatcherPolicyMatcherUrl(resourceWithAcr, name, mode); - // Set default Matcher if not exists - const resourceWithDefaultAgentMatcher = setDefaultAgentMatcherPolicyMatcherThingIfNotExist(resourceWithAcr, name, mode); - const defaultAgentMatcherThing = (_a = getThing(internal_getAcr(resourceWithDefaultAgentMatcher), matcherUrl)) !== null && _a !== void 0 ? _a : createThing({ url: matcherUrl }); - return setAccessControlResourceThing(resourceWithDefaultAgentMatcher, operation === "add" - ? addAgent(defaultAgentMatcherThing, webId) - : removeAgent(defaultAgentMatcherThing, webId)); -} -/** - * Set access for a given Agent. - * - * @param resourceWithAcr URL of the Resource you want to set the access for. - * @param webId WebID of the Agent you want to set the access for. - * @param access Access Modes you want to set for the agent. - * @since 1.16.0 - */ -async function setAgentAccess$1(resourceWithAcr, webId, access) { - const agentAccessModes = await getAgentAccess$1(resourceWithAcr, webId); - // Add Agent to Default Matchers (including member) if access mode is different from what exists - if (typeof access.read === "boolean" && - agentAccessModes.read !== access.read) { - resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACCESS_CONTROL, "read", access.read ? "add" : "remove"); - } - if (typeof access.append === "boolean" && - agentAccessModes.append !== access.append) { - resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACCESS_CONTROL, "append", access.append ? "add" : "remove"); - } - if (typeof access.write === "boolean" && - agentAccessModes.write !== access.write) { - resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACCESS_CONTROL, "write", access.write ? "add" : "remove"); - } - if (typeof access.controlRead === "boolean" && - agentAccessModes.controlRead !== access.controlRead) { - resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACR_ACCESS_CONTROL, "controlRead", access.controlRead ? "add" : "remove"); - } - if (typeof access.controlWrite === "boolean" && - agentAccessModes.controlWrite !== access.controlWrite) { - resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACR_ACCESS_CONTROL, "controlWrite", access.controlWrite ? "add" : "remove"); - } - return resourceWithAcr; -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Set access to a resource for a given Agent. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably setting access. - * - It will only set access explicitly for the given Agent. In other words, - * additional restrictions could be present that further restrict or loosen - * what access the given Agent has in particular circumstances. - * - The provided access will only apply to the given Resource. In other words, - * if the Resource is a Container, the configured Access will not apply to - * contained Resources. - * - If the current user does not have permission to view or change access for - * the given Resource, this function will resolve to `null`. - * - * Additionally, two caveats apply to users with a Pod server that uses WAC: - * - If the Resource did not have an ACL yet, a new one will be initialised. - * This means that changes to the ACL of a parent Container can no longer - * affect access people have to this Resource, although existing access will - * be preserved. - * - Setting different values for `controlRead` and `controlWrite` is not - * supported, and **will throw an error**. If you expect (some of) your users - * to have Pods implementing WAC, be sure to pass the same value for both. - * - * @param resourceUrl URL of the Resource you want to set access for. - * @param webId WebID of the Agent you want to set access for. - * @param access The Access Modes to add (true) or remove (false). - * @param options Default Options such as a fetch function. - * @since 1.19.0 - */ -async function setAgentAccess(resourceUrl, webId, access, options) { - // TODO: Change the standard getAgentAccess signatures to all take a T extends WithAcl - const resourceInfo = await getResourceInfo(resourceUrl, options); - const acr = await getResourceAcr(resourceInfo, options); - if (acr === null) { - await setAgentResourceAccess(resourceInfo, webId, access, options); - return getAgentAccess$4(resourceInfo, webId, options); - } - // TODO: Make sure both setAgentAccessWac and setAgentAccessAcp don't save within the function, expose one standard saveAclFor function that is universal. - try { - await saveAcrFor(await setAgentAccess$1(acr, webId, access), options); - return await getAgentAccess(resourceUrl, webId, options); - } - catch (e) { - return null; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Set access for the public. - * - * @param resourceWithAcr URL of the Resource you want to read the access for. - * @param access Access Modes you want to set for the agent. - * @since 1.16.0 - */ -async function setPublicAccess$1(resourceWithAcr, access) { - return setAgentAccess$1(resourceWithAcr, ACP.PublicAgent, access); -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * Set access to a resource for the public. - * - * This function works with Solid Pods that implement either the Web Access - * Control spec or the Access Control Policies proposal, with some caveats: - * - * - If access to the given Resource has been set using anything other than the - * functions in this module, it is possible that it has been set in a way that - * prevents this function from reliably setting access. - * - It will only set access explicitly for the given Agent. In other words, - * additional restrictions could be present that further restrict or loosen - * what access the given Agent has in particular circumstances. - * - The provided access will only apply to the given Resource. In other words, - * if the Resource is a Container, the configured Access will not apply to - * contained Resources. - * - If the current user does not have permission to view or change access for - * the given Resource, this function will resolve to `null`. - * - * Additionally, two caveats apply to users with a Pod server that uses WAC: - * - If the Resource did not have an ACL yet, a new one will be initialised. - * This means that changes to the ACL of a parent Container can no longer - * affect access people have to this Resource, although existing access will - * be preserved. - * - Setting different values for `controlRead` and `controlWrite` is not - * supported, and **will throw an error**. If you expect (some of) your users - * to have Pods implementing WAC, be sure to pass the same value for both. - * - * @param resourceUrl URL of the Resource you want to set access for. - * @param access The Access Modes to add (true) or remove (false). - * @param options Default Options such as a fetch function. - * @since 1.19.0 - */ -async function setPublicAccess(resourceUrl, access, options) { - const resourceInfo = await getResourceInfo(resourceUrl, options); - const acr = await getResourceAcr(resourceInfo, options); - if (acr === null) { - await setPublicResourceAccess(resourceInfo, access, options); - return getPublicAccess$4(resourceInfo, options); - } - try { - await saveAcrFor(await setPublicAccess$1(acr, access), options); - return await getPublicAccess(resourceUrl, options); - } - catch (e) { - return null; - } -} - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * :::{admonition} Experimental API - * :class: important - * - * This API is still experimental, and subject to change. It builds on top of - * both ACP and WAC, aiming at being adaptable to any Access Control system that - * may be implemented in Solid. That is why it is purely Resource-centric: the - * library discovers metadata associated with the Resource itself, and calls the - * appropriate underlying API to deal with the Access Control in place for the - * target Resource. - * - * As it is still under development, the following export is *only* intended for - * experimentation by early adopters, and is not recommended for production - * applications. - * - * For more information see: [Tutorial: Managing - * Access](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/manage-access/) - * ::: - * - * This module can be imported as an object from the main package, which results - * in tree-shaking not being supported (so all the exported APIs will likely end - * up in your bundle). This import style is used for environments such as nextjs - * or create-react-app. - * - * ```typescript - * import { universalAccess } from "@inrupt/solid-client"; - * ``` - * - * Alternatively, if your environment supports [export - * maps](https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#exports), - * then you can import directly: - * - * ```typescript - * import * as universalAccess from "@inrupt/solid-client/universal"; - * ``` - * - * If you're using Typescript, and receive errors about type definitions not - * being found, please see this - * [documentation](https://www.typescriptlang.org/docs/handbook/esm-node.html) - * - * @packageDocumentation - * @module universalAccess - */ - -var index = /*#__PURE__*/Object.freeze({ - __proto__: null, - getAclServerResourceInfo: getAclServerResourceInfo, - getAgentAccess: getAgentAccess, - getAgentAccessAll: getAgentAccessAll, - getPublicAccess: getPublicAccess, - setAgentAccess: setAgentAccess, - setPublicAccess: setPublicAccess -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * :::{admonition} Experimental API - * :class: important - * - * The Access Control Policies proposal has not yet been reviewed for inclusion in the Solid spec. - * To enable early experimentation, solid-client exposes a low-level API. However, this API can and - * will include breaking changes in non-major releases. Additionally, for most applications, a - * higher-level API that is planned will be more applicable. - * - * Thus, the following export is *only* intended for experimentation by early adopters, and is not - * recommended for production applications. Because of this, all ACP-related API's are exported on a - * single object, which does not facilitate tree-shaking: if you use one ACP-related API, all of - * them will be included in your bundle. - * - * For more information see: [Tutorial: Managing - * Access](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/manage-access/) - * ::: - * - * This module supports Inrupt's ESS 1.1 ACP implementation. - * - * This module can be imported as an object from the main package, which results - * in tree-shaking not being supported (so all the exported APIs will likely end - * up in your bundle). This import style is used for environments such as nextjs - * or create-react-app. - * - * ```typescript - * import { acp_ess_1 } from "@inrupt/solid-client"; - * ``` - * - * @packageDocumentation - * @module acp_ess_1 - */ - -var ess1 = /*#__PURE__*/Object.freeze({ - __proto__: null, - acrAsMarkdown: acrAsMarkdown, - addAcrPolicyUrl: addAcrPolicyUrl$1, - addAgent: addAgent$1, - addAllOfRuleUrl: addAllOfRuleUrl, - addAnyOfRuleUrl: addAnyOfRuleUrl, - addClient: addClient$1, - addGroup: addGroup, - addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1, - addMemberPolicyUrl: addMemberPolicyUrl$1, - addMockAcrTo: addMockAcrTo, - addNoneOfRuleUrl: addNoneOfRuleUrl, - addPolicyUrl: addPolicyUrl$1, - createPolicy: createPolicy, - createResourcePolicyFor: createResourcePolicyFor, - createResourceRuleFor: createResourceRuleFor, - createRule: createRule, - getAcrPolicyUrlAll: getAcrPolicyUrlAll$1, - getAgentAll: getAgentAll$1, - getAllOfRuleUrlAll: getAllOfRuleUrlAll, - getAllowModes: getAllowModesV1, - getAnyOfRuleUrlAll: getAnyOfRuleUrlAll, - getClientAll: getClientAll$1, - getDenyModes: getDenyModesV1, - getFileWithAccessDatasets: getFileWithAccessDatasets, - getFileWithAcr: getFileWithAcr, - getGroupAll: getGroupAll, - getLinkedAcrUrl: getLinkedAcrUrl, - getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1, - getMemberPolicyUrlAll: getMemberPolicyUrlAll$1, - getNoneOfRuleUrlAll: getNoneOfRuleUrlAll, - getPolicy: getPolicy, - getPolicyAll: getPolicyAll, - getPolicyUrlAll: getPolicyUrlAll$1, - getReferencedPolicyUrlAll: getReferencedPolicyUrlAll, - getResourceAcrPolicy: getResourceAcrPolicy, - getResourceAcrPolicyAll: getResourceAcrPolicyAll, - getResourceInfoWithAccessDatasets: getResourceInfoWithAccessDatasets, - getResourceInfoWithAcr: getResourceInfoWithAcr, - getResourcePolicy: getResourcePolicy, - getResourcePolicyAll: getResourcePolicyAll, - getResourceRule: getResourceRule, - getResourceRuleAll: getResourceRuleAll, - getRule: getRule, - getRuleAll: getRuleAll, - getSolidDatasetWithAccessDatasets: getSolidDatasetWithAccessDatasets, - getSolidDatasetWithAcr: getSolidDatasetWithAcr, - hasAccessibleAcr: hasAccessibleAcr, - hasAnyClient: hasAnyClient$1, - hasAuthenticated: hasAuthenticated$1, - hasCreator: hasCreator$1, - hasLinkedAcr: hasLinkedAcr, - hasPublic: hasPublic$1, - isAcpControlled: isAcpControlled, - mockAcrFor: mockAcrFor, - policyAsMarkdown: policyAsMarkdown, - removeAcrPolicyUrl: removeAcrPolicyUrl$1, - removeAcrPolicyUrlAll: removeAcrPolicyUrlAll, - removeAgent: removeAgent$1, - removeAllOfRuleUrl: removeAllOfRuleUrl, - removeAnyClient: removeAnyClient$1, - removeAnyOfRuleUrl: removeAnyOfRuleUrl, - removeAuthenticated: removeAuthenticated$1, - removeClient: removeClient$1, - removeCreator: removeCreator$1, - removeGroup: removeGroup, - removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1, - removeMemberAcrPolicyUrlAll: removeMemberAcrPolicyUrlAll, - removeMemberPolicyUrl: removeMemberPolicyUrl$1, - removeMemberPolicyUrlAll: removeMemberPolicyUrlAll, - removeNoneOfRuleUrl: removeNoneOfRuleUrl, - removePolicy: removePolicy, - removePolicyUrl: removePolicyUrl$1, - removePolicyUrlAll: removePolicyUrlAll, - removePublic: removePublic$1, - removeResourceAcrPolicy: removeResourceAcrPolicy, - removeResourcePolicy: removeResourcePolicy, - removeResourceRule: removeResourceRule, - removeRule: removeRule, - ruleAsMarkdown: ruleAsMarkdown, - saveAcrFor: saveAcrFor, - setAgent: setAgent$1, - setAllOfRuleUrl: setAllOfRuleUrl, - setAllowModes: setAllowModesV1, - setAnyClient: setAnyClient$1, - setAnyOfRuleUrl: setAnyOfRuleUrl, - setAuthenticated: setAuthenticated$1, - setClient: setClient$1, - setCreator: setCreator$1, - setDenyModes: setDenyModesV1, - setGroup: setGroup, - setNoneOfRuleUrl: setNoneOfRuleUrl, - setPolicy: setPolicy, - setPublic: setPublic$1, - setResourceAcrPolicy: setResourceAcrPolicy, - setResourcePolicy: setResourcePolicy$1, - setResourceRule: setResourceRule, - setRule: setRule -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -/** - * :::{admonition} Experimental API - * :class: important - * - * The Access Control Policies proposal has not yet been reviewed for inclusion in the Solid spec. - * To enable early experimentation, solid-client exposes a low-level API. However, this API can and - * will include breaking changes in non-major releases. Additionally, for most applications, a - * higher-level API that is planned will be more applicable. - * - * Thus, the following export is *only* intended for experimentation by early adopters, and is not - * recommended for production applications. Because of this, all ACP-related API's are exported on a - * single object, which does not facilitate tree-shaking: if you use one ACP-related API, all of - * them will be included in your bundle. - * - * For more information see: [Tutorial: Managing - * Access](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/manage-access/) - * ::: - * - * This module supports Inrupt's ESS 2.0 ACP implementation. - * - * This module can be imported as an object from the main package, which results - * in tree-shaking not being supported (so all the exported APIs will likely end - * up in your bundle). This import style is used for environments such as nextjs - * or create-react-app. - * - * ```typescript - * import { acp_ess_2 } from "@inrupt/solid-client"; - * ``` - * - * @packageDocumentation - * @module acp_ess_2 - */ - -var ess2 = /*#__PURE__*/Object.freeze({ - __proto__: null, - addAcrPolicyUrl: addAcrPolicyUrl, - addAgent: addAgent, - addAllOfMatcherUrl: addAllOfMatcherUrl, - addAnyOfMatcherUrl: addAnyOfMatcherUrl, - addClient: addClient, - addMemberAcrPolicyUrl: addMemberAcrPolicyUrl, - addMemberPolicyUrl: addMemberPolicyUrl, - addMockAcrTo: addMockAcrTo, - addNoneOfMatcherUrl: addNoneOfMatcherUrl, - addPolicyUrl: addPolicyUrl, - createMatcher: createMatcher, - createPolicy: createPolicy, - createResourceMatcherFor: createResourceMatcherFor, - createResourcePolicyFor: createResourcePolicyFor, - getAcrPolicyUrlAll: getAcrPolicyUrlAll, - getAgentAll: getAgentAll, - getAllOfMatcherUrlAll: getAllOfMatcherUrlAll, - getAllowModes: getAllowModesV2, - getAnyOfMatcherUrlAll: getAnyOfMatcherUrlAll, - getClientAll: getClientAll, - getDenyModes: getDenyModesV2, - getFileWithAccessDatasets: getFileWithAccessDatasets, - getFileWithAcr: getFileWithAcr, - getLinkedAcrUrl: getLinkedAcrUrl, - getMatcher: getMatcher, - getMatcherAll: getMatcherAll, - getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll, - getMemberPolicyUrlAll: getMemberPolicyUrlAll, - getNoneOfMatcherUrlAll: getNoneOfMatcherUrlAll, - getPolicy: getPolicy, - getPolicyAll: getPolicyAll, - getPolicyUrlAll: getPolicyUrlAll, - getReferencedPolicyUrlAll: getReferencedPolicyUrlAll, - getResourceAcrPolicy: getResourceAcrPolicy, - getResourceAcrPolicyAll: getResourceAcrPolicyAll, - getResourceInfoWithAccessDatasets: getResourceInfoWithAccessDatasets, - getResourceInfoWithAcr: getResourceInfoWithAcr, - getResourceMatcher: getResourceMatcher, - getResourceMatcherAll: getResourceMatcherAll, - getResourcePolicy: getResourcePolicy, - getResourcePolicyAll: getResourcePolicyAll, - getSolidDatasetWithAccessDatasets: getSolidDatasetWithAccessDatasets, - getSolidDatasetWithAcr: getSolidDatasetWithAcr, - getVcAccess: getVcAccess, - hasAccessibleAcr: hasAccessibleAcr, - hasAuthenticated: hasAuthenticated, - hasCreator: hasCreator, - hasLinkedAcr: hasLinkedAcr, - hasPublic: hasPublic, - isAcpControlled: isAcpControlled, - mockAcrFor: mockAcrFor, - removeAcrPolicyUrl: removeAcrPolicyUrl, - removeAcrPolicyUrlAll: removeAcrPolicyUrlAll, - removeAgent: removeAgent, - removeAllOfMatcherUrl: removeAllOfMatcherUrl, - removeAnyOfMatcherUrl: removeAnyOfMatcherUrl, - removeAuthenticated: removeAuthenticated, - removeClient: removeClient, - removeCreator: removeCreator, - removeMatcher: removeMatcher, - removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl, - removeMemberAcrPolicyUrlAll: removeMemberAcrPolicyUrlAll, - removeMemberPolicyUrl: removeMemberPolicyUrl, - removeMemberPolicyUrlAll: removeMemberPolicyUrlAll, - removeNoneOfMatcherUrl: removeNoneOfMatcherUrl, - removePolicy: removePolicy, - removePolicyUrl: removePolicyUrl, - removePolicyUrlAll: removePolicyUrlAll, - removePublic: removePublic, - removeResourceAcrPolicy: removeResourceAcrPolicy, - removeResourceMatcher: removeResourceMatcher, - removeResourcePolicy: removeResourcePolicy, - saveAcrFor: saveAcrFor, - setAgent: setAgent, - setAllOfMatcherUrl: setAllOfMatcherUrl, - setAllowModes: setAllowModesV2, - setAnyOfMatcherUrl: setAnyOfMatcherUrl, - setAuthenticated: setAuthenticated, - setCreator: setCreator, - setDenyModes: setDenyModesV2, - setMatcher: setMatcher, - setNoneOfMatcherUrl: setNoneOfMatcherUrl, - setPolicy: setPolicy, - setPublic: setPublic, - setResourceMatcher: setResourceMatcher, - setResourcePolicy: setResourcePolicy, - setVcAccess: setVcAccess -}); - -// -// Copyright Inrupt Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the -// Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// Export the different formats methods from @inrupt/solid-client import, these -// are not part of our Public API, but are needed to be exported for usage from -// our other packages. -// -// NOTE: We have to export like this, otherwise rollup does some sort of -// tree-shaking and breaks the build where `dist/formats/index.mjs` is no longer -// built, and this causes the `@inrupt/solid-client/formats` subpath export to -// no longer work. -const { getJsonLdParser, getTurtleParser, solidDatasetAsTurtle } = formats; - -exports.FetchError = FetchError; -exports.SolidClientError = SolidClientError; -exports.ThingExpectedError = ThingExpectedError; -exports.access = universal; -exports.access_v1 = universal_v1; -exports.access_v2 = universal_v2; -exports.acp_ess_1 = ess1; -exports.acp_ess_2 = ess2; -exports.acp_v1 = acp_v1; -exports.acp_v2 = acp_v2; -exports.acp_v3 = acp_v3; -exports.acp_v4 = acp_v4; -exports.addBoolean = addBoolean; -exports.addDate = addDate; -exports.addDatetime = addDatetime; -exports.addDecimal = addDecimal; -exports.addInteger = addInteger; -exports.addIri = addIri; -exports.addJwkToJwks = addJwkToJwks; -exports.addLiteral = addLiteral; -exports.addMockFallbackAclTo = addMockFallbackAclTo; -exports.addMockResourceAclTo = addMockResourceAclTo; -exports.addNamedNode = addNamedNode; -exports.addPublicKeyToProfileJwks = addPublicKeyToProfileJwks; -exports.addStringEnglish = addStringEnglish; -exports.addStringNoLocale = addStringNoLocale; -exports.addStringWithLocale = addStringWithLocale; -exports.addTerm = addTerm; -exports.addTime = addTime; -exports.addUrl = addUrl; -exports.asIri = asIri; -exports.asUrl = asUrl; -exports.buildThing = buildThing; -exports.changeLogAsMarkdown = changeLogAsMarkdown; -exports.createAcl = createAcl; -exports.createAclFromFallbackAcl = createAclFromFallbackAcl; -exports.createContainerAt = createContainerAt; -exports.createContainerInContainer = createContainerInContainer; -exports.createSolidDataset = createSolidDataset; -exports.createThing = createThing; -exports.deleteAclFor = deleteAclFor; -exports.deleteContainer = deleteContainer; -exports.deleteFile = deleteFile; -exports.deleteSolidDataset = deleteSolidDataset; -exports.fromRdfJsDataset = fromRdfJsDataset; -exports.getAgentAccess = getAgentAccess$5; -exports.getAgentAccessAll = getAgentAccessAll$5; -exports.getAgentDefaultAccess = getAgentDefaultAccess; -exports.getAgentDefaultAccessAll = getAgentDefaultAccessAll; -exports.getAgentResourceAccess = getAgentResourceAccess; -exports.getAgentResourceAccessAll = getAgentResourceAccessAll; -exports.getAltProfileUrlAllFrom = getAltProfileUrlAllFrom; -exports.getBoolean = getBoolean; -exports.getBooleanAll = getBooleanAll; -exports.getContainedResourceUrlAll = getContainedResourceUrlAll; -exports.getContentType = getContentType$1; -exports.getDate = getDate; -exports.getDateAll = getDateAll; -exports.getDatetime = getDatetime; -exports.getDatetimeAll = getDatetimeAll; -exports.getDecimal = getDecimal; -exports.getDecimalAll = getDecimalAll; -exports.getEffectiveAccess = getEffectiveAccess; -exports.getFallbackAcl = getFallbackAcl; -exports.getFile = getFile; -exports.getFileWithAcl = getFileWithAcl; -exports.getGroupAccess = getGroupAccess$2; -exports.getGroupAccessAll = getGroupAccessAll$2; -exports.getGroupDefaultAccess = getGroupDefaultAccess; -exports.getGroupDefaultAccessAll = getGroupDefaultAccessAll; -exports.getGroupResourceAccess = getGroupResourceAccess; -exports.getGroupResourceAccessAll = getGroupResourceAccessAll; -exports.getInteger = getInteger; -exports.getIntegerAll = getIntegerAll; -exports.getIri = getIri; -exports.getIriAll = getIriAll; -exports.getJsonLdParser = getJsonLdParser; -exports.getLinkedResourceUrlAll = getLinkedResourceUrlAll; -exports.getLiteral = getLiteral; -exports.getLiteralAll = getLiteralAll; -exports.getNamedNode = getNamedNode; -exports.getNamedNodeAll = getNamedNodeAll; -exports.getPodOwner = getPodOwner; -exports.getPodUrlAll = getPodUrlAll; -exports.getPodUrlAllFrom = getPodUrlAllFrom; -exports.getProfileAll = getProfileAll; -exports.getProfileJwksIri = getProfileJwksIri; -exports.getPropertyAll = getPropertyAll; -exports.getPublicAccess = getPublicAccess$5; -exports.getPublicDefaultAccess = getPublicDefaultAccess; -exports.getPublicResourceAccess = getPublicResourceAccess; -exports.getResourceAcl = getResourceAcl; -exports.getResourceInfo = getResourceInfo; -exports.getResourceInfoWithAcl = getResourceInfoWithAcl; -exports.getSolidDataset = getSolidDataset; -exports.getSolidDatasetWithAcl = getSolidDatasetWithAcl; -exports.getSourceIri = getSourceIri; -exports.getSourceUrl = getSourceUrl; -exports.getStringByLocaleAll = getStringByLocaleAll; -exports.getStringEnglish = getStringEnglish; -exports.getStringEnglishAll = getStringEnglishAll; -exports.getStringNoLocale = getStringNoLocale; -exports.getStringNoLocaleAll = getStringNoLocaleAll; -exports.getStringWithLocale = getStringWithLocale; -exports.getStringWithLocaleAll = getStringWithLocaleAll; -exports.getTerm = getTerm; -exports.getTermAll = getTermAll; -exports.getThing = getThing; -exports.getThingAll = getThingAll; -exports.getTime = getTime; -exports.getTimeAll = getTimeAll; -exports.getTurtleParser = getTurtleParser; -exports.getUrl = getUrl; -exports.getUrlAll = getUrlAll; -exports.getWebIdDataset = getWebIdDataset; -exports.getWellKnownSolid = getWellKnownSolid; -exports.hasAccessibleAcl = hasAccessibleAcl; -exports.hasAcl = hasAcl; -exports.hasFallbackAcl = hasFallbackAcl; -exports.hasResourceAcl = hasResourceAcl; -exports.hasResourceInfo = hasResourceInfo; -exports.hasServerResourceInfo = hasServerResourceInfo; -exports.isContainer = isContainer; -exports.isPodOwner = isPodOwner; -exports.isRawData = isRawData; -exports.isThing = isThing; -exports.isThingLocal = isThingLocal; -exports.mockContainerFrom = mockContainerFrom; -exports.mockFetchError = mockFetchError; -exports.mockFileFrom = mockFileFrom; -exports.mockSolidDatasetFrom = mockSolidDatasetFrom; -exports.mockThingFrom = mockThingFrom; -exports.overwriteFile = overwriteFile; -exports.removeAll = removeAll; -exports.removeBoolean = removeBoolean; -exports.removeDate = removeDate; -exports.removeDatetime = removeDatetime; -exports.removeDecimal = removeDecimal; -exports.removeInteger = removeInteger; -exports.removeIri = removeIri; -exports.removeLiteral = removeLiteral; -exports.removeNamedNode = removeNamedNode; -exports.removeStringEnglish = removeStringEnglish; -exports.removeStringNoLocale = removeStringNoLocale; -exports.removeStringWithLocale = removeStringWithLocale; -exports.removeThing = removeThing; -exports.removeTime = removeTime; -exports.removeUrl = removeUrl; -exports.responseToResourceInfo = responseToResourceInfo; -exports.responseToSolidDataset = responseToSolidDataset; -exports.saveAclFor = saveAclFor; -exports.saveFileInContainer = saveFileInContainer; -exports.saveSolidDatasetAt = saveSolidDatasetAt; -exports.saveSolidDatasetInContainer = saveSolidDatasetInContainer; -exports.setAgentDefaultAccess = setAgentDefaultAccess; -exports.setAgentResourceAccess = setAgentResourceAccess$1; -exports.setBoolean = setBoolean; -exports.setDate = setDate; -exports.setDatetime = setDatetime; -exports.setDecimal = setDecimal; -exports.setGroupDefaultAccess = setGroupDefaultAccess; -exports.setGroupResourceAccess = setGroupResourceAccess$1; -exports.setInteger = setInteger; -exports.setIri = setIri; -exports.setLiteral = setLiteral; -exports.setNamedNode = setNamedNode; -exports.setProfileJwks = setProfileJwks; -exports.setPublicDefaultAccess = setPublicDefaultAccess; -exports.setPublicResourceAccess = setPublicResourceAccess$1; -exports.setStringNoLocale = setStringNoLocale; -exports.setStringWithLocale = setStringWithLocale; -exports.setTerm = setTerm; -exports.setThing = setThing; -exports.setTime = setTime; -exports.setUrl = setUrl; -exports.solidDatasetAsMarkdown = solidDatasetAsMarkdown; -exports.solidDatasetAsTurtle = solidDatasetAsTurtle; -exports.thingAsMarkdown = thingAsMarkdown; -exports.toRdfJsDataset = toRdfJsDataset; -exports.universalAccess = index; -exports.validateContainedResourceAll = validateContainedResourceAll; - - -/***/ }), - -/***/ "./node_modules/@inrupt/universal-fetch/dist/index-browser.js": -/*!********************************************************************!*\ - !*** ./node_modules/@inrupt/universal-fetch/dist/index-browser.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ value: true })); - -var indexBrowser = globalThis.fetch; -const { fetch, Response, Request, Headers } = globalThis; - -exports.Headers = Headers; -exports.Request = Request; -exports.Response = Response; -exports["default"] = indexBrowser; -exports.fetch = fetch; - - -/***/ }), - -/***/ "./node_modules/@inrupt/universal-fetch/dist/index-browser.mjs": -/*!*********************************************************************!*\ - !*** ./node_modules/@inrupt/universal-fetch/dist/index-browser.mjs ***! - \*********************************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Headers: function() { return /* binding */ Headers; }, -/* harmony export */ Request: function() { return /* binding */ Request; }, -/* harmony export */ Response: function() { return /* binding */ Response; }, -/* harmony export */ "default": function() { return /* binding */ indexBrowser; }, -/* harmony export */ fetch: function() { return /* binding */ fetch; } -/* harmony export */ }); -var indexBrowser = globalThis.fetch; -const { fetch, Response, Request, Headers } = globalThis; - - - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/index.js": -/*!*************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/index.js ***! - \*************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -const DataFactory = __webpack_require__(/*! ./lib/DataFactory.js */ "./node_modules/@rdfjs/data-model/lib/DataFactory.js") - -module.exports = DataFactory - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/BlankNode.js": -/*!*********************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/BlankNode.js ***! - \*********************************************************/ -/***/ (function(module) { - -class BlankNode { - constructor (id) { - this.value = id || ('b' + (++BlankNode.nextId)) - } - - equals (other) { - return !!other && other.termType === this.termType && other.value === this.value - } -} - -BlankNode.prototype.termType = 'BlankNode' - -BlankNode.nextId = 0 - -module.exports = BlankNode - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/DataFactory.js": -/*!***********************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/DataFactory.js ***! - \***********************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -const BlankNode = __webpack_require__(/*! ./BlankNode.js */ "./node_modules/@rdfjs/data-model/lib/BlankNode.js") -const DefaultGraph = __webpack_require__(/*! ./DefaultGraph.js */ "./node_modules/@rdfjs/data-model/lib/DefaultGraph.js") -const fromTermRaw = __webpack_require__(/*! ./fromTerm.js */ "./node_modules/@rdfjs/data-model/lib/fromTerm.js") -const Literal = __webpack_require__(/*! ./Literal.js */ "./node_modules/@rdfjs/data-model/lib/Literal.js") -const NamedNode = __webpack_require__(/*! ./NamedNode.js */ "./node_modules/@rdfjs/data-model/lib/NamedNode.js") -const Quad = __webpack_require__(/*! ./Quad.js */ "./node_modules/@rdfjs/data-model/lib/Quad.js") -const Variable = __webpack_require__(/*! ./Variable.js */ "./node_modules/@rdfjs/data-model/lib/Variable.js") - -function namedNode (value) { - return new NamedNode(value) -} - -function blankNode (value) { - return new BlankNode(value) -} - -function literal (value, languageOrDatatype) { - if (typeof languageOrDatatype === 'string') { - if (languageOrDatatype.indexOf(':') === -1) { - return new Literal(value, languageOrDatatype) - } - - return new Literal(value, null, DataFactory.namedNode(languageOrDatatype)) - } - - return new Literal(value, null, languageOrDatatype) -} - -function variable (value) { - return new Variable(value) -} - -function defaultGraph () { - return DataFactory.defaultGraphInstance -} - -function triple (subject, predicate, object) { - return DataFactory.quad(subject, predicate, object) -} - -function quad (subject, predicate, object, graph) { - return new Quad(subject, predicate, object, graph || DataFactory.defaultGraphInstance) -} - -function fromTerm (original) { - return fromTermRaw.call(DataFactory, original) -} - -function fromQuad (original) { - return fromTermRaw.call(DataFactory, original) -} - -const DataFactory = { - namedNode, - blankNode, - literal, - variable, - defaultGraph, - triple, - quad, - fromTerm, - fromQuad, - defaultGraphInstance: new DefaultGraph() -} - -module.exports = DataFactory - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/DefaultGraph.js": -/*!************************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/DefaultGraph.js ***! - \************************************************************/ -/***/ (function(module) { - -class DefaultGraph { - equals (other) { - return !!other && other.termType === this.termType - } -} - -DefaultGraph.prototype.termType = 'DefaultGraph' -DefaultGraph.prototype.value = '' - -module.exports = DefaultGraph - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/Literal.js": -/*!*******************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/Literal.js ***! - \*******************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -const NamedNode = __webpack_require__(/*! ./NamedNode.js */ "./node_modules/@rdfjs/data-model/lib/NamedNode.js") - -class Literal { - constructor (value, language, datatype) { - this.value = value - this.datatype = Literal.stringDatatype - this.language = '' - - if (language) { - this.language = language - this.datatype = Literal.langStringDatatype - } else if (datatype) { - this.datatype = datatype - } - } - - equals (other) { - return !!other && other.termType === this.termType && other.value === this.value && - other.language === this.language && other.datatype.equals(this.datatype) - } -} - -Literal.prototype.termType = 'Literal' - -Literal.langStringDatatype = new NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString') -Literal.stringDatatype = new NamedNode('http://www.w3.org/2001/XMLSchema#string') - -module.exports = Literal - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/NamedNode.js": -/*!*********************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/NamedNode.js ***! - \*********************************************************/ -/***/ (function(module) { - -class NamedNode { - constructor (iri) { - this.value = iri - } - - equals (other) { - return !!other && other.termType === this.termType && other.value === this.value - } -} - -NamedNode.prototype.termType = 'NamedNode' - -module.exports = NamedNode - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/Quad.js": -/*!****************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/Quad.js ***! - \****************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -const DefaultGraph = __webpack_require__(/*! ./DefaultGraph.js */ "./node_modules/@rdfjs/data-model/lib/DefaultGraph.js") - -class Quad { - constructor (subject, predicate, object, graph) { - this.subject = subject - this.predicate = predicate - this.object = object - - if (graph) { - this.graph = graph - } else { - this.graph = new DefaultGraph() - } - } - - equals (other) { - // `|| !other.termType` is for backwards-compatibility with old factories without RDF* support. - return !!other && (other.termType === 'Quad' || !other.termType) && - other.subject.equals(this.subject) && other.predicate.equals(this.predicate) && - other.object.equals(this.object) && other.graph.equals(this.graph) - } -} - -Quad.prototype.termType = 'Quad' -Quad.prototype.value = '' - -module.exports = Quad - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/Variable.js": -/*!********************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/Variable.js ***! - \********************************************************/ -/***/ (function(module) { - -class Variable { - constructor (name) { - this.value = name - } - - equals (other) { - return !!other && other.termType === this.termType && other.value === this.value - } -} - -Variable.prototype.termType = 'Variable' - -module.exports = Variable - - -/***/ }), - -/***/ "./node_modules/@rdfjs/data-model/lib/fromTerm.js": -/*!********************************************************!*\ - !*** ./node_modules/@rdfjs/data-model/lib/fromTerm.js ***! - \********************************************************/ -/***/ (function(module) { - -function fromTerm (original) { - if (!original) { - return null - } - - if (original.termType === 'BlankNode') { - return this.blankNode(original.value) - } - - if (original.termType === 'DefaultGraph') { - return this.defaultGraph() - } - - if (original.termType === 'Literal') { - return this.literal(original.value, original.language || this.namedNode(original.datatype.value)) - } - - if (original.termType === 'NamedNode') { - return this.namedNode(original.value) - } - - if (original.termType === 'Quad') { - const subject = this.fromTerm(original.subject) - const predicate = this.fromTerm(original.predicate) - const object = this.fromTerm(original.object) - const graph = this.fromTerm(original.graph) - - return this.quad(subject, predicate, object, graph) - } - - if (original.termType === 'Variable') { - return this.variable(original.value) - } - - throw new Error(`unknown termType ${original.termType}`) -} - -module.exports = fromTerm - - -/***/ }), - -/***/ "./node_modules/@rdfjs/dataset/DatasetCore.js": -/*!****************************************************!*\ - !*** ./node_modules/@rdfjs/dataset/DatasetCore.js ***! - \****************************************************/ -/***/ (function(module) { - -function isString (s) { - return typeof s === 'string' || s instanceof String -} - -const xsdString = 'http://www.w3.org/2001/XMLSchema#string' - -function termToId (term) { - if (typeof term === 'string') { - return term - } - - if (!term) { - return '' - } - - if (typeof term.id !== 'undefined' && term.termType !== 'Quad') { - return term.id - } - - let subject, predicate, object, graph - - // Term instantiated with another library - switch (term.termType) { - case 'NamedNode': - return term.value - - case 'BlankNode': - return `_:${term.value}` - - case 'Variable': - return `?${term.value}` - - case 'DefaultGraph': - return '' - - case 'Literal': - if (term.language) { - return `"${term.value}"@${term.language}` - } - - return `"${term.value}"${term.datatype && term.datatype.value !== xsdString ? `^^${term.datatype.value}` : ''}` - - case 'Quad': - // To identify RDF* quad components, we escape quotes by doubling them. - // This avoids the overhead of backslash parsing of Turtle-like syntaxes. - subject = escapeQuotes(termToId(term.subject)) - predicate = escapeQuotes(termToId(term.predicate)) - object = escapeQuotes(termToId(term.object)) - graph = term.graph.termType === 'DefaultGraph' ? '' : ` ${termToId(term.graph)}` - - return `<<${subject} ${predicate} ${object}${graph}>>` - - default: - throw new Error(`Unexpected termType: ${term.termType}`) - } -} - -const escapedLiteral = /^"(.*".*)(?="[^"]*$)/ - -function escapeQuotes (id) { - return id.replace(escapedLiteral, (_, quoted) => `"${quoted.replace(/"/g, '""')}`) -} - -class DatasetCore { - constructor (quads) { - // The number of quads is initially zero - this._size = 0 - // `_graphs` contains subject, predicate, and object indexes per graph - this._graphs = Object.create(null) - // `_ids` maps entities such as `http://xmlns.com/foaf/0.1/name` to numbers, - // saving memory by using only numbers as keys in `_graphs` - this._id = 0 - this._ids = Object.create(null) - this._ids['><'] = 0 // dummy entry, so the first actual key is non-zero - this._entities = Object.create(null) // inverse of `_ids` - - this._quads = new Map() - - // Add quads if passed - if (quads) { - for (const quad of quads) { - this.add(quad) - } - } - } - - get size () { - // Return the quad count if if was cached - let size = this._size - - if (size !== null) { - return size - } - - // Calculate the number of quads by counting to the deepest level - size = 0 - const graphs = this._graphs - let subjects, subject - - for (const graphKey in graphs) { - for (const subjectKey in (subjects = graphs[graphKey].subjects)) { - for (const predicateKey in (subject = subjects[subjectKey])) { - size += Object.keys(subject[predicateKey]).length - } - } - } - - this._size = size - - return this._size - } - - add (quad) { - // Convert terms to internal string representation - let subject = termToId(quad.subject) - let predicate = termToId(quad.predicate) - let object = termToId(quad.object) - const graph = termToId(quad.graph) - - // Find the graph that will contain the triple - let graphItem = this._graphs[graph] - // Create the graph if it doesn't exist yet - if (!graphItem) { - graphItem = this._graphs[graph] = { subjects: {}, predicates: {}, objects: {} } - // Freezing a graph helps subsequent `add` performance, - // and properties will never be modified anyway - Object.freeze(graphItem) - } - - // Since entities can often be long IRIs, we avoid storing them in every index. - // Instead, we have a separate index that maps entities to numbers, - // which are then used as keys in the other indexes. - const ids = this._ids - const entities = this._entities - subject = ids[subject] || (ids[entities[++this._id] = subject] = this._id) - predicate = ids[predicate] || (ids[entities[++this._id] = predicate] = this._id) - object = ids[object] || (ids[entities[++this._id] = object] = this._id) - - this._addToIndex(graphItem.subjects, subject, predicate, object) - this._addToIndex(graphItem.predicates, predicate, object, subject) - this._addToIndex(graphItem.objects, object, subject, predicate) - - this._setQuad(subject, predicate, object, graph, quad) - - // The cached quad count is now invalid - this._size = null - - return this - } - - delete (quad) { - // Convert terms to internal string representation - let subject = termToId(quad.subject) - let predicate = termToId(quad.predicate) - let object = termToId(quad.object) - const graph = termToId(quad.graph) - - // Find internal identifiers for all components - // and verify the quad exists. - const ids = this._ids - const graphs = this._graphs - let graphItem, subjects, predicates - - if (!(subject = ids[subject]) || !(predicate = ids[predicate]) || - !(object = ids[object]) || !(graphItem = graphs[graph]) || - !(subjects = graphItem.subjects[subject]) || - !(predicates = subjects[predicate]) || - !(object in predicates) - ) { - return this - } - - // Remove it from all indexes - this._removeFromIndex(graphItem.subjects, subject, predicate, object) - this._removeFromIndex(graphItem.predicates, predicate, object, subject) - this._removeFromIndex(graphItem.objects, object, subject, predicate) - - if (this._size !== null) { - this._size-- - } - - this._deleteQuad(subject, predicate, object, graph) - - // Remove the graph if it is empty - for (subject in graphItem.subjects) { // eslint-disable-line no-unreachable-loop - return this - } - - delete graphs[graph] - - return this - } - - has (quad) { - // Convert terms to internal string representation - const subject = termToId(quad.subject) - const predicate = termToId(quad.predicate) - const object = termToId(quad.object) - const graph = termToId(quad.graph) - - const graphItem = this._graphs[graph] - - if (!graphItem) { - return false - } - - const ids = this._ids - let subjectId, predicateId, objectId - - // Translate IRIs to internal index keys. - if ( - (isString(subject) && !(subjectId = ids[subject])) || - (isString(predicate) && !(predicateId = ids[predicate])) || - (isString(object) && !(objectId = ids[object])) - ) { - return false - } - - return this._countInIndex(graphItem.objects, objectId, subjectId, predicateId) === 1 - } - - match (subject, predicate, object, graph) { - return this._createDataset(this._match(subject, predicate, object, graph)) - } - - [Symbol.iterator] () { - return this._match()[Symbol.iterator]() - } - - // ## Private methods - - // ### `_addToIndex` adds a quad to a three-layered index. - // Returns if the index has changed, if the entry did not already exist. - _addToIndex (index0, key0, key1, key2) { - // Create layers as necessary - const index1 = index0[key0] || (index0[key0] = {}) - const index2 = index1[key1] || (index1[key1] = {}) - // Setting the key to _any_ value signals the presence of the quad - const existed = key2 in index2 - - if (!existed) { - index2[key2] = null - } - - return !existed - } - - // ### `_removeFromIndex` removes a quad from a three-layered index - _removeFromIndex (index0, key0, key1, key2) { - // Remove the quad from the index - const index1 = index0[key0] - const index2 = index1[key1] - delete index2[key2] - - // Remove intermediary index layers if they are empty - for (const key in index2) { // eslint-disable-line no-unreachable-loop - return - } - - delete index1[key1] - - for (const key in index1) { // eslint-disable-line no-unreachable-loop - return - } - - delete index0[key0] - } - - // ### `_findInIndex` finds a set of quads in a three-layered index. - // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`. - // Any of these keys can be undefined, which is interpreted as a wildcard. - // `name0`, `name1`, and `name2` are the names of the keys at each level, - // used when reconstructing the resulting quad - // (for instance: _subject_, _predicate_, and _object_). - // Finally, `graph` will be the graph of the created quads. - // If `callback` is given, each result is passed through it - // and iteration halts when it returns truthy for any quad. - // If instead `array` is given, each result is added to the array. - _findInIndex (index0, key0, key1, key2, name0, name1, name2, graph, callback, array) { - let tmp, index1, index2 - - // If a key is specified, use only that part of index 0. - if (key0) { - (tmp = index0, index0 = {})[key0] = tmp[key0] - } - - for (const value0 in index0) { - index1 = index0[value0] - - if (index1) { - // If a key is specified, use only that part of index 1. - if (key1) { - (tmp = index1, index1 = {})[key1] = tmp[key1] - } - - for (const value1 in index1) { - index2 = index1[value1] - - if (index2) { - // If a key is specified, use only that part of index 2, if it exists. - const values = key2 ? (key2 in index2 ? [key2] : []) : Object.keys(index2) - // Create quads for all items found in index 2. - for (let l = 0; l < values.length; l++) { - const parts = { - [name0]: value0, - [name1]: value1, - [name2]: values[l] - } - - const quad = this._getQuad(parts.subject, parts.predicate, parts.object, graph) - - if (array) { - array.push(quad) - } else if (callback(quad)) { - return true - } - } - } - } - } - } - - return array - } - - // ### `_countInIndex` counts matching quads in a three-layered index. - // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`. - // Any of these keys can be undefined, which is interpreted as a wildcard. - _countInIndex (index0, key0, key1, key2) { - let count = 0 - let tmp, index1, index2 - - // If a key is specified, count only that part of index 0 - if (key0) { - (tmp = index0, index0 = {})[key0] = tmp[key0] - } - - for (const value0 in index0) { - index1 = index0[value0] - - if (index1) { - // If a key is specified, count only that part of index 1 - if (key1) { - (tmp = index1, index1 = {})[key1] = tmp[key1] - } - - for (const value1 in index1) { - index2 = index1[value1] - - if (index2) { - if (key2) { - // If a key is specified, count the quad if it exists - (key2 in index2) && count++ - } else { - // Otherwise, count all quads - count += Object.keys(index2).length - } - } - } - } - } - - return count - } - - // ### `_getGraphs` returns an array with the given graph, - // or all graphs if the argument is null or undefined. - _getGraphs (graph) { - if (!isString(graph)) { - return this._graphs - } - - return { - [graph]: this._graphs[graph] - } - } - - _match (subject, predicate, object, graph) { - // Convert terms to internal string representation - subject = subject && termToId(subject) - predicate = predicate && termToId(predicate) - object = object && termToId(object) - graph = graph && termToId(graph) - - const quads = [] - const graphs = this._getGraphs(graph) - const ids = this._ids - let content, subjectId, predicateId, objectId - - // Translate IRIs to internal index keys. - if ( - (isString(subject) && !(subjectId = ids[subject])) || - (isString(predicate) && !(predicateId = ids[predicate])) || - (isString(object) && !(objectId = ids[object])) - ) { - return quads - } - - for (const graphId in graphs) { - content = graphs[graphId] - - // Only if the specified graph contains triples, there can be results - if (content) { - // Choose the optimal index, based on what fields are present - if (subjectId) { - if (objectId) { - // If subject and object are given, the object index will be the fastest - this._findInIndex(content.objects, objectId, subjectId, predicateId, 'object', 'subject', 'predicate', graphId, null, quads) - } else { - // If only subject and possibly predicate are given, the subject index will be the fastest - this._findInIndex(content.subjects, subjectId, predicateId, null, 'subject', 'predicate', 'object', graphId, null, quads) - } - } else if (predicateId) { - // if only predicate and possibly object are given, the predicate index will be the fastest - this._findInIndex(content.predicates, predicateId, objectId, null, 'predicate', 'object', 'subject', graphId, null, quads) - } else if (objectId) { - // If only object is given, the object index will be the fastest - this._findInIndex(content.objects, objectId, null, null, 'object', 'subject', 'predicate', graphId, null, quads) - } else { - // If nothing is given, iterate subjects and predicates first - this._findInIndex(content.subjects, null, null, null, 'subject', 'predicate', 'object', graphId, null, quads) - } - } - } - - return quads - } - - _getQuad (subjectId, predicateId, objectId, graphId) { - return this._quads.get(this._toId(subjectId, predicateId, objectId, graphId)) - } - - _setQuad (subjectId, predicateId, objectId, graphId, quad) { - this._quads.set(this._toId(subjectId, predicateId, objectId, graphId), quad) - } - - _deleteQuad (subjectId, predicateId, objectId, graphId) { - this._quads.delete(this._toId(subjectId, predicateId, objectId, graphId)) - } - - _createDataset (quads) { - return new this.constructor(quads) - } - - _toId (subjectId, predicateId, objectId, graphId) { - return `${subjectId}:${predicateId}:${objectId}:${graphId}` - } -} - -module.exports = DatasetCore - - -/***/ }), - -/***/ "./node_modules/@rdfjs/dataset/index.js": -/*!**********************************************!*\ - !*** ./node_modules/@rdfjs/dataset/index.js ***! - \**********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -const rdf = __webpack_require__(/*! @rdfjs/data-model */ "./node_modules/@rdfjs/data-model/index.js") -const DatasetCore = __webpack_require__(/*! ./DatasetCore */ "./node_modules/@rdfjs/dataset/DatasetCore.js") - -function dataset (quads) { - return new DatasetCore(quads) -} - -module.exports = Object.assign({ dataset }, rdf) - - -/***/ }), - -/***/ "./node_modules/abort-controller/browser.js": -/*!**************************************************!*\ - !*** ./node_modules/abort-controller/browser.js ***! - \**************************************************/ -/***/ (function(module) { - -"use strict"; -/*globals self, window */ - - -/*eslint-disable @mysticatea/prettier */ -const { AbortController, AbortSignal } = - typeof self !== "undefined" ? self : - typeof window !== "undefined" ? window : - /* otherwise */ undefined -/*eslint-enable @mysticatea/prettier */ - -module.exports = AbortController -module.exports.AbortSignal = AbortSignal -module.exports["default"] = AbortController - - -/***/ }), - -/***/ "./node_modules/base64-js/index.js": -/*!*****************************************!*\ - !*** ./node_modules/base64-js/index.js ***! - \*****************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - - -/***/ }), - -/***/ "./node_modules/blob/main.js": -/*!***********************************!*\ - !*** ./node_modules/blob/main.js ***! - \***********************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/** - * Create a blob builder even when vendor prefixes exist - */ - -var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : - typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder : - typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : - typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : - false; - -/** - * Check if Blob constructor is supported - */ - -var blobSupported = (function() { - try { - var a = new Blob(['hi']); - return a.size === 2; - } catch(e) { - return false; - } -})(); - -/** - * Check if Blob constructor supports ArrayBufferViews - * Fails in Safari 6, so we need to map to ArrayBuffers there. - */ - -var blobSupportsArrayBufferView = blobSupported && (function() { - try { - var b = new Blob([new Uint8Array([1,2])]); - return b.size === 2; - } catch(e) { - return false; - } -})(); - -/** - * Check if BlobBuilder is supported - */ - -var blobBuilderSupported = BlobBuilder - && BlobBuilder.prototype.append - && BlobBuilder.prototype.getBlob; - -/** - * Helper function that maps ArrayBufferViews to ArrayBuffers - * Used by BlobBuilder constructor and old browsers that didn't - * support it in the Blob constructor. - */ - -function mapArrayBufferViews(ary) { - return ary.map(function(chunk) { - if (chunk.buffer instanceof ArrayBuffer) { - var buf = chunk.buffer; - - // if this is a subarray, make a copy so we only - // include the subarray region from the underlying buffer - if (chunk.byteLength !== buf.byteLength) { - var copy = new Uint8Array(chunk.byteLength); - copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); - buf = copy.buffer; - } - - return buf; - } - - return chunk; - }); -} - -function BlobBuilderConstructor(ary, options) { - options = options || {}; - - var bb = new BlobBuilder(); - mapArrayBufferViews(ary).forEach(function(part) { - bb.append(part); - }); - - return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); -} - -function BlobConstructor(ary, options) { - return new Blob(mapArrayBufferViews(ary), options || {}); -} - -if (typeof Blob !== 'undefined') { - BlobBuilderConstructor.prototype = Blob.prototype; - BlobConstructor.prototype = Blob.prototype; -} - -/* harmony default export */ __webpack_exports__["default"] = ((function() { - if (blobSupported) { - return blobSupportsArrayBufferView ? Blob : BlobConstructor; - } else if (blobBuilderSupported) { - return BlobBuilderConstructor; - } else { - return undefined; - } -})()); - - -/***/ }), - -/***/ "./node_modules/buffer/index.js": -/*!**************************************!*\ - !*** ./node_modules/buffer/index.js ***! - \**************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - - - -const base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js") -const ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js") -const customInspectSymbol = - (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -const K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1) - const proto = { foo: function () { return 42 } } - Object.setPrototypeOf(proto, Uint8Array.prototype) - Object.setPrototypeOf(arr, proto) - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length) - Object.setPrototypeOf(buf, Buffer.prototype) - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayView(value) - } - - if (value == null) { - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof SharedArrayBuffer !== 'undefined' && - (isInstance(value, SharedArrayBuffer) || - (value && isInstance(value.buffer, SharedArrayBuffer)))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - const valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - const b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) -Object.setPrototypeOf(Buffer, Uint8Array) - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - const length = byteLength(string, encoding) | 0 - let buf = createBuffer(length) - - const actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0 - const buf = createBuffer(length) - for (let i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayView (arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView) - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) - } - return fromArrayLike(arrayView) -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - let buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype) - - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0 - const buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - let x = a.length - let y = b.length - - for (let i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - let i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - const buffer = Buffer.allocUnsafe(length) - let pos = 0 - for (i = 0; i < list.length; ++i) { - let buf = list[i] - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) - buf.copy(buffer, pos) - } else { - Uint8Array.prototype.set.call( - buffer, - buf, - pos - ) - } - } else if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } else { - buf.copy(buffer, pos) - } - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - const len = string.length - const mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - let loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - let loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - const i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - const len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (let i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - const len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (let i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - const len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (let i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - const length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - let str = '' - const max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} -if (customInspectSymbol) { - Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - let x = thisEnd - thisStart - let y = end - start - const len = Math.min(x, y) - - const thisCopy = this.slice(thisStart, thisEnd) - const targetCopy = target.slice(start, end) - - for (let i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - let indexSize = 1 - let arrLength = arr.length - let valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - let i - if (dir) { - let foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - let found = true - for (let j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - const remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - const strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - let i - for (i = 0; i < length; ++i) { - const parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - const remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - let loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - const res = [] - - let i = start - while (i < end) { - const firstByte = buf[i] - let codePoint = null - let bytesPerSequence = (firstByte > 0xEF) - ? 4 - : (firstByte > 0xDF) - ? 3 - : (firstByte > 0xBF) - ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - const len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - let res = '' - let i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - let ret = '' - end = Math.min(buf.length, end) - - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - let ret = '' - end = Math.min(buf.length, end) - - for (let i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - const len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - let out = '' - for (let i = start; i < end; ++i) { - out += hexSliceLookupTable[buf[i]] - } - return out -} - -function utf16leSlice (buf, start, end) { - const bytes = buf.slice(start, end) - let res = '' - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for (let i = 0; i < bytes.length - 1; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - const len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - const newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype) - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUintLE = -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let val = this[offset] - let mul = 1 - let i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUintBE = -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - let val = this[offset + --byteLength] - let mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUint8 = -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUint16LE = -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUint16BE = -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUint32LE = -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUint32BE = -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const lo = first + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 24 - - const hi = this[++offset] + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - last * 2 ** 24 - - return BigInt(lo) + (BigInt(hi) << BigInt(32)) -}) - -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const hi = first * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - this[++offset] - - const lo = this[++offset] * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - last - - return (BigInt(hi) << BigInt(32)) + BigInt(lo) -}) - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let val = this[offset] - let mul = 1 - let i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - let i = byteLength - let mul = 1 - let val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - const val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - const val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const val = this[offset + 4] + - this[offset + 5] * 2 ** 8 + - this[offset + 6] * 2 ** 16 + - (last << 24) // Overflow - - return (BigInt(val) << BigInt(32)) + - BigInt(first + - this[++offset] * 2 ** 8 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 24) -}) - -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { - offset = offset >>> 0 - validateNumber(offset, 'offset') - const first = this[offset] - const last = this[offset + 7] - if (first === undefined || last === undefined) { - boundsError(offset, this.length - 8) - } - - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - this[++offset] - - return (BigInt(val) << BigInt(32)) + - BigInt(this[++offset] * 2 ** 24 + - this[++offset] * 2 ** 16 + - this[++offset] * 2 ** 8 + - last) -}) - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUintLE = -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - let mul = 1 - let i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUintBE = -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - let i = byteLength - 1 - let mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUint8 = -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUint16LE = -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUint16BE = -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUint32LE = -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUint32BE = -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function wrtBigUInt64LE (buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7) - - let lo = Number(value & BigInt(0xffffffff)) - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - lo = lo >> 8 - buf[offset++] = lo - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - hi = hi >> 8 - buf[offset++] = hi - return offset -} - -function wrtBigUInt64BE (buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7) - - let lo = Number(value & BigInt(0xffffffff)) - buf[offset + 7] = lo - lo = lo >> 8 - buf[offset + 6] = lo - lo = lo >> 8 - buf[offset + 5] = lo - lo = lo >> 8 - buf[offset + 4] = lo - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) - buf[offset + 3] = hi - hi = hi >> 8 - buf[offset + 2] = hi - hi = hi >> 8 - buf[offset + 1] = hi - hi = hi >> 8 - buf[offset] = hi - return offset + 8 -} - -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) -}) - -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) -}) - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - let i = 0 - let mul = 1 - let sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - const limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - let i = byteLength - 1 - let mul = 1 - let sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) -}) - -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) -}) - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - const len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - const code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } else if (typeof val === 'boolean') { - val = Number(val) - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - let i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - const bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - const len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// CUSTOM ERRORS -// ============= - -// Simplified versions from Node, changed for Buffer-only usage -const errors = {} -function E (sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor () { - super() - - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }) - - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]` - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - // Reset the name to the actual name. - delete this.name - } - - get code () { - return sym - } - - set code (value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }) - } - - toString () { - return `${this.name} [${sym}]: ${this.message}` - } - } -} - -E('ERR_BUFFER_OUT_OF_BOUNDS', - function (name) { - if (name) { - return `${name} is outside of buffer bounds` - } - - return 'Attempt to access memory outside buffer bounds' - }, RangeError) -E('ERR_INVALID_ARG_TYPE', - function (name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}` - }, TypeError) -E('ERR_OUT_OF_RANGE', - function (str, range, input) { - let msg = `The value of "${str}" is out of range.` - let received = input - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)) - } else if (typeof input === 'bigint') { - received = String(input) - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { - received = addNumericalSeparator(received) - } - received += 'n' - } - msg += ` It must be ${range}. Received ${received}` - return msg - }, RangeError) - -function addNumericalSeparator (val) { - let res = '' - let i = val.length - const start = val[0] === '-' ? 1 : 0 - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}` - } - return `${val.slice(0, i)}${res}` -} - -// CHECK FUNCTIONS -// =============== - -function checkBounds (buf, offset, byteLength) { - validateNumber(offset, 'offset') - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { - boundsError(offset, buf.length - (byteLength + 1)) - } -} - -function checkIntBI (value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : '' - let range - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) { - range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` - } else { - range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + - `${(byteLength + 1) * 8 - 1}${n}` - } - } else { - range = `>= ${min}${n} and <= ${max}${n}` - } - throw new errors.ERR_OUT_OF_RANGE('value', range, value) - } - checkBounds(buf, offset, byteLength) -} - -function validateNumber (value, name) { - if (typeof value !== 'number') { - throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) - } -} - -function boundsError (value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type) - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) - } - - if (length < 0) { - throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() - } - - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', - `>= ${type ? 1 : 0} and <= ${length}`, - value) -} - -// HELPER FUNCTIONS -// ================ - -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function utf8ToBytes (string, units) { - units = units || Infinity - let codePoint - const length = string.length - let leadSurrogate = null - const bytes = [] - - for (let i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - const byteArray = [] - for (let i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - let c, hi, lo - const byteArray = [] - for (let i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - let i - for (i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = (function () { - const alphabet = '0123456789abcdef' - const table = new Array(256) - for (let i = 0; i < 16; ++i) { - const i16 = i * 16 - for (let j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j] - } - } - return table -})() - -// Return not function with Error if BigInt not supported -function defineBigIntMethod (fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn -} - -function BufferBigIntNotDefined () { - throw new Error('BigInt not supported') -} - - -/***/ }), - -/***/ "./node_modules/canonicalize/lib/canonicalize.js": -/*!*******************************************************!*\ - !*** ./node_modules/canonicalize/lib/canonicalize.js ***! - \*******************************************************/ -/***/ (function(module) { - -"use strict"; -/* jshint esversion: 6 */ -/* jslint node: true */ - - -module.exports = function serialize (object) { - if (object === null || typeof object !== 'object' || object.toJSON != null) { - return JSON.stringify(object); - } - - if (Array.isArray(object)) { - return '[' + object.reduce((t, cv, ci) => { - const comma = ci === 0 ? '' : ','; - const value = cv === undefined || typeof cv === 'symbol' ? null : cv; - return t + comma + serialize(value); - }, '') + ']'; - } - - return '{' + Object.keys(object).sort().reduce((t, cv, ci) => { - if (object[cv] === undefined || - typeof object[cv] === 'symbol') { - return t; - } - const comma = t.length === 0 ? '' : ','; - return t + comma + serialize(cv) + ':' + serialize(object[cv]); - }, '') + '}'; -}; - - -/***/ }), - -/***/ "./node_modules/cross-fetch/dist/browser-polyfill.js": -/*!***********************************************************!*\ - !*** ./node_modules/cross-fetch/dist/browser-polyfill.js ***! - \***********************************************************/ -/***/ (function() { - -(function(self) { - -var irrelevant = (function (exports) { - - var support = { - searchParams: 'URLSearchParams' in self, - iterable: 'Symbol' in self && 'iterator' in Symbol, - blob: - 'FileReader' in self && - 'Blob' in self && - (function() { - try { - new Blob(); - return true - } catch (e) { - return false - } - })(), - formData: 'FormData' in self, - arrayBuffer: 'ArrayBuffer' in self - }; - - function isDataView(obj) { - return obj && DataView.prototype.isPrototypeOf(obj) - } - - if (support.arrayBuffer) { - var viewClasses = [ - '[object Int8Array]', - '[object Uint8Array]', - '[object Uint8ClampedArray]', - '[object Int16Array]', - '[object Uint16Array]', - '[object Int32Array]', - '[object Uint32Array]', - '[object Float32Array]', - '[object Float64Array]' - ]; - - var isArrayBufferView = - ArrayBuffer.isView || - function(obj) { - return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 - }; - } - - function normalizeName(name) { - if (typeof name !== 'string') { - name = String(name); - } - if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { - throw new TypeError('Invalid character in header field name') - } - return name.toLowerCase() - } - - function normalizeValue(value) { - if (typeof value !== 'string') { - value = String(value); - } - return value - } - - // Build a destructive iterator for the value list - function iteratorFor(items) { - var iterator = { - next: function() { - var value = items.shift(); - return {done: value === undefined, value: value} - } - }; - - if (support.iterable) { - iterator[Symbol.iterator] = function() { - return iterator - }; - } - - return iterator - } - - function Headers(headers) { - this.map = {}; - - if (headers instanceof Headers) { - headers.forEach(function(value, name) { - this.append(name, value); - }, this); - } else if (Array.isArray(headers)) { - headers.forEach(function(header) { - this.append(header[0], header[1]); - }, this); - } else if (headers) { - Object.getOwnPropertyNames(headers).forEach(function(name) { - this.append(name, headers[name]); - }, this); - } - } - - Headers.prototype.append = function(name, value) { - name = normalizeName(name); - value = normalizeValue(value); - var oldValue = this.map[name]; - this.map[name] = oldValue ? oldValue + ', ' + value : value; - }; - - Headers.prototype['delete'] = function(name) { - delete this.map[normalizeName(name)]; - }; - - Headers.prototype.get = function(name) { - name = normalizeName(name); - return this.has(name) ? this.map[name] : null - }; - - Headers.prototype.has = function(name) { - return this.map.hasOwnProperty(normalizeName(name)) - }; - - Headers.prototype.set = function(name, value) { - this.map[normalizeName(name)] = normalizeValue(value); - }; - - Headers.prototype.forEach = function(callback, thisArg) { - for (var name in this.map) { - if (this.map.hasOwnProperty(name)) { - callback.call(thisArg, this.map[name], name, this); - } - } - }; - - Headers.prototype.keys = function() { - var items = []; - this.forEach(function(value, name) { - items.push(name); - }); - return iteratorFor(items) - }; - - Headers.prototype.values = function() { - var items = []; - this.forEach(function(value) { - items.push(value); - }); - return iteratorFor(items) - }; - - Headers.prototype.entries = function() { - var items = []; - this.forEach(function(value, name) { - items.push([name, value]); - }); - return iteratorFor(items) - }; - - if (support.iterable) { - Headers.prototype[Symbol.iterator] = Headers.prototype.entries; - } - - function consumed(body) { - if (body.bodyUsed) { - return Promise.reject(new TypeError('Already read')) - } - body.bodyUsed = true; - } - - function fileReaderReady(reader) { - return new Promise(function(resolve, reject) { - reader.onload = function() { - resolve(reader.result); - }; - reader.onerror = function() { - reject(reader.error); - }; - }) - } - - function readBlobAsArrayBuffer(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsArrayBuffer(blob); - return promise - } - - function readBlobAsText(blob) { - var reader = new FileReader(); - var promise = fileReaderReady(reader); - reader.readAsText(blob); - return promise - } - - function readArrayBufferAsText(buf) { - var view = new Uint8Array(buf); - var chars = new Array(view.length); - - for (var i = 0; i < view.length; i++) { - chars[i] = String.fromCharCode(view[i]); - } - return chars.join('') - } - - function bufferClone(buf) { - if (buf.slice) { - return buf.slice(0) - } else { - var view = new Uint8Array(buf.byteLength); - view.set(new Uint8Array(buf)); - return view.buffer - } - } - - function Body() { - this.bodyUsed = false; - - this._initBody = function(body) { - this._bodyInit = body; - if (!body) { - this._bodyText = ''; - } else if (typeof body === 'string') { - this._bodyText = body; - } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { - this._bodyBlob = body; - } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { - this._bodyFormData = body; - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this._bodyText = body.toString(); - } else if (support.arrayBuffer && support.blob && isDataView(body)) { - this._bodyArrayBuffer = bufferClone(body.buffer); - // IE 10-11 can't handle a DataView body. - this._bodyInit = new Blob([this._bodyArrayBuffer]); - } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { - this._bodyArrayBuffer = bufferClone(body); - } else { - this._bodyText = body = Object.prototype.toString.call(body); - } - - if (!this.headers.get('content-type')) { - if (typeof body === 'string') { - this.headers.set('content-type', 'text/plain;charset=UTF-8'); - } else if (this._bodyBlob && this._bodyBlob.type) { - this.headers.set('content-type', this._bodyBlob.type); - } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { - this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); - } - } - }; - - if (support.blob) { - this.blob = function() { - var rejected = consumed(this); - if (rejected) { - return rejected - } - - if (this._bodyBlob) { - return Promise.resolve(this._bodyBlob) - } else if (this._bodyArrayBuffer) { - return Promise.resolve(new Blob([this._bodyArrayBuffer])) - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as blob') - } else { - return Promise.resolve(new Blob([this._bodyText])) - } - }; - - this.arrayBuffer = function() { - if (this._bodyArrayBuffer) { - return consumed(this) || Promise.resolve(this._bodyArrayBuffer) - } else { - return this.blob().then(readBlobAsArrayBuffer) - } - }; - } - - this.text = function() { - var rejected = consumed(this); - if (rejected) { - return rejected - } - - if (this._bodyBlob) { - return readBlobAsText(this._bodyBlob) - } else if (this._bodyArrayBuffer) { - return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) - } else if (this._bodyFormData) { - throw new Error('could not read FormData body as text') - } else { - return Promise.resolve(this._bodyText) - } - }; - - if (support.formData) { - this.formData = function() { - return this.text().then(decode) - }; - } - - this.json = function() { - return this.text().then(JSON.parse) - }; - - return this - } - - // HTTP methods whose capitalization should be normalized - var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; - - function normalizeMethod(method) { - var upcased = method.toUpperCase(); - return methods.indexOf(upcased) > -1 ? upcased : method - } - - function Request(input, options) { - options = options || {}; - var body = options.body; - - if (input instanceof Request) { - if (input.bodyUsed) { - throw new TypeError('Already read') - } - this.url = input.url; - this.credentials = input.credentials; - if (!options.headers) { - this.headers = new Headers(input.headers); - } - this.method = input.method; - this.mode = input.mode; - this.signal = input.signal; - if (!body && input._bodyInit != null) { - body = input._bodyInit; - input.bodyUsed = true; - } - } else { - this.url = String(input); - } - - this.credentials = options.credentials || this.credentials || 'same-origin'; - if (options.headers || !this.headers) { - this.headers = new Headers(options.headers); - } - this.method = normalizeMethod(options.method || this.method || 'GET'); - this.mode = options.mode || this.mode || null; - this.signal = options.signal || this.signal; - this.referrer = null; - - if ((this.method === 'GET' || this.method === 'HEAD') && body) { - throw new TypeError('Body not allowed for GET or HEAD requests') - } - this._initBody(body); - } - - Request.prototype.clone = function() { - return new Request(this, {body: this._bodyInit}) - }; - - function decode(body) { - var form = new FormData(); - body - .trim() - .split('&') - .forEach(function(bytes) { - if (bytes) { - var split = bytes.split('='); - var name = split.shift().replace(/\+/g, ' '); - var value = split.join('=').replace(/\+/g, ' '); - form.append(decodeURIComponent(name), decodeURIComponent(value)); - } - }); - return form - } - - function parseHeaders(rawHeaders) { - var headers = new Headers(); - // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space - // https://tools.ietf.org/html/rfc7230#section-3.2 - var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); - preProcessedHeaders.split(/\r?\n/).forEach(function(line) { - var parts = line.split(':'); - var key = parts.shift().trim(); - if (key) { - var value = parts.join(':').trim(); - headers.append(key, value); - } - }); - return headers - } - - Body.call(Request.prototype); - - function Response(bodyInit, options) { - if (!options) { - options = {}; - } - - this.type = 'default'; - this.status = options.status === undefined ? 200 : options.status; - this.ok = this.status >= 200 && this.status < 300; - this.statusText = 'statusText' in options ? options.statusText : 'OK'; - this.headers = new Headers(options.headers); - this.url = options.url || ''; - this._initBody(bodyInit); - } - - Body.call(Response.prototype); - - Response.prototype.clone = function() { - return new Response(this._bodyInit, { - status: this.status, - statusText: this.statusText, - headers: new Headers(this.headers), - url: this.url - }) - }; - - Response.error = function() { - var response = new Response(null, {status: 0, statusText: ''}); - response.type = 'error'; - return response - }; - - var redirectStatuses = [301, 302, 303, 307, 308]; - - Response.redirect = function(url, status) { - if (redirectStatuses.indexOf(status) === -1) { - throw new RangeError('Invalid status code') - } - - return new Response(null, {status: status, headers: {location: url}}) - }; - - exports.DOMException = self.DOMException; - try { - new exports.DOMException(); - } catch (err) { - exports.DOMException = function(message, name) { - this.message = message; - this.name = name; - var error = Error(message); - this.stack = error.stack; - }; - exports.DOMException.prototype = Object.create(Error.prototype); - exports.DOMException.prototype.constructor = exports.DOMException; - } - - function fetch(input, init) { - return new Promise(function(resolve, reject) { - var request = new Request(input, init); - - if (request.signal && request.signal.aborted) { - return reject(new exports.DOMException('Aborted', 'AbortError')) - } - - var xhr = new XMLHttpRequest(); - - function abortXhr() { - xhr.abort(); - } - - xhr.onload = function() { - var options = { - status: xhr.status, - statusText: xhr.statusText, - headers: parseHeaders(xhr.getAllResponseHeaders() || '') - }; - options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); - var body = 'response' in xhr ? xhr.response : xhr.responseText; - resolve(new Response(body, options)); - }; - - xhr.onerror = function() { - reject(new TypeError('Network request failed')); - }; - - xhr.ontimeout = function() { - reject(new TypeError('Network request failed')); - }; - - xhr.onabort = function() { - reject(new exports.DOMException('Aborted', 'AbortError')); - }; - - xhr.open(request.method, request.url, true); - - if (request.credentials === 'include') { - xhr.withCredentials = true; - } else if (request.credentials === 'omit') { - xhr.withCredentials = false; - } - - if ('responseType' in xhr && support.blob) { - xhr.responseType = 'blob'; - } - - request.headers.forEach(function(value, name) { - xhr.setRequestHeader(name, value); - }); - - if (request.signal) { - request.signal.addEventListener('abort', abortXhr); - - xhr.onreadystatechange = function() { - // DONE (success or failure) - if (xhr.readyState === 4) { - request.signal.removeEventListener('abort', abortXhr); - } - }; - } - - xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); - }) - } - - fetch.polyfill = true; - - if (!self.fetch) { - self.fetch = fetch; - self.Headers = Headers; - self.Request = Request; - self.Response = Response; - } - - exports.Headers = Headers; - exports.Request = Request; - exports.Response = Response; - exports.fetch = fetch; - - Object.defineProperty(exports, '__esModule', { value: true }); - - return exports; - -})({}); -})(typeof self !== 'undefined' ? self : this); - - -/***/ }), - -/***/ "./node_modules/events/events.js": -/*!***************************************!*\ - !*** ./node_modules/events/events.js ***! - \***************************************/ -/***/ (function(module) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -var R = typeof Reflect === 'object' ? Reflect : null -var ReflectApply = R && typeof R.apply === 'function' - ? R.apply - : function ReflectApply(target, receiver, args) { - return Function.prototype.apply.call(target, receiver, args); - } - -var ReflectOwnKeys -if (R && typeof R.ownKeys === 'function') { - ReflectOwnKeys = R.ownKeys -} else if (Object.getOwnPropertySymbols) { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target) - .concat(Object.getOwnPropertySymbols(target)); - }; -} else { - ReflectOwnKeys = function ReflectOwnKeys(target) { - return Object.getOwnPropertyNames(target); - }; -} - -function ProcessEmitWarning(warning) { - if (console && console.warn) console.warn(warning); -} - -var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { - return value !== value; -} - -function EventEmitter() { - EventEmitter.init.call(this); -} -module.exports = EventEmitter; -module.exports.once = once; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._eventsCount = 0; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -function checkListener(listener) { - if (typeof listener !== 'function') { - throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); - } -} - -Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { - throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); - } - defaultMaxListeners = arg; - } -}); - -EventEmitter.init = function() { - - if (this._events === undefined || - this._events === Object.getPrototypeOf(this)._events) { - this._events = Object.create(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -}; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { - throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); - } - this._maxListeners = n; - return this; -}; - -function _getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return _getMaxListeners(this); -}; - -EventEmitter.prototype.emit = function emit(type) { - var args = []; - for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); - var doError = (type === 'error'); - - var events = this._events; - if (events !== undefined) - doError = (doError && events.error === undefined); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - var er; - if (args.length > 0) - er = args[0]; - if (er instanceof Error) { - // Note: The comments on the `throw` lines are intentional, they show - // up in Node's output if this results in an unhandled exception. - throw er; // Unhandled 'error' event - } - // At least give some kind of context to the user - var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); - err.context = er; - throw err; // Unhandled 'error' event - } - - var handler = events[type]; - - if (handler === undefined) - return false; - - if (typeof handler === 'function') { - ReflectApply(handler, this, args); - } else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - ReflectApply(listeners[i], this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - checkListener(listener); - - events = target._events; - if (events === undefined) { - events = target._events = Object.create(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener !== undefined) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - - if (existing === undefined) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - // If we've already got an array, just append. - } else if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - - // Check for listener leak - m = _getMaxListeners(target); - if (m > 0 && existing.length > m && !existing.warned) { - existing.warned = true; - // No error code for this since it is a Warning - // eslint-disable-next-line no-restricted-syntax - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' ' + String(type) + ' listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - ProcessEmitWarning(w); - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - if (arguments.length === 0) - return this.listener.call(this.target); - return this.listener.apply(this.target, arguments); - } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = onceWrapper.bind(state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - checkListener(listener); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - checkListener(listener); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - checkListener(listener); - - events = this._events; - if (events === undefined) - return this; - - list = events[type]; - if (list === undefined) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = Object.create(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) - return this; - - if (position === 0) - list.shift(); - else { - spliceOne(list, position); - } - - if (list.length === 1) - events[type] = list[0]; - - if (events.removeListener !== undefined) - this.emit('removeListener', type, originalListener || listener); - } - - return this; - }; - -EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (events === undefined) - return this; - - // not listening for removeListener, no need to emit - if (events.removeListener === undefined) { - if (arguments.length === 0) { - this._events = Object.create(null); - this._eventsCount = 0; - } else if (events[type] !== undefined) { - if (--this._eventsCount === 0) - this._events = Object.create(null); - else - delete events[type]; - } - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = Object.keys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = Object.create(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners !== undefined) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; - }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (events === undefined) - return []; - - var evlistener = events[type]; - if (evlistener === undefined) - return []; - - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - - return unwrap ? - unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; - - if (events !== undefined) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener !== undefined) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; -}; - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -function spliceOne(list, index) { - for (; index + 1 < list.length; index++) - list[index] = list[index + 1]; - list.pop(); -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} - -function once(emitter, name) { - return new Promise(function (resolve, reject) { - function errorListener(err) { - emitter.removeListener(name, resolver); - reject(err); - } - - function resolver() { - if (typeof emitter.removeListener === 'function') { - emitter.removeListener('error', errorListener); - } - resolve([].slice.call(arguments)); - }; - - eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); - if (name !== 'error') { - addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); - } - }); -} - -function addErrorHandlerIfEventEmitter(emitter, handler, flags) { - if (typeof emitter.on === 'function') { - eventTargetAgnosticAddListener(emitter, 'error', handler, flags); - } -} - -function eventTargetAgnosticAddListener(emitter, name, listener, flags) { - if (typeof emitter.on === 'function') { - if (flags.once) { - emitter.once(name, listener); - } else { - emitter.on(name, listener); - } - } else if (typeof emitter.addEventListener === 'function') { - // EventTarget does not have `error` event semantics like Node - // EventEmitters, we do not listen for `error` events here. - emitter.addEventListener(name, function wrapListener(arg) { - // IE does not have builtin `{ once: true }` support so we - // have to do it manually. - if (flags.once) { - emitter.removeEventListener(name, wrapListener); - } - listener(arg); - }); - } else { - throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); - } -} - - -/***/ }), - -/***/ "./node_modules/http-link-header/lib/link.js": -/*!***************************************************!*\ - !*** ./node_modules/http-link-header/lib/link.js ***! - \***************************************************/ -/***/ (function(module) { - -"use strict"; - - -var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i -var WS_TRIM_PATTERN = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g -var WS_CHAR_PATTERN = /\s|\uFEFF|\xA0/ -var WS_FOLD_PATTERN = /\r?\n[\x20\x09]+/g -var DELIMITER_PATTERN = /[;,"]/ -var WS_DELIMITER_PATTERN = /[;,"]|\s/ - -/** - * Token character pattern - * @type {RegExp} - * @see https://tools.ietf.org/html/rfc7230#section-3.2.6 - */ -var TOKEN_PATTERN = /^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/ - -var STATE = { - IDLE: 1 << 0, - URI: 1 << 1, - ATTR: 1 << 2, -} - -function trim( value ) { - return value.replace( WS_TRIM_PATTERN, '' ) -} - -function hasWhitespace( value ) { - return WS_CHAR_PATTERN.test( value ) -} - -function skipWhitespace( value, offset ) { - while( hasWhitespace( value[offset] ) ) { - offset++ - } - return offset -} - -function needsQuotes( value ) { - return WS_DELIMITER_PATTERN.test( value ) || - !TOKEN_PATTERN.test( value ) -} - -/** - * Shallow compares two objects to check if their properties match. - * @param {object} object1 First object to compare. - * @param {object} object2 Second object to compare. - * @returns {boolean} Do the objects have matching properties. - */ -function shallowCompareObjects( object1, object2 ) { - return ( - Object.keys( object1 ).length === Object.keys( object2 ).length && - Object.keys( object1 ).every( - ( key ) => key in object2 && object1[ key ] === object2[ key ] - ) - ); -} - -class Link { - - /** - * Link - * @constructor - * @param {String} [value] - * @returns {Link} - */ - constructor( value ) { - - /** @type {Array} URI references */ - this.refs = [] - - if( value ) { - this.parse( value ) - } - - } - - /** - * Get refs with given relation type - * @param {String} value - * @returns {Array} - */ - rel( value ) { - - var links = [] - var type = value.toLowerCase() - - for( var i = 0; i < this.refs.length; i++ ) { - if( this.refs[ i ].rel.toLowerCase() === type ) { - links.push( this.refs[ i ] ) - } - } - - return links - - } - - /** - * Get refs where given attribute has a given value - * @param {String} attr - * @param {String} value - * @returns {Array} - */ - get( attr, value ) { - - attr = attr.toLowerCase() - - var links = [] - - for( var i = 0; i < this.refs.length; i++ ) { - if( this.refs[ i ][ attr ] === value ) { - links.push( this.refs[ i ] ) - } - } - - return links - - } - - /** Sets a reference. */ - set( link ) { - this.refs.push( link ) - return this - } - - /** - * Sets a reference if a reference with similar properties isn’t already set. - */ - setUnique( link ) { - - if( !this.refs.some(( ref ) => shallowCompareObjects( ref, link )) ) { - this.refs.push( link ) - } - - return this - - } - - has( attr, value ) { - - attr = attr.toLowerCase() - - for( var i = 0; i < this.refs.length; i++ ) { - if( this.refs[ i ][ attr ] === value ) { - return true - } - } - - return false - - } - - parse( value, offset ) { - - offset = offset || 0 - value = offset ? value.slice( offset ) : value - - // Trim & unfold folded lines - value = trim( value ).replace( WS_FOLD_PATTERN, '' ) - - var state = STATE.IDLE - var length = value.length - var offset = 0 - var ref = null - - while( offset < length ) { - if( state === STATE.IDLE ) { - if( hasWhitespace( value[offset] ) ) { - offset++ - continue - } else if( value[offset] === '<' ) { - if( ref != null ) { - ref.rel != null ? - this.refs.push( ...Link.expandRelations( ref ) ) : - this.refs.push( ref ) - } - var end = value.indexOf( '>', offset ) - if( end === -1 ) throw new Error( 'Expected end of URI delimiter at offset ' + offset ) - ref = { uri: value.slice( offset + 1, end ) } - // this.refs.push( ref ) - offset = end - state = STATE.URI - } else { - throw new Error( 'Unexpected character "' + value[offset] + '" at offset ' + offset ) - } - offset++ - } else if( state === STATE.URI ) { - if( hasWhitespace( value[offset] ) ) { - offset++ - continue - } else if( value[offset] === ';' ) { - state = STATE.ATTR - offset++ - } else if( value[offset] === ',' ) { - state = STATE.IDLE - offset++ - } else { - throw new Error( 'Unexpected character "' + value[offset] + '" at offset ' + offset ) - } - } else if( state === STATE.ATTR ) { - if( value[offset] ===';' || hasWhitespace( value[offset] ) ) { - offset++ - continue - } - var end = value.indexOf( '=', offset ) - if( end === -1 ) end = value.indexOf( ';', offset ) - if( end === -1 ) end = value.length - var attr = trim( value.slice( offset, end ) ).toLowerCase() - var attrValue = '' - offset = end + 1 - offset = skipWhitespace( value, offset ) - if( value[offset] === '"' ) { - offset++ - while( offset < length ) { - if( value[offset] === '"' ) { - offset++; break - } - if( value[offset] === '\\' ) { - offset++ - } - attrValue += value[offset] - offset++ - } - } else { - var end = offset + 1 - while( !DELIMITER_PATTERN.test( value[end] ) && end < length ) { - end++ - } - attrValue = value.slice( offset, end ) - offset = end - } - if( ref[ attr ] && Link.isSingleOccurenceAttr( attr ) ) { - // Ignore multiples of attributes which may only appear once - } else if( attr[ attr.length - 1 ] === '*' ) { - ref[ attr ] = Link.parseExtendedValue( attrValue ) - } else { - attrValue = attr === 'type' ? - attrValue.toLowerCase() : attrValue - if( ref[ attr ] != null ) { - if( Array.isArray( ref[ attr ] ) ) { - ref[ attr ].push( attrValue ) - } else { - ref[ attr ] = [ ref[ attr ], attrValue ] - } - } else { - ref[ attr ] = attrValue - } - } - switch( value[offset] ) { - case ',': state = STATE.IDLE; break - case ';': state = STATE.ATTR; break - } - offset++ - } else { - throw new Error( 'Unknown parser state "' + state + '"' ) - } - } - - if( ref != null ) { - ref.rel != null ? - this.refs.push( ...Link.expandRelations( ref ) ) : - this.refs.push( ref ) - } - - ref = null - - return this - - } - - toString() { - - var refs = [] - var link = '' - var ref = null - - for( var i = 0; i < this.refs.length; i++ ) { - ref = this.refs[i] - link = Object.keys( this.refs[i] ).reduce( function( link, attr ) { - if( attr === 'uri' ) return link - return link + '; ' + Link.formatAttribute( attr, ref[ attr ] ) - }, '<' + ref.uri + '>' ) - refs.push( link ) - } - - return refs.join( ', ' ) - - } - -} - -/** - * Determines whether an encoding can be - * natively handled with a `Buffer` - * @param {String} value - * @returns {Boolean} - */ -Link.isCompatibleEncoding = function( value ) { - return COMPATIBLE_ENCODING_PATTERN.test( value ) -} - -Link.parse = function( value, offset ) { - return new Link().parse( value, offset ) -} - -Link.isSingleOccurenceAttr = function( attr ) { - return attr === 'rel' || attr === 'type' || attr === 'media' || - attr === 'title' || attr === 'title*' -} - -Link.isTokenAttr = function( attr ) { - return attr === 'rel' || attr === 'type' || attr === 'anchor' -} - -Link.escapeQuotes = function( value ) { - return value.replace( /"/g, '\\"' ) -} - -Link.expandRelations = function( ref ) { - var rels = ref.rel.split( ' ' ) - return rels.map( function( rel ) { - var value = Object.assign( {}, ref ) - value.rel = rel - return value - }) -} - -/** - * Parses an extended value and attempts to decode it - * @internal - * @param {String} value - * @return {Object} - */ -Link.parseExtendedValue = function( value ) { - var parts = /([^']+)?(?:'([^']*)')?(.+)/.exec( value ) - return { - language: parts[2].toLowerCase(), - encoding: Link.isCompatibleEncoding( parts[1] ) ? - null : parts[1].toLowerCase(), - value: Link.isCompatibleEncoding( parts[1] ) ? - decodeURIComponent( parts[3] ) : parts[3] - } -} - -/** - * Format a given extended attribute and it's value - * @param {String} attr - * @param {Object} data - * @return {String} - */ -Link.formatExtendedAttribute = function( attr, data ) { - - var encoding = ( data.encoding || 'utf-8' ).toUpperCase() - var language = data.language || 'en' - - var encodedValue = '' - - if( Buffer.isBuffer( data.value ) && Link.isCompatibleEncoding( encoding ) ) { - encodedValue = data.value.toString( encoding ) - } else if( Buffer.isBuffer( data.value ) ) { - encodedValue = data.value.toString( 'hex' ) - .replace( /[0-9a-f]{2}/gi, '%$1' ) - } else { - encodedValue = encodeURIComponent( data.value ) - } - - return attr + '=' + encoding + '\'' + - language + '\'' + encodedValue - -} - -/** - * Format a given attribute and it's value - * @param {String} attr - * @param {String|Object} value - * @return {String} - */ -Link.formatAttribute = function( attr, value ) { - - if( Array.isArray( value ) ) { - return value.map(( item ) => { - return Link.formatAttribute( attr, item ) - }).join( '; ' ) - } - - if( attr[ attr.length - 1 ] === '*' || typeof value !== 'string' ) { - return Link.formatExtendedAttribute( attr, value ) - } - - if( Link.isTokenAttr( attr ) ) { - value = needsQuotes( value ) ? - '"' + Link.escapeQuotes( value ) + '"' : - Link.escapeQuotes( value ) - } else if( needsQuotes( value ) ) { - value = encodeURIComponent( value ) - // We don't need to escape <,> <;> within quotes - value = value - .replace( /%20/g, ' ' ) - .replace( /%2C/g, ',' ) - .replace( /%3B/g, ';' ) - - value = '"' + value + '"' - } - - return attr + '=' + value - -} - -module.exports = Link - - -/***/ }), - -/***/ "./node_modules/ieee754/index.js": -/*!***************************************!*\ - !*** ./node_modules/ieee754/index.js ***! - \***************************************/ -/***/ (function(__unused_webpack_module, exports) { - -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/jsonld-context-parser/index.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__webpack_require__(/*! ./lib/ContextParser */ "./node_modules/jsonld-context-parser/lib/ContextParser.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/ErrorCoded */ "./node_modules/jsonld-context-parser/lib/ErrorCoded.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/FetchDocumentLoader */ "./node_modules/jsonld-context-parser/lib/FetchDocumentLoader.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/IDocumentLoader */ "./node_modules/jsonld-context-parser/lib/IDocumentLoader.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/JsonLdContext */ "./node_modules/jsonld-context-parser/lib/JsonLdContext.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/JsonLdContextNormalized */ "./node_modules/jsonld-context-parser/lib/JsonLdContextNormalized.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/Util */ "./node_modules/jsonld-context-parser/lib/Util.js"), exports); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/lib/ContextParser.js": -/*!*****************************************************************!*\ - !*** ./node_modules/jsonld-context-parser/lib/ContextParser.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContextParser = void 0; -__webpack_require__(/*! cross-fetch/polyfill */ "./node_modules/cross-fetch/dist/browser-polyfill.js"); -const relative_to_absolute_iri_1 = __webpack_require__(/*! relative-to-absolute-iri */ "./node_modules/relative-to-absolute-iri/index.js"); -const ErrorCoded_1 = __webpack_require__(/*! ./ErrorCoded */ "./node_modules/jsonld-context-parser/lib/ErrorCoded.js"); -const FetchDocumentLoader_1 = __webpack_require__(/*! ./FetchDocumentLoader */ "./node_modules/jsonld-context-parser/lib/FetchDocumentLoader.js"); -const JsonLdContextNormalized_1 = __webpack_require__(/*! ./JsonLdContextNormalized */ "./node_modules/jsonld-context-parser/lib/JsonLdContextNormalized.js"); -const Util_1 = __webpack_require__(/*! ./Util */ "./node_modules/jsonld-context-parser/lib/Util.js"); -/** - * Parses JSON-LD contexts. - */ -class ContextParser { - constructor(options) { - options = options || {}; - this.documentLoader = options.documentLoader || new FetchDocumentLoader_1.FetchDocumentLoader(); - this.documentCache = {}; - this.validateContext = !options.skipValidation; - this.expandContentTypeToBase = !!options.expandContentTypeToBase; - this.remoteContextsDepthLimit = options.remoteContextsDepthLimit || 32; - this.redirectSchemaOrgHttps = 'redirectSchemaOrgHttps' in options ? !!options.redirectSchemaOrgHttps : true; - } - /** - * Validate the given @language value. - * An error will be thrown if it is invalid. - * @param value An @language value. - * @param {boolean} strictRange If the string value should be strictly checked against a regex. - * @param {string} errorCode The error code to emit on errors. - * @return {boolean} If validation passed. - * Can only be false if strictRange is false and the string value did not pass the regex. - */ - static validateLanguage(value, strictRange, errorCode) { - if (typeof value !== 'string') { - throw new ErrorCoded_1.ErrorCoded(`The value of an '@language' must be a string, got '${JSON.stringify(value)}'`, errorCode); - } - if (!Util_1.Util.REGEX_LANGUAGE_TAG.test(value)) { - if (strictRange) { - throw new ErrorCoded_1.ErrorCoded(`The value of an '@language' must be a valid language tag, got '${JSON.stringify(value)}'`, errorCode); - } - else { - return false; - } - } - return true; - } - /** - * Validate the given @direction value. - * An error will be thrown if it is invalid. - * @param value An @direction value. - * @param {boolean} strictValues If the string value should be strictly checked against a regex. - * @return {boolean} If validation passed. - * Can only be false if strictRange is false and the string value did not pass the regex. - */ - static validateDirection(value, strictValues) { - if (typeof value !== 'string') { - throw new ErrorCoded_1.ErrorCoded(`The value of an '@direction' must be a string, got '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_BASE_DIRECTION); - } - if (!Util_1.Util.REGEX_DIRECTION_TAG.test(value)) { - if (strictValues) { - throw new ErrorCoded_1.ErrorCoded(`The value of an '@direction' must be 'ltr' or 'rtl', got '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_BASE_DIRECTION); - } - else { - return false; - } - } - return true; - } - /** - * Add an @id term for all @reverse terms. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @return {IJsonLdContextNormalizedRaw} The mutated input context. - */ - idifyReverseTerms(context) { - for (const key of Object.keys(context)) { - let value = context[key]; - if (value && typeof value === 'object') { - if (value['@reverse'] && !value['@id']) { - if (typeof value['@reverse'] !== 'string' || Util_1.Util.isValidKeyword(value['@reverse'])) { - throw new ErrorCoded_1.ErrorCoded(`Invalid @reverse value, must be absolute IRI or blank node: '${value['@reverse']}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - value = context[key] = Object.assign(Object.assign({}, value), { '@id': value['@reverse'] }); - value['@id'] = value['@reverse']; - if (Util_1.Util.isPotentialKeyword(value['@reverse'])) { - delete value['@reverse']; - } - else { - value['@reverse'] = true; - } - } - } - } - return context; - } - /** - * Expand all prefixed terms in the given context. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @param {boolean} expandContentTypeToBase If @type inside the context may be expanded - * via @base if @vocab is set to null. - * @param {string[]} keys Optional set of keys from the context to expand. If left undefined, all - * keys in the context will be expanded. - */ - expandPrefixedTerms(context, expandContentTypeToBase, keys) { - const contextRaw = context.getContextRaw(); - for (const key of (keys || Object.keys(contextRaw))) { - // Only expand allowed keys - if (Util_1.Util.EXPAND_KEYS_BLACKLIST.indexOf(key) < 0 && !Util_1.Util.isReservedInternalKeyword(key)) { - // Error if we try to alias a keyword to something else. - const keyValue = contextRaw[key]; - if (Util_1.Util.isPotentialKeyword(key) && Util_1.Util.ALIAS_DOMAIN_BLACKLIST.indexOf(key) >= 0) { - if (key !== '@type' || typeof contextRaw[key] === 'object' - && !(contextRaw[key]['@protected'] || contextRaw[key]['@container'] === '@set')) { - throw new ErrorCoded_1.ErrorCoded(`Keywords can not be aliased to something else. -Tried mapping ${key} to ${JSON.stringify(keyValue)}`, ErrorCoded_1.ERROR_CODES.KEYWORD_REDEFINITION); - } - } - // Error if we try to alias to an illegal keyword - if (Util_1.Util.ALIAS_RANGE_BLACKLIST.indexOf(Util_1.Util.getContextValueId(keyValue)) >= 0) { - throw new ErrorCoded_1.ErrorCoded(`Aliasing to certain keywords is not allowed. -Tried mapping ${key} to ${JSON.stringify(keyValue)}`, ErrorCoded_1.ERROR_CODES.INVALID_KEYWORD_ALIAS); - } - // Error if this term was marked as prefix as well - if (keyValue && Util_1.Util.isPotentialKeyword(Util_1.Util.getContextValueId(keyValue)) - && keyValue['@prefix'] === true) { - throw new ErrorCoded_1.ErrorCoded(`Tried to use keyword aliases as prefix: '${key}': '${JSON.stringify(keyValue)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION); - } - // Loop because prefixes might be nested - while (Util_1.Util.isPrefixValue(contextRaw[key])) { - const value = contextRaw[key]; - let changed = false; - if (typeof value === 'string') { - contextRaw[key] = context.expandTerm(value, true); - changed = changed || value !== contextRaw[key]; - } - else { - const id = value['@id']; - const type = value['@type']; - // If @id is missing, don't allow @id to be added if @prefix: true and key not being a valid IRI. - const canAddIdEntry = !('@prefix' in value) || Util_1.Util.isValidIri(key); - if ('@id' in value) { - // Use @id value for expansion - if (id !== undefined && id !== null && typeof id === 'string') { - contextRaw[key] = Object.assign(Object.assign({}, contextRaw[key]), { '@id': context.expandTerm(id, true) }); - changed = changed || id !== contextRaw[key]['@id']; - } - } - else if (!Util_1.Util.isPotentialKeyword(key) && canAddIdEntry) { - // Add an explicit @id value based on the expanded key value - const newId = context.expandTerm(key, true); - if (newId !== key) { - // Don't set @id if expansion failed - contextRaw[key] = Object.assign(Object.assign({}, contextRaw[key]), { '@id': newId }); - changed = true; - } - } - if (type && typeof type === 'string' && type !== '@vocab' - && (!value['@container'] || !value['@container']['@type']) - && canAddIdEntry) { - // First check @vocab, then fallback to @base - let expandedType = context.expandTerm(type, true); - if (expandContentTypeToBase && type === expandedType) { - expandedType = context.expandTerm(type, false); - } - if (expandedType !== type) { - changed = true; - contextRaw[key] = Object.assign(Object.assign({}, contextRaw[key]), { '@type': expandedType }); - } - } - } - if (!changed) { - break; - } - } - } - } - } - /** - * Normalize the @language entries in the given context to lowercase. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @param {IParseOptions} parseOptions The parsing options. - */ - normalize(context, { processingMode, normalizeLanguageTags }) { - // Lowercase language keys in 1.0 - if (normalizeLanguageTags || processingMode === 1.0) { - for (const key of Object.keys(context)) { - if (key === '@language' && typeof context[key] === 'string') { - context[key] = context[key].toLowerCase(); - } - else { - const value = context[key]; - if (value && typeof value === 'object') { - if (typeof value['@language'] === 'string') { - const lowercase = value['@language'].toLowerCase(); - if (lowercase !== value['@language']) { - context[key] = Object.assign(Object.assign({}, value), { '@language': lowercase }); - } - } - } - } - } - } - } - /** - * Convert all @container strings and array values to hash-based values. - * @param {IJsonLdContextNormalizedRaw} context A context. - */ - containersToHash(context) { - for (const key of Object.keys(context)) { - const value = context[key]; - if (value && typeof value === 'object') { - if (typeof value['@container'] === 'string') { - context[key] = Object.assign(Object.assign({}, value), { '@container': { [value['@container']]: true } }); - } - else if (Array.isArray(value['@container'])) { - const newValue = {}; - for (const containerValue of value['@container']) { - newValue[containerValue] = true; - } - context[key] = Object.assign(Object.assign({}, value), { '@container': newValue }); - } - } - } - } - /** - * Normalize and apply context-level @protected terms onto each term separately. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @param {number} processingMode The processing mode. - */ - applyScopedProtected(context, { processingMode }, expandOptions) { - if (processingMode && processingMode >= 1.1) { - if (context['@protected']) { - for (const key of Object.keys(context)) { - if (Util_1.Util.isReservedInternalKeyword(key)) { - continue; - } - if (!Util_1.Util.isPotentialKeyword(key) && !Util_1.Util.isTermProtected(context, key)) { - const value = context[key]; - if (value && typeof value === 'object') { - if (!('@protected' in context[key])) { - // Mark terms with object values as protected if they don't have an @protected: false annotation - context[key] = Object.assign(Object.assign({}, context[key]), { '@protected': true }); - } - } - else { - // Convert string-based term values to object-based values with @protected: true - context[key] = { - '@id': value, - '@protected': true, - }; - if (Util_1.Util.isSimpleTermDefinitionPrefix(value, expandOptions)) { - context[key] = Object.assign(Object.assign({}, context[key]), { '@prefix': true }); - } - } - } - } - delete context['@protected']; - } - } - } - /** - * Check if the given context inheritance does not contain any overrides of protected terms. - * @param {IJsonLdContextNormalizedRaw} contextBefore The context that may contain some protected terms. - * @param {IJsonLdContextNormalizedRaw} contextAfter A new context that is being applied on the first one. - * @param {IExpandOptions} expandOptions Options that are needed for any expansions during this validation. - * @param {string[]} keys Optional set of keys from the context to validate. If left undefined, all - * keys defined in contextAfter will be checked. - */ - validateKeywordRedefinitions(contextBefore, contextAfter, expandOptions, keys) { - for (const key of (keys !== null && keys !== void 0 ? keys : Object.keys(contextAfter))) { - if (Util_1.Util.isTermProtected(contextBefore, key)) { - // The entry in the context before will always be in object-mode - // If the new entry is in string-mode, convert it to object-mode - // before checking if it is identical. - if (typeof contextAfter[key] === 'string') { - contextAfter[key] = { '@id': contextAfter[key], '@protected': true }; - } - else { - // We modify this deliberately, - // as we need it for the value comparison (they must be identical modulo '@protected')), - // and for the fact that this new value will override the first one. - contextAfter[key] = Object.assign(Object.assign({}, contextAfter[key]), { '@protected': true }); - } - // Error if they are not identical - if (!Util_1.Util.deepEqual(contextBefore[key], contextAfter[key])) { - throw new ErrorCoded_1.ErrorCoded(`Attempted to override the protected keyword ${key} from ${JSON.stringify(Util_1.Util.getContextValueId(contextBefore[key]))} to ${JSON.stringify(Util_1.Util.getContextValueId(contextAfter[key]))}`, ErrorCoded_1.ERROR_CODES.PROTECTED_TERM_REDEFINITION); - } - } - } - } - /** - * Validate the entries of the given context. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @param {IParseOptions} options The parse options. - */ - validate(context, { processingMode }) { - for (const key of Object.keys(context)) { - // Ignore reserved internal keywords. - if (Util_1.Util.isReservedInternalKeyword(key)) { - continue; - } - // Do not allow empty term - if (key === '') { - throw new ErrorCoded_1.ErrorCoded(`The empty term is not allowed, got: '${key}': '${JSON.stringify(context[key])}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION); - } - const value = context[key]; - const valueType = typeof value; - // First check if the key is a keyword - if (Util_1.Util.isPotentialKeyword(key)) { - switch (key.substr(1)) { - case 'vocab': - if (value !== null && valueType !== 'string') { - throw new ErrorCoded_1.ErrorCoded(`Found an invalid @vocab IRI: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_VOCAB_MAPPING); - } - break; - case 'base': - if (value !== null && valueType !== 'string') { - throw new ErrorCoded_1.ErrorCoded(`Found an invalid @base IRI: ${context[key]}`, ErrorCoded_1.ERROR_CODES.INVALID_BASE_IRI); - } - break; - case 'language': - if (value !== null) { - ContextParser.validateLanguage(value, true, ErrorCoded_1.ERROR_CODES.INVALID_DEFAULT_LANGUAGE); - } - break; - case 'version': - if (value !== null && valueType !== 'number') { - throw new ErrorCoded_1.ErrorCoded(`Found an invalid @version number: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_VERSION_VALUE); - } - break; - case 'direction': - if (value !== null) { - ContextParser.validateDirection(value, true); - } - break; - case 'propagate': - if (processingMode === 1.0) { - throw new ErrorCoded_1.ErrorCoded(`Found an illegal @propagate keyword: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_ENTRY); - } - if (value !== null && valueType !== 'boolean') { - throw new ErrorCoded_1.ErrorCoded(`Found an invalid @propagate value: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_PROPAGATE_VALUE); - } - break; - } - // Don't allow keywords to be overridden - if (Util_1.Util.isValidKeyword(key) && Util_1.Util.isValidKeyword(Util_1.Util.getContextValueId(value))) { - throw new ErrorCoded_1.ErrorCoded(`Illegal keyword alias in term value, found: '${key}': '${Util_1.Util - .getContextValueId(value)}'`, ErrorCoded_1.ERROR_CODES.KEYWORD_REDEFINITION); - } - continue; - } - // Otherwise, consider the key a term - if (value !== null) { - switch (valueType) { - case 'string': - if (Util_1.Util.getPrefix(value, context) === key) { - throw new ErrorCoded_1.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${key}': '${JSON - .stringify(value)}'`, ErrorCoded_1.ERROR_CODES.CYCLIC_IRI_MAPPING); - } - if (Util_1.Util.isValidIriWeak(key)) { - if (value === '@type') { - throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to @type, found: '${key}': '${value}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - else if (Util_1.Util.isValidIri(value) && value !== new JsonLdContextNormalized_1.JsonLdContextNormalized(context).expandTerm(key)) { - throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${key}': '${value}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - } - break; - case 'object': - if (!Util_1.Util.isCompactIri(key) && !('@id' in value) - && (value['@type'] === '@id' ? !context['@base'] : !context['@vocab'])) { - throw new ErrorCoded_1.ErrorCoded(`Missing @id in context entry: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - for (const objectKey of Object.keys(value)) { - const objectValue = value[objectKey]; - if (!objectValue) { - continue; - } - switch (objectKey) { - case '@id': - if (Util_1.Util.isValidKeyword(objectValue) - && objectValue !== '@type' && objectValue !== '@id' && objectValue !== '@graph' && objectValue !== '@nest') { - throw new ErrorCoded_1.ErrorCoded(`Illegal keyword alias in term value, found: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - if (Util_1.Util.isValidIriWeak(key)) { - if (objectValue === '@type') { - throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to @type, found: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - else if (Util_1.Util.isValidIri(objectValue) - && objectValue !== new JsonLdContextNormalized_1.JsonLdContextNormalized(context).expandTerm(key)) { - throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - } - if (typeof objectValue !== 'string') { - throw new ErrorCoded_1.ErrorCoded(`Detected non-string @id in context entry: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - if (Util_1.Util.getPrefix(objectValue, context) === key) { - throw new ErrorCoded_1.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${key}': '${JSON - .stringify(value)}'`, ErrorCoded_1.ERROR_CODES.CYCLIC_IRI_MAPPING); - } - break; - case '@type': - if (value['@container'] === '@type' && objectValue !== '@id' && objectValue !== '@vocab') { - throw new ErrorCoded_1.ErrorCoded(`@container: @type only allows @type: @id or @vocab, but got: '${key}': '${objectValue}'`, ErrorCoded_1.ERROR_CODES.INVALID_TYPE_MAPPING); - } - if (typeof objectValue !== 'string') { - throw new ErrorCoded_1.ErrorCoded(`The value of an '@type' must be a string, got '${JSON.stringify(valueType)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TYPE_MAPPING); - } - if (objectValue !== '@id' && objectValue !== '@vocab' - && (processingMode === 1.0 || objectValue !== '@json') - && (processingMode === 1.0 || objectValue !== '@none') - && (objectValue[0] === '_' || !Util_1.Util.isValidIri(objectValue))) { - throw new ErrorCoded_1.ErrorCoded(`A context @type must be an absolute IRI, found: '${key}': '${objectValue}'`, ErrorCoded_1.ERROR_CODES.INVALID_TYPE_MAPPING); - } - break; - case '@reverse': - if (typeof objectValue === 'string' && value['@id'] && value['@id'] !== objectValue) { - throw new ErrorCoded_1.ErrorCoded(`Found non-matching @id and @reverse term values in '${key}':\ -'${objectValue}' and '${value['@id']}'`, ErrorCoded_1.ERROR_CODES.INVALID_REVERSE_PROPERTY); - } - if ('@nest' in value) { - throw new ErrorCoded_1.ErrorCoded(`@nest is not allowed in the reverse property '${key}'`, ErrorCoded_1.ERROR_CODES.INVALID_REVERSE_PROPERTY); - } - break; - case '@container': - if (processingMode === 1.0) { - if (Object.keys(objectValue).length > 1 - || Util_1.Util.CONTAINERS_1_0.indexOf(Object.keys(objectValue)[0]) < 0) { - throw new ErrorCoded_1.ErrorCoded(`Invalid term @container for '${key}' ('${Object.keys(objectValue)}') in 1.0, \ -must be only one of ${Util_1.Util.CONTAINERS_1_0.join(', ')}`, ErrorCoded_1.ERROR_CODES.INVALID_CONTAINER_MAPPING); - } - } - for (const containerValue of Object.keys(objectValue)) { - if (containerValue === '@list' && value['@reverse']) { - throw new ErrorCoded_1.ErrorCoded(`Term value can not be @container: @list and @reverse at the same time on '${key}'`, ErrorCoded_1.ERROR_CODES.INVALID_REVERSE_PROPERTY); - } - if (Util_1.Util.CONTAINERS.indexOf(containerValue) < 0) { - throw new ErrorCoded_1.ErrorCoded(`Invalid term @container for '${key}' ('${containerValue}'), \ -must be one of ${Util_1.Util.CONTAINERS.join(', ')}`, ErrorCoded_1.ERROR_CODES.INVALID_CONTAINER_MAPPING); - } - } - break; - case '@language': - ContextParser.validateLanguage(objectValue, true, ErrorCoded_1.ERROR_CODES.INVALID_LANGUAGE_MAPPING); - break; - case '@direction': - ContextParser.validateDirection(objectValue, true); - break; - case '@prefix': - if (objectValue !== null && typeof objectValue !== 'boolean') { - throw new ErrorCoded_1.ErrorCoded(`Found an invalid term @prefix boolean in: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_PREFIX_VALUE); - } - if (!('@id' in value) && !Util_1.Util.isValidIri(key)) { - throw new ErrorCoded_1.ErrorCoded(`Invalid @prefix definition for '${key}' ('${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION); - } - break; - case '@index': - if (processingMode === 1.0 || !value['@container'] || !value['@container']['@index']) { - throw new ErrorCoded_1.ErrorCoded(`Attempt to add illegal key to value object: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION); - } - break; - case '@nest': - if (Util_1.Util.isPotentialKeyword(objectValue) && objectValue !== '@nest') { - throw new ErrorCoded_1.ErrorCoded(`Found an invalid term @nest value in: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_NEST_VALUE); - } - } - } - break; - default: - throw new ErrorCoded_1.ErrorCoded(`Found an invalid term value: '${key}': '${value}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION); - } - } - } - } - /** - * Apply the @base context entry to the given context under certain circumstances. - * @param context A context. - * @param options Parsing options. - * @param inheritFromParent If the @base value from the parent context can be inherited. - * @return The given context. - */ - applyBaseEntry(context, options, inheritFromParent) { - // In some special cases, this can be a string, so ignore those. - if (typeof context === 'string') { - return context; - } - // Give priority to @base in the parent context - if (inheritFromParent && !('@base' in context) && options.parentContext - && typeof options.parentContext === 'object' && '@base' in options.parentContext) { - context['@base'] = options.parentContext['@base']; - if (options.parentContext['@__baseDocument']) { - context['@__baseDocument'] = true; - } - } - // Override the base IRI if provided. - if (options.baseIRI && !options.external) { - if (!('@base' in context)) { - // The context base is the document base - context['@base'] = options.baseIRI; - context['@__baseDocument'] = true; - } - else if (context['@base'] !== null && typeof context['@base'] === 'string' - && !Util_1.Util.isValidIri(context['@base'])) { - // The context base is relative to the document base - context['@base'] = (0, relative_to_absolute_iri_1.resolve)(context['@base'], options.parentContext && options.parentContext['@base'] || options.baseIRI); - } - } - return context; - } - /** - * Resolve relative context IRIs, or return full IRIs as-is. - * @param {string} contextIri A context IRI. - * @param {string} baseIRI A base IRI. - * @return {string} The normalized context IRI. - */ - normalizeContextIri(contextIri, baseIRI) { - if (!Util_1.Util.isValidIri(contextIri)) { - try { - contextIri = (0, relative_to_absolute_iri_1.resolve)(contextIri, baseIRI); - } - catch (_a) { - throw new Error(`Invalid context IRI: ${contextIri}`); - } - } - // TODO: Temporary workaround for fixing schema.org CORS issues (https://github.com/schemaorg/schemaorg/issues/2578#issuecomment-652324465) - if (this.redirectSchemaOrgHttps && contextIri.startsWith('http://schema.org')) { - contextIri = 'https://schema.org/'; - } - return contextIri; - } - /** - * Parse scoped contexts in the given context. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @param {IParseOptions} options Parsing options. - * @return {IJsonLdContextNormalizedRaw} The mutated input context. - * @param {string[]} keys Optional set of keys from the context to parseInnerContexts of. If left undefined, all - * keys in the context will be iterated over. - */ - async parseInnerContexts(context, options, keys) { - for (const key of (keys !== null && keys !== void 0 ? keys : Object.keys(context))) { - const value = context[key]; - if (value && typeof value === 'object') { - if ('@context' in value && value['@context'] !== null && !options.ignoreScopedContexts) { - // Simulate a processing based on the parent context to check if there are any (potential errors). - // Honestly, I find it a bit weird to do this here, as the context may be unused, - // and the final effective context may differ based on any other embedded/scoped contexts. - // But hey, it's part of the spec, so we have no choice... - // https://w3c.github.io/json-ld-api/#h-note-10 - if (this.validateContext) { - try { - const parentContext = Object.assign(Object.assign({}, context), { [key]: Object.assign({}, context[key]) }); - delete parentContext[key]['@context']; - await this.parse(value['@context'], Object.assign(Object.assign({}, options), { external: false, parentContext, ignoreProtection: true, ignoreRemoteScopedContexts: true, ignoreScopedContexts: true })); - } - catch (e) { - throw new ErrorCoded_1.ErrorCoded(e.message, ErrorCoded_1.ERROR_CODES.INVALID_SCOPED_CONTEXT); - } - } - context[key] = Object.assign(Object.assign({}, value), { '@context': (await this.parse(value['@context'], Object.assign(Object.assign({}, options), { external: false, minimalProcessing: true, ignoreRemoteScopedContexts: true, parentContext: context }))) - .getContextRaw() }); - } - } - } - return context; - } - async parse(context, options = {}, - // These options are only for internal use on recursive calls and should not be used by - // libraries consuming this function - internalOptions = {}) { - const { baseIRI, parentContext, external, processingMode = ContextParser.DEFAULT_PROCESSING_MODE, normalizeLanguageTags, ignoreProtection, minimalProcessing, } = options; - const remoteContexts = options.remoteContexts || {}; - // Avoid remote context overflows - if (Object.keys(remoteContexts).length >= this.remoteContextsDepthLimit) { - throw new ErrorCoded_1.ErrorCoded('Detected an overflow in remote context inclusions: ' + Object.keys(remoteContexts), ErrorCoded_1.ERROR_CODES.CONTEXT_OVERFLOW); - } - if (context === null || context === undefined) { - // Don't allow context nullification and there are protected terms - if (!ignoreProtection && parentContext && Util_1.Util.hasProtectedTerms(parentContext)) { - throw new ErrorCoded_1.ErrorCoded('Illegal context nullification when terms are protected', ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_NULLIFICATION); - } - // Context that are explicitly set to null are empty. - return new JsonLdContextNormalized_1.JsonLdContextNormalized(this.applyBaseEntry({}, options, false)); - } - else if (typeof context === 'string') { - const contextIri = this.normalizeContextIri(context, baseIRI); - const overriddenLoad = this.getOverriddenLoad(contextIri, options); - if (overriddenLoad) { - return new JsonLdContextNormalized_1.JsonLdContextNormalized(overriddenLoad); - } - const parsedStringContext = await this.parse(await this.load(contextIri), Object.assign(Object.assign({}, options), { baseIRI: contextIri, external: true, remoteContexts: Object.assign(Object.assign({}, remoteContexts), { [contextIri]: true }) })); - this.applyBaseEntry(parsedStringContext.getContextRaw(), options, true); - return parsedStringContext; - } - else if (Array.isArray(context)) { - // As a performance consideration, first load all external contexts in parallel. - const contextIris = []; - const contexts = await Promise.all(context.map((subContext, i) => { - if (typeof subContext === 'string') { - const contextIri = this.normalizeContextIri(subContext, baseIRI); - contextIris[i] = contextIri; - const overriddenLoad = this.getOverriddenLoad(contextIri, options); - if (overriddenLoad) { - return overriddenLoad; - } - return this.load(contextIri); - } - else { - return subContext; - } - })); - // Don't apply inheritance logic on minimal processing - if (minimalProcessing) { - return new JsonLdContextNormalized_1.JsonLdContextNormalized(contexts); - } - const reducedContexts = await contexts.reduce((accContextPromise, contextEntry, i) => accContextPromise - .then((accContext) => this.parse(contextEntry, Object.assign(Object.assign({}, options), { baseIRI: contextIris[i] || options.baseIRI, external: !!contextIris[i] || options.external, parentContext: accContext.getContextRaw(), remoteContexts: contextIris[i] ? Object.assign(Object.assign({}, remoteContexts), { [contextIris[i]]: true }) : remoteContexts }), - // @ts-expect-error: This third argument causes a type error because we have hidden it from consumers - { - skipValidation: i < contexts.length - 1, - })), Promise.resolve(new JsonLdContextNormalized_1.JsonLdContextNormalized(parentContext || {}))); - // Override the base IRI if provided. - this.applyBaseEntry(reducedContexts.getContextRaw(), options, true); - return reducedContexts; - } - else if (typeof context === 'object') { - if ('@context' in context) { - return await this.parse(context['@context'], options); - } - // Make a deep clone of the given context, to avoid modifying it. - context = Object.assign({}, context); - // According to the JSON-LD spec, @base must be ignored from external contexts. - if (external) { - delete context['@base']; - } - // Override the base IRI if provided. - this.applyBaseEntry(context, options, true); - // Hashify container entries - // Do this before protected term validation as that influences term format - this.containersToHash(context); - // Don't perform any other modifications if only minimal processing is needed. - if (minimalProcessing) { - return new JsonLdContextNormalized_1.JsonLdContextNormalized(context); - } - // In JSON-LD 1.1, load @import'ed context prior to processing. - let importContext = {}; - if ('@import' in context) { - if (processingMode >= 1.1) { - // Only accept string values - if (typeof context['@import'] !== 'string') { - throw new ErrorCoded_1.ErrorCoded('An @import value must be a string, but got ' + typeof context['@import'], ErrorCoded_1.ERROR_CODES.INVALID_IMPORT_VALUE); - } - // Load context - importContext = await this.loadImportContext(this.normalizeContextIri(context['@import'], baseIRI)); - delete context['@import']; - } - else { - throw new ErrorCoded_1.ErrorCoded('Context importing is not supported in JSON-LD 1.0', ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_ENTRY); - } - } - this.applyScopedProtected(importContext, { processingMode }, JsonLdContextNormalized_1.defaultExpandOptions); - const newContext = Object.assign(importContext, context); - // Handle terms (before protection checks) - this.idifyReverseTerms(newContext); - this.normalize(newContext, { processingMode, normalizeLanguageTags }); - this.applyScopedProtected(newContext, { processingMode }, JsonLdContextNormalized_1.defaultExpandOptions); - const keys = Object.keys(newContext); - const overlappingKeys = []; - if (typeof parentContext === 'object') { - // Merge different parts of the final context in order - for (const key in parentContext) { - if (key in newContext) { - overlappingKeys.push(key); - } - else { - newContext[key] = parentContext[key]; - } - } - } - // Parse inner contexts with minimal processing - await this.parseInnerContexts(newContext, options, keys); - const newContextWrapped = new JsonLdContextNormalized_1.JsonLdContextNormalized(newContext); - // In JSON-LD 1.1, @vocab can be relative to @vocab in the parent context, or a compact IRI. - if ((newContext && newContext['@version'] || ContextParser.DEFAULT_PROCESSING_MODE) >= 1.1 - && ((context['@vocab'] && typeof context['@vocab'] === 'string') || context['@vocab'] === '')) { - if (parentContext && '@vocab' in parentContext && context['@vocab'].indexOf(':') < 0) { - newContext['@vocab'] = parentContext['@vocab'] + context['@vocab']; - } - else if (Util_1.Util.isCompactIri(context['@vocab']) || context['@vocab'] in newContext) { - // @vocab is a compact IRI or refers exactly to a prefix - newContext['@vocab'] = newContextWrapped.expandTerm(context['@vocab'], true); - } - } - this.expandPrefixedTerms(newContextWrapped, this.expandContentTypeToBase, keys); - // In JSON-LD 1.1, check if we are not redefining any protected keywords - if (!ignoreProtection && parentContext && processingMode >= 1.1) { - this.validateKeywordRedefinitions(parentContext, newContext, JsonLdContextNormalized_1.defaultExpandOptions, overlappingKeys); - } - if (this.validateContext && !internalOptions.skipValidation) { - this.validate(newContext, { processingMode }); - } - return newContextWrapped; - } - else { - throw new ErrorCoded_1.ErrorCoded(`Tried parsing a context that is not a string, array or object, but got ${context}`, ErrorCoded_1.ERROR_CODES.INVALID_LOCAL_CONTEXT); - } - } - /** - * Fetch the given URL as a raw JSON-LD context. - * @param url An URL. - * @return A promise resolving to a raw JSON-LD context. - */ - async load(url) { - // First try to retrieve the context from cache - const cached = this.documentCache[url]; - if (cached) { - return cached; - } - // If not in cache, load it - let document; - try { - document = await this.documentLoader.load(url); - } - catch (e) { - throw new ErrorCoded_1.ErrorCoded(`Failed to load remote context ${url}: ${e.message}`, ErrorCoded_1.ERROR_CODES.LOADING_REMOTE_CONTEXT_FAILED); - } - // Validate the context - if (!('@context' in document)) { - throw new ErrorCoded_1.ErrorCoded(`Missing @context in remote context at ${url}`, ErrorCoded_1.ERROR_CODES.INVALID_REMOTE_CONTEXT); - } - return this.documentCache[url] = document['@context']; - } - /** - * Override the given context that may be loaded. - * - * This will check whether or not the url is recursively being loaded. - * @param url An URL. - * @param options Parsing options. - * @return An overridden context, or null. - * Optionally an error can be thrown if a cyclic context is detected. - */ - getOverriddenLoad(url, options) { - if (url in (options.remoteContexts || {})) { - if (options.ignoreRemoteScopedContexts) { - return url; - } - else { - throw new ErrorCoded_1.ErrorCoded('Detected a cyclic context inclusion of ' + url, ErrorCoded_1.ERROR_CODES.RECURSIVE_CONTEXT_INCLUSION); - } - } - return null; - } - /** - * Load an @import'ed context. - * @param importContextIri The full URI of an @import value. - */ - async loadImportContext(importContextIri) { - // Load the context - and do a deep clone since we are about to mutate it - let importContext = await this.load(importContextIri); - // Require the context to be a non-array object - if (typeof importContext !== 'object' || Array.isArray(importContext)) { - throw new ErrorCoded_1.ErrorCoded('An imported context must be a single object: ' + importContextIri, ErrorCoded_1.ERROR_CODES.INVALID_REMOTE_CONTEXT); - } - // Error if the context contains another @import - if ('@import' in importContext) { - throw new ErrorCoded_1.ErrorCoded('An imported context can not import another context: ' + importContextIri, ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_ENTRY); - } - importContext = Object.assign({}, importContext); - // Containers have to be converted into hash values the same way as for the importing context - // Otherwise context validation will fail for container values - this.containersToHash(importContext); - return importContext; - } -} -ContextParser.DEFAULT_PROCESSING_MODE = 1.1; -exports.ContextParser = ContextParser; -//# sourceMappingURL=ContextParser.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/lib/ErrorCoded.js": -/*!**************************************************************!*\ - !*** ./node_modules/jsonld-context-parser/lib/ErrorCoded.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ERROR_CODES = exports.ErrorCoded = void 0; -/** - * An error that has a certain error code. - * - * The error code can be any string. - * All standardized error codes are listed in {@link ERROR_CODES}. - */ -class ErrorCoded extends Error { - /* istanbul ignore next */ - constructor(message, code) { - super(message); - this.code = code; - } -} -exports.ErrorCoded = ErrorCoded; -/** - * All standardized JSON-LD error codes. - * @see https://w3c.github.io/json-ld-api/#dom-jsonlderrorcode - */ -// tslint:disable:object-literal-sort-keys -var ERROR_CODES; -(function (ERROR_CODES) { - ERROR_CODES["COLLIDING_KEYWORDS"] = "colliding keywords"; - ERROR_CODES["CONFLICTING_INDEXES"] = "conflicting indexes"; - ERROR_CODES["CYCLIC_IRI_MAPPING"] = "cyclic IRI mapping"; - ERROR_CODES["INVALID_ID_VALUE"] = "invalid @id value"; - ERROR_CODES["INVALID_INDEX_VALUE"] = "invalid @index value"; - ERROR_CODES["INVALID_NEST_VALUE"] = "invalid @nest value"; - ERROR_CODES["INVALID_PREFIX_VALUE"] = "invalid @prefix value"; - ERROR_CODES["INVALID_PROPAGATE_VALUE"] = "invalid @propagate value"; - ERROR_CODES["INVALID_REVERSE_VALUE"] = "invalid @reverse value"; - ERROR_CODES["INVALID_IMPORT_VALUE"] = "invalid @import value"; - ERROR_CODES["INVALID_VERSION_VALUE"] = "invalid @version value"; - ERROR_CODES["INVALID_BASE_IRI"] = "invalid base IRI"; - ERROR_CODES["INVALID_CONTAINER_MAPPING"] = "invalid container mapping"; - ERROR_CODES["INVALID_CONTEXT_ENTRY"] = "invalid context entry"; - ERROR_CODES["INVALID_CONTEXT_NULLIFICATION"] = "invalid context nullification"; - ERROR_CODES["INVALID_DEFAULT_LANGUAGE"] = "invalid default language"; - ERROR_CODES["INVALID_INCLUDED_VALUE"] = "invalid @included value"; - ERROR_CODES["INVALID_IRI_MAPPING"] = "invalid IRI mapping"; - ERROR_CODES["INVALID_JSON_LITERAL"] = "invalid JSON literal"; - ERROR_CODES["INVALID_KEYWORD_ALIAS"] = "invalid keyword alias"; - ERROR_CODES["INVALID_LANGUAGE_MAP_VALUE"] = "invalid language map value"; - ERROR_CODES["INVALID_LANGUAGE_MAPPING"] = "invalid language mapping"; - ERROR_CODES["INVALID_LANGUAGE_TAGGED_STRING"] = "invalid language-tagged string"; - ERROR_CODES["INVALID_LANGUAGE_TAGGED_VALUE"] = "invalid language-tagged value"; - ERROR_CODES["INVALID_LOCAL_CONTEXT"] = "invalid local context"; - ERROR_CODES["INVALID_REMOTE_CONTEXT"] = "invalid remote context"; - ERROR_CODES["INVALID_REVERSE_PROPERTY"] = "invalid reverse property"; - ERROR_CODES["INVALID_REVERSE_PROPERTY_MAP"] = "invalid reverse property map"; - ERROR_CODES["INVALID_REVERSE_PROPERTY_VALUE"] = "invalid reverse property value"; - ERROR_CODES["INVALID_SCOPED_CONTEXT"] = "invalid scoped context"; - ERROR_CODES["INVALID_SCRIPT_ELEMENT"] = "invalid script element"; - ERROR_CODES["INVALID_SET_OR_LIST_OBJECT"] = "invalid set or list object"; - ERROR_CODES["INVALID_TERM_DEFINITION"] = "invalid term definition"; - ERROR_CODES["INVALID_TYPE_MAPPING"] = "invalid type mapping"; - ERROR_CODES["INVALID_TYPE_VALUE"] = "invalid type value"; - ERROR_CODES["INVALID_TYPED_VALUE"] = "invalid typed value"; - ERROR_CODES["INVALID_VALUE_OBJECT"] = "invalid value object"; - ERROR_CODES["INVALID_VALUE_OBJECT_VALUE"] = "invalid value object value"; - ERROR_CODES["INVALID_VOCAB_MAPPING"] = "invalid vocab mapping"; - ERROR_CODES["IRI_CONFUSED_WITH_PREFIX"] = "IRI confused with prefix"; - ERROR_CODES["KEYWORD_REDEFINITION"] = "keyword redefinition"; - ERROR_CODES["LOADING_DOCUMENT_FAILED"] = "loading document failed"; - ERROR_CODES["LOADING_REMOTE_CONTEXT_FAILED"] = "loading remote context failed"; - ERROR_CODES["MULTIPLE_CONTEXT_LINK_HEADERS"] = "multiple context link headers"; - ERROR_CODES["PROCESSING_MODE_CONFLICT"] = "processing mode conflict"; - ERROR_CODES["PROTECTED_TERM_REDEFINITION"] = "protected term redefinition"; - ERROR_CODES["CONTEXT_OVERFLOW"] = "context overflow"; - ERROR_CODES["INVALID_BASE_DIRECTION"] = "invalid base direction"; - ERROR_CODES["RECURSIVE_CONTEXT_INCLUSION"] = "recursive context inclusion"; - ERROR_CODES["INVALID_STREAMING_KEY_ORDER"] = "invalid streaming key order"; - /** - * JSON-LD-star - */ - ERROR_CODES["INVALID_EMBEDDED_NODE"] = "invalid embedded node"; - ERROR_CODES["INVALID_ANNOTATION"] = "invalid annotation"; -})(ERROR_CODES = exports.ERROR_CODES || (exports.ERROR_CODES = {})); -//# sourceMappingURL=ErrorCoded.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/lib/FetchDocumentLoader.js": -/*!***********************************************************************!*\ - !*** ./node_modules/jsonld-context-parser/lib/FetchDocumentLoader.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.FetchDocumentLoader = void 0; -__webpack_require__(/*! cross-fetch/polyfill */ "./node_modules/cross-fetch/dist/browser-polyfill.js"); -const ErrorCoded_1 = __webpack_require__(/*! ./ErrorCoded */ "./node_modules/jsonld-context-parser/lib/ErrorCoded.js"); -const http_link_header_1 = __webpack_require__(/*! http-link-header */ "./node_modules/http-link-header/lib/link.js"); -const relative_to_absolute_iri_1 = __webpack_require__(/*! relative-to-absolute-iri */ "./node_modules/relative-to-absolute-iri/index.js"); -/** - * Loads documents via the fetch API. - */ -class FetchDocumentLoader { - constructor(fetcher) { - this.fetcher = fetcher; - } - async load(url) { - const response = await (this.fetcher || fetch)(url, { headers: new Headers({ accept: 'application/ld+json' }) }); - if (response.ok && response.headers) { - let mediaType = response.headers.get('Content-Type'); - if (mediaType) { - const colonPos = mediaType.indexOf(';'); - if (colonPos > 0) { - mediaType = mediaType.substr(0, colonPos); - } - } - if (mediaType === 'application/ld+json') { - // Return JSON-LD if proper content type was returned - return (await response.json()); - } - else { - // Check for alternate link for a non-JSON-LD response - if (response.headers.has('Link')) { - let alternateUrl; - response.headers.forEach((value, key) => { - if (key === 'link') { - const linkHeader = (0, http_link_header_1.parse)(value); - for (const link of linkHeader.get('type', 'application/ld+json')) { - if (link.rel === 'alternate') { - if (alternateUrl) { - throw new Error('Multiple JSON-LD alternate links were found on ' + url); - } - alternateUrl = (0, relative_to_absolute_iri_1.resolve)(link.uri, url); - } - } - } - }); - if (alternateUrl) { - return this.load(alternateUrl); - } - } - throw new ErrorCoded_1.ErrorCoded(`Unsupported JSON-LD media type ${mediaType}`, ErrorCoded_1.ERROR_CODES.LOADING_DOCUMENT_FAILED); - } - } - else { - throw new Error(response.statusText || `Status code: ${response.status}`); - } - } -} -exports.FetchDocumentLoader = FetchDocumentLoader; -//# sourceMappingURL=FetchDocumentLoader.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/lib/IDocumentLoader.js": -/*!*******************************************************************!*\ - !*** ./node_modules/jsonld-context-parser/lib/IDocumentLoader.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=IDocumentLoader.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/lib/JsonLdContext.js": -/*!*****************************************************************!*\ - !*** ./node_modules/jsonld-context-parser/lib/JsonLdContext.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -// tslint:disable:max-line-length -Object.defineProperty(exports, "__esModule", ({ value: true })); -//# sourceMappingURL=JsonLdContext.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/lib/JsonLdContextNormalized.js": -/*!***************************************************************************!*\ - !*** ./node_modules/jsonld-context-parser/lib/JsonLdContextNormalized.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.defaultExpandOptions = exports.JsonLdContextNormalized = void 0; -const relative_to_absolute_iri_1 = __webpack_require__(/*! relative-to-absolute-iri */ "./node_modules/relative-to-absolute-iri/index.js"); -const ErrorCoded_1 = __webpack_require__(/*! ./ErrorCoded */ "./node_modules/jsonld-context-parser/lib/ErrorCoded.js"); -const Util_1 = __webpack_require__(/*! ./Util */ "./node_modules/jsonld-context-parser/lib/Util.js"); -/** - * A class exposing operations over a normalized JSON-LD context. - */ -class JsonLdContextNormalized { - constructor(contextRaw) { - this.contextRaw = contextRaw; - } - /** - * @return The raw inner context. - */ - getContextRaw() { - return this.contextRaw; - } - /** - * Expand the term or prefix of the given term if it has one, - * otherwise return the term as-is. - * - * This will try to expand the IRI as much as possible. - * - * Iff in vocab-mode, then other references to other terms in the context can be used, - * such as to `myTerm`: - * ``` - * { - * "myTerm": "http://example.org/myLongTerm" - * } - * ``` - * - * @param {string} term A term that is an URL or a prefixed URL. - * @param {boolean} expandVocab If the term is a predicate or type and should be expanded based on @vocab, - * otherwise it is considered a regular term that is expanded based on @base. - * @param {IExpandOptions} options Options that define the way how expansion must be done. - * @return {string} The expanded term, the term as-is, or null if it was explicitly disabled in the context. - * @throws If the term is aliased to an invalid value (not a string, IRI or keyword). - */ - expandTerm(term, expandVocab, options = exports.defaultExpandOptions) { - const contextValue = this.contextRaw[term]; - // Immediately return if the term was disabled in the context - if (contextValue === null || (contextValue && contextValue['@id'] === null)) { - return null; - } - // Check the @id - let validIriMapping = true; - if (contextValue && expandVocab) { - const value = Util_1.Util.getContextValueId(contextValue); - if (value && value !== term) { - if (typeof value !== 'string' || (!Util_1.Util.isValidIri(value) && !Util_1.Util.isValidKeyword(value))) { - // Don't mark this mapping as invalid if we have an unknown keyword, but of the correct form. - if (!Util_1.Util.isPotentialKeyword(value)) { - validIriMapping = false; - } - } - else { - return value; - } - } - } - // Check if the term is prefixed - const prefix = Util_1.Util.getPrefix(term, this.contextRaw); - const vocab = this.contextRaw['@vocab']; - const vocabRelative = (!!vocab || vocab === '') && vocab.indexOf(':') < 0; - const base = this.contextRaw['@base']; - const potentialKeyword = Util_1.Util.isPotentialKeyword(term); - if (prefix) { - const contextPrefixValue = this.contextRaw[prefix]; - const value = Util_1.Util.getContextValueId(contextPrefixValue); - if (value) { - if (typeof contextPrefixValue === 'string' || !options.allowPrefixForcing) { - // If we have a simple term definition, - // check the last character of the prefix to determine whether or not it is a prefix. - // Validate that prefix ends with gen-delim character, unless @prefix is true - if (!Util_1.Util.isSimpleTermDefinitionPrefix(value, options)) { - // Treat the term as an absolute IRI - return term; - } - } - else { - // If we have an expanded term definition, default to @prefix: false - if (value[0] !== '_' && !potentialKeyword && !contextPrefixValue['@prefix'] && !(term in this.contextRaw)) { - // Treat the term as an absolute IRI - return term; - } - } - return value + term.substr(prefix.length + 1); - } - } - else if (expandVocab && ((vocab || vocab === '') || (options.allowVocabRelativeToBase && (base && vocabRelative))) - && !potentialKeyword && !Util_1.Util.isCompactIri(term)) { - if (vocabRelative) { - if (options.allowVocabRelativeToBase) { - return ((vocab || base) ? (0, relative_to_absolute_iri_1.resolve)(vocab, base) : '') + term; - } - else { - throw new ErrorCoded_1.ErrorCoded(`Relative vocab expansion for term '${term}' with vocab '${vocab}' is not allowed.`, ErrorCoded_1.ERROR_CODES.INVALID_VOCAB_MAPPING); - } - } - else { - return vocab + term; - } - } - else if (!expandVocab && base && !potentialKeyword && !Util_1.Util.isCompactIri(term)) { - return (0, relative_to_absolute_iri_1.resolve)(term, base); - } - // Return the term as-is, unless we discovered an invalid IRI mapping for this term in the context earlier. - if (validIriMapping) { - return term; - } - else { - throw new ErrorCoded_1.ErrorCoded(`Invalid IRI mapping found for context entry '${term}': '${JSON.stringify(contextValue)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING); - } - } - /** - * Compact the given term using @base, @vocab, an aliased term, or a prefixed term. - * - * This will try to compact the IRI as much as possible. - * - * @param {string} iri An IRI to compact. - * @param {boolean} vocab If the term is a predicate or type and should be compacted based on @vocab, - * otherwise it is considered a regular term that is compacted based on @base. - * @return {string} The compacted term or the IRI as-is. - */ - compactIri(iri, vocab) { - // Try @vocab compacting - if (vocab && this.contextRaw['@vocab'] && iri.startsWith(this.contextRaw['@vocab'])) { - return iri.substr(this.contextRaw['@vocab'].length); - } - // Try @base compacting - if (!vocab && this.contextRaw['@base'] && iri.startsWith(this.contextRaw['@base'])) { - return iri.substr(this.contextRaw['@base'].length); - } - // Loop over all terms in the context - // This will try to prefix as short as possible. - // Once a fully compacted alias is found, return immediately, as we can not go any shorter. - const shortestPrefixing = { prefix: '', suffix: iri }; - for (const key in this.contextRaw) { - const value = this.contextRaw[key]; - if (value && !Util_1.Util.isPotentialKeyword(key)) { - const contextIri = Util_1.Util.getContextValueId(value); - if (iri.startsWith(contextIri)) { - const suffix = iri.substr(contextIri.length); - if (!suffix) { - if (vocab) { - // Immediately return on compacted alias - return key; - } - } - else if (suffix.length < shortestPrefixing.suffix.length) { - // Overwrite the shortest prefix - shortestPrefixing.prefix = key; - shortestPrefixing.suffix = suffix; - } - } - } - } - // Return the shortest prefix - if (shortestPrefixing.prefix) { - return shortestPrefixing.prefix + ':' + shortestPrefixing.suffix; - } - return iri; - } -} -exports.JsonLdContextNormalized = JsonLdContextNormalized; -exports.defaultExpandOptions = { - allowPrefixForcing: true, - allowPrefixNonGenDelims: false, - allowVocabRelativeToBase: true, -}; -//# sourceMappingURL=JsonLdContextNormalized.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-context-parser/lib/Util.js": -/*!********************************************************!*\ - !*** ./node_modules/jsonld-context-parser/lib/Util.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Util = void 0; -class Util { - /** - * Check if the given term is a valid compact IRI. - * Otherwise, it may be an IRI. - * @param {string} term A term. - * @return {boolean} If it is a compact IRI. - */ - static isCompactIri(term) { - return term.indexOf(':') > 0 && !(term && term[0] === '#'); - } - /** - * Get the prefix from the given term. - * @see https://json-ld.org/spec/latest/json-ld/#compact-iris - * @param {string} term A term that is an URL or a prefixed URL. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @return {string} The prefix or null. - */ - static getPrefix(term, context) { - // Do not consider relative IRIs starting with a hash as compact IRIs - if (term && term[0] === '#') { - return null; - } - const separatorPos = term.indexOf(':'); - if (separatorPos >= 0) { - // Suffix can not begin with two slashes - if (term.length > separatorPos + 1 - && term.charAt(separatorPos + 1) === '/' - && term.charAt(separatorPos + 2) === '/') { - return null; - } - const prefix = term.substr(0, separatorPos); - // Prefix can not be an underscore (this is a blank node) - if (prefix === '_') { - return null; - } - // Prefix must match a term in the active context - if (context[prefix]) { - return prefix; - } - } - return null; - } - /** - * From a given context entry value, get the string value, or the @id field. - * @param contextValue A value for a term in a context. - * @return {string} The id value, or null. - */ - static getContextValueId(contextValue) { - if (contextValue === null || typeof contextValue === 'string') { - return contextValue; - } - const id = contextValue['@id']; - return id ? id : null; - } - /** - * Check if the given simple term definition (string-based value of a context term) - * should be considered a prefix. - * @param value A simple term definition value. - * @param options Options that define the way how expansion must be done. - */ - static isSimpleTermDefinitionPrefix(value, options) { - return !Util.isPotentialKeyword(value) - && (options.allowPrefixNonGenDelims || (typeof value === 'string' && (value[0] === '_' || Util.isPrefixIriEndingWithGenDelim(value)))); - } - /** - * Check if the given keyword is of the keyword format "@"1*ALPHA. - * @param {string} keyword A potential keyword. - * @return {boolean} If the given keyword is of the keyword format. - */ - static isPotentialKeyword(keyword) { - return typeof keyword === 'string' && Util.KEYWORD_REGEX.test(keyword); - } - /** - * Check if the given prefix ends with a gen-delim character. - * @param {string} prefixIri A prefix IRI. - * @return {boolean} If the given prefix IRI is valid. - */ - static isPrefixIriEndingWithGenDelim(prefixIri) { - return Util.ENDS_WITH_GEN_DELIM.test(prefixIri); - } - /** - * Check if the given context value can be a prefix value. - * @param value A context value. - * @return {boolean} If it can be a prefix value. - */ - static isPrefixValue(value) { - return value && (typeof value === 'string' || (value && typeof value === 'object')); - } - /** - * Check if the given IRI is valid. - * @param {string} iri A potential IRI. - * @return {boolean} If the given IRI is valid. - */ - static isValidIri(iri) { - return Boolean(iri && Util.IRI_REGEX.test(iri)); - } - /** - * Check if the given IRI is valid, this includes the possibility of being a relative IRI. - * @param {string} iri A potential IRI. - * @return {boolean} If the given IRI is valid. - */ - static isValidIriWeak(iri) { - return !!iri && iri[0] !== ':' && Util.IRI_REGEX_WEAK.test(iri); - } - /** - * Check if the given keyword is a defined according to the JSON-LD specification. - * @param {string} keyword A potential keyword. - * @return {boolean} If the given keyword is valid. - */ - static isValidKeyword(keyword) { - return Util.VALID_KEYWORDS[keyword]; - } - /** - * Check if the given term is protected in the context. - * @param {IJsonLdContextNormalizedRaw} context A context. - * @param {string} key A context term. - * @return {boolean} If the given term has an @protected flag. - */ - static isTermProtected(context, key) { - const value = context[key]; - return !(typeof value === 'string') && value && value['@protected']; - } - /** - * Check if the given context has at least one protected term. - * @param context A context. - * @return If the context has a protected term. - */ - static hasProtectedTerms(context) { - for (const key of Object.keys(context)) { - if (Util.isTermProtected(context, key)) { - return true; - } - } - return false; - } - /** - * Check if the given key is an internal reserved keyword. - * @param key A context key. - */ - static isReservedInternalKeyword(key) { - return key.startsWith('@__'); - } - /** - * Check if two objects are deepEqual to on another. - * @param object1 The first object to test. - * @param object2 The second object to test. - */ - static deepEqual(object1, object2) { - const objKeys1 = Object.keys(object1); - const objKeys2 = Object.keys(object2); - if (objKeys1.length !== objKeys2.length) - return false; - return objKeys1.every((key) => { - const value1 = object1[key]; - const value2 = object2[key]; - return (value1 === value2) || (value1 !== null && - value2 !== null && - typeof value1 === "object" && - typeof value2 === "object" && - this.deepEqual(value1, value2)); - }); - } - ; -} -// Regex for valid IRIs -Util.IRI_REGEX = /^([A-Za-z][A-Za-z0-9+-.]*|_):[^ "<>{}|\\\[\]`#]*(#[^#]*)?$/; -// Weaker regex for valid IRIs, this includes relative IRIs -Util.IRI_REGEX_WEAK = /(?::[^:])|\//; -// Regex for keyword form -Util.KEYWORD_REGEX = /^@[a-z]+$/i; -// Regex to see if an IRI ends with a gen-delim character (see RFC 3986) -Util.ENDS_WITH_GEN_DELIM = /[:/?#\[\]@]$/; -// Regex for language tags -Util.REGEX_LANGUAGE_TAG = /^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/; -// Regex for base directions -Util.REGEX_DIRECTION_TAG = /^(ltr)|(rtl)$/; -// All known valid JSON-LD keywords -// @see https://www.w3.org/TR/json-ld11/#keywords -Util.VALID_KEYWORDS = { - '@annotation': true, - '@base': true, - '@container': true, - '@context': true, - '@direction': true, - '@graph': true, - '@id': true, - '@import': true, - '@included': true, - '@index': true, - '@json': true, - '@language': true, - '@list': true, - '@nest': true, - '@none': true, - '@prefix': true, - '@propagate': true, - '@protected': true, - '@reverse': true, - '@set': true, - '@type': true, - '@value': true, - '@version': true, - '@vocab': true, -}; -// Keys in the contexts that will not be expanded based on the base IRI -Util.EXPAND_KEYS_BLACKLIST = [ - '@base', - '@vocab', - '@language', - '@version', - '@direction', -]; -// Keys in the contexts that may not be aliased from -Util.ALIAS_DOMAIN_BLACKLIST = [ - '@container', - '@graph', - '@id', - '@index', - '@list', - '@nest', - '@none', - '@prefix', - '@reverse', - '@set', - '@type', - '@value', - '@version', -]; -// Keys in the contexts that may not be aliased to -Util.ALIAS_RANGE_BLACKLIST = [ - '@context', - '@preserve', -]; -// All valid @container values -Util.CONTAINERS = [ - '@list', - '@set', - '@index', - '@language', - '@graph', - '@id', - '@type', -]; -// All valid @container values under processing mode 1.0 -Util.CONTAINERS_1_0 = [ - '@list', - '@set', - '@index', -]; -exports.Util = Util; -//# sourceMappingURL=Util.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/index.js": -/*!*******************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/index.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__webpack_require__(/*! ./lib/JsonLdParser */ "./node_modules/jsonld-streaming-parser/lib/JsonLdParser.js"), exports); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/ContextTree.js": -/*!*****************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/ContextTree.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContextTree = void 0; -/** - * A tree structure that holds all contexts, - * based on their position in the JSON object. - * - * Positions are identified by a path of keys. - */ -class ContextTree { - constructor() { - this.subTrees = {}; - } - getContext(keys) { - if (keys.length > 0) { - const [head, ...tail] = keys; - const subTree = this.subTrees[head]; - if (subTree) { - const subContext = subTree.getContext(tail); - if (subContext) { - return subContext.then(({ context, depth }) => ({ context, depth: depth + 1 })); - } - } - } - return this.context ? this.context.then((context) => ({ context, depth: 0 })) : null; - } - setContext(keys, context) { - if (keys.length === 0) { - this.context = context; - } - else { - const [head, ...tail] = keys; - let subTree = this.subTrees[head]; - if (!subTree) { - subTree = this.subTrees[head] = new ContextTree(); - } - subTree.setContext(tail, context); - } - } - removeContext(path) { - this.setContext(path, null); - } -} -exports.ContextTree = ContextTree; -//# sourceMappingURL=ContextTree.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/JsonLdParser.js": -/*!******************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/JsonLdParser.js ***! - \******************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.JsonLdParser = void 0; -// tslint:disable-next-line:no-var-requires -const Parser = __webpack_require__(/*! @bergos/jsonparse */ "./node_modules/@bergos/jsonparse/jsonparse.js"); -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const readable_stream_1 = __webpack_require__(/*! readable-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/browser.js"); -const EntryHandlerArrayValue_1 = __webpack_require__(/*! ./entryhandler/EntryHandlerArrayValue */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerArrayValue.js"); -const EntryHandlerContainer_1 = __webpack_require__(/*! ./entryhandler/EntryHandlerContainer */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerContainer.js"); -const EntryHandlerInvalidFallback_1 = __webpack_require__(/*! ./entryhandler/EntryHandlerInvalidFallback */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerInvalidFallback.js"); -const EntryHandlerPredicate_1 = __webpack_require__(/*! ./entryhandler/EntryHandlerPredicate */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js"); -const EntryHandlerKeywordContext_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordContext */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordContext.js"); -const EntryHandlerKeywordGraph_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordGraph */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordGraph.js"); -const EntryHandlerKeywordId_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordId */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordId.js"); -const EntryHandlerKeywordIncluded_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordIncluded */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordIncluded.js"); -const EntryHandlerKeywordNest_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordNest */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordNest.js"); -const EntryHandlerKeywordType_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordType */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordType.js"); -const EntryHandlerKeywordUnknownFallback_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordUnknownFallback */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordUnknownFallback.js"); -const EntryHandlerKeywordValue_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordValue */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordValue.js"); -const ParsingContext_1 = __webpack_require__(/*! ./ParsingContext */ "./node_modules/jsonld-streaming-parser/lib/ParsingContext.js"); -const Util_1 = __webpack_require__(/*! ./Util */ "./node_modules/jsonld-streaming-parser/lib/Util.js"); -const http_link_header_1 = __webpack_require__(/*! http-link-header */ "./node_modules/http-link-header/lib/link.js"); -const EntryHandlerKeywordAnnotation_1 = __webpack_require__(/*! ./entryhandler/keyword/EntryHandlerKeywordAnnotation */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordAnnotation.js"); -/** - * A stream transformer that parses JSON-LD (text) streams to an {@link RDF.Stream}. - */ -class JsonLdParser extends readable_stream_1.Transform { - constructor(options) { - super({ readableObjectMode: true }); - options = options || {}; - this.options = options; - this.parsingContext = new ParsingContext_1.ParsingContext(Object.assign({ parser: this }, options)); - this.util = new Util_1.Util({ dataFactory: options.dataFactory, parsingContext: this.parsingContext }); - this.jsonParser = new Parser(); - this.contextJobs = []; - this.typeJobs = []; - this.contextAwaitingJobs = []; - this.lastDepth = 0; - this.lastKeys = []; - this.lastOnValueJob = Promise.resolve(); - this.attachJsonParserListeners(); - this.on('end', () => { - if (typeof this.jsonParser.mode !== 'undefined') { - this.emit('error', new Error('Unclosed document')); - } - }); - } - /** - * Construct a JsonLdParser from the given HTTP response. - * - * This will throw an error if no valid JSON response is received - * (application/ld+json, application/json, or something+json). - * - * For raw JSON responses, exactly one link header pointing to a JSON-LD context is required. - * - * This method is not responsible for handling redirects. - * - * @param baseIRI The URI of the received response. - * @param mediaType The received content type. - * @param headers Optional HTTP headers. - * @param options Optional parser options. - */ - static fromHttpResponse(baseIRI, mediaType, headers, options) { - let context; - // Special cases when receiving something else than the JSON-LD media type - if (mediaType !== 'application/ld+json') { - // Only accept JSON or JSON extension types - if (mediaType !== 'application/json' && !mediaType.endsWith('+json')) { - throw new jsonld_context_parser_1.ErrorCoded(`Unsupported JSON-LD media type ${mediaType}`, jsonld_context_parser_1.ERROR_CODES.LOADING_DOCUMENT_FAILED); - } - // We need exactly one JSON-LD context in the link header - if (headers && headers.has('Link')) { - headers.forEach((value, key) => { - if (key === 'link') { - const linkHeader = (0, http_link_header_1.parse)(value); - for (const link of linkHeader.get('rel', 'http://www.w3.org/ns/json-ld#context')) { - if (context) { - throw new jsonld_context_parser_1.ErrorCoded('Multiple JSON-LD context link headers were found on ' + baseIRI, jsonld_context_parser_1.ERROR_CODES.MULTIPLE_CONTEXT_LINK_HEADERS); - } - context = link.uri; - } - } - }); - } - if (!context && !(options === null || options === void 0 ? void 0 : options.ignoreMissingContextLinkHeader)) { - throw new jsonld_context_parser_1.ErrorCoded(`Missing context link header for media type ${mediaType} on ${baseIRI}`, jsonld_context_parser_1.ERROR_CODES.LOADING_DOCUMENT_FAILED); - } - } - // Check if the streaming profile is present - let streamingProfile; - if (headers && headers.has('Content-Type')) { - const contentType = headers.get('Content-Type'); - const match = /; *profile=([^"]*)/.exec(contentType); - if (match && match[1] === 'http://www.w3.org/ns/json-ld#streaming') { - streamingProfile = true; - } - } - return new JsonLdParser(Object.assign({ baseIRI, - context, - streamingProfile }, options ? options : {})); - } - /** - * Parses the given text stream into a quad stream. - * @param {NodeJS.EventEmitter} stream A text stream. - * @return {RDF.Stream} A quad stream. - */ - import(stream) { - if ('pipe' in stream) { - stream.on('error', (error) => parsed.emit('error', error)); - const parsed = stream.pipe(new JsonLdParser(this.options)); - return parsed; - } - else { - const output = new readable_stream_1.PassThrough({ readableObjectMode: true }); - stream.on('error', (error) => parsed.emit('error', error)); - stream.on('data', (data) => output.push(data)); - stream.on('end', () => output.push(null)); - const parsed = output.pipe(new JsonLdParser(this.options)); - return parsed; - } - } - _transform(chunk, encoding, callback) { - this.jsonParser.write(chunk); - this.lastOnValueJob - .then(() => callback(), (error) => callback(error)); - } - /** - * Start a new job for parsing the given value. - * - * This will let the first valid {@link IEntryHandler} handle the entry. - * - * @param {any[]} keys The stack of keys. - * @param value The value to parse. - * @param {number} depth The depth to parse at. - * @param {boolean} lastDepthCheck If the lastDepth check should be done for buffer draining. - * @return {Promise} A promise resolving when the job is done. - */ - async newOnValueJob(keys, value, depth, lastDepthCheck) { - let flushStacks = true; - // When we go up the stack, emit all unidentified values - // We need to do this before the new job, because the new job may require determined values from the flushed jobs. - if (lastDepthCheck && depth < this.lastDepth) { - // Check if we had any RDF lists that need to be terminated with an rdf:nil - const listPointer = this.parsingContext.listPointerStack[this.lastDepth]; - if (listPointer) { - // Terminate the list if the had at least one value - if (listPointer.value) { - this.push(this.util.dataFactory.quad(listPointer.value, this.util.rdfRest, this.util.rdfNil, this.util.getDefaultGraph())); - } - // Add the list id to the id stack, so it can be used higher up in the stack - listPointer.listId.listHead = true; - this.parsingContext.idStack[listPointer.listRootDepth + 1] = [listPointer.listId]; - this.parsingContext.listPointerStack.splice(this.lastDepth, 1); - } - // Flush the buffer for lastDepth - // If the parent key is a special type of container, postpone flushing until that parent is handled. - if (await EntryHandlerContainer_1.EntryHandlerContainer.isBufferableContainerHandler(this.parsingContext, this.lastKeys, this.lastDepth)) { - this.parsingContext.pendingContainerFlushBuffers - .push({ depth: this.lastDepth, keys: this.lastKeys.slice(0, this.lastKeys.length) }); - flushStacks = false; - } - else { - await this.flushBuffer(this.lastDepth, this.lastKeys); - } - } - const key = await this.util.unaliasKeyword(keys[depth], keys, depth); - const parentKey = await this.util.unaliasKeywordParent(keys, depth); - this.parsingContext.emittedStack[depth] = true; - let handleKey = true; - // Keywords inside @reverse is not allowed apart from @context - if (jsonld_context_parser_1.Util.isValidKeyword(key) && parentKey === '@reverse' && key !== '@context') { - this.emit('error', new jsonld_context_parser_1.ErrorCoded(`Found the @id '${value}' inside an @reverse property`, jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_PROPERTY_MAP)); - } - // Skip further processing if one of the parent nodes are invalid. - // We use the validationStack to reuse validation results that were produced before with common key stacks. - let inProperty = false; - if (this.parsingContext.validationStack.length > 1) { - inProperty = this.parsingContext.validationStack[this.parsingContext.validationStack.length - 1].property; - } - for (let i = Math.max(1, this.parsingContext.validationStack.length - 1); i < keys.length - 1; i++) { - const validationResult = this.parsingContext.validationStack[i] - || (this.parsingContext.validationStack[i] = await this.validateKey(keys.slice(0, i + 1), i, inProperty)); - if (!validationResult.valid) { - this.parsingContext.emittedStack[depth] = false; - handleKey = false; - break; - } - else if (!inProperty && validationResult.property) { - inProperty = true; - } - } - // Skip further processing if this node is part of a literal - if (await this.util.isLiteral(keys, depth)) { - handleKey = false; - } - // Get handler - if (handleKey) { - for (const entryHandler of JsonLdParser.ENTRY_HANDLERS) { - const testResult = await entryHandler.test(this.parsingContext, this.util, key, keys, depth); - if (testResult) { - // Pass processing over to the handler - await entryHandler.handle(this.parsingContext, this.util, key, keys, value, depth, testResult); - // Flag that this depth is processed - if (entryHandler.isStackProcessor()) { - this.parsingContext.processingStack[depth] = true; - } - break; - } - } - } - // Validate value indexes on the root. - if (depth === 0 && Array.isArray(value)) { - await this.util.validateValueIndexes(value); - } - // When we go up the stack, flush the old stack - if (flushStacks && depth < this.lastDepth) { - // Reset our stacks - this.flushStacks(this.lastDepth); - } - this.lastDepth = depth; - this.lastKeys = keys; - // Clear the keyword cache at this depth, and everything underneath. - this.parsingContext.unaliasedKeywordCacheStack.splice(depth - 1); - } - /** - * Flush the processing stacks at the given depth. - * @param {number} depth A depth. - */ - flushStacks(depth) { - this.parsingContext.processingStack.splice(depth, 1); - this.parsingContext.processingType.splice(depth, 1); - this.parsingContext.emittedStack.splice(depth, 1); - this.parsingContext.idStack.splice(depth, 1); - this.parsingContext.graphStack.splice(depth + 1, 1); - this.parsingContext.graphContainerTermStack.splice(depth, 1); - this.parsingContext.jsonLiteralStack.splice(depth, 1); - this.parsingContext.validationStack.splice(depth - 1, 2); - this.parsingContext.literalStack.splice(depth, this.parsingContext.literalStack.length - depth); - this.parsingContext.annotationsBuffer.splice(depth, 1); - // TODO: just like the literal stack, splice all other stack until the end as well? - } - /** - * Flush buffers for the given depth. - * - * This should be called after the last entry at a given depth was processed. - * - * @param {number} depth A depth. - * @param {any[]} keys A stack of keys. - * @return {Promise} A promise resolving if flushing is done. - */ - async flushBuffer(depth, keys) { - let subjects = this.parsingContext.idStack[depth]; - const subjectsWasDefined = !!subjects; - if (!subjectsWasDefined) { - subjects = this.parsingContext.idStack[depth] = [this.util.dataFactory.blankNode()]; - } - // Flush values at this level - const valueBuffer = this.parsingContext.unidentifiedValuesBuffer[depth]; - if (valueBuffer) { - for (const subject of subjects) { - const depthOffsetGraph = await this.util.getDepthOffsetGraph(depth, keys); - const graphs = (this.parsingContext.graphStack[depth] || depthOffsetGraph >= 0) - ? this.parsingContext.idStack[depth - depthOffsetGraph - 1] - : [await this.util.getGraphContainerValue(keys, depth)]; - if (graphs) { - for (const graph of graphs) { - // Flush values to stream if the graph @id is known - this.parsingContext.emittedStack[depth] = true; - for (const bufferedValue of valueBuffer) { - this.util.emitQuadChecked(depth, subject, bufferedValue.predicate, bufferedValue.object, graph, bufferedValue.reverse, bufferedValue.isEmbedded); - } - } - } - else { - // Place the values in the graphs buffer if the graph @id is not yet known - const subGraphBuffer = this.parsingContext.getUnidentifiedGraphBufferSafe(depth - await this.util.getDepthOffsetGraph(depth, keys) - 1); - for (const bufferedValue of valueBuffer) { - if (bufferedValue.reverse) { - subGraphBuffer.push({ - object: subject, - predicate: bufferedValue.predicate, - subject: bufferedValue.object, - isEmbedded: bufferedValue.isEmbedded, - }); - } - else { - subGraphBuffer.push({ - object: bufferedValue.object, - predicate: bufferedValue.predicate, - subject, - isEmbedded: bufferedValue.isEmbedded, - }); - } - } - } - } - this.parsingContext.unidentifiedValuesBuffer.splice(depth, 1); - this.parsingContext.literalStack.splice(depth, 1); - this.parsingContext.jsonLiteralStack.splice(depth, 1); - } - // Flush graphs at this level - const graphBuffer = this.parsingContext.unidentifiedGraphsBuffer[depth]; - if (graphBuffer) { - for (const subject of subjects) { - // A @graph statement at the root without @id relates to the default graph, - // unless there are top-level properties, - // others relate to blank nodes. - const graph = depth === 1 && subject.termType === 'BlankNode' - && !this.parsingContext.topLevelProperties ? this.util.getDefaultGraph() : subject; - this.parsingContext.emittedStack[depth] = true; - for (const bufferedValue of graphBuffer) { - this.parsingContext.emitQuad(depth, this.util.dataFactory.quad(bufferedValue.subject, bufferedValue.predicate, bufferedValue.object, graph)); - } - } - this.parsingContext.unidentifiedGraphsBuffer.splice(depth, 1); - } - // Push unhandled annotations up the stack as nested annotations - const annotationsBuffer = this.parsingContext.annotationsBuffer[depth]; - if (annotationsBuffer) { - // Throw an error if we reach the top, and still have annotations - if (annotationsBuffer.length > 0 && depth === 1) { - this.parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Annotations can not be made on top-level nodes`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION)); - } - // Pass the annotations buffer up one level in the stack - const annotationsBufferParent = this.parsingContext.getAnnotationsBufferSafe(depth - 1); - for (const annotation of annotationsBuffer) { - annotationsBufferParent.push(annotation); - } - delete this.parsingContext.annotationsBuffer[depth]; - } - } - /** - * Check if at least one {@link IEntryHandler} validates the entry to true. - * @param {any[]} keys A stack of keys. - * @param {number} depth A depth. - * @param {boolean} inProperty If the current depth is part of a valid property node. - * @return {Promise<{ valid: boolean, property: boolean }>} A promise resolving to true or false. - */ - async validateKey(keys, depth, inProperty) { - for (const entryHandler of JsonLdParser.ENTRY_HANDLERS) { - if (await entryHandler.validate(this.parsingContext, this.util, keys, depth, inProperty)) { - return { valid: true, property: inProperty || entryHandler.isPropertyHandler() }; - } - } - return { valid: false, property: false }; - } - /** - * Attach all required listeners to the JSON parser. - * - * This should only be called once. - */ - attachJsonParserListeners() { - // Listen to json parser events - this.jsonParser.onValue = (value) => { - const depth = this.jsonParser.stack.length; - const keys = (new Array(depth + 1).fill(0)).map((v, i) => { - return i === depth ? this.jsonParser.key : this.jsonParser.stack[i].key; - }); - if (!this.isParsingContextInner(depth)) { // Don't parse inner nodes inside @context - const valueJobCb = () => this.newOnValueJob(keys, value, depth, true); - if (!this.parsingContext.streamingProfile - && !this.parsingContext.contextTree.getContext(keys.slice(0, -1))) { - // If an out-of-order context is allowed, - // we have to buffer everything. - // We store jobs for @context's and @type's separately, - // because at the end, we have to process them first. - // We also handle @type because these *could* introduce a type-scoped context. - if (keys[depth] === '@context') { - let jobs = this.contextJobs[depth]; - if (!jobs) { - jobs = this.contextJobs[depth] = []; - } - jobs.push(valueJobCb); - } - else { - this.contextAwaitingJobs.push({ job: valueJobCb, keys, depth }); - } - } - else { - // Make sure that our value jobs are chained synchronously - this.lastOnValueJob = this.lastOnValueJob.then(valueJobCb); - } - // Execute all buffered jobs on deeper levels - if (!this.parsingContext.streamingProfile && depth === 0) { - this.lastOnValueJob = this.lastOnValueJob - .then(() => this.executeBufferedJobs()); - } - } - }; - this.jsonParser.onError = (error) => { - this.emit('error', error); - }; - } - /** - * Check if the parser is currently parsing an element that is part of an @context entry. - * @param {number} depth A depth. - * @return {boolean} A boolean. - */ - isParsingContextInner(depth) { - for (let i = depth; i > 0; i--) { - if (this.jsonParser.stack[i - 1].key === '@context') { - return true; - } - } - return false; - } - /** - * Execute all buffered jobs. - * @return {Promise} A promise resolving if all jobs are finished. - */ - async executeBufferedJobs() { - // Handle context jobs - for (const jobs of this.contextJobs) { - if (jobs) { - for (const job of jobs) { - await job(); - } - } - } - // Clear the keyword cache. - this.parsingContext.unaliasedKeywordCacheStack.splice(0); - const contextAwaitingJobs = []; - for (const job of this.contextAwaitingJobs) { - if ((await this.util.unaliasKeyword(job.keys[job.depth], job.keys, job.depth, true)) === '@type' - || typeof job.keys[job.depth] === 'number' && (await this.util.unaliasKeyword(job.keys[job.depth - 1], job.keys, job.depth - 1, true)) === '@type') { // Also capture @type with array values - // Remove @type from keys, because we want it to apply to parent later on - this.typeJobs.push({ job: job.job, keys: job.keys.slice(0, job.keys.length - 1) }); - } - else { - contextAwaitingJobs.push(job); - } - } - // Handle non-context jobs - for (const job of contextAwaitingJobs) { - // Check if we have a type (with possible type-scoped context) that should be handled before. - // We check all possible parent nodes for the current job, from root to leaves. - if (this.typeJobs.length > 0) { - // First collect all applicable type jobs - const applicableTypeJobs = []; - const applicableTypeJobIds = []; - for (let i = 0; i < this.typeJobs.length; i++) { - const typeJob = this.typeJobs[i]; - if (Util_1.Util.isPrefixArray(typeJob.keys, job.keys)) { - applicableTypeJobs.push(typeJob); - applicableTypeJobIds.push(i); - } - } - // Next, sort the jobs from short to long key length (to ensure types higher up in the tree to be handled first) - const sortedTypeJobs = applicableTypeJobs.sort((job1, job2) => job1.keys.length - job2.keys.length); - // Finally, execute the jobs in order - for (const typeJob of sortedTypeJobs) { - await typeJob.job(); - } - // Remove the executed type jobs - // Sort first, so we can efficiently splice - const sortedApplicableTypeJobIds = applicableTypeJobIds.sort().reverse(); - for (const jobId of sortedApplicableTypeJobIds) { - this.typeJobs.splice(jobId, 1); - } - } - await job.job(); - } - } -} -JsonLdParser.DEFAULT_PROCESSING_MODE = '1.1'; -JsonLdParser.ENTRY_HANDLERS = [ - new EntryHandlerArrayValue_1.EntryHandlerArrayValue(), - new EntryHandlerKeywordContext_1.EntryHandlerKeywordContext(), - new EntryHandlerKeywordId_1.EntryHandlerKeywordId(), - new EntryHandlerKeywordIncluded_1.EntryHandlerKeywordIncluded(), - new EntryHandlerKeywordGraph_1.EntryHandlerKeywordGraph(), - new EntryHandlerKeywordNest_1.EntryHandlerKeywordNest(), - new EntryHandlerKeywordType_1.EntryHandlerKeywordType(), - new EntryHandlerKeywordValue_1.EntryHandlerKeywordValue(), - new EntryHandlerKeywordAnnotation_1.EntryHandlerKeywordAnnotation(), - new EntryHandlerContainer_1.EntryHandlerContainer(), - new EntryHandlerKeywordUnknownFallback_1.EntryHandlerKeywordUnknownFallback(), - new EntryHandlerPredicate_1.EntryHandlerPredicate(), - new EntryHandlerInvalidFallback_1.EntryHandlerInvalidFallback(), -]; -exports.JsonLdParser = JsonLdParser; -//# sourceMappingURL=JsonLdParser.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/ParsingContext.js": -/*!********************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/ParsingContext.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ParsingContext = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const ErrorCoded_1 = __webpack_require__(/*! jsonld-context-parser/lib/ErrorCoded */ "./node_modules/jsonld-context-parser/lib/ErrorCoded.js"); -const ContextTree_1 = __webpack_require__(/*! ./ContextTree */ "./node_modules/jsonld-streaming-parser/lib/ContextTree.js"); -const JsonLdParser_1 = __webpack_require__(/*! ./JsonLdParser */ "./node_modules/jsonld-streaming-parser/lib/JsonLdParser.js"); -/** - * Data holder for parsing information. - */ -class ParsingContext { - constructor(options) { - // Initialize settings - this.contextParser = new jsonld_context_parser_1.ContextParser({ documentLoader: options.documentLoader, skipValidation: options.skipContextValidation }); - this.streamingProfile = !!options.streamingProfile; - this.baseIRI = options.baseIRI; - this.produceGeneralizedRdf = !!options.produceGeneralizedRdf; - this.allowSubjectList = !!options.allowSubjectList; - this.processingMode = options.processingMode || JsonLdParser_1.JsonLdParser.DEFAULT_PROCESSING_MODE; - this.strictValues = !!options.strictValues; - this.validateValueIndexes = !!options.validateValueIndexes; - this.defaultGraph = options.defaultGraph; - this.rdfDirection = options.rdfDirection; - this.normalizeLanguageTags = options.normalizeLanguageTags; - this.streamingProfileAllowOutOfOrderPlainType = options.streamingProfileAllowOutOfOrderPlainType; - this.rdfstar = options.rdfstar !== false; - this.rdfstarReverseInEmbedded = options.rdfstarReverseInEmbedded; - this.topLevelProperties = false; - this.activeProcessingMode = parseFloat(this.processingMode); - // Initialize stacks - this.processingStack = []; - this.processingType = []; - this.emittedStack = []; - this.idStack = []; - this.graphStack = []; - this.graphContainerTermStack = []; - this.listPointerStack = []; - this.contextTree = new ContextTree_1.ContextTree(); - this.literalStack = []; - this.validationStack = []; - this.unaliasedKeywordCacheStack = []; - this.jsonLiteralStack = []; - this.unidentifiedValuesBuffer = []; - this.unidentifiedGraphsBuffer = []; - this.annotationsBuffer = []; - this.pendingContainerFlushBuffers = []; - this.parser = options.parser; - if (options.context) { - this.rootContext = this.parseContext(options.context); - this.rootContext.then((context) => this.validateContext(context)); - } - else { - this.rootContext = Promise.resolve(new jsonld_context_parser_1.JsonLdContextNormalized(this.baseIRI ? { '@base': this.baseIRI, '@__baseDocument': true } : {})); - } - } - /** - * Parse the given context with the configured options. - * @param {JsonLdContext} context A context to parse. - * @param {JsonLdContextNormalized} parentContext An optional parent context. - * @param {boolean} ignoreProtection If @protected term checks should be ignored. - * @return {Promise} A promise resolving to the parsed context. - */ - async parseContext(context, parentContext, ignoreProtection) { - return this.contextParser.parse(context, { - baseIRI: this.baseIRI, - ignoreProtection, - normalizeLanguageTags: this.normalizeLanguageTags, - parentContext, - processingMode: this.activeProcessingMode, - }); - } - /** - * Check if the given context is valid. - * If not, an error will be thrown. - * @param {JsonLdContextNormalized} context A context. - */ - validateContext(context) { - const activeVersion = context.getContextRaw()['@version']; - if (activeVersion) { - if (this.activeProcessingMode && activeVersion > this.activeProcessingMode) { - throw new ErrorCoded_1.ErrorCoded(`Unsupported JSON-LD version '${activeVersion}' under active processing mode ${this.activeProcessingMode}.`, ErrorCoded_1.ERROR_CODES.PROCESSING_MODE_CONFLICT); - } - else { - if (this.activeProcessingMode && activeVersion < this.activeProcessingMode) { - throw new ErrorCoded_1.ErrorCoded(`Invalid JSON-LD version ${activeVersion} under active processing mode ${this.activeProcessingMode}.`, ErrorCoded_1.ERROR_CODES.INVALID_VERSION_VALUE); - } - this.activeProcessingMode = activeVersion; - } - } - } - /** - * Get the context at the given path. - * @param {keys} keys The path of keys to get the context at. - * @param {number} offset The path offset, defaults to 1. - * @return {Promise} A promise resolving to a context. - */ - async getContext(keys, offset = 1) { - const keysOriginal = keys; - // Ignore array keys at the end - while (typeof keys[keys.length - 1] === 'number') { - keys = keys.slice(0, keys.length - 1); - } - // Handle offset on keys - if (offset) { - keys = keys.slice(0, -offset); - } - // Determine the closest context - const contextData = await this.getContextPropagationAware(keys); - const context = contextData.context; - // Process property-scoped contexts (high-to-low) - let contextRaw = context.getContextRaw(); - for (let i = contextData.depth; i < keysOriginal.length - offset; i++) { - const key = keysOriginal[i]; - const contextKeyEntry = contextRaw[key]; - if (contextKeyEntry && typeof contextKeyEntry === 'object' && '@context' in contextKeyEntry) { - const scopedContext = (await this.parseContext(contextKeyEntry, contextRaw, true)).getContextRaw(); - const propagate = !(key in scopedContext) - || scopedContext[key]['@context']['@propagate']; // Propagation is true by default - if (propagate !== false || i === keysOriginal.length - 1 - offset) { - contextRaw = Object.assign({}, scopedContext); - // Clean up final context - delete contextRaw['@propagate']; - contextRaw[key] = Object.assign({}, contextRaw[key]); - if ('@id' in contextKeyEntry) { - contextRaw[key]['@id'] = contextKeyEntry['@id']; - } - delete contextRaw[key]['@context']; - if (propagate !== false) { - this.contextTree.setContext(keysOriginal.slice(0, i + offset), Promise.resolve(new jsonld_context_parser_1.JsonLdContextNormalized(contextRaw))); - } - } - } - } - return new jsonld_context_parser_1.JsonLdContextNormalized(contextRaw); - } - /** - * Get the context at the given path. - * Non-propagating contexts will be skipped, - * unless the context at that exact depth is retrieved. - * - * This ONLY takes into account context propagation logic, - * so this should usually not be called directly, - * call {@link #getContext} instead. - * - * @param keys The path of keys to get the context at. - * @return {Promise<{ context: JsonLdContextNormalized, depth: number }>} A context and its depth. - */ - async getContextPropagationAware(keys) { - const originalDepth = keys.length; - let contextData = null; - let hasApplicablePropertyScopedContext; - do { - hasApplicablePropertyScopedContext = false; - if (contextData && '@__propagateFallback' in contextData.context.getContextRaw()) { - // If a propagation fallback context has been set, - // fallback to that context and retry for the same depth. - contextData.context = new jsonld_context_parser_1.JsonLdContextNormalized(contextData.context.getContextRaw()['@__propagateFallback']); - } - else { - if (contextData) { - // If we had a previous iteration, jump to the parent of context depth. - // We must do this because once we get here, last context had propagation disabled, - // so we check its first parent instead. - keys = keys.slice(0, contextData.depth - 1); - } - contextData = await this.contextTree.getContext(keys) || { context: await this.rootContext, depth: 0 }; - } - // Allow non-propagating contexts to propagate one level deeper - // if it defines a property-scoped context that is applicable for the current key. - // @see https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tc012 - const lastKey = keys[keys.length - 1]; - if (lastKey in contextData.context.getContextRaw()) { - const lastKeyValue = contextData.context.getContextRaw()[lastKey]; - if (lastKeyValue && typeof lastKeyValue === 'object' && '@context' in lastKeyValue) { - hasApplicablePropertyScopedContext = true; - } - } - } while (contextData.depth > 0 // Root context has a special case - && contextData.context.getContextRaw()['@propagate'] === false // Stop loop if propagation is true - && contextData.depth !== originalDepth // Stop loop if requesting exact depth of non-propagating - && !hasApplicablePropertyScopedContext); - // Special case for root context that does not allow propagation. - // Fallback to empty context in that case. - if (contextData.depth === 0 - && contextData.context.getContextRaw()['@propagate'] === false - && contextData.depth !== originalDepth) { - contextData.context = new jsonld_context_parser_1.JsonLdContextNormalized({}); - } - return contextData; - } - /** - * Start a new job for parsing the given value. - * @param {any[]} keys The stack of keys. - * @param value The value to parse. - * @param {number} depth The depth to parse at. - * @param {boolean} lastDepthCheck If the lastDepth check should be done for buffer draining. - * @return {Promise} A promise resolving when the job is done. - */ - async newOnValueJob(keys, value, depth, lastDepthCheck) { - await this.parser.newOnValueJob(keys, value, depth, lastDepthCheck); - } - /** - * Flush the pending container flush buffers - * @return {boolean} If any pending buffers were flushed. - */ - async handlePendingContainerFlushBuffers() { - if (this.pendingContainerFlushBuffers.length > 0) { - for (const pendingFlushBuffer of this.pendingContainerFlushBuffers) { - await this.parser.flushBuffer(pendingFlushBuffer.depth, pendingFlushBuffer.keys); - this.parser.flushStacks(pendingFlushBuffer.depth); - } - this.pendingContainerFlushBuffers.splice(0, this.pendingContainerFlushBuffers.length); - return true; - } - else { - return false; - } - } - /** - * Emit the given quad into the output stream. - * @param {number} depth The depth the quad was generated at. - * @param {Quad} quad A quad to emit. - */ - emitQuad(depth, quad) { - if (depth === 1) { - this.topLevelProperties = true; - } - this.parser.push(quad); - } - /** - * Emit the given error into the output stream. - * @param {Error} error An error to emit. - */ - emitError(error) { - this.parser.emit('error', error); - } - /** - * Emit the given context into the output stream under the 'context' event. - * @param {JsonLdContext} context A context to emit. - */ - emitContext(context) { - this.parser.emit('context', context); - } - /** - * Safely get or create the depth value of {@link ParsingContext.unidentifiedValuesBuffer}. - * @param {number} depth A depth. - * @return {{predicate: Term; object: Term; reverse: boolean}[]} An element of - * {@link ParsingContext.unidentifiedValuesBuffer}. - */ - getUnidentifiedValueBufferSafe(depth) { - let buffer = this.unidentifiedValuesBuffer[depth]; - if (!buffer) { - buffer = []; - this.unidentifiedValuesBuffer[depth] = buffer; - } - return buffer; - } - /** - * Safely get or create the depth value of {@link ParsingContext.unidentifiedGraphsBuffer}. - * @param {number} depth A depth. - * @return {{predicate: Term; object: Term; reverse: boolean}[]} An element of - * {@link ParsingContext.unidentifiedGraphsBuffer}. - */ - getUnidentifiedGraphBufferSafe(depth) { - let buffer = this.unidentifiedGraphsBuffer[depth]; - if (!buffer) { - buffer = []; - this.unidentifiedGraphsBuffer[depth] = buffer; - } - return buffer; - } - /** - * Safely get or create the depth value of {@link ParsingContext.annotationsBuffer}. - * @param {number} depth A depth. - * @return {} An element of {@link ParsingContext.annotationsBuffer}. - */ - getAnnotationsBufferSafe(depth) { - let buffer = this.annotationsBuffer[depth]; - if (!buffer) { - buffer = []; - this.annotationsBuffer[depth] = buffer; - } - return buffer; - } - /** - * @return IExpandOptions The expand options for the active processing mode. - */ - getExpandOptions() { - return ParsingContext.EXPAND_OPTIONS[this.activeProcessingMode]; - } - /** - * Shift the stack at the given offset to the given depth. - * - * This will override anything in the stack at `depth`, - * and this will remove anything at `depth + depthOffset` - * - * @param depth The target depth. - * @param depthOffset The origin depth, relative to `depth`. - */ - shiftStack(depth, depthOffset) { - // Copy the id stack value up one level so that the next job can access the id. - const deeperIdStack = this.idStack[depth + depthOffset]; - if (deeperIdStack) { - this.idStack[depth] = deeperIdStack; - this.emittedStack[depth] = true; - delete this.idStack[depth + depthOffset]; - } - // Shorten key stack - if (this.pendingContainerFlushBuffers.length) { - for (const buffer of this.pendingContainerFlushBuffers) { - if (buffer.depth >= depth + depthOffset) { - buffer.depth -= depthOffset; - buffer.keys.splice(depth, depthOffset); - } - } - } - // Splice stacks - if (this.unidentifiedValuesBuffer[depth + depthOffset]) { - this.unidentifiedValuesBuffer[depth] = this.unidentifiedValuesBuffer[depth + depthOffset]; - delete this.unidentifiedValuesBuffer[depth + depthOffset]; - } - if (this.annotationsBuffer[depth + depthOffset - 1]) { - if (!this.annotationsBuffer[depth - 1]) { - this.annotationsBuffer[depth - 1] = []; - } - this.annotationsBuffer[depth - 1] = [ - ...this.annotationsBuffer[depth - 1], - ...this.annotationsBuffer[depth + depthOffset - 1], - ]; - delete this.annotationsBuffer[depth + depthOffset - 1]; - } - // TODO: also do the same for other stacks - } -} -ParsingContext.EXPAND_OPTIONS = { - 1.0: { - allowPrefixForcing: false, - allowPrefixNonGenDelims: false, - allowVocabRelativeToBase: false, - }, - 1.1: { - allowPrefixForcing: true, - allowPrefixNonGenDelims: false, - allowVocabRelativeToBase: true, - }, -}; -exports.ParsingContext = ParsingContext; -//# sourceMappingURL=ParsingContext.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/Util.js": -/*!**********************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/Util.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Util = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const rdf_data_factory_1 = __webpack_require__(/*! rdf-data-factory */ "./node_modules/rdf-data-factory/index.js"); -const EntryHandlerContainer_1 = __webpack_require__(/*! ./entryhandler/EntryHandlerContainer */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerContainer.js"); -// tslint:disable-next-line:no-var-requires -const canonicalizeJson = __webpack_require__(/*! canonicalize */ "./node_modules/canonicalize/lib/canonicalize.js"); -/** - * Utility functions and methods. - */ -class Util { - constructor(options) { - this.parsingContext = options.parsingContext; - this.dataFactory = options.dataFactory || new rdf_data_factory_1.DataFactory(); - this.rdfFirst = this.dataFactory.namedNode(Util.RDF + 'first'); - this.rdfRest = this.dataFactory.namedNode(Util.RDF + 'rest'); - this.rdfNil = this.dataFactory.namedNode(Util.RDF + 'nil'); - this.rdfType = this.dataFactory.namedNode(Util.RDF + 'type'); - this.rdfJson = this.dataFactory.namedNode(Util.RDF + 'JSON'); - } - /** - * Helper function to get the value of a context entry, - * or fallback to a certain value. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} contextKey A pre-defined JSON-LD key in context entries. - * @param {string} key A context entry key. - * @param {string} fallback A fallback value for when the given contextKey - * could not be found in the value with the given key. - * @return {string} The value of the given contextKey in the entry behind key in the given context, - * or the given fallback value. - */ - static getContextValue(context, contextKey, key, fallback) { - const entry = context.getContextRaw()[key]; - if (!entry) { - return fallback; - } - const type = entry[contextKey]; - return type === undefined ? fallback : type; - } - /** - * Get the container type of the given key in the context. - * - * Should any context-scoping bugs should occur related to this in the future, - * it may be required to increase the offset from the depth at which the context is retrieved by one (to 2). - * This is because containers act 2 levels deep. - * - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key A context entry key. - * @return {string} The container type. - */ - static getContextValueContainer(context, key) { - return Util.getContextValue(context, '@container', key, { '@set': true }); - } - /** - * Get the value type of the given key in the context. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key A context entry key. - * @return {string} The node type. - */ - static getContextValueType(context, key) { - const valueType = Util.getContextValue(context, '@type', key, null); - if (valueType === '@none') { - return null; - } - return valueType; - } - /** - * Get the language of the given key in the context. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key A context entry key. - * @return {string} The node type. - */ - static getContextValueLanguage(context, key) { - return Util.getContextValue(context, '@language', key, context.getContextRaw()['@language'] || null); - } - /** - * Get the direction of the given key in the context. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key A context entry key. - * @return {string} The node type. - */ - static getContextValueDirection(context, key) { - return Util.getContextValue(context, '@direction', key, context.getContextRaw()['@direction'] || null); - } - /** - * Check if the given key in the context is a reversed property. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key A context entry key. - * @return {boolean} If the context value has a @reverse key. - */ - static isContextValueReverse(context, key) { - return !!Util.getContextValue(context, '@reverse', key, null); - } - /** - * Get the @index of the given key in the context. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key A context entry key. - * @return {string} The index. - */ - static getContextValueIndex(context, key) { - return Util.getContextValue(context, '@index', key, context.getContextRaw()['@index'] || null); - } - /** - * Check if the given key refers to a reversed property. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key The property key. - * @param {string} parentKey The parent key. - * @return {boolean} If the property must be reversed. - */ - static isPropertyReverse(context, key, parentKey) { - // '!==' is needed because reversed properties in a @reverse container should cancel each other out. - return parentKey === '@reverse' !== Util.isContextValueReverse(context, key); - } - /** - * Check if the given key exists inside an embedded node as direct child. - * @param {string} parentKey The parent key. - * @return {boolean} If the property is embedded. - */ - static isPropertyInEmbeddedNode(parentKey) { - return parentKey === '@id'; - } - /** - * Check if the given key exists inside an annotation object as direct child. - * @param {string} parentKey The parent key. - * @return {boolean} If the property is an annotation. - */ - static isPropertyInAnnotationObject(parentKey) { - return parentKey === '@annotation'; - } - /** - * Check if the given IRI is valid. - * @param {string} iri A potential IRI. - * @return {boolean} If the given IRI is valid. - */ - static isValidIri(iri) { - return iri !== null && jsonld_context_parser_1.Util.isValidIri(iri); - } - /** - * Check if the given first array (needle) is a prefix of the given second array (haystack). - * @param needle An array to check if it is a prefix. - * @param haystack An array to look in. - */ - static isPrefixArray(needle, haystack) { - if (needle.length > haystack.length) { - return false; - } - for (let i = 0; i < needle.length; i++) { - if (needle[i] !== haystack[i]) { - return false; - } - } - return true; - } - /** - * Make sure that @id-@index pairs are equal over all array values. - * Reject otherwise. - * @param {any[]} value An array value. - * @return {Promise} A promise rejecting if conflicts are present. - */ - async validateValueIndexes(value) { - if (this.parsingContext.validateValueIndexes) { - const indexHashes = {}; - for (const entry of value) { - if (entry && typeof entry === 'object') { - const id = entry['@id']; - const index = entry['@index']; - if (id && index) { - const existingIndexValue = indexHashes[id]; - if (existingIndexValue && existingIndexValue !== index) { - throw new jsonld_context_parser_1.ErrorCoded(`Conflicting @index value for ${id}`, jsonld_context_parser_1.ERROR_CODES.CONFLICTING_INDEXES); - } - indexHashes[id] = index; - } - } - } - } - } - /** - * Convert a given JSON value to an RDF term. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key The current JSON key. - * @param value A JSON value. - * @param {number} depth The depth the value is at. - * @param {string[]} keys The path of keys. - * @return {Promise} An RDF term array. - */ - async valueToTerm(context, key, value, depth, keys) { - // Skip further processing if we have an @type: @json - if (Util.getContextValueType(context, key) === '@json') { - return [this.dataFactory.literal(this.valueToJsonString(value), this.rdfJson)]; - } - const type = typeof value; - switch (type) { - case 'object': - // Skip if we have a null or undefined object - if (value === null || value === undefined) { - return []; - } - // Special case for arrays - if (Array.isArray(value)) { - // We handle arrays at value level so we can emit earlier, so this is handled already when we get here. - // Empty context-based lists are emitted at this place, because our streaming algorithm doesn't detect those. - if ('@list' in Util.getContextValueContainer(context, key)) { - if (value.length === 0) { - return [this.rdfNil]; - } - else { - return this.parsingContext.idStack[depth + 1] || []; - } - } - await this.validateValueIndexes(value); - return []; - } - // Handle property-scoped contexts - context = await this.getContextSelfOrPropertyScoped(context, key); - // Handle local context in the value - if ('@context' in value) { - context = await this.parsingContext.parseContext(value['@context'], (await this.parsingContext.getContext(keys, 0)).getContextRaw()); - } - // In all other cases, we have a hash - value = await this.unaliasKeywords(value, keys, depth, context); // Un-alias potential keywords in this hash - if ('@value' in value) { - let val; - let valueLanguage; - let valueDirection; - let valueType; - let valueIndex; // We don't use the index, but we need to check its type for spec-compliance - for (key in value) { - const subValue = value[key]; - switch (key) { - case '@value': - val = subValue; - break; - case '@language': - valueLanguage = subValue; - break; - case '@direction': - valueDirection = subValue; - break; - case '@type': - valueType = subValue; - break; - case '@index': - valueIndex = subValue; - break; - case '@annotation': - // This keyword is allowed, but is processed like normal nodes - break; - default: - throw new jsonld_context_parser_1.ErrorCoded(`Unknown value entry '${key}' in @value: ${JSON.stringify(value)}`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT); - } - } - // Skip further processing if we have an @type: @json - if (await this.unaliasKeyword(valueType, keys, depth, true, context) === '@json') { - return [this.dataFactory.literal(this.valueToJsonString(val), this.rdfJson)]; - } - // Validate @value - if (val === null) { - return []; - } - if (typeof val === 'object') { - throw new jsonld_context_parser_1.ErrorCoded(`The value of an '@value' can not be an object, got '${JSON.stringify(val)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT_VALUE); - } - // Validate @index - if (this.parsingContext.validateValueIndexes && valueIndex && typeof valueIndex !== 'string') { - throw new jsonld_context_parser_1.ErrorCoded(`The value of an '@index' must be a string, got '${JSON.stringify(valueIndex)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INDEX_VALUE); - } - // Validate @language and @direction - if (valueLanguage) { - if (typeof val !== 'string') { - throw new jsonld_context_parser_1.ErrorCoded(`When an '@language' is set, the value of '@value' must be a string, got '${JSON.stringify(val)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_LANGUAGE_TAGGED_VALUE); - } - if (!jsonld_context_parser_1.ContextParser.validateLanguage(valueLanguage, this.parsingContext.strictValues, jsonld_context_parser_1.ERROR_CODES.INVALID_LANGUAGE_TAGGED_STRING)) { - return []; - } - // Language tags are always normalized to lowercase in 1.0. - if (this.parsingContext.normalizeLanguageTags || this.parsingContext.activeProcessingMode === 1.0) { - valueLanguage = valueLanguage.toLowerCase(); - } - } - if (valueDirection) { - if (typeof val !== 'string') { - throw new Error(`When an '@direction' is set, the value of '@value' must be a string, got '${JSON.stringify(val)}'`); - } - if (!jsonld_context_parser_1.ContextParser.validateDirection(valueDirection, this.parsingContext.strictValues)) { - return []; - } - } - // Check @language and @direction - if (valueLanguage && valueDirection && this.parsingContext.rdfDirection) { - if (valueType) { - throw new jsonld_context_parser_1.ErrorCoded(`Can not have '@language', '@direction' and '@type' in a value: '${JSON - .stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT); - } - return this.nullableTermToArray(this - .createLanguageDirectionLiteral(depth, val, valueLanguage, valueDirection)); - } - else if (valueLanguage) { // Check @language - if (valueType) { - throw new jsonld_context_parser_1.ErrorCoded(`Can not have both '@language' and '@type' in a value: '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT); - } - return [this.dataFactory.literal(val, valueLanguage)]; - } - else if (valueDirection && this.parsingContext.rdfDirection) { // Check @direction - if (valueType) { - throw new jsonld_context_parser_1.ErrorCoded(`Can not have both '@direction' and '@type' in a value: '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT); - } - return this.nullableTermToArray(this - .createLanguageDirectionLiteral(depth, val, valueLanguage, valueDirection)); - } - else if (valueType) { // Validate @type - if (typeof valueType !== 'string') { - throw new jsonld_context_parser_1.ErrorCoded(`The value of an '@type' must be a string, got '${JSON.stringify(valueType)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPED_VALUE); - } - const typeTerm = this.createVocabOrBaseTerm(context, valueType); - if (!typeTerm) { - throw new jsonld_context_parser_1.ErrorCoded(`Invalid '@type' value, got '${JSON.stringify(valueType)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPED_VALUE); - } - if (typeTerm.termType !== 'NamedNode') { - throw new jsonld_context_parser_1.ErrorCoded(`Illegal value type (${typeTerm.termType}): ${valueType}`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPED_VALUE); - } - return [this.dataFactory.literal(val, typeTerm)]; - } - // We don't pass the context, because context-based things like @language should be ignored - return await this.valueToTerm(new jsonld_context_parser_1.JsonLdContextNormalized({}), key, val, depth, keys); - } - else if ('@set' in value) { - // No other entries are allow in this value - if (Object.keys(value).length > 1) { - throw new jsonld_context_parser_1.ErrorCoded(`Found illegal neighbouring entries next to @set for key: '${key}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT); - } - // No need to do anything here, this is handled at the deeper level. - return []; - } - else if ('@list' in value) { - // No other entries are allowed in this value - if (Object.keys(value).length > 1) { - throw new jsonld_context_parser_1.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${key}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT); - } - const listValue = value["@list"]; - // We handle lists at value level so we can emit earlier, so this is handled already when we get here. - // Empty anonymous lists are emitted at this place, because our streaming algorithm doesn't detect those. - if (Array.isArray(listValue)) { - if (listValue.length === 0) { - return [this.rdfNil]; - } - else { - return this.parsingContext.idStack[depth + 1] || []; - } - } - else { - // We only have a single list element here, so emit this directly as single element - return await this.valueToTerm(await this.parsingContext.getContext(keys), key, listValue, depth - 1, keys.slice(0, -1)); - } - } - else if ('@reverse' in value && typeof value['@reverse'] === 'boolean') { - // We handle reverse properties at value level so we can emit earlier, - // so this is handled already when we get here. - return []; - } - else if ('@graph' in Util.getContextValueContainer(await this.parsingContext.getContext(keys), key)) { - // We are processing a graph container - const graphContainerEntries = this.parsingContext.graphContainerTermStack[depth + 1]; - return graphContainerEntries ? Object.values(graphContainerEntries) : [this.dataFactory.blankNode()]; - } - else if ("@id" in value) { - // Use deeper context if the value node contains other properties next to @id. - if (Object.keys(value).length > 1) { - context = await this.parsingContext.getContext(keys, 0); - } - // Handle local context in the value - if ('@context' in value) { - context = await this.parsingContext.parseContext(value['@context'], context.getContextRaw()); - } - if (value["@type"] === '@vocab') { - return this.nullableTermToArray(this.createVocabOrBaseTerm(context, value["@id"])); - } - else { - const valueId = value["@id"]; - let valueTerm; - if (typeof valueId === 'object') { - if (this.parsingContext.rdfstar) { - valueTerm = this.parsingContext.idStack[depth + 1][0]; - } - else { - throw new jsonld_context_parser_1.ErrorCoded(`Found illegal @id '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_ID_VALUE); - } - } - else { - valueTerm = this.resourceToTerm(context, valueId); - } - return this.nullableTermToArray(valueTerm); - } - } - else { - // Only make a blank node if at least one triple was emitted at the value's level. - if (this.parsingContext.emittedStack[depth + 1] - || (value && typeof value === 'object' && Object.keys(value).length === 0)) { - return (this.parsingContext.idStack[depth + 1] - || (this.parsingContext.idStack[depth + 1] = [this.dataFactory.blankNode()])); - } - else { - return []; - } - } - case 'string': - return this.nullableTermToArray(this.stringValueToTerm(depth, await this.getContextSelfOrPropertyScoped(context, key), key, value, null)); - case 'boolean': - return this.nullableTermToArray(this.stringValueToTerm(depth, await this.getContextSelfOrPropertyScoped(context, key), key, Boolean(value).toString(), this.dataFactory.namedNode(Util.XSD_BOOLEAN))); - case 'number': - return this.nullableTermToArray(this.stringValueToTerm(depth, await this.getContextSelfOrPropertyScoped(context, key), key, value, this.dataFactory.namedNode(value % 1 === 0 && value < 1e21 ? Util.XSD_INTEGER : Util.XSD_DOUBLE))); - default: - this.parsingContext.emitError(new Error(`Could not determine the RDF type of a ${type}`)); - return []; - } - } - /** - * If the context defines a property-scoped context for the given key, - * that context will be returned. - * Otherwise, the given context will be returned as-is. - * - * This should be used for valueToTerm cases that are not objects. - * @param context A context. - * @param key A JSON key. - */ - async getContextSelfOrPropertyScoped(context, key) { - const contextKeyEntry = context.getContextRaw()[key]; - if (contextKeyEntry && typeof contextKeyEntry === 'object' && '@context' in contextKeyEntry) { - context = await this.parsingContext.parseContext(contextKeyEntry, context.getContextRaw(), true); - } - return context; - } - /** - * If the given term is null, return an empty array, otherwise return an array with the single given term. - * @param term A term. - */ - nullableTermToArray(term) { - return term ? [term] : []; - } - /** - * Convert a given JSON key to an RDF predicate term, - * based on @vocab. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param key A JSON key. - * @return {RDF.NamedNode} An RDF named node. - */ - predicateToTerm(context, key) { - const expanded = context.expandTerm(key, true, this.parsingContext.getExpandOptions()); - // Immediately return if the predicate was disabled in the context - if (!expanded) { - return null; - } - // Check if the predicate is a blank node - if (expanded[0] === '_' && expanded[1] === ':') { - if (this.parsingContext.produceGeneralizedRdf) { - return this.dataFactory.blankNode(expanded.substr(2)); - } - else { - return null; - } - } - // Check if the predicate is a valid IRI - if (Util.isValidIri(expanded)) { - return this.dataFactory.namedNode(expanded); - } - else { - if (expanded && this.parsingContext.strictValues) { - this.parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Invalid predicate IRI: ${expanded}`, jsonld_context_parser_1.ERROR_CODES.INVALID_IRI_MAPPING)); - } - else { - return null; - } - } - return null; - } - /** - * Convert a given JSON key to an RDF resource term or blank node, - * based on @base. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param key A JSON key. - * @return {RDF.NamedNode} An RDF named node or null. - */ - resourceToTerm(context, key) { - if (key.startsWith('_:')) { - return this.dataFactory.blankNode(key.substr(2)); - } - const iri = context.expandTerm(key, false, this.parsingContext.getExpandOptions()); - if (!Util.isValidIri(iri)) { - if (iri && this.parsingContext.strictValues) { - this.parsingContext.emitError(new Error(`Invalid resource IRI: ${iri}`)); - } - else { - return null; - } - } - return this.dataFactory.namedNode(iri); - } - /** - * Convert a given JSON key to an RDF resource term. - * It will do this based on the @vocab, - * and fallback to @base. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param key A JSON key. - * @return {RDF.NamedNode} An RDF named node or null. - */ - createVocabOrBaseTerm(context, key) { - if (key.startsWith('_:')) { - return this.dataFactory.blankNode(key.substr(2)); - } - const expandOptions = this.parsingContext.getExpandOptions(); - let expanded = context.expandTerm(key, true, expandOptions); - if (expanded === key) { - expanded = context.expandTerm(key, false, expandOptions); - } - if (!Util.isValidIri(expanded)) { - if (expanded && this.parsingContext.strictValues && !expanded.startsWith('@')) { - this.parsingContext.emitError(new Error(`Invalid term IRI: ${expanded}`)); - } - else { - return null; - } - } - return this.dataFactory.namedNode(expanded); - } - /** - * Ensure that the given value becomes a string. - * @param {string | number} value A string or number. - * @param {NamedNode} datatype The intended datatype. - * @return {string} The returned string. - */ - intToString(value, datatype) { - if (typeof value === 'number') { - if (Number.isFinite(value)) { - const isInteger = value % 1 === 0; - if (isInteger && (!datatype || datatype.value !== Util.XSD_DOUBLE)) { - return Number(value).toString(); - } - else { - return value.toExponential(15).replace(/(\d)0*e\+?/, '$1E'); - } - } - else { - return value > 0 ? 'INF' : '-INF'; - } - } - else { - return value; - } - } - /** - * Convert a given JSON string value to an RDF term. - * @param {number} depth The current stack depth. - * @param {JsonLdContextNormalized} context A JSON-LD context. - * @param {string} key The current JSON key. - * @param {string} value A JSON value. - * @param {NamedNode} defaultDatatype The default datatype for the given value. - * @return {RDF.Term} An RDF term or null. - */ - stringValueToTerm(depth, context, key, value, defaultDatatype) { - // Check the datatype from the context - const contextType = Util.getContextValueType(context, key); - if (contextType) { - if (contextType === '@id') { - if (!defaultDatatype) { - return this.resourceToTerm(context, this.intToString(value, defaultDatatype)); - } - } - else if (contextType === '@vocab') { - if (!defaultDatatype) { - return this.createVocabOrBaseTerm(context, this.intToString(value, defaultDatatype)); - } - } - else { - defaultDatatype = this.dataFactory.namedNode(contextType); - } - } - // If we don't find such a datatype, check the language from the context - if (!defaultDatatype) { - const contextLanguage = Util.getContextValueLanguage(context, key); - const contextDirection = Util.getContextValueDirection(context, key); - if (contextDirection && this.parsingContext.rdfDirection) { - return this.createLanguageDirectionLiteral(depth, this.intToString(value, defaultDatatype), contextLanguage, contextDirection); - } - else { - return this.dataFactory.literal(this.intToString(value, defaultDatatype), contextLanguage); - } - } - // If all else fails, make a literal based on the default content type - return this.dataFactory.literal(this.intToString(value, defaultDatatype), defaultDatatype); - } - /** - * Create a literal for the given value with the given language and direction. - * Auxiliary quads may be emitted. - * @param {number} depth The current stack depth. - * @param {string} value A string value. - * @param {string} language A language tag. - * @param {string} direction A direction. - * @return {Term} An RDF term. - */ - createLanguageDirectionLiteral(depth, value, language, direction) { - if (this.parsingContext.rdfDirection === 'i18n-datatype') { - // Create a datatyped literal, by encoding the language and direction into https://www.w3.org/ns/i18n#. - if (!language) { - language = ''; - } - return this.dataFactory.literal(value, this.dataFactory.namedNode(`https://www.w3.org/ns/i18n#${language}_${direction}`)); - } - else { - // Reify the literal. - const valueNode = this.dataFactory.blankNode(); - const graph = this.getDefaultGraph(); - this.parsingContext.emitQuad(depth, this.dataFactory.quad(valueNode, this.dataFactory.namedNode(Util.RDF + 'value'), this.dataFactory.literal(value), graph)); - if (language) { - this.parsingContext.emitQuad(depth, this.dataFactory.quad(valueNode, this.dataFactory.namedNode(Util.RDF + 'language'), this.dataFactory.literal(language), graph)); - } - this.parsingContext.emitQuad(depth, this.dataFactory.quad(valueNode, this.dataFactory.namedNode(Util.RDF + 'direction'), this.dataFactory.literal(direction), graph)); - return valueNode; - } - } - /** - * Stringify the given JSON object to a canonical JSON string. - * @param value Any valid JSON value. - * @return {string} A canonical JSON string. - */ - valueToJsonString(value) { - return canonicalizeJson(value); - } - /** - * If the key is not a keyword, try to check if it is an alias for a keyword, - * and if so, un-alias it. - * @param {string} key A key, can be falsy. - * @param {string[]} keys The path of keys. - * @param {number} depth The depth to - * @param {boolean} disableCache If the cache should be disabled - * @param {JsonLdContextNormalized} context A context to unalias with, - * will fallback to retrieving the context for the given keys. - * @return {Promise} A promise resolving to the key itself, or another key. - */ - async unaliasKeyword(key, keys, depth, disableCache, context) { - // Numbers can not be an alias - if (Number.isInteger(key)) { - return key; - } - // Try to grab from cache if it was already un-aliased before. - if (!disableCache) { - const cachedUnaliasedKeyword = this.parsingContext.unaliasedKeywordCacheStack[depth]; - if (cachedUnaliasedKeyword) { - return cachedUnaliasedKeyword; - } - } - if (!jsonld_context_parser_1.Util.isPotentialKeyword(key)) { - context = context || await this.parsingContext.getContext(keys); - let unliased = context.getContextRaw()[key]; - if (unliased && typeof unliased === 'object') { - unliased = unliased['@id']; - } - if (jsonld_context_parser_1.Util.isValidKeyword(unliased)) { - key = unliased; - } - } - return disableCache ? key : (this.parsingContext.unaliasedKeywordCacheStack[depth] = key); - } - /** - * Unalias the keyword of the parent. - * This adds a safety check if no parent exist. - * @param {any[]} keys A stack of keys. - * @param {number} depth The current depth. - * @return {Promise} A promise resolving to the parent key, or another key. - */ - async unaliasKeywordParent(keys, depth) { - return await this.unaliasKeyword(depth > 0 && keys[depth - 1], keys, depth - 1); - } - /** - * Un-alias all keywords in the given hash. - * @param {{[p: string]: any}} hash A hash object. - * @param {string[]} keys The path of keys. - * @param {number} depth The depth. - * @param {JsonLdContextNormalized} context A context to unalias with, - * will fallback to retrieving the context for the given keys. - * @return {Promise<{[p: string]: any}>} A promise resolving to the new hash. - */ - async unaliasKeywords(hash, keys, depth, context) { - const newHash = {}; - for (const key in hash) { - newHash[await this.unaliasKeyword(key, keys, depth + 1, true, context)] = hash[key]; - } - return newHash; - } - /** - * Check if we are processing a literal (including JSON literals) at the given depth. - * This will also check higher levels, - * because if a parent is a literal, - * then the deeper levels are definitely a literal as well. - * @param {any[]} keys The keys. - * @param {number} depth The depth. - * @return {boolean} If we are processing a literal. - */ - async isLiteral(keys, depth) { - for (let i = depth; i >= 0; i--) { - if (await this.unaliasKeyword(keys[i], keys, i) === '@annotation') { - // Literals may have annotations, which require processing of inner nodes. - return false; - } - if (this.parsingContext.literalStack[i] || this.parsingContext.jsonLiteralStack[i]) { - return true; - } - } - return false; - } - /** - * Check how many parents should be skipped for checking the @graph for the given node. - * - * @param {number} depth The depth of the node. - * @param {any[]} keys An array of keys. - * @return {number} The graph depth offset. - */ - async getDepthOffsetGraph(depth, keys) { - for (let i = depth - 1; i > 0; i--) { - if (await this.unaliasKeyword(keys[i], keys, i) === '@graph') { - // Skip further processing if we are already in an @graph-@id or @graph-@index container - const containers = (await EntryHandlerContainer_1.EntryHandlerContainer.getContainerHandler(this.parsingContext, keys, i)).containers; - if (EntryHandlerContainer_1.EntryHandlerContainer.isComplexGraphContainer(containers)) { - return -1; - } - return depth - i - 1; - } - } - return -1; - } - /** - * Check if the given subject is of a valid type. - * This should be called when applying @reverse'd properties. - * @param {Term} subject A subject. - */ - validateReverseSubject(subject) { - if (subject.termType === 'Literal') { - throw new jsonld_context_parser_1.ErrorCoded(`Found illegal literal in subject position: ${subject.value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE); - } - } - /** - * Get the default graph. - * @return {Term} An RDF term. - */ - getDefaultGraph() { - return this.parsingContext.defaultGraph || this.dataFactory.defaultGraph(); - } - /** - * Get the current graph, while taking into account a graph that can be defined via @container: @graph. - * If not within a graph container, the default graph will be returned. - * @param keys The current keys. - * @param depth The current depth. - */ - async getGraphContainerValue(keys, depth) { - // Default to default graph - let graph = this.getDefaultGraph(); - // Check if we are in an @container: @graph. - const { containers, depth: depthContainer } = await EntryHandlerContainer_1.EntryHandlerContainer - .getContainerHandler(this.parsingContext, keys, depth); - if ('@graph' in containers) { - // Get the graph from the stack. - const graphContainerIndex = EntryHandlerContainer_1.EntryHandlerContainer.getContainerGraphIndex(containers, depthContainer, keys); - const entry = this.parsingContext.graphContainerTermStack[depthContainer]; - graph = entry ? entry[graphContainerIndex] : null; - // Set the graph in the stack if none has been set yet. - if (!graph) { - let graphId = null; - if ('@id' in containers) { - const keyUnaliased = await this.getContainerKey(keys[depthContainer], keys, depthContainer); - if (keyUnaliased !== null) { - graphId = await this.resourceToTerm(await this.parsingContext.getContext(keys), keyUnaliased); - } - } - if (!graphId) { - graphId = this.dataFactory.blankNode(); - } - if (!this.parsingContext.graphContainerTermStack[depthContainer]) { - this.parsingContext.graphContainerTermStack[depthContainer] = {}; - } - graph = this.parsingContext.graphContainerTermStack[depthContainer][graphContainerIndex] = graphId; - } - } - return graph; - } - /** - * Get the properties depth for retrieving properties. - * - * Typically, the properties depth will be identical to the given depth. - * - * The following exceptions apply: - * * When the parent is @reverse, the depth is decremented by one. - * * When @nest parents are found, the depth is decremented by the number of @nest parents. - * If in combination with the exceptions above an intermediary array is discovered, - * the depth is also decremented by this number of arrays. - * - * @param keys The current key chain. - * @param depth The current depth. - */ - async getPropertiesDepth(keys, depth) { - let lastValidDepth = depth; - for (let i = depth - 1; i > 0; i--) { - if (typeof keys[i] !== 'number') { // Skip array keys - const parentKey = await this.unaliasKeyword(keys[i], keys, i); - if (parentKey === '@reverse') { - return i; - } - else if (parentKey === '@nest') { - lastValidDepth = i; - } - else { - return lastValidDepth; - } - } - } - return lastValidDepth; - } - /** - * Get the key for the current container entry. - * @param key A key, can be falsy. - * @param keys The key chain. - * @param depth The current depth to get the key from. - * @return Promise resolving to the key. - * Null will be returned for @none entries, with aliasing taken into account. - */ - async getContainerKey(key, keys, depth) { - const keyUnaliased = await this.unaliasKeyword(key, keys, depth); - return keyUnaliased === '@none' ? null : keyUnaliased; - } - /** - * Check if no reverse properties are present in embedded nodes. - * @param key The current key. - * @param reverse If a reverse property is active. - * @param isEmbedded If we're in an embedded node. - */ - validateReverseInEmbeddedNode(key, reverse, isEmbedded) { - if (isEmbedded && reverse && !this.parsingContext.rdfstarReverseInEmbedded) { - throw new jsonld_context_parser_1.ErrorCoded(`Illegal reverse property in embedded node in ${key}`, jsonld_context_parser_1.ERROR_CODES.INVALID_EMBEDDED_NODE); - } - } - /** - * Emit a quad, with checks. - * @param depth The current depth. - * @param subject S - * @param predicate P - * @param object O - * @param graph G - * @param reverse If a reverse property is active. - * @param isEmbedded If we're in an embedded node. - */ - emitQuadChecked(depth, subject, predicate, object, graph, reverse, isEmbedded) { - // Create a quad - let quad; - if (reverse) { - this.validateReverseSubject(object); - quad = this.dataFactory.quad(object, predicate, subject, graph); - } - else { - quad = this.dataFactory.quad(subject, predicate, object, graph); - } - // Emit the quad, unless it was created in an embedded node - if (isEmbedded) { - // Embedded nodes don't inherit the active graph - if (quad.graph.termType !== 'DefaultGraph') { - quad = this.dataFactory.quad(quad.subject, quad.predicate, quad.object); - } - // Multiple embedded nodes are not allowed - if (this.parsingContext.idStack[depth - 1]) { - throw new jsonld_context_parser_1.ErrorCoded(`Illegal multiple properties in an embedded node`, jsonld_context_parser_1.ERROR_CODES.INVALID_EMBEDDED_NODE); - } - this.parsingContext.idStack[depth - 1] = [quad]; - } - else { - this.parsingContext.emitQuad(depth, quad); - } - // Flush annotations - const annotationsBuffer = this.parsingContext.annotationsBuffer[depth]; - if (annotationsBuffer) { - for (const annotation of annotationsBuffer) { - this.emitAnnotation(depth, quad, annotation); - } - delete this.parsingContext.annotationsBuffer[depth]; - } - } - // This is a separate function to enable recursion - emitAnnotation(depth, quad, annotation) { - // Construct annotation quad - let annotationQuad; - if (annotation.reverse) { - this.validateReverseSubject(annotation.object); - annotationQuad = this.dataFactory.quad(annotation.object, annotation.predicate, quad); - } - else { - annotationQuad = this.dataFactory.quad(quad, annotation.predicate, annotation.object); - } - // Emit annotated quad - this.parsingContext.emitQuad(depth, annotationQuad); - // Also emit nested annotations - for (const nestedAnnotation of annotation.nestedAnnotations) { - this.emitAnnotation(depth, annotationQuad, nestedAnnotation); - } - } -} -Util.XSD = 'http://www.w3.org/2001/XMLSchema#'; -Util.XSD_BOOLEAN = Util.XSD + 'boolean'; -Util.XSD_INTEGER = Util.XSD + 'integer'; -Util.XSD_DOUBLE = Util.XSD + 'double'; -Util.RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'; -exports.Util = Util; -//# sourceMappingURL=Util.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIdentifier.js": -/*!*************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIdentifier.js ***! - \*************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContainerHandlerIdentifier = void 0; -/** - * Container handler for @id. - * - * It assumes that the current key is the identifier of the current value. - * This will add this value to the parent node. - */ -class ContainerHandlerIdentifier { - canCombineWithGraph() { - return true; - } - async handle(containers, parsingContext, util, keys, value, depth) { - let id; - // First check if the child node already has a defined id. - if (parsingContext.emittedStack[depth + 1] && parsingContext.idStack[depth + 1]) { - // Use the existing identifier - id = parsingContext.idStack[depth + 1][0]; - } - else { - // Create the identifier - const keyUnaliased = await util.getContainerKey(keys[depth], keys, depth); - const maybeId = keyUnaliased !== null - ? await util.resourceToTerm(await parsingContext.getContext(keys), keys[depth]) - : util.dataFactory.blankNode(); - // Do nothing if the id is invalid - if (!maybeId) { - parsingContext.emittedStack[depth] = false; // Don't emit the predicate owning this container. - return; - } - id = maybeId; - // Insert the id into the stack so that buffered children can make us of it. - parsingContext.idStack[depth + 1] = [id]; - } - // Insert the id into the stack so that parents can make use of it. - // Insert it as an array because multiple id container entries may exist - let ids = parsingContext.idStack[depth]; - if (!ids) { - ids = parsingContext.idStack[depth] = []; - } - // Only insert the term if it does not exist yet in the array. - if (!ids.some((term) => term.equals(id))) { - ids.push(id); - } - // Flush any pending flush buffers - if (!await parsingContext.handlePendingContainerFlushBuffers()) { - parsingContext.emittedStack[depth] = false; // Don't emit the predicate owning this container. - } - } -} -exports.ContainerHandlerIdentifier = ContainerHandlerIdentifier; -//# sourceMappingURL=ContainerHandlerIdentifier.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIndex.js": -/*!********************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIndex.js ***! - \********************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContainerHandlerIndex = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const EntryHandlerPredicate_1 = __webpack_require__(/*! ../entryhandler/EntryHandlerPredicate */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js"); -const Util_1 = __webpack_require__(/*! ../Util */ "./node_modules/jsonld-streaming-parser/lib/Util.js"); -/** - * Container handler for @index. - * - * This will ignore the current key and add this entry to the parent node. - */ -class ContainerHandlerIndex { - canCombineWithGraph() { - return true; - } - async handle(containers, parsingContext, util, keys, value, depth) { - if (!Array.isArray(value)) { - const graphContainer = '@graph' in containers; - // Check if the container is a property-based container by checking if there is a valid @index. - const context = await parsingContext.getContext(keys); - const indexKey = keys[depth - 1]; - const indexPropertyRaw = Util_1.Util.getContextValueIndex(context, indexKey); - if (indexPropertyRaw) { - // Validate the @index value - if (jsonld_context_parser_1.Util.isPotentialKeyword(indexPropertyRaw)) { - throw new jsonld_context_parser_1.ErrorCoded(`Keywords can not be used as @index value, got: ${indexPropertyRaw}`, jsonld_context_parser_1.ERROR_CODES.INVALID_TERM_DEFINITION); - } - if (typeof indexPropertyRaw !== 'string') { - throw new jsonld_context_parser_1.ErrorCoded(`@index values must be strings, got: ${indexPropertyRaw}`, jsonld_context_parser_1.ERROR_CODES.INVALID_TERM_DEFINITION); - } - // When @index is used, values must be node values, unless @type: @id is defined in the context - if (typeof value !== 'object') { - // Error if we don't have @type: @id - if (Util_1.Util.getContextValueType(context, indexKey) !== '@id') { - throw new jsonld_context_parser_1.ErrorCoded(`Property-based index containers require nodes as values or strings with @type: @id, but got: ${value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT); - } - // Add an @id to the stack, so our expanded @index value can make use of it - const id = util.resourceToTerm(context, value); - if (id) { - parsingContext.idStack[depth + 1] = [id]; - } - } - // Expand the @index value - const indexProperty = util.createVocabOrBaseTerm(context, indexPropertyRaw); - if (indexProperty) { - const indexValues = await util.valueToTerm(context, indexPropertyRaw, await util.getContainerKey(keys[depth], keys, depth), depth, keys); - if (graphContainer) { - // When we're in a graph container, attach the index to the graph identifier - const graphId = await util.getGraphContainerValue(keys, depth + 1); - for (const indexValue of indexValues) { - parsingContext.emitQuad(depth, util.dataFactory.quad(graphId, indexProperty, indexValue, util.getDefaultGraph())); - } - } - else { - // Otherwise, attach the index to the node identifier - for (const indexValue of indexValues) { - await EntryHandlerPredicate_1.EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth + 1, indexProperty, indexValue, false, false, false); - } - } - } - } - const depthOffset = graphContainer ? 2 : 1; - await parsingContext.newOnValueJob(keys.slice(0, keys.length - depthOffset), value, depth - depthOffset, true); - // Flush any pending flush buffers - await parsingContext.handlePendingContainerFlushBuffers(); - } - parsingContext.emittedStack[depth] = false; // We have emitted a level higher - } -} -exports.ContainerHandlerIndex = ContainerHandlerIndex; -//# sourceMappingURL=ContainerHandlerIndex.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerLanguage.js": -/*!***********************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerLanguage.js ***! - \***********************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContainerHandlerLanguage = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -/** - * Container handler for @language. - * - * It assumes that the current key is the language of the current value. - * This will add this value to the parent node. - */ -class ContainerHandlerLanguage { - canCombineWithGraph() { - return false; - } - async handle(containers, parsingContext, util, keys, value, depth) { - const language = await util.getContainerKey(keys[depth], keys, depth); - if (Array.isArray(value)) { - // No type-checking needed, will be handled on each value when this handler is called recursively. - value = value.map((subValue) => ({ '@value': subValue, '@language': language })); - } - else { - if (typeof value !== 'string') { - throw new jsonld_context_parser_1.ErrorCoded(`Got invalid language map value, got '${JSON.stringify(value)}', but expected string`, jsonld_context_parser_1.ERROR_CODES.INVALID_LANGUAGE_MAP_VALUE); - } - value = { '@value': value, '@language': language }; - } - await parsingContext.newOnValueJob(keys.slice(0, keys.length - 1), value, depth - 1, true); - parsingContext.emittedStack[depth] = false; // We have emitted a level higher - } -} -exports.ContainerHandlerLanguage = ContainerHandlerLanguage; -//# sourceMappingURL=ContainerHandlerLanguage.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerType.js": -/*!*******************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerType.js ***! - \*******************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ContainerHandlerType = void 0; -const EntryHandlerPredicate_1 = __webpack_require__(/*! ../entryhandler/EntryHandlerPredicate */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js"); -const Util_1 = __webpack_require__(/*! ../Util */ "./node_modules/jsonld-streaming-parser/lib/Util.js"); -/** - * Container handler for @type. - * - * This will add this entry to the parent node, and use the current key as an rdf:type value. - */ -class ContainerHandlerType { - canCombineWithGraph() { - return false; - } - async handle(containers, parsingContext, util, keys, value, depth) { - if (!Array.isArray(value)) { - if (typeof value === 'string') { - // Determine the @type of the container - const context = await parsingContext.getContext(keys); - const containerTypeType = Util_1.Util.getContextValueType(context, keys[depth - 1]); - // String values refer to node references - const id = containerTypeType === '@vocab' - ? await util.createVocabOrBaseTerm(context, value) - : await util.resourceToTerm(context, value); - if (id) { - // Handle the value of this node as @id, which will also cause the predicate from above to be emitted. - const subValue = { '@id': id.termType === 'NamedNode' ? id.value : value }; - await parsingContext.newOnValueJob(keys.slice(0, keys.length - 1), subValue, depth - 1, true); - // Set the id in the stack so it can be used for the rdf:type handling later on - parsingContext.idStack[depth + 1] = [id]; - } - } - else { - // Other values are handled by handling them as a proper job - // Check needed for cases where entries don't have an explicit @id - const entryHasIdentifier = !!parsingContext.idStack[depth + 1]; - // Handle the value of this node, which will also cause the predicate from above to be emitted. - if (!entryHasIdentifier) { - delete parsingContext.idStack[depth]; // Force new (blank node) identifier - } - await parsingContext.newOnValueJob(keys.slice(0, keys.length - 1), value, depth - 1, true); - if (!entryHasIdentifier) { - parsingContext.idStack[depth + 1] = parsingContext.idStack[depth]; // Copy the id to the child node, for @type - } - } - // Identify the type to emit. - const keyOriginal = await util.getContainerKey(keys[depth], keys, depth); - const type = keyOriginal !== null - ? util.createVocabOrBaseTerm(await parsingContext.getContext(keys), keyOriginal) - : null; - if (type) { - // Push the type to the stack using the rdf:type predicate - await EntryHandlerPredicate_1.EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth + 1, util.rdfType, type, false, false, false); - } - // Flush any pending flush buffers - await parsingContext.handlePendingContainerFlushBuffers(); - } - parsingContext.emittedStack[depth] = false; // Don't emit the predicate owning this container. - } -} -exports.ContainerHandlerType = ContainerHandlerType; -//# sourceMappingURL=ContainerHandlerType.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerArrayValue.js": -/*!*****************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerArrayValue.js ***! - \*****************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerArrayValue = void 0; -const Util_1 = __webpack_require__(/*! ../Util */ "./node_modules/jsonld-streaming-parser/lib/Util.js"); -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -/** - * Handles values that are part of an array. - */ -class EntryHandlerArrayValue { - isPropertyHandler() { - return false; - } - isStackProcessor() { - return true; - } - async validate(parsingContext, util, keys, depth, inProperty) { - return this.test(parsingContext, util, null, keys, depth); - } - async test(parsingContext, util, key, keys, depth) { - return typeof keys[depth] === 'number'; - } - async handle(parsingContext, util, key, keys, value, depth) { - let parentKey = await util.unaliasKeywordParent(keys, depth); - // Check if we have an anonymous list - if (parentKey === '@list') { - // Our value is part of an array - // Determine the list root key - let listRootKey = null; - let listRootDepth = 0; - for (let i = depth - 2; i > 0; i--) { - const keyOption = keys[i]; - if (typeof keyOption === 'string' || typeof keyOption === 'number') { - listRootDepth = i; - listRootKey = keyOption; - break; - } - } - if (listRootKey !== null) { - // Emit the given objects as list elements - const values = await util.valueToTerm(await parsingContext.getContext(keys), listRootKey, value, depth, keys); - for (const object of values) { - await this.handleListElement(parsingContext, util, object, value, depth, keys.slice(0, listRootDepth), listRootDepth); - } - // If no values were found, emit a falsy list element to force an empty RDF list to be emitted. - if (values.length === 0) { - await this.handleListElement(parsingContext, util, null, value, depth, keys.slice(0, listRootDepth), listRootDepth); - } - } - } - else if (parentKey === '@set') { - // Our value is part of a set, so we just add it to the parent-parent - await parsingContext.newOnValueJob(keys.slice(0, -2), value, depth - 2, false); - } - else if (parentKey !== undefined && parentKey !== '@type') { - // Buffer our value using the parent key as predicate - // Determine the first parent key that is *not* an array key - // This is needed in case we have an @list container with nested arrays, - // where each of them should produce nested RDF lists. - for (let i = depth - 1; i > 0; i--) { - if (typeof keys[i] !== 'number') { - parentKey = await util.unaliasKeyword(keys[i], keys, i); - break; - } - } - // Check if the predicate is marked as an @list in the context - const parentContext = await parsingContext.getContext(keys.slice(0, -1)); - if ('@list' in Util_1.Util.getContextValueContainer(parentContext, parentKey)) { - // Our value is part of an array - // Emit the given objects as list elements - parsingContext.emittedStack[depth + 1] = true; // Ensure the creation of bnodes for empty nodes - const values = await util.valueToTerm(await parsingContext.getContext(keys), parentKey, value, depth, keys); - for (const object of values) { - await this.handleListElement(parsingContext, util, object, value, depth, keys.slice(0, -1), depth - 1); - } - // If no values were found, emit a falsy list element to force an empty RDF list to be emitted. - if (values.length === 0) { - await this.handleListElement(parsingContext, util, null, value, depth, keys.slice(0, -1), depth - 1); - } - } - else { - // Copy the stack values up one level so that the next job can access them. - parsingContext.shiftStack(depth, 1); - // Execute the job one level higher - await parsingContext.newOnValueJob(keys.slice(0, -1), value, depth - 1, false); - // Remove any defined contexts at this level to avoid it to propagate to the next array element. - parsingContext.contextTree.removeContext(keys.slice(0, -1)); - } - } - } - async handleListElement(parsingContext, util, value, valueOriginal, depth, listRootKeys, listRootDepth) { - // Buffer our value as an RDF list using the listRootKey as predicate - let listPointer = parsingContext.listPointerStack[depth]; - if (valueOriginal !== null && (await util.unaliasKeywords(valueOriginal, listRootKeys, depth))['@value'] !== null) { - if (!listPointer || !listPointer.value) { - const linkTerm = util.dataFactory.blankNode(); - listPointer = { value: linkTerm, listRootDepth, listId: linkTerm }; - } - else { - // rdf:rest links are always emitted before the next element, - // as the blank node identifier is only created at that point. - // Because of this reason, the final rdf:nil is emitted when the stack depth is decreased. - const newLinkTerm = util.dataFactory.blankNode(); - parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer.value, util.rdfRest, newLinkTerm, util.getDefaultGraph())); - // Update the list pointer for the next element - listPointer.value = newLinkTerm; - } - // Emit a list element for the current value - // Omit rdf:first if the value is invalid - if (value) { - parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer.value, util.rdfFirst, value, util.getDefaultGraph())); - } - } - else { - // A falsy list element if found. - // Mark it as an rdf:nil list until another valid list element comes in - if (!listPointer) { - listPointer = { listRootDepth, listId: util.rdfNil }; - } - } - parsingContext.listPointerStack[depth] = listPointer; - // Error if an annotation was defined - if (parsingContext.rdfstar && parsingContext.annotationsBuffer[depth]) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal annotation inside a list`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION)); - } - } -} -exports.EntryHandlerArrayValue = EntryHandlerArrayValue; -//# sourceMappingURL=EntryHandlerArrayValue.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerContainer.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerContainer.js ***! - \****************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerContainer = void 0; -const ContainerHandlerIdentifier_1 = __webpack_require__(/*! ../containerhandler/ContainerHandlerIdentifier */ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIdentifier.js"); -const ContainerHandlerIndex_1 = __webpack_require__(/*! ../containerhandler/ContainerHandlerIndex */ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIndex.js"); -const ContainerHandlerLanguage_1 = __webpack_require__(/*! ../containerhandler/ContainerHandlerLanguage */ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerLanguage.js"); -const ContainerHandlerType_1 = __webpack_require__(/*! ../containerhandler/ContainerHandlerType */ "./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerType.js"); -const Util_1 = __webpack_require__(/*! ../Util */ "./node_modules/jsonld-streaming-parser/lib/Util.js"); -/** - * Handles values that are part of a container type (like @index), - * as specified by {@link IContainerHandler}. - */ -class EntryHandlerContainer { - /** - * Check fit the given container is a simple @graph container. - * Concretely, it will check if no @index or @id is active as well. - * @param containers A container hash. - */ - static isSimpleGraphContainer(containers) { - return '@graph' in containers - && (('@set' in containers && Object.keys(containers).length === 2) || Object.keys(containers).length === 1); - } - /** - * Check fit the given container is a complex @graph container. - * Concretely, it will check if @index or @id is active as well next to @graph. - * @param containers A container hash. - */ - static isComplexGraphContainer(containers) { - return '@graph' in containers - && (('@set' in containers && Object.keys(containers).length > 2) - || (!('@set' in containers) && Object.keys(containers).length > 1)); - } - /** - * Create an graph container index that can be used for identifying a graph term inside the graphContainerTermStack. - * @param containers The applicable containers. - * @param depth The container depth. - * @param keys The array of keys. - * @return The graph index. - */ - static getContainerGraphIndex(containers, depth, keys) { - let isSimpleGraphContainer = EntryHandlerContainer.isSimpleGraphContainer(containers); - let index = ''; - for (let i = depth; i < keys.length; i++) { - if (!isSimpleGraphContainer || typeof keys[i] === 'number') { - index += ':' + keys[i]; - } - // Only allow a second 'real' key if in a non-simple graph container. - if (!isSimpleGraphContainer && typeof keys[i] !== 'number') { - isSimpleGraphContainer = true; - } - } - return index; - } - /** - * Return the applicable container type at the given depth. - * - * This will ignore any arrays in the key chain. - * - * @param {ParsingContext} parsingContext A parsing context. - * @param {any[]} keys The array of keys. - * @param {number} depth The current depth. - * @return {Promise<{ containers: {[typeName: string]: boolean}, depth: number, fallback: boolean }>} - * All applicable containers for the given depth, - * the `depth` of the container root (can change when arrays are in the key chain), - * and the `fallback` flag that indicates if the default container type was returned - * (i.e., no dedicated container type is defined). - */ - static async getContainerHandler(parsingContext, keys, depth) { - const fallback = { - containers: { '@set': true }, - depth, - fallback: true, - }; - // A flag that is enabled when @graph container should be tested in next iteration - let checkGraphContainer = false; - // Iterate from deeper to higher - const context = await parsingContext.getContext(keys, 2); - for (let i = depth - 1; i >= 0; i--) { - if (typeof keys[i] !== 'number') { // Skip array keys - // @graph containers without any other types are one level less deep, and require special handling - const containersSelf = Util_1.Util.getContextValue(context, '@container', keys[i], false); - if (containersSelf && EntryHandlerContainer.isSimpleGraphContainer(containersSelf)) { - return { - containers: containersSelf, - depth: i + 1, - fallback: false, - }; - } - const containersParent = Util_1.Util.getContextValue(context, '@container', keys[i - 1], false); - if (!containersParent) { // If we have the fallback container value - if (checkGraphContainer) { - // Return false if we were already expecting a @graph-@id of @graph-@index container - return fallback; - } - // Check parent-parent, we may be in a @graph-@id of @graph-@index container, which have two levels - checkGraphContainer = true; - } - else { - // We had an invalid container next iteration, so we now have to check if we were in an @graph container - const graphContainer = '@graph' in containersParent; - // We're in a regular container - for (const containerHandleName in EntryHandlerContainer.CONTAINER_HANDLERS) { - if (containersParent[containerHandleName]) { - if (graphContainer) { - // Only accept graph containers if their combined handlers can handle them. - if (EntryHandlerContainer.CONTAINER_HANDLERS[containerHandleName].canCombineWithGraph()) { - return { - containers: containersParent, - depth: i, - fallback: false, - }; - } - else { - return fallback; - } - } - else { - // Only accept if we were not expecting a @graph-@id of @graph-@index container - if (checkGraphContainer) { - return fallback; - } - else { - return { - containers: containersParent, - depth: i, - fallback: false, - }; - } - } - } - } - // Fail if no valid container handlers were found - return fallback; - } - } - } - return fallback; - } - /** - * Check if we are handling a value at the given depth - * that is part of something that should be handled as a container, - * AND if this container should be buffered, so that it can be handled by a dedicated container handler. - * - * For instance, any container with @graph will NOT be buffered. - * - * This will ignore any arrays in the key chain. - * - * @param {ParsingContext} parsingContext A parsing context. - * @param {any[]} keys The array of keys. - * @param {number} depth The current depth. - * @return {Promise} If we are in the scope of a container handler. - */ - static async isBufferableContainerHandler(parsingContext, keys, depth) { - const handler = await EntryHandlerContainer.getContainerHandler(parsingContext, keys, depth); - return !handler.fallback && !('@graph' in handler.containers); - } - isPropertyHandler() { - return false; - } - isStackProcessor() { - return true; - } - async validate(parsingContext, util, keys, depth, inProperty) { - return !!await this.test(parsingContext, util, null, keys, depth); - } - async test(parsingContext, util, key, keys, depth) { - const containers = Util_1.Util.getContextValueContainer(await parsingContext.getContext(keys, 2), keys[depth - 1]); - for (const containerName in EntryHandlerContainer.CONTAINER_HANDLERS) { - if (containers[containerName]) { - return { - containers, - handler: EntryHandlerContainer.CONTAINER_HANDLERS[containerName], - }; - } - } - return null; - } - async handle(parsingContext, util, key, keys, value, depth, testResult) { - return testResult.handler.handle(testResult.containers, parsingContext, util, keys, value, depth); - } -} -EntryHandlerContainer.CONTAINER_HANDLERS = { - '@id': new ContainerHandlerIdentifier_1.ContainerHandlerIdentifier(), - '@index': new ContainerHandlerIndex_1.ContainerHandlerIndex(), - '@language': new ContainerHandlerLanguage_1.ContainerHandlerLanguage(), - '@type': new ContainerHandlerType_1.ContainerHandlerType(), -}; -exports.EntryHandlerContainer = EntryHandlerContainer; -//# sourceMappingURL=EntryHandlerContainer.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerInvalidFallback.js": -/*!**********************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerInvalidFallback.js ***! - \**********************************************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerInvalidFallback = void 0; -/** - * A catch-all for properties, that will either emit an error or ignore, - * depending on whether or not the `strictValues` property is set. - */ -class EntryHandlerInvalidFallback { - isPropertyHandler() { - return false; - } - isStackProcessor() { - return true; - } - async validate(parsingContext, util, keys, depth, inProperty) { - return false; - } - async test(parsingContext, util, key, keys, depth) { - return true; - } - async handle(parsingContext, util, key, keys, value, depth) { - parsingContext.emittedStack[depth] = false; - } -} -exports.EntryHandlerInvalidFallback = EntryHandlerInvalidFallback; -//# sourceMappingURL=EntryHandlerInvalidFallback.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js ***! - \****************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerPredicate = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const Util_1 = __webpack_require__(/*! ../Util */ "./node_modules/jsonld-streaming-parser/lib/Util.js"); -/** - * Interprets keys as predicates. - * The most common case in JSON-LD processing. - */ -class EntryHandlerPredicate { - /** - * Handle the given predicate-object by either emitting it, - * or by placing it in the appropriate stack for later emission when no @graph and/or @id has been defined. - * @param {ParsingContext} parsingContext A parsing context. - * @param {Util} util A utility instance. - * @param {any[]} keys A stack of keys. - * @param {number} depth The current depth. - * @param {Term} predicate The predicate. - * @param {Term} object The object. - * @param {boolean} reverse If the property is reversed. - * @param {boolean} isEmbedded If the property exists in an embedded node as direct child. - * @param {boolean} isAnnotation If the property exists in an annotation object. - * @return {Promise} A promise resolving when handling is done. - */ - static async handlePredicateObject(parsingContext, util, keys, depth, predicate, object, reverse, isEmbedded, isAnnotation) { - const depthProperties = await util.getPropertiesDepth(keys, depth); - const depthOffsetGraph = await util.getDepthOffsetGraph(depth, keys); - const depthPropertiesGraph = depth - depthOffsetGraph; - const subjects = parsingContext.idStack[depthProperties]; - if (subjects && !isAnnotation) { - // Emit directly if the @id was already defined - for (const subject of subjects) { - // Check if we're in a @graph context - const atGraph = depthOffsetGraph >= 0; - if (atGraph) { - const graphs = parsingContext.idStack[depthPropertiesGraph - 1]; - if (graphs) { - for (const graph of graphs) { - // Emit our quad if graph @id is known - util.emitQuadChecked(depth, subject, predicate, object, graph, reverse, isEmbedded); - } - } - else { - // Buffer our triple if graph @id is not known yet. - if (reverse) { - util.validateReverseSubject(object); - parsingContext.getUnidentifiedGraphBufferSafe(depthPropertiesGraph - 1).push({ subject: object, predicate, object: subject, isEmbedded }); - } - else { - parsingContext.getUnidentifiedGraphBufferSafe(depthPropertiesGraph - 1) - .push({ subject, predicate, object, isEmbedded }); - } - } - } - else { - // Emit if no @graph was applicable - const graph = await util.getGraphContainerValue(keys, depthProperties); - util.emitQuadChecked(depth, subject, predicate, object, graph, reverse, isEmbedded); - } - } - } - else { - // Buffer until our @id becomes known, or we go up the stack - if (reverse) { - util.validateReverseSubject(object); - } - // Either push to the annotations or the actual value buffer - if (isAnnotation) { - // Only add to buffer if rdfstar is enabled - if (parsingContext.rdfstar) { - // Error if an @id was defined - if (parsingContext.idStack[depth]) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @id inside an annotation: ${parsingContext.idStack[depth][0].value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION)); - } - // Error if we're in an embedded node - for (let i = 0; i < depth; i++) { - if (await util.unaliasKeyword(keys[i], keys, i) === '@id') { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal annotation inside an embedded node`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION)); - } - } - // Store new annotation in the buffer - const annotationsBuffer = parsingContext.getAnnotationsBufferSafe(depthProperties); - const newAnnotation = { predicate, object, reverse, nestedAnnotations: [], depth: depthProperties }; - annotationsBuffer.push(newAnnotation); - // Check in the buffer if any annotations were defined at a deeper depth, - // if so, they are considered nested annotations. - for (let i = annotationsBuffer.length - 2; i >= 0; i--) { - // We iterate in reverse order, to enable easy item removal from the back. - const existingAnnotation = annotationsBuffer[i]; - if (existingAnnotation.depth > depthProperties) { - newAnnotation.nestedAnnotations.push(existingAnnotation); - annotationsBuffer.splice(i, 1); - } - } - } - } - else { - parsingContext.getUnidentifiedValueBufferSafe(depthProperties).push({ predicate, object, reverse, isEmbedded }); - } - } - } - isPropertyHandler() { - return true; - } - isStackProcessor() { - return true; - } - async validate(parsingContext, util, keys, depth, inProperty) { - const key = keys[depth]; - if (key) { - const context = await parsingContext.getContext(keys); - if (!parsingContext.jsonLiteralStack[depth] && await util.predicateToTerm(context, keys[depth])) { - // If this valid predicate is of type @json, mark it so in the stack so that no deeper handling of nodes occurs. - if (Util_1.Util.getContextValueType(context, key) === '@json') { - parsingContext.jsonLiteralStack[depth + 1] = true; - } - return true; - } - } - return false; - } - async test(parsingContext, util, key, keys, depth) { - return keys[depth]; - } - async handle(parsingContext, util, key, keys, value, depth, testResult) { - const keyOriginal = keys[depth]; - const context = await parsingContext.getContext(keys); - const predicate = await util.predicateToTerm(context, key); - if (predicate) { - const objects = await util.valueToTerm(context, key, value, depth, keys); - if (objects.length) { - for (let object of objects) { - // Based on parent key, check if reverse, embedded, and annotation. - let parentKey = await util.unaliasKeywordParent(keys, depth); - const reverse = Util_1.Util.isPropertyReverse(context, keyOriginal, parentKey); - let parentDepthOffset = 0; - while (parentKey === '@reverse' || typeof parentKey === 'number') { - // Check parent of parent when checking while we're in an array or in @reverse - if (typeof parentKey === 'number') { - parentDepthOffset++; - } - else { - depth--; - } - parentKey = await util.unaliasKeywordParent(keys, depth - parentDepthOffset); - } - const isEmbedded = Util_1.Util.isPropertyInEmbeddedNode(parentKey); - util.validateReverseInEmbeddedNode(key, reverse, isEmbedded); - const isAnnotation = Util_1.Util.isPropertyInAnnotationObject(parentKey); - if (value) { - // Special case if our term was defined as an @list, but does not occur in an array, - // In that case we just emit it as an RDF list with a single element. - const listValueContainer = '@list' in Util_1.Util.getContextValueContainer(context, key); - if (listValueContainer || value['@list']) { - if (((listValueContainer && !Array.isArray(value) && !value['@list']) - || (value['@list'] && !Array.isArray(value['@list']))) - && object !== util.rdfNil) { - const listPointer = util.dataFactory.blankNode(); - parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer, util.rdfRest, util.rdfNil, util.getDefaultGraph())); - parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer, util.rdfFirst, object, util.getDefaultGraph())); - object = listPointer; - } - // Lists are not allowed in @reverse'd properties - if (reverse && !parsingContext.allowSubjectList) { - throw new jsonld_context_parser_1.ErrorCoded(`Found illegal list value in subject position at ${key}`, jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE); - } - } - } - await EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth, predicate, object, reverse, isEmbedded, isAnnotation); - } - } - } - } -} -exports.EntryHandlerPredicate = EntryHandlerPredicate; -//# sourceMappingURL=EntryHandlerPredicate.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js": -/*!**********************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js ***! - \**********************************************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeyword = void 0; -/** - * An abstract keyword entry handler. - */ -class EntryHandlerKeyword { - constructor(keyword) { - this.keyword = keyword; - } - isPropertyHandler() { - return false; - } - isStackProcessor() { - return true; - } - async validate(parsingContext, util, keys, depth, inProperty) { - return false; - } - async test(parsingContext, util, key, keys, depth) { - return key === this.keyword; - } -} -exports.EntryHandlerKeyword = EntryHandlerKeyword; -//# sourceMappingURL=EntryHandlerKeyword.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordAnnotation.js": -/*!********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordAnnotation.js ***! - \********************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordAnnotation = void 0; -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -/** - * Handles @annotation entries. - */ -class EntryHandlerKeywordAnnotation extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@annotation'); - } - async handle(parsingContext, util, key, keys, value, depth) { - // Validate value - if (typeof value === 'string' || (typeof value === 'object' && value['@value'])) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal annotation value: ${JSON.stringify(value)}`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION)); - } - // Rest of the processing is done as regular nodes - } -} -exports.EntryHandlerKeywordAnnotation = EntryHandlerKeywordAnnotation; -//# sourceMappingURL=EntryHandlerKeywordAnnotation.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordContext.js": -/*!*****************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordContext.js ***! - \*****************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordContext = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -/** - * Handles @context entries. - */ -class EntryHandlerKeywordContext extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@context'); - } - isStackProcessor() { - return false; - } - async handle(parsingContext, util, key, keys, value, depth) { - // Error if an out-of-order context was found when support is not enabled. - if (parsingContext.streamingProfile - && (parsingContext.processingStack[depth] - || parsingContext.processingType[depth] - || parsingContext.idStack[depth] !== undefined)) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded('Found an out-of-order context, while streaming is enabled.' + - '(disable `streamingProfile`)', jsonld_context_parser_1.ERROR_CODES.INVALID_STREAMING_KEY_ORDER)); - } - // Find the parent context to inherit from. - // We actually request a context for the current depth (with fallback to parent) - // because we want to take into account any property-scoped contexts that are defined for this depth. - const parentContext = parsingContext.getContext(keys); - // Set the context for this scope - const context = parsingContext.parseContext(value, (await parentContext).getContextRaw()); - parsingContext.contextTree.setContext(keys.slice(0, -1), context); - parsingContext.emitContext(value); - await parsingContext.validateContext(await context); - } -} -exports.EntryHandlerKeywordContext = EntryHandlerKeywordContext; -//# sourceMappingURL=EntryHandlerKeywordContext.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordGraph.js": -/*!***************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordGraph.js ***! - \***************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordGraph = void 0; -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -/** - * Handles @graph entries. - */ -class EntryHandlerKeywordGraph extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@graph'); - } - async handle(parsingContext, util, key, keys, value, depth) { - // The current identifier identifies a graph for the deeper level. - parsingContext.graphStack[depth + 1] = true; - } -} -exports.EntryHandlerKeywordGraph = EntryHandlerKeywordGraph; -//# sourceMappingURL=EntryHandlerKeywordGraph.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordId.js": -/*!************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordId.js ***! - \************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordId = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -/** - * Handles @id entries. - */ -class EntryHandlerKeywordId extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@id'); - } - isStackProcessor() { - return false; - } - async handle(parsingContext, util, key, keys, value, depth) { - if (typeof value !== 'string') { - // JSON-LD-star allows @id object values - if (parsingContext.rdfstar && typeof value === 'object') { - const valueKeys = Object.keys(value); - if (valueKeys.length === 1 && valueKeys[0] === '@id') { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Invalid embedded node without property with @id ${value['@id']}`, jsonld_context_parser_1.ERROR_CODES.INVALID_EMBEDDED_NODE)); - } - } - else { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal @id '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_ID_VALUE)); - } - return; - } - // Determine the canonical place for this id. - // For example, @nest parents should be ignored. - const depthProperties = await util.getPropertiesDepth(keys, depth); - // Error if an @id for this node already existed. - if (parsingContext.idStack[depthProperties] !== undefined) { - if (parsingContext.idStack[depthProperties][0].listHead) { - // Error if an @list was already defined for this node - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${keys[depth - 1]}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT)); - } - else { - // Otherwise, the previous id was just because of an @id entry. - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found duplicate @ids '${parsingContext - .idStack[depthProperties][0].value}' and '${value}'`, jsonld_context_parser_1.ERROR_CODES.COLLIDING_KEYWORDS)); - } - } - // Error if an annotation was defined - if (parsingContext.rdfstar && parsingContext.annotationsBuffer[depth]) { - for (const annotation of parsingContext.annotationsBuffer[depth]) { - if (annotation.depth === depth) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @id inside an annotation: ${value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION)); - } - } - } - // Save our @id on the stack - parsingContext.idStack[depthProperties] = util.nullableTermToArray(await util.resourceToTerm(await parsingContext.getContext(keys), value)); - } -} -exports.EntryHandlerKeywordId = EntryHandlerKeywordId; -//# sourceMappingURL=EntryHandlerKeywordId.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordIncluded.js": -/*!******************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordIncluded.js ***! - \******************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordIncluded = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -/** - * Handles @included entries. - */ -class EntryHandlerKeywordIncluded extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@included'); - } - async handle(parsingContext, util, key, keys, value, depth) { - if (typeof value !== 'object') { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal @included '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INCLUDED_VALUE)); - } - const valueUnliased = await util.unaliasKeywords(value, keys, depth, await parsingContext.getContext(keys)); - if ('@value' in valueUnliased) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @included @value node '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INCLUDED_VALUE)); - } - if ('@list' in valueUnliased) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @included @list node '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INCLUDED_VALUE)); - } - parsingContext.emittedStack[depth] = false; - } -} -exports.EntryHandlerKeywordIncluded = EntryHandlerKeywordIncluded; -//# sourceMappingURL=EntryHandlerKeywordIncluded.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordNest.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordNest.js ***! - \**************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordNest = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -/** - * Handles @nest entries. - */ -class EntryHandlerKeywordNest extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@nest'); - } - async handle(parsingContext, util, key, keys, value, depth) { - if (typeof value !== 'object') { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found invalid @nest entry for '${key}': '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_NEST_VALUE)); - } - if ('@value' in await util.unaliasKeywords(value, keys, depth, await parsingContext.getContext(keys))) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an invalid @value node for '${key}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_NEST_VALUE)); - } - parsingContext.emittedStack[depth] = false; - } -} -exports.EntryHandlerKeywordNest = EntryHandlerKeywordNest; -//# sourceMappingURL=EntryHandlerKeywordNest.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordType.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordType.js ***! - \**************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordType = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -const Util_1 = __webpack_require__(/*! ../../Util */ "./node_modules/jsonld-streaming-parser/lib/Util.js"); -const EntryHandlerPredicate_1 = __webpack_require__(/*! ../EntryHandlerPredicate */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js"); -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -/** - * Handles @graph entries. - */ -class EntryHandlerKeywordType extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@type'); - } - isStackProcessor() { - return false; - } - async handle(parsingContext, util, key, keys, value, depth) { - const keyOriginal = keys[depth]; - // The current identifier identifies an rdf:type predicate. - // But we only emit it once the node closes, - // as it's possible that the @type is used to identify the datatype of a literal, which we ignore here. - const context = await parsingContext.getContext(keys); - const predicate = util.rdfType; - const parentKey = await util.unaliasKeywordParent(keys, depth); - const reverse = Util_1.Util.isPropertyReverse(context, keyOriginal, parentKey); - const isEmbedded = Util_1.Util.isPropertyInEmbeddedNode(parentKey); - util.validateReverseInEmbeddedNode(key, reverse, isEmbedded); - const isAnnotation = Util_1.Util.isPropertyInAnnotationObject(parentKey); - // Handle multiple values if the value is an array - const elements = Array.isArray(value) ? value : [value]; - for (const element of elements) { - if (typeof element !== 'string') { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal @type '${element}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPE_VALUE)); - } - const type = util.createVocabOrBaseTerm(context, element); - if (type) { - await EntryHandlerPredicate_1.EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth, predicate, type, reverse, isEmbedded, isAnnotation); - } - } - // Collect type-scoped contexts if they exist - let scopedContext = Promise.resolve(context); - let hasTypedScopedContext = false; - for (const element of elements.sort()) { // Spec requires lexicographical ordering - const typeContext = Util_1.Util.getContextValue(context, '@context', element, null); - if (typeContext) { - hasTypedScopedContext = true; - scopedContext = scopedContext.then((c) => parsingContext.parseContext(typeContext, c.getContextRaw())); - } - } - // Error if an out-of-order type-scoped context was found when support is not enabled. - if (parsingContext.streamingProfile - && (hasTypedScopedContext || !parsingContext.streamingProfileAllowOutOfOrderPlainType) - && (parsingContext.processingStack[depth] || parsingContext.idStack[depth])) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded('Found an out-of-order type-scoped context, while streaming is enabled.' + - '(disable `streamingProfile`)', jsonld_context_parser_1.ERROR_CODES.INVALID_STREAMING_KEY_ORDER)); - } - // If at least least one type-scoped context applies, set them in the tree. - if (hasTypedScopedContext) { - // Do not propagate by default - scopedContext = scopedContext.then((c) => { - // Set the original context at this depth as a fallback - // This is needed when a context was already defined at the given depth, - // and this context needs to remain accessible from child nodes when propagation is disabled. - if (c.getContextRaw()['@propagate'] !== true) { - return new jsonld_context_parser_1.JsonLdContextNormalized(Object.assign(Object.assign({}, c.getContextRaw()), { '@propagate': false, '@__propagateFallback': context.getContextRaw() })); - } - return c; - }); - // Set the new context in the context tree - parsingContext.contextTree.setContext(keys.slice(0, keys.length - 1), scopedContext); - } - // Flag that type has been processed at this depth - parsingContext.processingType[depth] = true; - } -} -exports.EntryHandlerKeywordType = EntryHandlerKeywordType; -//# sourceMappingURL=EntryHandlerKeywordType.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordUnknownFallback.js": -/*!*************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordUnknownFallback.js ***! - \*************************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordUnknownFallback = void 0; -const jsonld_context_parser_1 = __webpack_require__(/*! jsonld-context-parser */ "./node_modules/jsonld-context-parser/index.js"); -/** - * A catch-all for keywords, that will either emit an error or ignore, - * depending on whether or not the `strictValues` property is set. - */ -class EntryHandlerKeywordUnknownFallback { - isPropertyHandler() { - return false; - } - isStackProcessor() { - return true; - } - async validate(parsingContext, util, keys, depth, inProperty) { - const key = await util.unaliasKeyword(keys[depth], keys, depth); - if (jsonld_context_parser_1.Util.isPotentialKeyword(key)) { - // Don't emit anything inside free-floating lists - if (!inProperty) { - if (key === '@list') { - return false; - } - } - return true; - } - return false; - } - async test(parsingContext, util, key, keys, depth) { - return jsonld_context_parser_1.Util.isPotentialKeyword(key); - } - async handle(parsingContext, util, key, keys, value, depth) { - const keywordType = EntryHandlerKeywordUnknownFallback.VALID_KEYWORDS_TYPES[key]; - if (keywordType !== undefined) { - if (keywordType && typeof value !== keywordType.type) { - parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Invalid value type for '${key}' with value '${value}'`, keywordType.errorCode)); - } - } - else if (parsingContext.strictValues) { - parsingContext.emitError(new Error(`Unknown keyword '${key}' with value '${value}'`)); - } - parsingContext.emittedStack[depth] = false; - } -} -EntryHandlerKeywordUnknownFallback.VALID_KEYWORDS_TYPES = { - '@index': { type: 'string', errorCode: jsonld_context_parser_1.ERROR_CODES.INVALID_INDEX_VALUE }, - '@list': null, - '@reverse': { type: 'object', errorCode: jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_VALUE }, - '@set': null, - '@value': null, -}; -exports.EntryHandlerKeywordUnknownFallback = EntryHandlerKeywordUnknownFallback; -//# sourceMappingURL=EntryHandlerKeywordUnknownFallback.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordValue.js": -/*!***************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordValue.js ***! - \***************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EntryHandlerKeywordValue = void 0; -const EntryHandlerKeyword_1 = __webpack_require__(/*! ./EntryHandlerKeyword */ "./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js"); -/** - * Handles @value entries. - */ -class EntryHandlerKeywordValue extends EntryHandlerKeyword_1.EntryHandlerKeyword { - constructor() { - super('@value'); - } - async validate(parsingContext, util, keys, depth, inProperty) { - // If this is @value, mark it so in the stack so that no deeper handling of nodes occurs. - const key = keys[depth]; - if (key && !parsingContext.literalStack[depth] && await this.test(parsingContext, util, key, keys, depth)) { - parsingContext.literalStack[depth] = true; - } - return super.validate(parsingContext, util, keys, depth, inProperty); - } - async test(parsingContext, util, key, keys, depth) { - return await util.unaliasKeyword(keys[depth], keys.slice(0, keys.length - 1), depth - 1, true) === '@value'; - } - async handle(parsingContext, util, key, keys, value, depth) { - // If the value is valid, indicate that we are processing a literal. - // The actual value will be determined at the parent level when the @value is part of an object, - // because we may want to take into account additional entries such as @language. - // See {@link Util.valueToTerm} - // Indicate that we are processing a literal, and that no later predicates should be parsed at this depth. - parsingContext.literalStack[depth] = true; - // Void any buffers that we may have accumulated up until now - delete parsingContext.unidentifiedValuesBuffer[depth]; - delete parsingContext.unidentifiedGraphsBuffer[depth]; - // Indicate that we have not emitted at this depth - parsingContext.emittedStack[depth] = false; - } -} -exports.EntryHandlerKeywordValue = EntryHandlerKeywordValue; -//# sourceMappingURL=EntryHandlerKeywordValue.js.map - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js": -/*!********************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js ***! - \********************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { SymbolDispose } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { AbortError, codes } = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { isNodeStream, isWebStream, kControllerErrorFunction } = __webpack_require__(/*! ./utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const { ERR_INVALID_ARG_TYPE } = codes -let addAbortListener - -// This method is inlined here for readable-stream -// It also does not allow for signal to not exist on the stream -// https://github.com/nodejs/node/pull/36061#discussion_r533718029 -const validateAbortSignal = (signal, name) => { - if (typeof signal !== 'object' || !('aborted' in signal)) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } -} -module.exports.addAbortSignal = function addAbortSignal(signal, stream) { - validateAbortSignal(signal, 'signal') - if (!isNodeStream(stream) && !isWebStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) - } - return module.exports.addAbortSignalNoValidate(signal, stream) -} -module.exports.addAbortSignalNoValidate = function (signal, stream) { - if (typeof signal !== 'object' || !('aborted' in signal)) { - return stream - } - const onAbort = isNodeStream(stream) - ? () => { - stream.destroy( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } - : () => { - stream[kControllerErrorFunction]( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } - if (signal.aborted) { - onAbort() - } else { - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - const disposable = addAbortListener(signal, onAbort) - eos(stream, disposable[SymbolDispose]) - } - return stream -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/buffer_list.js": -/*!***************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/buffer_list.js ***! - \***************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { inspect } = __webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") -module.exports = class BufferList { - constructor() { - this.head = null - this.tail = null - this.length = 0 - } - push(v) { - const entry = { - data: v, - next: null - } - if (this.length > 0) this.tail.next = entry - else this.head = entry - this.tail = entry - ++this.length - } - unshift(v) { - const entry = { - data: v, - next: this.head - } - if (this.length === 0) this.tail = entry - this.head = entry - ++this.length - } - shift() { - if (this.length === 0) return - const ret = this.head.data - if (this.length === 1) this.head = this.tail = null - else this.head = this.head.next - --this.length - return ret - } - clear() { - this.head = this.tail = null - this.length = 0 - } - join(s) { - if (this.length === 0) return '' - let p = this.head - let ret = '' + p.data - while ((p = p.next) !== null) ret += s + p.data - return ret - } - concat(n) { - if (this.length === 0) return Buffer.alloc(0) - const ret = Buffer.allocUnsafe(n >>> 0) - let p = this.head - let i = 0 - while (p) { - TypedArrayPrototypeSet(ret, p.data, i) - i += p.data.length - p = p.next - } - return ret - } - - // Consumes a specified amount of bytes or characters from the buffered data. - consume(n, hasStrings) { - const data = this.head.data - if (n < data.length) { - // `slice` is the same for buffers and strings. - const slice = data.slice(0, n) - this.head.data = data.slice(n) - return slice - } - if (n === data.length) { - // First chunk is a perfect match. - return this.shift() - } - // Result spans more than one buffer. - return hasStrings ? this._getString(n) : this._getBuffer(n) - } - first() { - return this.head.data - } - *[SymbolIterator]() { - for (let p = this.head; p; p = p.next) { - yield p.data - } - } - - // Consumes a specified amount of characters from the buffered data. - _getString(n) { - let ret = '' - let p = this.head - let c = 0 - do { - const str = p.data - if (n > str.length) { - ret += str - n -= str.length - } else { - if (n === str.length) { - ret += str - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - ret += StringPrototypeSlice(str, 0, n) - this.head = p - p.data = StringPrototypeSlice(str, n) - } - break - } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret - } - - // Consumes a specified amount of bytes from the buffered data. - _getBuffer(n) { - const ret = Buffer.allocUnsafe(n) - const retLen = n - let p = this.head - let c = 0 - do { - const buf = p.data - if (n > buf.length) { - TypedArrayPrototypeSet(ret, buf, retLen - n) - n -= buf.length - } else { - if (n === buf.length) { - TypedArrayPrototypeSet(ret, buf, retLen - n) - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n) - this.head = p - p.data = buf.slice(n) - } - break - } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret - } - - // Make sure the linked list only shows the minimal necessary information. - [Symbol.for('nodejs.util.inspect.custom')](_, options) { - return inspect(this, { - ...options, - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - }) - } -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/compose.js": -/*!***********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/compose.js ***! - \***********************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { pipeline } = __webpack_require__(/*! ./pipeline */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/pipeline.js") -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") -const { destroyer } = __webpack_require__(/*! ./destroy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js") -const { - isNodeStream, - isReadable, - isWritable, - isWebStream, - isTransformStream, - isWritableStream, - isReadableStream -} = __webpack_require__(/*! ./utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const { - AbortError, - codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS } -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -module.exports = function compose(...streams) { - if (streams.length === 0) { - throw new ERR_MISSING_ARGS('streams') - } - if (streams.length === 1) { - return Duplex.from(streams[0]) - } - const orgStreams = [...streams] - if (typeof streams[0] === 'function') { - streams[0] = Duplex.from(streams[0]) - } - if (typeof streams[streams.length - 1] === 'function') { - const idx = streams.length - 1 - streams[idx] = Duplex.from(streams[idx]) - } - for (let n = 0; n < streams.length; ++n) { - if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) { - // TODO(ronag): Add checks for non streams. - continue - } - if ( - n < streams.length - 1 && - !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n])) - ) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable') - } - if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable') - } - } - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } else if (!readable && !writable) { - d.destroy() - } - } - const head = streams[0] - const tail = pipeline(streams, onfinished) - const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head)) - const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail)) - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplex({ - // TODO (ronag): highWaterMark? - writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode), - readableObjectMode: !!(tail !== null && tail !== undefined && tail.readableObjectMode), - writable, - readable - }) - if (writable) { - if (isNodeStream(head)) { - d._write = function (chunk, encoding, callback) { - if (head.write(chunk, encoding)) { - callback() - } else { - ondrain = callback - } - } - d._final = function (callback) { - head.end() - onfinish = callback - } - head.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() - } - }) - } else if (isWebStream(head)) { - const writable = isTransformStream(head) ? head.writable : head - const writer = writable.getWriter() - d._write = async function (chunk, encoding, callback) { - try { - await writer.ready - writer.write(chunk).catch(() => {}) - callback() - } catch (err) { - callback(err) - } - } - d._final = async function (callback) { - try { - await writer.ready - writer.close().catch(() => {}) - onfinish = callback - } catch (err) { - callback(err) - } - } - } - const toRead = isTransformStream(tail) ? tail.readable : tail - eos(toRead, () => { - if (onfinish) { - const cb = onfinish - onfinish = null - cb() - } - }) - } - if (readable) { - if (isNodeStream(tail)) { - tail.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() - } - }) - tail.on('end', function () { - d.push(null) - }) - d._read = function () { - while (true) { - const buf = tail.read() - if (buf === null) { - onreadable = d._read - return - } - if (!d.push(buf)) { - return - } - } - } - } else if (isWebStream(tail)) { - const readable = isTransformStream(tail) ? tail.readable : tail - const reader = readable.getReader() - d._read = async function () { - while (true) { - try { - const { value, done } = await reader.read() - if (!d.push(value)) { - return - } - if (done) { - d.push(null) - return - } - } catch { - return - } - } - } - } - } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() - } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) - } else { - onclose = callback - if (isNodeStream(tail)) { - destroyer(tail, err) - } - } - } - return d -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js": -/*!***********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js ***! - \***********************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ - -const { - aggregateTwoErrors, - codes: { ERR_MULTIPLE_CALLBACK }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { Symbol } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { kIsDestroyed, isDestroyed, isFinished, isServerRequest } = __webpack_require__(/*! ./utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const kDestroy = Symbol('kDestroy') -const kConstruct = Symbol('kConstruct') -function checkError(err, w, r) { - if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - } -} - -// Backwards compat. cb() is undocumented and unused in core but -// unfortunately might be used by modules. -function destroy(err, cb) { - const r = this._readableState - const w = this._writableState - // With duplex streams we use the writable side for state. - const s = w || r - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - if (typeof cb === 'function') { - cb() - } - return this - } - - // We set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - checkError(err, w, r) - if (w) { - w.destroyed = true - } - if (r) { - r.destroyed = true - } - - // If still constructing then defer calling _destroy. - if (!s.constructed) { - this.once(kDestroy, function (er) { - _destroy(this, aggregateTwoErrors(er, err), cb) - }) - } else { - _destroy(this, err, cb) - } - return this -} -function _destroy(self, err, cb) { - let called = false - function onDestroy(err) { - if (called) { - return - } - called = true - const r = self._readableState - const w = self._writableState - checkError(err, w, r) - if (w) { - w.closed = true - } - if (r) { - r.closed = true - } - if (typeof cb === 'function') { - cb(err) - } - if (err) { - process.nextTick(emitErrorCloseNT, self, err) - } else { - process.nextTick(emitCloseNT, self) - } - } - try { - self._destroy(err || null, onDestroy) - } catch (err) { - onDestroy(err) - } -} -function emitErrorCloseNT(self, err) { - emitErrorNT(self, err) - emitCloseNT(self) -} -function emitCloseNT(self) { - const r = self._readableState - const w = self._writableState - if (w) { - w.closeEmitted = true - } - if (r) { - r.closeEmitted = true - } - if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) { - self.emit('close') - } -} -function emitErrorNT(self, err) { - const r = self._readableState - const w = self._writableState - if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) { - return - } - if (w) { - w.errorEmitted = true - } - if (r) { - r.errorEmitted = true - } - self.emit('error', err) -} -function undestroy() { - const r = this._readableState - const w = this._writableState - if (r) { - r.constructed = true - r.closed = false - r.closeEmitted = false - r.destroyed = false - r.errored = null - r.errorEmitted = false - r.reading = false - r.ended = r.readable === false - r.endEmitted = r.readable === false - } - if (w) { - w.constructed = true - w.destroyed = false - w.closed = false - w.closeEmitted = false - w.errored = null - w.errorEmitted = false - w.finalCalled = false - w.prefinished = false - w.ended = w.writable === false - w.ending = w.writable === false - w.finished = w.writable === false - } -} -function errorOrDestroy(stream, err, sync) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - - const r = stream._readableState - const w = stream._writableState - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - return this - } - if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy)) - stream.destroy(err) - else if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - if (sync) { - process.nextTick(emitErrorNT, stream, err) - } else { - emitErrorNT(stream, err) - } - } -} -function construct(stream, cb) { - if (typeof stream._construct !== 'function') { - return - } - const r = stream._readableState - const w = stream._writableState - if (r) { - r.constructed = false - } - if (w) { - w.constructed = false - } - stream.once(kConstruct, cb) - if (stream.listenerCount(kConstruct) > 1) { - // Duplex - return - } - process.nextTick(constructNT, stream) -} -function constructNT(stream) { - let called = false - function onConstruct(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK()) - return - } - called = true - const r = stream._readableState - const w = stream._writableState - const s = w || r - if (r) { - r.constructed = true - } - if (w) { - w.constructed = true - } - if (s.destroyed) { - stream.emit(kDestroy, err) - } else if (err) { - errorOrDestroy(stream, err, true) - } else { - process.nextTick(emitConstructNT, stream) - } - } - try { - stream._construct((err) => { - process.nextTick(onConstruct, err) - }) - } catch (err) { - process.nextTick(onConstruct, err) - } -} -function emitConstructNT(stream) { - stream.emit(kConstruct) -} -function isRequest(stream) { - return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function' -} -function emitCloseLegacy(stream) { - stream.emit('close') -} -function emitErrorCloseLegacy(stream, err) { - stream.emit('error', err) - process.nextTick(emitCloseLegacy, stream) -} - -// Normalize destroy for legacy. -function destroyer(stream, err) { - if (!stream || isDestroyed(stream)) { - return - } - if (!err && !isFinished(stream)) { - err = new AbortError() - } - - // TODO: Remove isRequest branches. - if (isServerRequest(stream)) { - stream.socket = null - stream.destroy(err) - } else if (isRequest(stream)) { - stream.abort() - } else if (isRequest(stream.req)) { - stream.req.abort() - } else if (typeof stream.destroy === 'function') { - stream.destroy(err) - } else if (typeof stream.close === 'function') { - // TODO: Don't lose err? - stream.close() - } else if (err) { - process.nextTick(emitErrorCloseLegacy, stream, err) - } else { - process.nextTick(emitCloseLegacy, stream) - } - if (!stream.destroyed) { - stream[kIsDestroyed] = true - } -} -module.exports = { - construct, - destroyer, - destroy, - undestroy, - errorOrDestroy -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js": -/*!**********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js ***! - \**********************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototype inheritance, this class -// prototypically inherits from Readable, and then parasitically from -// Writable. - - - -const { - ObjectDefineProperties, - ObjectGetOwnPropertyDescriptor, - ObjectKeys, - ObjectSetPrototypeOf -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Duplex -const Readable = __webpack_require__(/*! ./readable */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/readable.js") -const Writable = __webpack_require__(/*! ./writable */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/writable.js") -ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype) -ObjectSetPrototypeOf(Duplex, Readable) -{ - const keys = ObjectKeys(Writable.prototype) - // Allow the keys array to be GC'ed. - for (let i = 0; i < keys.length; i++) { - const method = keys[i] - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method] - } -} -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options) - Readable.call(this, options) - Writable.call(this, options) - if (options) { - this.allowHalfOpen = options.allowHalfOpen !== false - if (options.readable === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if (options.writable === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } else { - this.allowHalfOpen = true - } -} -ObjectDefineProperties(Duplex.prototype, { - writable: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable') - }, - writableHighWaterMark: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') - }, - writableObjectMode: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') - }, - writableBuffer: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') - }, - writableLength: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength') - }, - writableFinished: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished') - }, - writableCorked: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked') - }, - writableEnded: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded') - }, - writableNeedDrain: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') - }, - destroyed: { - __proto__: null, - get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false - } - return this._readableState.destroyed && this._writableState.destroyed - }, - set(value) { - // Backward compatibility, the user is explicitly - // managing destroyed. - if (this._readableState && this._writableState) { - this._readableState.destroyed = value - this._writableState.destroyed = value - } - } - } -}) -let webStreamsAdapters - -// Lazy to avoid circular references -function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters -} -Duplex.fromWeb = function (pair, options) { - return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options) -} -Duplex.toWeb = function (duplex) { - return lazyWebStreams().newReadableWritablePairFromDuplex(duplex) -} -let duplexify -Duplex.from = function (body) { - if (!duplexify) { - duplexify = __webpack_require__(/*! ./duplexify */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplexify.js") - } - return duplexify(body, 'body') -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplexify.js": -/*!*************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplexify.js ***! - \*************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ - -;('use strict') -const bufferModule = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { - isReadable, - isWritable, - isIterable, - isNodeStream, - isReadableNodeStream, - isWritableNodeStream, - isDuplexNodeStream, - isReadableStream, - isWritableStream -} = __webpack_require__(/*! ./utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const { - AbortError, - codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE } -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { destroyer } = __webpack_require__(/*! ./destroy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js") -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") -const Readable = __webpack_require__(/*! ./readable */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/readable.js") -const Writable = __webpack_require__(/*! ./writable */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/writable.js") -const { createDeferredPromise } = __webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") -const from = __webpack_require__(/*! ./from */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/from.js") -const Blob = globalThis.Blob || bufferModule.Blob -const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - return b instanceof Blob - } - : function isBlob(b) { - return false - } -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -const { FunctionPrototypeCall } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") - -// This is needed for pre node 17. -class Duplexify extends Duplex { - constructor(options) { - super(options) - - // https://github.com/nodejs/node/pull/34385 - - if ((options === null || options === undefined ? undefined : options.readable) === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if ((options === null || options === undefined ? undefined : options.writable) === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } -} -module.exports = function duplexify(body, name) { - if (isDuplexNodeStream(body)) { - return body - } - if (isReadableNodeStream(body)) { - return _duplexify({ - readable: body - }) - } - if (isWritableNodeStream(body)) { - return _duplexify({ - writable: body - }) - } - if (isNodeStream(body)) { - return _duplexify({ - writable: false, - readable: false - }) - } - if (isReadableStream(body)) { - return _duplexify({ - readable: Readable.fromWeb(body) - }) - } - if (isWritableStream(body)) { - return _duplexify({ - writable: Writable.fromWeb(body) - }) - } - if (typeof body === 'function') { - const { value, write, final, destroy } = fromAsyncGen(body) - if (isIterable(value)) { - return from(Duplexify, value, { - // TODO (ronag): highWaterMark? - objectMode: true, - write, - final, - destroy - }) - } - const then = value === null || value === undefined ? undefined : value.then - if (typeof then === 'function') { - let d - const promise = FunctionPrototypeCall( - then, - value, - (val) => { - if (val != null) { - throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val) - } - }, - (err) => { - destroyer(d, err) - } - ) - return (d = new Duplexify({ - // TODO (ronag): highWaterMark? - objectMode: true, - readable: false, - write, - final(cb) { - final(async () => { - try { - await promise - process.nextTick(cb, null) - } catch (err) { - process.nextTick(cb, err) - } - }) - }, - destroy - })) - } - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value) - } - if (isBlob(body)) { - return duplexify(body.arrayBuffer()) - } - if (isIterable(body)) { - return from(Duplexify, body, { - // TODO (ronag): highWaterMark? - objectMode: true, - writable: false - }) - } - if ( - isReadableStream(body === null || body === undefined ? undefined : body.readable) && - isWritableStream(body === null || body === undefined ? undefined : body.writable) - ) { - return Duplexify.fromWeb(body) - } - if ( - typeof (body === null || body === undefined ? undefined : body.writable) === 'object' || - typeof (body === null || body === undefined ? undefined : body.readable) === 'object' - ) { - const readable = - body !== null && body !== undefined && body.readable - ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable) - ? body === null || body === undefined - ? undefined - : body.readable - : duplexify(body.readable) - : undefined - const writable = - body !== null && body !== undefined && body.writable - ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable) - ? body === null || body === undefined - ? undefined - : body.writable - : duplexify(body.writable) - : undefined - return _duplexify({ - readable, - writable - }) - } - const then = body === null || body === undefined ? undefined : body.then - if (typeof then === 'function') { - let d - FunctionPrototypeCall( - then, - body, - (val) => { - if (val != null) { - d.push(val) - } - d.push(null) - }, - (err) => { - destroyer(d, err) - } - ) - return (d = new Duplexify({ - objectMode: true, - writable: false, - read() {} - })) - } - throw new ERR_INVALID_ARG_TYPE( - name, - [ - 'Blob', - 'ReadableStream', - 'WritableStream', - 'Stream', - 'Iterable', - 'AsyncIterable', - 'Function', - '{ readable, writable } pair', - 'Promise' - ], - body - ) -} -function fromAsyncGen(fn) { - let { promise, resolve } = createDeferredPromise() - const ac = new AbortController() - const signal = ac.signal - const value = fn( - (async function* () { - while (true) { - const _promise = promise - promise = null - const { chunk, done, cb } = await _promise - process.nextTick(cb) - if (done) return - if (signal.aborted) - throw new AbortError(undefined, { - cause: signal.reason - }) - ;({ promise, resolve } = createDeferredPromise()) - yield chunk - } - })(), - { - signal - } - ) - return { - value, - write(chunk, encoding, cb) { - const _resolve = resolve - resolve = null - _resolve({ - chunk, - done: false, - cb - }) - }, - final(cb) { - const _resolve = resolve - resolve = null - _resolve({ - done: true, - cb - }) - }, - destroy(err, cb) { - ac.abort() - cb(err) - } - } -} -function _duplexify(pair) { - const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable - const w = pair.writable - let readable = !!isReadable(r) - let writable = !!isWritable(w) - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } - } - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplexify({ - // TODO (ronag): highWaterMark? - readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode), - writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode), - readable, - writable - }) - if (writable) { - eos(w, (err) => { - writable = false - if (err) { - destroyer(r, err) - } - onfinished(err) - }) - d._write = function (chunk, encoding, callback) { - if (w.write(chunk, encoding)) { - callback() - } else { - ondrain = callback - } - } - d._final = function (callback) { - w.end() - onfinish = callback - } - w.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() - } - }) - w.on('finish', function () { - if (onfinish) { - const cb = onfinish - onfinish = null - cb() - } - }) - } - if (readable) { - eos(r, (err) => { - readable = false - if (err) { - destroyer(r, err) - } - onfinished(err) - }) - r.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() - } - }) - r.on('end', function () { - d.push(null) - }) - d._read = function () { - while (true) { - const buf = r.read() - if (buf === null) { - onreadable = d._read - return - } - if (!d.push(buf)) { - return - } - } - } - } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() - } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) - } else { - onclose = callback - destroyer(w, err) - destroyer(r, err) - } - } - return d -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js": -/*!*****************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***! - \*****************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). - -;('use strict') -const { AbortError, codes } = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes -const { kEmptyObject, once } = __webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") -const { validateAbortSignal, validateFunction, validateObject, validateBoolean } = __webpack_require__(/*! ../validators */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js") -const { Promise, PromisePrototypeThen, SymbolDispose } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { - isClosed, - isReadable, - isReadableNodeStream, - isReadableStream, - isReadableFinished, - isReadableErrored, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableFinished, - isWritableErrored, - isNodeStream, - willEmitClose: _willEmitClose, - kIsClosedPromise -} = __webpack_require__(/*! ./utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -let addAbortListener -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function' -} -const nop = () => {} -function eos(stream, options, callback) { - var _options$readable, _options$writable - if (arguments.length === 2) { - callback = options - options = kEmptyObject - } else if (options == null) { - options = kEmptyObject - } else { - validateObject(options, 'options') - } - validateFunction(callback, 'callback') - validateAbortSignal(options.signal, 'options.signal') - callback = once(callback) - if (isReadableStream(stream) || isWritableStream(stream)) { - return eosWeb(stream, options, callback) - } - if (!isNodeStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) - } - const readable = - (_options$readable = options.readable) !== null && _options$readable !== undefined - ? _options$readable - : isReadableNodeStream(stream) - const writable = - (_options$writable = options.writable) !== null && _options$writable !== undefined - ? _options$writable - : isWritableNodeStream(stream) - const wState = stream._writableState - const rState = stream._readableState - const onlegacyfinish = () => { - if (!stream.writable) { - onfinish() - } - } - - // TODO (ronag): Improve soft detection to include core modules and - // common ecosystem modules that do properly emit 'close' but fail - // this generic check. - let willEmitClose = - _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable - let writableFinished = isWritableFinished(stream, false) - const onfinish = () => { - writableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false - } - if (willEmitClose && (!stream.readable || readable)) { - return - } - if (!readable || readableFinished) { - callback.call(stream) - } - } - let readableFinished = isReadableFinished(stream, false) - const onend = () => { - readableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false - } - if (willEmitClose && (!stream.writable || writable)) { - return - } - if (!writable || writableFinished) { - callback.call(stream) - } - } - const onerror = (err) => { - callback.call(stream, err) - } - let closed = isClosed(stream) - const onclose = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } - if (readable && !readableFinished && isReadableNodeStream(stream, true)) { - if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - if (writable && !writableFinished) { - if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - callback.call(stream) - } - const onclosed = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } - callback.call(stream) - } - const onrequest = () => { - stream.req.on('finish', onfinish) - } - if (isRequest(stream)) { - stream.on('complete', onfinish) - if (!willEmitClose) { - stream.on('abort', onclose) - } - if (stream.req) { - onrequest() - } else { - stream.on('request', onrequest) - } - } else if (writable && !wState) { - // legacy streams - stream.on('end', onlegacyfinish) - stream.on('close', onlegacyfinish) - } - - // Not all streams will emit 'close' after 'aborted'. - if (!willEmitClose && typeof stream.aborted === 'boolean') { - stream.on('aborted', onclose) - } - stream.on('end', onend) - stream.on('finish', onfinish) - if (options.error !== false) { - stream.on('error', onerror) - } - stream.on('close', onclose) - if (closed) { - process.nextTick(onclose) - } else if ( - (wState !== null && wState !== undefined && wState.errorEmitted) || - (rState !== null && rState !== undefined && rState.errorEmitted) - ) { - if (!willEmitClose) { - process.nextTick(onclosed) - } - } else if ( - !readable && - (!willEmitClose || isReadable(stream)) && - (writableFinished || isWritable(stream) === false) - ) { - process.nextTick(onclosed) - } else if ( - !writable && - (!willEmitClose || isWritable(stream)) && - (readableFinished || isReadable(stream) === false) - ) { - process.nextTick(onclosed) - } else if (rState && stream.req && stream.aborted) { - process.nextTick(onclosed) - } - const cleanup = () => { - callback = nop - stream.removeListener('aborted', onclose) - stream.removeListener('complete', onfinish) - stream.removeListener('abort', onclose) - stream.removeListener('request', onrequest) - if (stream.req) stream.req.removeListener('finish', onfinish) - stream.removeListener('end', onlegacyfinish) - stream.removeListener('close', onlegacyfinish) - stream.removeListener('finish', onfinish) - stream.removeListener('end', onend) - stream.removeListener('error', onerror) - stream.removeListener('close', onclose) - } - if (options.signal && !closed) { - const abort = () => { - // Keep it because cleanup removes it. - const endCallback = callback - cleanup() - endCallback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - const disposable = addAbortListener(options.signal, abort) - const originalCallback = callback - callback = once((...args) => { - disposable[SymbolDispose]() - originalCallback.apply(stream, args) - }) - } - } - return cleanup -} -function eosWeb(stream, options, callback) { - let isAborted = false - let abort = nop - if (options.signal) { - abort = () => { - isAborted = true - callback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - const disposable = addAbortListener(options.signal, abort) - const originalCallback = callback - callback = once((...args) => { - disposable[SymbolDispose]() - originalCallback.apply(stream, args) - }) - } - } - const resolverFn = (...args) => { - if (!isAborted) { - process.nextTick(() => callback.apply(stream, args)) - } - } - PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn) - return nop -} -function finished(stream, opts) { - var _opts - let autoCleanup = false - if (opts === null) { - opts = kEmptyObject - } - if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) { - validateBoolean(opts.cleanup, 'cleanup') - autoCleanup = opts.cleanup - } - return new Promise((resolve, reject) => { - const cleanup = eos(stream, opts, (err) => { - if (autoCleanup) { - cleanup() - } - if (err) { - reject(err) - } else { - resolve() - } - }) - }) -} -module.exports = eos -module.exports.finished = finished - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/from.js": -/*!********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/from.js ***! - \********************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ - -const { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js").codes) -function from(Readable, iterable, opts) { - let iterator - if (typeof iterable === 'string' || iterable instanceof Buffer) { - return new Readable({ - objectMode: true, - ...opts, - read() { - this.push(iterable) - this.push(null) - } - }) - } - let isAsync - if (iterable && iterable[SymbolAsyncIterator]) { - isAsync = true - iterator = iterable[SymbolAsyncIterator]() - } else if (iterable && iterable[SymbolIterator]) { - isAsync = false - iterator = iterable[SymbolIterator]() - } else { - throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable) - } - const readable = new Readable({ - objectMode: true, - highWaterMark: 1, - // TODO(ronag): What options should be allowed? - ...opts - }) - - // Flag to protect against _read - // being called before last iteration completion. - let reading = false - readable._read = function () { - if (!reading) { - reading = true - next() - } - } - readable._destroy = function (error, cb) { - PromisePrototypeThen( - close(error), - () => process.nextTick(cb, error), - // nextTick is here in case cb throws - (e) => process.nextTick(cb, e || error) - ) - } - async function close(error) { - const hadError = error !== undefined && error !== null - const hasThrow = typeof iterator.throw === 'function' - if (hadError && hasThrow) { - const { value, done } = await iterator.throw(error) - await value - if (done) { - return - } - } - if (typeof iterator.return === 'function') { - const { value } = await iterator.return() - await value - } - } - async function next() { - for (;;) { - try { - const { value, done } = isAsync ? await iterator.next() : iterator.next() - if (done) { - readable.push(null) - } else { - const res = value && typeof value.then === 'function' ? await value : value - if (res === null) { - reading = false - throw new ERR_STREAM_NULL_VALUES() - } else if (readable.push(res)) { - continue - } else { - reading = false - } - } - } catch (err) { - readable.destroy(err) - } - break - } - } - return readable -} -module.exports = from - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/legacy.js": -/*!**********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/legacy.js ***! - \**********************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { ArrayIsArray, ObjectSetPrototypeOf } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { EventEmitter: EE } = __webpack_require__(/*! events */ "./node_modules/events/events.js") -function Stream(opts) { - EE.call(this, opts) -} -ObjectSetPrototypeOf(Stream.prototype, EE.prototype) -ObjectSetPrototypeOf(Stream, EE) -Stream.prototype.pipe = function (dest, options) { - const source = this - function ondata(chunk) { - if (dest.writable && dest.write(chunk) === false && source.pause) { - source.pause() - } - } - source.on('data', ondata) - function ondrain() { - if (source.readable && source.resume) { - source.resume() - } - } - dest.on('drain', ondrain) - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend) - source.on('close', onclose) - } - let didOnEnd = false - function onend() { - if (didOnEnd) return - didOnEnd = true - dest.end() - } - function onclose() { - if (didOnEnd) return - didOnEnd = true - if (typeof dest.destroy === 'function') dest.destroy() - } - - // Don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup() - if (EE.listenerCount(this, 'error') === 0) { - this.emit('error', er) - } - } - prependListener(source, 'error', onerror) - prependListener(dest, 'error', onerror) - - // Remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata) - dest.removeListener('drain', ondrain) - source.removeListener('end', onend) - source.removeListener('close', onclose) - source.removeListener('error', onerror) - dest.removeListener('error', onerror) - source.removeListener('end', cleanup) - source.removeListener('close', cleanup) - dest.removeListener('close', cleanup) - } - source.on('end', cleanup) - source.on('close', cleanup) - dest.on('close', cleanup) - dest.emit('pipe', source) - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest -} -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn) - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn) - else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn) - else emitter._events[event] = [fn, emitter._events[event]] -} -module.exports = { - Stream, - prependListener -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/operators.js": -/*!*************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/operators.js ***! - \*************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -const { - codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { validateAbortSignal, validateInteger, validateObject } = __webpack_require__(/*! ../validators */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js") -const kWeakHandler = (__webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js").Symbol)('kWeak') -const kResistStopPropagation = (__webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js").Symbol)('kResistStopPropagation') -const { finished } = __webpack_require__(/*! ./end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const staticCompose = __webpack_require__(/*! ./compose */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/compose.js") -const { addAbortSignalNoValidate } = __webpack_require__(/*! ./add-abort-signal */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -const { isWritable, isNodeStream } = __webpack_require__(/*! ./utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const { deprecate } = __webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") -const { - ArrayPrototypePush, - Boolean, - MathFloor, - Number, - NumberIsNaN, - Promise, - PromiseReject, - PromiseResolve, - PromisePrototypeThen, - Symbol -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const kEmpty = Symbol('kEmpty') -const kEof = Symbol('kEof') -function compose(stream, options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - if (isNodeStream(stream) && !isWritable(stream)) { - throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable') - } - const composedStream = staticCompose(this, stream) - if (options !== null && options !== undefined && options.signal) { - // Not validating as we already validated before - addAbortSignalNoValidate(options.signal, composedStream) - } - return composedStream -} -function map(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - let concurrency = 1 - if ((options === null || options === undefined ? undefined : options.concurrency) != null) { - concurrency = MathFloor(options.concurrency) - } - let highWaterMark = concurrency - 1 - if ((options === null || options === undefined ? undefined : options.highWaterMark) != null) { - highWaterMark = MathFloor(options.highWaterMark) - } - validateInteger(concurrency, 'options.concurrency', 1) - validateInteger(highWaterMark, 'options.highWaterMark', 0) - highWaterMark += concurrency - return async function* map() { - const signal = (__webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js").AbortSignalAny)( - [options === null || options === undefined ? undefined : options.signal].filter(Boolean) - ) - const stream = this - const queue = [] - const signalOpt = { - signal - } - let next - let resume - let done = false - let cnt = 0 - function onCatch() { - done = true - afterItemProcessed() - } - function afterItemProcessed() { - cnt -= 1 - maybeResume() - } - function maybeResume() { - if (resume && !done && cnt < concurrency && queue.length < highWaterMark) { - resume() - resume = null - } - } - async function pump() { - try { - for await (let val of stream) { - if (done) { - return - } - if (signal.aborted) { - throw new AbortError() - } - try { - val = fn(val, signalOpt) - if (val === kEmpty) { - continue - } - val = PromiseResolve(val) - } catch (err) { - val = PromiseReject(err) - } - cnt += 1 - PromisePrototypeThen(val, afterItemProcessed, onCatch) - queue.push(val) - if (next) { - next() - next = null - } - if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) { - await new Promise((resolve) => { - resume = resolve - }) - } - } - queue.push(kEof) - } catch (err) { - const val = PromiseReject(err) - PromisePrototypeThen(val, afterItemProcessed, onCatch) - queue.push(val) - } finally { - done = true - if (next) { - next() - next = null - } - } - } - pump() - try { - while (true) { - while (queue.length > 0) { - const val = await queue[0] - if (val === kEof) { - return - } - if (signal.aborted) { - throw new AbortError() - } - if (val !== kEmpty) { - yield val - } - queue.shift() - maybeResume() - } - await new Promise((resolve) => { - next = resolve - }) - } - } finally { - done = true - if (resume) { - resume() - resume = null - } - } - }.call(this) -} -function asIndexedPairs(options = undefined) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - return async function* asIndexedPairs() { - let index = 0 - for await (const val of this) { - var _options$signal - if ( - options !== null && - options !== undefined && - (_options$signal = options.signal) !== null && - _options$signal !== undefined && - _options$signal.aborted - ) { - throw new AbortError({ - cause: options.signal.reason - }) - } - yield [index++, val] - } - }.call(this) -} -async function some(fn, options = undefined) { - for await (const unused of filter.call(this, fn, options)) { - return true - } - return false -} -async function every(fn, options = undefined) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - // https://en.wikipedia.org/wiki/De_Morgan%27s_laws - return !(await some.call( - this, - async (...args) => { - return !(await fn(...args)) - }, - options - )) -} -async function find(fn, options) { - for await (const result of filter.call(this, fn, options)) { - return result - } - return undefined -} -async function forEach(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - async function forEachFn(value, options) { - await fn(value, options) - return kEmpty - } - // eslint-disable-next-line no-unused-vars - for await (const unused of map.call(this, forEachFn, options)); -} -function filter(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - async function filterFn(value, options) { - if (await fn(value, options)) { - return value - } - return kEmpty - } - return map.call(this, filterFn, options) -} - -// Specific to provide better error to reduce since the argument is only -// missing if the stream has no items in it - but the code is still appropriate -class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS { - constructor() { - super('reduce') - this.message = 'Reduce of an empty stream requires an initial value' - } -} -async function reduce(reducer, initialValue, options) { - var _options$signal2 - if (typeof reducer !== 'function') { - throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer) - } - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - let hasInitialValue = arguments.length > 1 - if ( - options !== null && - options !== undefined && - (_options$signal2 = options.signal) !== null && - _options$signal2 !== undefined && - _options$signal2.aborted - ) { - const err = new AbortError(undefined, { - cause: options.signal.reason - }) - this.once('error', () => {}) // The error is already propagated - await finished(this.destroy(err)) - throw err - } - const ac = new AbortController() - const signal = ac.signal - if (options !== null && options !== undefined && options.signal) { - const opts = { - once: true, - [kWeakHandler]: this, - [kResistStopPropagation]: true - } - options.signal.addEventListener('abort', () => ac.abort(), opts) - } - let gotAnyItemFromStream = false - try { - for await (const value of this) { - var _options$signal3 - gotAnyItemFromStream = true - if ( - options !== null && - options !== undefined && - (_options$signal3 = options.signal) !== null && - _options$signal3 !== undefined && - _options$signal3.aborted - ) { - throw new AbortError() - } - if (!hasInitialValue) { - initialValue = value - hasInitialValue = true - } else { - initialValue = await reducer(initialValue, value, { - signal - }) - } - } - if (!gotAnyItemFromStream && !hasInitialValue) { - throw new ReduceAwareErrMissingArgs() - } - } finally { - ac.abort() - } - return initialValue -} -async function toArray(options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - const result = [] - for await (const val of this) { - var _options$signal4 - if ( - options !== null && - options !== undefined && - (_options$signal4 = options.signal) !== null && - _options$signal4 !== undefined && - _options$signal4.aborted - ) { - throw new AbortError(undefined, { - cause: options.signal.reason - }) - } - ArrayPrototypePush(result, val) - } - return result -} -function flatMap(fn, options) { - const values = map.call(this, fn, options) - return async function* flatMap() { - for await (const val of values) { - yield* val - } - }.call(this) -} -function toIntegerOrInfinity(number) { - // We coerce here to align with the spec - // https://github.com/tc39/proposal-iterator-helpers/issues/169 - number = Number(number) - if (NumberIsNaN(number)) { - return 0 - } - if (number < 0) { - throw new ERR_OUT_OF_RANGE('number', '>= 0', number) - } - return number -} -function drop(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - number = toIntegerOrInfinity(number) - return async function* drop() { - var _options$signal5 - if ( - options !== null && - options !== undefined && - (_options$signal5 = options.signal) !== null && - _options$signal5 !== undefined && - _options$signal5.aborted - ) { - throw new AbortError() - } - for await (const val of this) { - var _options$signal6 - if ( - options !== null && - options !== undefined && - (_options$signal6 = options.signal) !== null && - _options$signal6 !== undefined && - _options$signal6.aborted - ) { - throw new AbortError() - } - if (number-- <= 0) { - yield val - } - } - }.call(this) -} -function take(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - number = toIntegerOrInfinity(number) - return async function* take() { - var _options$signal7 - if ( - options !== null && - options !== undefined && - (_options$signal7 = options.signal) !== null && - _options$signal7 !== undefined && - _options$signal7.aborted - ) { - throw new AbortError() - } - for await (const val of this) { - var _options$signal8 - if ( - options !== null && - options !== undefined && - (_options$signal8 = options.signal) !== null && - _options$signal8 !== undefined && - _options$signal8.aborted - ) { - throw new AbortError() - } - if (number-- > 0) { - yield val - } - - // Don't get another item from iterator in case we reached the end - if (number <= 0) { - return - } - } - }.call(this) -} -module.exports.streamReturningOperators = { - asIndexedPairs: deprecate(asIndexedPairs, 'readable.asIndexedPairs will be removed in a future version.'), - drop, - filter, - flatMap, - map, - take, - compose -} -module.exports.promiseReturningOperators = { - every, - forEach, - reduce, - toArray, - some, - find -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/passthrough.js": -/*!***************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/passthrough.js ***! - \***************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - - - -const { ObjectSetPrototypeOf } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = PassThrough -const Transform = __webpack_require__(/*! ./transform */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/transform.js") -ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype) -ObjectSetPrototypeOf(PassThrough, Transform) -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options) - Transform.call(this, options) -} -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk) -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/pipeline.js": -/*!************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/pipeline.js ***! - \************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). - -;('use strict') -const { ArrayIsArray, Promise, SymbolAsyncIterator, SymbolDispose } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const { once } = __webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") -const destroyImpl = __webpack_require__(/*! ./destroy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js") -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") -const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_INVALID_RETURN_VALUE, - ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED, - ERR_STREAM_PREMATURE_CLOSE - }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { validateFunction, validateAbortSignal } = __webpack_require__(/*! ../validators */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js") -const { - isIterable, - isReadable, - isReadableNodeStream, - isNodeStream, - isTransformStream, - isWebStream, - isReadableStream, - isReadableFinished -} = __webpack_require__(/*! ./utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -let PassThrough -let Readable -let addAbortListener -function destroyer(stream, reading, writing) { - let finished = false - stream.on('close', () => { - finished = true - }) - const cleanup = eos( - stream, - { - readable: reading, - writable: writing - }, - (err) => { - finished = !err - } - ) - return { - destroy: (err) => { - if (finished) return - finished = true - destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe')) - }, - cleanup - } -} -function popCallback(streams) { - // Streams should never be an empty array. It should always contain at least - // a single stream. Therefore optimize for the average case instead of - // checking for length === 0 as well. - validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]') - return streams.pop() -} -function makeAsyncIterable(val) { - if (isIterable(val)) { - return val - } else if (isReadableNodeStream(val)) { - // Legacy streams are not Iterable. - return fromReadable(val) - } - throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val) -} -async function* fromReadable(val) { - if (!Readable) { - Readable = __webpack_require__(/*! ./readable */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/readable.js") - } - yield* Readable.prototype[SymbolAsyncIterator].call(val) -} -async function pumpToNode(iterable, writable, finish, { end }) { - let error - let onresolve = null - const resume = (err) => { - if (err) { - error = err - } - if (onresolve) { - const callback = onresolve - onresolve = null - callback() - } - } - const wait = () => - new Promise((resolve, reject) => { - if (error) { - reject(error) - } else { - onresolve = () => { - if (error) { - reject(error) - } else { - resolve() - } - } - } - }) - writable.on('drain', resume) - const cleanup = eos( - writable, - { - readable: false - }, - resume - ) - try { - if (writable.writableNeedDrain) { - await wait() - } - for await (const chunk of iterable) { - if (!writable.write(chunk)) { - await wait() - } - } - if (end) { - writable.end() - await wait() - } - finish() - } catch (err) { - finish(error !== err ? aggregateTwoErrors(error, err) : err) - } finally { - cleanup() - writable.off('drain', resume) - } -} -async function pumpToWeb(readable, writable, finish, { end }) { - if (isTransformStream(writable)) { - writable = writable.writable - } - // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure - const writer = writable.getWriter() - try { - for await (const chunk of readable) { - await writer.ready - writer.write(chunk).catch(() => {}) - } - await writer.ready - if (end) { - await writer.close() - } - finish() - } catch (err) { - try { - await writer.abort(err) - finish(err) - } catch (err) { - finish(err) - } - } -} -function pipeline(...streams) { - return pipelineImpl(streams, once(popCallback(streams))) -} -function pipelineImpl(streams, callback, opts) { - if (streams.length === 1 && ArrayIsArray(streams[0])) { - streams = streams[0] - } - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams') - } - const ac = new AbortController() - const signal = ac.signal - const outerSignal = opts === null || opts === undefined ? undefined : opts.signal - - // Need to cleanup event listeners if last stream is readable - // https://github.com/nodejs/node/issues/35452 - const lastStreamCleanup = [] - validateAbortSignal(outerSignal, 'options.signal') - function abort() { - finishImpl(new AbortError()) - } - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - let disposable - if (outerSignal) { - disposable = addAbortListener(outerSignal, abort) - } - let error - let value - const destroys = [] - let finishCount = 0 - function finish(err) { - finishImpl(err, --finishCount === 0) - } - function finishImpl(err, final) { - var _disposable - if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { - error = err - } - if (!error && !final) { - return - } - while (destroys.length) { - destroys.shift()(error) - } - ;(_disposable = disposable) === null || _disposable === undefined ? undefined : _disposable[SymbolDispose]() - ac.abort() - if (final) { - if (!error) { - lastStreamCleanup.forEach((fn) => fn()) - } - process.nextTick(callback, error, value) - } - } - let ret - for (let i = 0; i < streams.length; i++) { - const stream = streams[i] - const reading = i < streams.length - 1 - const writing = i > 0 - const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false - const isLastStream = i === streams.length - 1 - if (isNodeStream(stream)) { - if (end) { - const { destroy, cleanup } = destroyer(stream, reading, writing) - destroys.push(destroy) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - - // Catch stream errors that occur after pipe/pump has completed. - function onError(err) { - if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - finish(err) - } - } - stream.on('error', onError) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(() => { - stream.removeListener('error', onError) - }) - } - } - if (i === 0) { - if (typeof stream === 'function') { - ret = stream({ - signal - }) - if (!isIterable(ret)) { - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret) - } - } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) { - ret = stream - } else { - ret = Duplex.from(stream) - } - } else if (typeof stream === 'function') { - if (isTransformStream(ret)) { - var _ret - ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable) - } else { - ret = makeAsyncIterable(ret) - } - ret = stream(ret, { - signal - }) - if (reading) { - if (!isIterable(ret, true)) { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret) - } - } else { - var _ret2 - if (!PassThrough) { - PassThrough = __webpack_require__(/*! ./passthrough */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/passthrough.js") - } - - // If the last argument to pipeline is not a stream - // we must create a proxy stream so that pipeline(...) - // always returns a stream which can be further - // composed through `.pipe(stream)`. - - const pt = new PassThrough({ - objectMode: true - }) - - // Handle Promises/A+ spec, `then` could be a getter that throws on - // second use. - const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then - if (typeof then === 'function') { - finishCount++ - then.call( - ret, - (val) => { - value = val - if (val != null) { - pt.write(val) - } - if (end) { - pt.end() - } - process.nextTick(finish) - }, - (err) => { - pt.destroy(err) - process.nextTick(finish, err) - } - ) - } else if (isIterable(ret, true)) { - finishCount++ - pumpToNode(ret, pt, finish, { - end - }) - } else if (isReadableStream(ret) || isTransformStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, pt, finish, { - end - }) - } else { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret) - } - ret = pt - const { destroy, cleanup } = destroyer(ret, false, true) - destroys.push(destroy) - if (isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - } else if (isNodeStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount += 2 - const cleanup = pipe(ret, stream, finish, { - end - }) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } else if (isTransformStream(ret) || isReadableStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, stream, finish, { - end - }) - } else if (isIterable(ret)) { - finishCount++ - pumpToNode(ret, stream, finish, { - end - }) - } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret - ) - } - ret = stream - } else if (isWebStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount++ - pumpToWeb(makeAsyncIterable(ret), stream, finish, { - end - }) - } else if (isReadableStream(ret) || isIterable(ret)) { - finishCount++ - pumpToWeb(ret, stream, finish, { - end - }) - } else if (isTransformStream(ret)) { - finishCount++ - pumpToWeb(ret.readable, stream, finish, { - end - }) - } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret - ) - } - ret = stream - } else { - ret = Duplex.from(stream) - } - } - if ( - (signal !== null && signal !== undefined && signal.aborted) || - (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted) - ) { - process.nextTick(abort) - } - return ret -} -function pipe(src, dst, finish, { end }) { - let ended = false - dst.on('close', () => { - if (!ended) { - // Finish if the destination closes before the source has completed. - finish(new ERR_STREAM_PREMATURE_CLOSE()) - } - }) - src.pipe(dst, { - end: false - }) // If end is true we already will have a listener to end dst. - - if (end) { - // Compat. Before node v10.12.0 stdio used to throw an error so - // pipe() did/does not end() stdio destinations. - // Now they allow it but "secretly" don't close the underlying fd. - - function endFn() { - ended = true - dst.end() - } - if (isReadableFinished(src)) { - // End the destination if the source has already ended. - process.nextTick(endFn) - } else { - src.once('end', endFn) - } - } else { - finish() - } - eos( - src, - { - readable: true, - writable: false - }, - (err) => { - const rState = src._readableState - if ( - err && - err.code === 'ERR_STREAM_PREMATURE_CLOSE' && - rState && - rState.ended && - !rState.errored && - !rState.errorEmitted - ) { - // Some readable streams will emit 'close' before 'end'. However, since - // this is on the readable side 'end' should still be emitted if the - // stream has been ended and no error emitted. This should be allowed in - // favor of backwards compatibility. Since the stream is piped to a - // destination this should not result in any observable difference. - // We don't need to check if this is a writable premature close since - // eos will only fail with premature close on the reading side for - // duplex streams. - src.once('end', finish).once('error', finish) - } else { - finish(err) - } - } - ) - return eos( - dst, - { - readable: false, - writable: true - }, - finish - ) -} -module.exports = { - pipelineImpl, - pipeline -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/readable.js": -/*!************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/readable.js ***! - \************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -;('use strict') -const { - ArrayPrototypeIndexOf, - NumberIsInteger, - NumberIsNaN, - NumberParseInt, - ObjectDefineProperties, - ObjectKeys, - ObjectSetPrototypeOf, - Promise, - SafeSet, - SymbolAsyncDispose, - SymbolAsyncIterator, - Symbol -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Readable -Readable.ReadableState = ReadableState -const { EventEmitter: EE } = __webpack_require__(/*! events */ "./node_modules/events/events.js") -const { Stream, prependListener } = __webpack_require__(/*! ./legacy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/legacy.js") -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { addAbortSignal } = __webpack_require__(/*! ./add-abort-signal */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -let debug = (__webpack_require__(/*! ../../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js").debuglog)('stream', (fn) => { - debug = fn -}) -const BufferList = __webpack_require__(/*! ./buffer_list */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/buffer_list.js") -const destroyImpl = __webpack_require__(/*! ./destroy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js") -const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(/*! ./state */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/state.js") -const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_OUT_OF_RANGE, - ERR_STREAM_PUSH_AFTER_EOF, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT - }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { validateObject } = __webpack_require__(/*! ../validators */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js") -const kPaused = Symbol('kPaused') -const { StringDecoder } = __webpack_require__(/*! string_decoder */ "./node_modules/jsonld-streaming-parser/node_modules/string_decoder/lib/string_decoder.js") -const from = __webpack_require__(/*! ./from */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/from.js") -ObjectSetPrototypeOf(Readable.prototype, Stream.prototype) -ObjectSetPrototypeOf(Readable, Stream) -const nop = () => {} -const { errorOrDestroy } = destroyImpl -const kObjectMode = 1 << 0 -const kEnded = 1 << 1 -const kEndEmitted = 1 << 2 -const kReading = 1 << 3 -const kConstructed = 1 << 4 -const kSync = 1 << 5 -const kNeedReadable = 1 << 6 -const kEmittedReadable = 1 << 7 -const kReadableListening = 1 << 8 -const kResumeScheduled = 1 << 9 -const kErrorEmitted = 1 << 10 -const kEmitClose = 1 << 11 -const kAutoDestroy = 1 << 12 -const kDestroyed = 1 << 13 -const kClosed = 1 << 14 -const kCloseEmitted = 1 << 15 -const kMultiAwaitDrain = 1 << 16 -const kReadingMore = 1 << 17 -const kDataEmitted = 1 << 18 - -// TODO(benjamingr) it is likely slower to do it this way than with free functions -function makeBitMapDescriptor(bit) { - return { - enumerable: false, - get() { - return (this.state & bit) !== 0 - }, - set(value) { - if (value) this.state |= bit - else this.state &= ~bit - } - } -} -ObjectDefineProperties(ReadableState.prototype, { - objectMode: makeBitMapDescriptor(kObjectMode), - ended: makeBitMapDescriptor(kEnded), - endEmitted: makeBitMapDescriptor(kEndEmitted), - reading: makeBitMapDescriptor(kReading), - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - constructed: makeBitMapDescriptor(kConstructed), - // A flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - sync: makeBitMapDescriptor(kSync), - // Whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - needReadable: makeBitMapDescriptor(kNeedReadable), - emittedReadable: makeBitMapDescriptor(kEmittedReadable), - readableListening: makeBitMapDescriptor(kReadableListening), - resumeScheduled: makeBitMapDescriptor(kResumeScheduled), - // True if the error was already emitted and should not be thrown again. - errorEmitted: makeBitMapDescriptor(kErrorEmitted), - emitClose: makeBitMapDescriptor(kEmitClose), - autoDestroy: makeBitMapDescriptor(kAutoDestroy), - // Has it been destroyed. - destroyed: makeBitMapDescriptor(kDestroyed), - // Indicates whether the stream has finished destroying. - closed: makeBitMapDescriptor(kClosed), - // True if close has been emitted or would have been emitted - // depending on emitClose. - closeEmitted: makeBitMapDescriptor(kCloseEmitted), - multiAwaitDrain: makeBitMapDescriptor(kMultiAwaitDrain), - // If true, a maybeReadMore has been scheduled. - readingMore: makeBitMapDescriptor(kReadingMore), - dataEmitted: makeBitMapDescriptor(kDataEmitted) -}) -function ReadableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") - - // Bit map field to store ReadableState more effciently with 1 bit per field - // instead of a V8 slot per field. - this.state = kEmitClose | kAutoDestroy | kConstructed | kSync - // Object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away. - if (options && options.objectMode) this.state |= kObjectMode - if (isDuplex && options && options.readableObjectMode) this.state |= kObjectMode - - // The point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - this.highWaterMark = options - ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift(). - this.buffer = new BufferList() - this.length = 0 - this.pipes = [] - this.flowing = null - this[kPaused] = null - - // Should close be emitted on destroy. Defaults to true. - if (options && options.emitClose === false) this.state &= ~kEmitClose - - // Should .destroy() be called after 'end' (and potentially 'finish'). - if (options && options.autoDestroy === false) this.state &= ~kAutoDestroy - - // Indicates whether the stream has errored. When true no further - // _read calls, 'data' or 'readable' events should occur. This is needed - // since when autoDestroy is disabled we need a way to tell whether the - // stream has failed. - this.errored = null - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Ref the piped dest which we need a drain event on it - // type: null | Writable | Set. - this.awaitDrainWriters = null - this.decoder = null - this.encoding = null - if (options && options.encoding) { - this.decoder = new StringDecoder(options.encoding) - this.encoding = options.encoding - } -} -function Readable(options) { - if (!(this instanceof Readable)) return new Readable(options) - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") - this._readableState = new ReadableState(options, this, isDuplex) - if (options) { - if (typeof options.read === 'function') this._read = options.read - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal && !isDuplex) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - if (this._readableState.needReadable) { - maybeReadMore(this, this._readableState) - } - }) -} -Readable.prototype.destroy = destroyImpl.destroy -Readable.prototype._undestroy = destroyImpl.undestroy -Readable.prototype._destroy = function (err, cb) { - cb(err) -} -Readable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) -} -Readable.prototype[SymbolAsyncDispose] = function () { - let error - if (!this.destroyed) { - error = this.readableEnded ? null : new AbortError() - this.destroy(error) - } - return new Promise((resolve, reject) => eos(this, (err) => (err && err !== error ? reject(err) : resolve(null)))) -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, false) -} - -// Unshift should *always* be something directly out of read(). -Readable.prototype.unshift = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, true) -} -function readableAddChunk(stream, chunk, encoding, addToFront) { - debug('readableAddChunk', chunk) - const state = stream._readableState - let err - if ((state.state & kObjectMode) === 0) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding - if (state.encoding !== encoding) { - if (addToFront && state.encoding) { - // When unshifting, if state.encoding is set, we have to save - // the string in the BufferList with the state encoding. - chunk = Buffer.from(chunk, encoding).toString(state.encoding) - } else { - chunk = Buffer.from(chunk, encoding) - encoding = '' - } - } - } else if (chunk instanceof Buffer) { - encoding = '' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) - encoding = '' - } else if (chunk != null) { - err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) - } - } - if (err) { - errorOrDestroy(stream, err) - } else if (chunk === null) { - state.state &= ~kReading - onEofChunk(stream, state) - } else if ((state.state & kObjectMode) !== 0 || (chunk && chunk.length > 0)) { - if (addToFront) { - if ((state.state & kEndEmitted) !== 0) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()) - else if (state.destroyed || state.errored) return false - else addChunk(stream, state, chunk, true) - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()) - } else if (state.destroyed || state.errored) { - return false - } else { - state.state &= ~kReading - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk) - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false) - else maybeReadMore(stream, state) - } else { - addChunk(stream, state, chunk, false) - } - } - } else if (!addToFront) { - state.state &= ~kReading - maybeReadMore(stream, state) - } - - // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - return !state.ended && (state.length < state.highWaterMark || state.length === 0) -} -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) { - // Use the guard to avoid creating `Set()` repeatedly - // when we have multiple pipes. - if ((state.state & kMultiAwaitDrain) !== 0) { - state.awaitDrainWriters.clear() - } else { - state.awaitDrainWriters = null - } - state.dataEmitted = true - stream.emit('data', chunk) - } else { - // Update the buffer info. - state.length += state.objectMode ? 1 : chunk.length - if (addToFront) state.buffer.unshift(chunk) - else state.buffer.push(chunk) - if ((state.state & kNeedReadable) !== 0) emitReadable(stream) - } - maybeReadMore(stream, state) -} -Readable.prototype.isPaused = function () { - const state = this._readableState - return state[kPaused] === true || state.flowing === false -} - -// Backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - const decoder = new StringDecoder(enc) - this._readableState.decoder = decoder - // If setEncoding(null), decoder.encoding equals utf8. - this._readableState.encoding = this._readableState.decoder.encoding - const buffer = this._readableState.buffer - // Iterate over current buffer to convert already stored Buffers: - let content = '' - for (const data of buffer) { - content += decoder.write(data) - } - buffer.clear() - if (content !== '') buffer.push(content) - this._readableState.length = content.length - return this -} - -// Don't raise the hwm > 1GB. -const MAX_HWM = 0x40000000 -function computeNewHighWaterMark(n) { - if (n > MAX_HWM) { - throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n) - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts. - n-- - n |= n >>> 1 - n |= n >>> 2 - n |= n >>> 4 - n |= n >>> 8 - n |= n >>> 16 - n++ - } - return n -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || (state.length === 0 && state.ended)) return 0 - if ((state.state & kObjectMode) !== 0) return 1 - if (NumberIsNaN(n)) { - // Only flow one buffer at a time. - if (state.flowing && state.length) return state.buffer.first().length - return state.length - } - if (n <= state.length) return n - return state.ended ? state.length : 0 -} - -// You can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n) - // Same as parseInt(undefined, 10), however V8 7.3 performance regressed - // in this scenario, so we are doing it manually. - if (n === undefined) { - n = NaN - } else if (!NumberIsInteger(n)) { - n = NumberParseInt(n, 10) - } - const state = this._readableState - const nOrig = n - - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n) - if (n !== 0) state.state &= ~kEmittedReadable - - // If we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if ( - n === 0 && - state.needReadable && - ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended) - ) { - debug('read: emitReadable', state.length, state.ended) - if (state.length === 0 && state.ended) endReadable(this) - else emitReadable(this) - return null - } - n = howMuchToRead(n, state) - - // If we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this) - return null - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - let doRead = (state.state & kNeedReadable) !== 0 - debug('need readable', doRead) - - // If we currently have less than the highWaterMark, then also read some. - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true - debug('length less than watermark', doRead) - } - - // However, if we've ended, then there's no point, if we're already - // reading, then it's unnecessary, if we're constructing we have to wait, - // and if we're destroyed or errored, then it's not allowed, - if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) { - doRead = false - debug('reading, ended or constructing', doRead) - } else if (doRead) { - debug('do read') - state.state |= kReading | kSync - // If the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.state |= kNeedReadable - - // Call internal read method - try { - this._read(state.highWaterMark) - } catch (err) { - errorOrDestroy(this, err) - } - state.state &= ~kSync - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state) - } - let ret - if (n > 0) ret = fromList(n, state) - else ret = null - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark - n = 0 - } else { - state.length -= n - if (state.multiAwaitDrain) { - state.awaitDrainWriters.clear() - } else { - state.awaitDrainWriters = null - } - } - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this) - } - if (ret !== null && !state.errorEmitted && !state.closeEmitted) { - state.dataEmitted = true - this.emit('data', ret) - } - return ret -} -function onEofChunk(stream, state) { - debug('onEofChunk') - if (state.ended) return - if (state.decoder) { - const chunk = state.decoder.end() - if (chunk && chunk.length) { - state.buffer.push(chunk) - state.length += state.objectMode ? 1 : chunk.length - } - } - state.ended = true - if (state.sync) { - // If we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call. - emitReadable(stream) - } else { - // Emit 'readable' now to make sure it gets picked up. - state.needReadable = false - state.emittedReadable = true - // We have to emit readable now that we are EOF. Modules - // in the ecosystem (e.g. dicer) rely on this event being sync. - emitReadable_(stream) - } -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - const state = stream._readableState - debug('emitReadable', state.needReadable, state.emittedReadable) - state.needReadable = false - if (!state.emittedReadable) { - debug('emitReadable', state.flowing) - state.emittedReadable = true - process.nextTick(emitReadable_, stream) - } -} -function emitReadable_(stream) { - const state = stream._readableState - debug('emitReadable_', state.destroyed, state.length, state.ended) - if (!state.destroyed && !state.errored && (state.length || state.ended)) { - stream.emit('readable') - state.emittedReadable = false - } - - // The stream needs another readable event if: - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark - flow(stream) -} - -// At this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore && state.constructed) { - state.readingMore = true - process.nextTick(maybeReadMore_, stream, state) - } -} -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while ( - !state.reading && - !state.ended && - (state.length < state.highWaterMark || (state.flowing && state.length === 0)) - ) { - const len = state.length - debug('maybeReadMore read 0') - stream.read(0) - if (len === state.length) - // Didn't get any data, stop spinning. - break - } - state.readingMore = false -} - -// Abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_read()') -} -Readable.prototype.pipe = function (dest, pipeOpts) { - const src = this - const state = this._readableState - if (state.pipes.length === 1) { - if (!state.multiAwaitDrain) { - state.multiAwaitDrain = true - state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : []) - } - } - state.pipes.push(dest) - debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts) - const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr - const endFn = doEnd ? onend : unpipe - if (state.endEmitted) process.nextTick(endFn) - else src.once('end', endFn) - dest.on('unpipe', onunpipe) - function onunpipe(readable, unpipeInfo) { - debug('onunpipe') - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true - cleanup() - } - } - } - function onend() { - debug('onend') - dest.end() - } - let ondrain - let cleanedUp = false - function cleanup() { - debug('cleanup') - // Cleanup event handlers once the pipe is broken. - dest.removeListener('close', onclose) - dest.removeListener('finish', onfinish) - if (ondrain) { - dest.removeListener('drain', ondrain) - } - dest.removeListener('error', onerror) - dest.removeListener('unpipe', onunpipe) - src.removeListener('end', onend) - src.removeListener('end', unpipe) - src.removeListener('data', ondata) - cleanedUp = true - - // If the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain() - } - function pause() { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if (!cleanedUp) { - if (state.pipes.length === 1 && state.pipes[0] === dest) { - debug('false write response, pause', 0) - state.awaitDrainWriters = dest - state.multiAwaitDrain = false - } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { - debug('false write response, pause', state.awaitDrainWriters.size) - state.awaitDrainWriters.add(dest) - } - src.pause() - } - if (!ondrain) { - // When the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - ondrain = pipeOnDrain(src, dest) - dest.on('drain', ondrain) - } - } - src.on('data', ondata) - function ondata(chunk) { - debug('ondata') - const ret = dest.write(chunk) - debug('dest.write', ret) - if (ret === false) { - pause() - } - } - - // If the dest has an error, then stop piping into it. - // However, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er) - unpipe() - dest.removeListener('error', onerror) - if (dest.listenerCount('error') === 0) { - const s = dest._writableState || dest._readableState - if (s && !s.errorEmitted) { - // User incorrectly emitted 'error' directly on the stream. - errorOrDestroy(dest, er) - } else { - dest.emit('error', er) - } - } - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror) - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish) - unpipe() - } - dest.once('close', onclose) - function onfinish() { - debug('onfinish') - dest.removeListener('close', onclose) - unpipe() - } - dest.once('finish', onfinish) - function unpipe() { - debug('unpipe') - src.unpipe(dest) - } - - // Tell the dest that it's being piped to. - dest.emit('pipe', src) - - // Start the flow if it hasn't been started already. - - if (dest.writableNeedDrain === true) { - pause() - } else if (!state.flowing) { - debug('pipe resume') - src.resume() - } - return dest -} -function pipeOnDrain(src, dest) { - return function pipeOnDrainFunctionResult() { - const state = src._readableState - - // `ondrain` will call directly, - // `this` maybe not a reference to dest, - // so we use the real dest here. - if (state.awaitDrainWriters === dest) { - debug('pipeOnDrain', 1) - state.awaitDrainWriters = null - } else if (state.multiAwaitDrain) { - debug('pipeOnDrain', state.awaitDrainWriters.size) - state.awaitDrainWriters.delete(dest) - } - if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) { - src.resume() - } - } -} -Readable.prototype.unpipe = function (dest) { - const state = this._readableState - const unpipeInfo = { - hasUnpiped: false - } - - // If we're not piping anywhere, then do nothing. - if (state.pipes.length === 0) return this - if (!dest) { - // remove all. - const dests = state.pipes - state.pipes = [] - this.pause() - for (let i = 0; i < dests.length; i++) - dests[i].emit('unpipe', this, { - hasUnpiped: false - }) - return this - } - - // Try to find the right one. - const index = ArrayPrototypeIndexOf(state.pipes, dest) - if (index === -1) return this - state.pipes.splice(index, 1) - if (state.pipes.length === 0) this.pause() - dest.emit('unpipe', this, unpipeInfo) - return this -} - -// Set up data events if they are asked for -// Ensure readable listeners eventually get something. -Readable.prototype.on = function (ev, fn) { - const res = Stream.prototype.on.call(this, ev, fn) - const state = this._readableState - if (ev === 'data') { - // Update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0 - - // Try start flowing on next tick if stream isn't explicitly paused. - if (state.flowing !== false) this.resume() - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true - state.flowing = false - state.emittedReadable = false - debug('on readable', state.length, state.reading) - if (state.length) { - emitReadable(this) - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this) - } - } - } - return res -} -Readable.prototype.addListener = Readable.prototype.on -Readable.prototype.removeListener = function (ev, fn) { - const res = Stream.prototype.removeListener.call(this, ev, fn) - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res -} -Readable.prototype.off = Readable.prototype.removeListener -Readable.prototype.removeAllListeners = function (ev) { - const res = Stream.prototype.removeAllListeners.apply(this, arguments) - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res -} -function updateReadableListening(self) { - const state = self._readableState - state.readableListening = self.listenerCount('readable') > 0 - if (state.resumeScheduled && state[kPaused] === false) { - // Flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true - - // Crude way to check if we should resume. - } else if (self.listenerCount('data') > 0) { - self.resume() - } else if (!state.readableListening) { - state.flowing = null - } -} -function nReadingNextTick(self) { - debug('readable nexttick read 0') - self.read(0) -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - const state = this._readableState - if (!state.flowing) { - debug('resume') - // We flow only if there is no one listening - // for readable, but we still have to call - // resume(). - state.flowing = !state.readableListening - resume(this, state) - } - state[kPaused] = false - return this -} -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true - process.nextTick(resume_, stream, state) - } -} -function resume_(stream, state) { - debug('resume', state.reading) - if (!state.reading) { - stream.read(0) - } - state.resumeScheduled = false - stream.emit('resume') - flow(stream) - if (state.flowing && !state.reading) stream.read(0) -} -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing) - if (this._readableState.flowing !== false) { - debug('pause') - this._readableState.flowing = false - this.emit('pause') - } - this._readableState[kPaused] = true - return this -} -function flow(stream) { - const state = stream._readableState - debug('flow', state.flowing) - while (state.flowing && stream.read() !== null); -} - -// Wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - let paused = false - - // TODO (ronag): Should this.destroy(err) emit - // 'error' on the wrapped stream? Would require - // a static factory method, e.g. Readable.wrap(stream). - - stream.on('data', (chunk) => { - if (!this.push(chunk) && stream.pause) { - paused = true - stream.pause() - } - }) - stream.on('end', () => { - this.push(null) - }) - stream.on('error', (err) => { - errorOrDestroy(this, err) - }) - stream.on('close', () => { - this.destroy() - }) - stream.on('destroy', () => { - this.destroy() - }) - this._read = () => { - if (paused && stream.resume) { - paused = false - stream.resume() - } - } - - // Proxy all the other methods. Important when wrapping filters and duplexes. - const streamKeys = ObjectKeys(stream) - for (let j = 1; j < streamKeys.length; j++) { - const i = streamKeys[j] - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = stream[i].bind(stream) - } - } - return this -} -Readable.prototype[SymbolAsyncIterator] = function () { - return streamToAsyncIterator(this) -} -Readable.prototype.iterator = function (options) { - if (options !== undefined) { - validateObject(options, 'options') - } - return streamToAsyncIterator(this, options) -} -function streamToAsyncIterator(stream, options) { - if (typeof stream.read !== 'function') { - stream = Readable.wrap(stream, { - objectMode: true - }) - } - const iter = createAsyncIterator(stream, options) - iter.stream = stream - return iter -} -async function* createAsyncIterator(stream, options) { - let callback = nop - function next(resolve) { - if (this === stream) { - callback() - callback = nop - } else { - callback = resolve - } - } - stream.on('readable', next) - let error - const cleanup = eos( - stream, - { - writable: false - }, - (err) => { - error = err ? aggregateTwoErrors(error, err) : null - callback() - callback = nop - } - ) - try { - while (true) { - const chunk = stream.destroyed ? null : stream.read() - if (chunk !== null) { - yield chunk - } else if (error) { - throw error - } else if (error === null) { - return - } else { - await new Promise(next) - } - } - } catch (err) { - error = aggregateTwoErrors(error, err) - throw error - } finally { - if ( - (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) && - (error === undefined || stream._readableState.autoDestroy) - ) { - destroyImpl.destroyer(stream, null) - } else { - stream.off('readable', next) - cleanup() - } - } -} - -// Making it explicit these properties are not enumerable -// because otherwise some prototype manipulation in -// userland will fail. -ObjectDefineProperties(Readable.prototype, { - readable: { - __proto__: null, - get() { - const r = this._readableState - // r.readable === false means that this is part of a Duplex stream - // where the readable side was disabled upon construction. - // Compat. The user might manually disable readable side through - // deprecated setter. - return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted - }, - set(val) { - // Backwards compat. - if (this._readableState) { - this._readableState.readable = !!val - } - } - }, - readableDidRead: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.dataEmitted - } - }, - readableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._readableState.readable !== false && - (this._readableState.destroyed || this._readableState.errored) && - !this._readableState.endEmitted - ) - } - }, - readableHighWaterMark: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.highWaterMark - } - }, - readableBuffer: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState && this._readableState.buffer - } - }, - readableFlowing: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.flowing - }, - set: function (state) { - if (this._readableState) { - this._readableState.flowing = state - } - } - }, - readableLength: { - __proto__: null, - enumerable: false, - get() { - return this._readableState.length - } - }, - readableObjectMode: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.objectMode : false - } - }, - readableEncoding: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.encoding : null - } - }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.errored : null - } - }, - closed: { - __proto__: null, - get() { - return this._readableState ? this._readableState.closed : false - } - }, - destroyed: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.destroyed : false - }, - set(value) { - // We ignore the value if the stream - // has not been initialized yet. - if (!this._readableState) { - return - } - - // Backward compatibility, the user is explicitly - // managing destroyed. - this._readableState.destroyed = value - } - }, - readableEnded: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.endEmitted : false - } - } -}) -ObjectDefineProperties(ReadableState.prototype, { - // Legacy getter for `pipesCount`. - pipesCount: { - __proto__: null, - get() { - return this.pipes.length - } - }, - // Legacy property for `paused`. - paused: { - __proto__: null, - get() { - return this[kPaused] !== false - }, - set(value) { - this[kPaused] = !!value - } - } -}) - -// Exposed for testing purposes only. -Readable._fromList = fromList - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered. - if (state.length === 0) return null - let ret - if (state.objectMode) ret = state.buffer.shift() - else if (!n || n >= state.length) { - // Read it all, truncate the list. - if (state.decoder) ret = state.buffer.join('') - else if (state.buffer.length === 1) ret = state.buffer.first() - else ret = state.buffer.concat(state.length) - state.buffer.clear() - } else { - // read part of list. - ret = state.buffer.consume(n, state.decoder) - } - return ret -} -function endReadable(stream) { - const state = stream._readableState - debug('endReadable', state.endEmitted) - if (!state.endEmitted) { - state.ended = true - process.nextTick(endReadableNT, state, stream) - } -} -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length) - - // Check that we didn't get one last unshift. - if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) { - state.endEmitted = true - stream.emit('end') - if (stream.writable && stream.allowHalfOpen === false) { - process.nextTick(endWritableNT, stream) - } else if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well. - const wState = stream._writableState - const autoDestroy = - !wState || - (wState.autoDestroy && - // We don't expect the writable to ever 'finish' - // if writable is explicitly set to false. - (wState.finished || wState.writable === false)) - if (autoDestroy) { - stream.destroy() - } - } - } -} -function endWritableNT(stream) { - const writable = stream.writable && !stream.writableEnded && !stream.destroyed - if (writable) { - stream.end() - } -} -Readable.from = function (iterable, opts) { - return from(Readable, iterable, opts) -} -let webStreamsAdapters - -// Lazy to avoid circular references -function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters -} -Readable.fromWeb = function (readableStream, options) { - return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options) -} -Readable.toWeb = function (streamReadable, options) { - return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options) -} -Readable.wrap = function (src, options) { - var _ref, _src$readableObjectMo - return new Readable({ - objectMode: - (_ref = - (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined - ? _src$readableObjectMo - : src.objectMode) !== null && _ref !== undefined - ? _ref - : true, - ...options, - destroy(err, callback) { - destroyImpl.destroyer(src, err) - callback(err) - } - }).wrap(src) -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/state.js": -/*!*********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/state.js ***! - \*********************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { MathFloor, NumberIsInteger } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { validateInteger } = __webpack_require__(/*! ../validators */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js") -const { ERR_INVALID_ARG_VALUE } = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js").codes) -let defaultHighWaterMarkBytes = 16 * 1024 -let defaultHighWaterMarkObjectMode = 16 -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null -} -function getDefaultHighWaterMark(objectMode) { - return objectMode ? defaultHighWaterMarkObjectMode : defaultHighWaterMarkBytes -} -function setDefaultHighWaterMark(objectMode, value) { - validateInteger(value, 'value', 0) - if (objectMode) { - defaultHighWaterMarkObjectMode = value - } else { - defaultHighWaterMarkBytes = value - } -} -function getHighWaterMark(state, options, duplexKey, isDuplex) { - const hwm = highWaterMarkFrom(options, isDuplex, duplexKey) - if (hwm != null) { - if (!NumberIsInteger(hwm) || hwm < 0) { - const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark' - throw new ERR_INVALID_ARG_VALUE(name, hwm) - } - return MathFloor(hwm) - } - - // Default value - return getDefaultHighWaterMark(state.objectMode) -} -module.exports = { - getHighWaterMark, - getDefaultHighWaterMark, - setDefaultHighWaterMark -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/transform.js": -/*!*************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/transform.js ***! - \*************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - - - -const { ObjectSetPrototypeOf, Symbol } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Transform -const { ERR_METHOD_NOT_IMPLEMENTED } = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js").codes) -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") -const { getHighWaterMark } = __webpack_require__(/*! ./state */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/state.js") -ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype) -ObjectSetPrototypeOf(Transform, Duplex) -const kCallback = Symbol('kCallback') -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options) - - // TODO (ronag): This should preferably always be - // applied but would be semver-major. Or even better; - // make Transform a Readable with the Writable interface. - const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null - if (readableHighWaterMark === 0) { - // A Duplex will buffer both on the writable and readable side while - // a Transform just wants to buffer hwm number of elements. To avoid - // buffering twice we disable buffering on the writable side. - options = { - ...options, - highWaterMark: null, - readableHighWaterMark, - // TODO (ronag): 0 is not optimal since we have - // a "bug" where we check needDrain before calling _write and not after. - // Refs: https://github.com/nodejs/node/pull/32887 - // Refs: https://github.com/nodejs/node/pull/35941 - writableHighWaterMark: options.writableHighWaterMark || 0 - } - } - Duplex.call(this, options) - - // We have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false - this[kCallback] = null - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform - if (typeof options.flush === 'function') this._flush = options.flush - } - - // When the writable side finishes, then flush out anything remaining. - // Backwards compat. Some Transform streams incorrectly implement _final - // instead of or in addition to _flush. By using 'prefinish' instead of - // implementing _final we continue supporting this unfortunate use case. - this.on('prefinish', prefinish) -} -function final(cb) { - if (typeof this._flush === 'function' && !this.destroyed) { - this._flush((er, data) => { - if (er) { - if (cb) { - cb(er) - } else { - this.destroy(er) - } - return - } - if (data != null) { - this.push(data) - } - this.push(null) - if (cb) { - cb() - } - }) - } else { - this.push(null) - if (cb) { - cb() - } - } -} -function prefinish() { - if (this._final !== final) { - final.call(this) - } -} -Transform.prototype._final = final -Transform.prototype._transform = function (chunk, encoding, callback) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()') -} -Transform.prototype._write = function (chunk, encoding, callback) { - const rState = this._readableState - const wState = this._writableState - const length = rState.length - this._transform(chunk, encoding, (err, val) => { - if (err) { - callback(err) - return - } - if (val != null) { - this.push(val) - } - if ( - wState.ended || - // Backwards compat. - length === rState.length || - // Backwards compat. - rState.length < rState.highWaterMark - ) { - callback() - } else { - this[kCallback] = callback - } - }) -} -Transform.prototype._read = function () { - if (this[kCallback]) { - const callback = this[kCallback] - this[kCallback] = null - callback() - } -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js": -/*!*********************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js ***! - \*********************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { SymbolAsyncIterator, SymbolIterator, SymbolFor } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") - -// We need to use SymbolFor to make these globally available -// for interopt with readable-stream, i.e. readable-stream -// and node core needs to be able to read/write private state -// from each other for proper interoperability. -const kIsDestroyed = SymbolFor('nodejs.stream.destroyed') -const kIsErrored = SymbolFor('nodejs.stream.errored') -const kIsReadable = SymbolFor('nodejs.stream.readable') -const kIsWritable = SymbolFor('nodejs.stream.writable') -const kIsDisturbed = SymbolFor('nodejs.stream.disturbed') -const kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise') -const kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction') -function isReadableNodeStream(obj, strict = false) { - var _obj$_readableState - return !!( - ( - obj && - typeof obj.pipe === 'function' && - typeof obj.on === 'function' && - (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) && - (!obj._writableState || - ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined - ? undefined - : _obj$_readableState.readable) !== false) && - // Duplex - (!obj._writableState || obj._readableState) - ) // Writable has .pipe. - ) -} - -function isWritableNodeStream(obj) { - var _obj$_writableState - return !!( - ( - obj && - typeof obj.write === 'function' && - typeof obj.on === 'function' && - (!obj._readableState || - ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined - ? undefined - : _obj$_writableState.writable) !== false) - ) // Duplex - ) -} - -function isDuplexNodeStream(obj) { - return !!( - obj && - typeof obj.pipe === 'function' && - obj._readableState && - typeof obj.on === 'function' && - typeof obj.write === 'function' - ) -} -function isNodeStream(obj) { - return ( - obj && - (obj._readableState || - obj._writableState || - (typeof obj.write === 'function' && typeof obj.on === 'function') || - (typeof obj.pipe === 'function' && typeof obj.on === 'function')) - ) -} -function isReadableStream(obj) { - return !!( - obj && - !isNodeStream(obj) && - typeof obj.pipeThrough === 'function' && - typeof obj.getReader === 'function' && - typeof obj.cancel === 'function' - ) -} -function isWritableStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function') -} -function isTransformStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object') -} -function isWebStream(obj) { - return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj) -} -function isIterable(obj, isAsync) { - if (obj == null) return false - if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function' - if (isAsync === false) return typeof obj[SymbolIterator] === 'function' - return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function' -} -function isDestroyed(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState - return !!(stream.destroyed || stream[kIsDestroyed] || (state !== null && state !== undefined && state.destroyed)) -} - -// Have been end():d. -function isWritableEnded(stream) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableEnded === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null - return wState.ended -} - -// Have emitted 'finish'. -function isWritableFinished(stream, strict) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableFinished === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null - return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0)) -} - -// Have been push(null):d. -function isReadableEnded(stream) { - if (!isReadableNodeStream(stream)) return null - if (stream.readableEnded === true) return true - const rState = stream._readableState - if (!rState || rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null - return rState.ended -} - -// Have emitted 'end'. -function isReadableFinished(stream, strict) { - if (!isReadableNodeStream(stream)) return null - const rState = stream._readableState - if (rState !== null && rState !== undefined && rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null - return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0)) -} -function isReadable(stream) { - if (stream && stream[kIsReadable] != null) return stream[kIsReadable] - if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream) -} -function isWritable(stream) { - if (stream && stream[kIsWritable] != null) return stream[kIsWritable] - if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream) -} -function isFinished(stream, opts) { - if (!isNodeStream(stream)) { - return null - } - if (isDestroyed(stream)) { - return true - } - if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) { - return false - } - if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) { - return false - } - return true -} -function isWritableErrored(stream) { - var _stream$_writableStat, _stream$_writableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.writableErrored) { - return stream.writableErrored - } - return (_stream$_writableStat = - (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined - ? undefined - : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined - ? _stream$_writableStat - : null -} -function isReadableErrored(stream) { - var _stream$_readableStat, _stream$_readableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.readableErrored) { - return stream.readableErrored - } - return (_stream$_readableStat = - (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined - ? undefined - : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined - ? _stream$_readableStat - : null -} -function isClosed(stream) { - if (!isNodeStream(stream)) { - return null - } - if (typeof stream.closed === 'boolean') { - return stream.closed - } - const wState = stream._writableState - const rState = stream._readableState - if ( - typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' || - typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean' - ) { - return ( - (wState === null || wState === undefined ? undefined : wState.closed) || - (rState === null || rState === undefined ? undefined : rState.closed) - ) - } - if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) { - return stream._closed - } - return null -} -function isOutgoingMessage(stream) { - return ( - typeof stream._closed === 'boolean' && - typeof stream._defaultKeepAlive === 'boolean' && - typeof stream._removedConnection === 'boolean' && - typeof stream._removedContLen === 'boolean' - ) -} -function isServerResponse(stream) { - return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream) -} -function isServerRequest(stream) { - var _stream$req - return ( - typeof stream._consuming === 'boolean' && - typeof stream._dumped === 'boolean' && - ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) === - undefined - ) -} -function willEmitClose(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState - return ( - (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false) - ) -} -function isDisturbed(stream) { - var _stream$kIsDisturbed - return !!( - stream && - ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined - ? _stream$kIsDisturbed - : stream.readableDidRead || stream.readableAborted) - ) -} -function isErrored(stream) { - var _ref, - _ref2, - _ref3, - _ref4, - _ref5, - _stream$kIsErrored, - _stream$_readableStat3, - _stream$_writableStat3, - _stream$_readableStat4, - _stream$_writableStat4 - return !!( - stream && - ((_ref = - (_ref2 = - (_ref3 = - (_ref4 = - (_ref5 = - (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined - ? _stream$kIsErrored - : stream.readableErrored) !== null && _ref5 !== undefined - ? _ref5 - : stream.writableErrored) !== null && _ref4 !== undefined - ? _ref4 - : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined - ? undefined - : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined - ? _ref3 - : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined - ? undefined - : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined - ? _ref2 - : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined - ? undefined - : _stream$_readableStat4.errored) !== null && _ref !== undefined - ? _ref - : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined - ? undefined - : _stream$_writableStat4.errored) - ) -} -module.exports = { - isDestroyed, - kIsDestroyed, - isDisturbed, - kIsDisturbed, - isErrored, - kIsErrored, - isReadable, - kIsReadable, - kIsClosedPromise, - kControllerErrorFunction, - kIsWritable, - isClosed, - isDuplexNodeStream, - isFinished, - isIterable, - isReadableNodeStream, - isReadableStream, - isReadableEnded, - isReadableFinished, - isReadableErrored, - isNodeStream, - isWebStream, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableEnded, - isWritableFinished, - isWritableErrored, - isServerRequest, - isServerResponse, - willEmitClose, - isTransformStream -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/writable.js": -/*!************************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/writable.js ***! - \************************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -;('use strict') -const { - ArrayPrototypeSlice, - Error, - FunctionPrototypeSymbolHasInstance, - ObjectDefineProperty, - ObjectDefineProperties, - ObjectSetPrototypeOf, - StringPrototypeToLowerCase, - Symbol, - SymbolHasInstance -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Writable -Writable.WritableState = WritableState -const { EventEmitter: EE } = __webpack_require__(/*! events */ "./node_modules/events/events.js") -const Stream = (__webpack_require__(/*! ./legacy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/legacy.js").Stream) -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const destroyImpl = __webpack_require__(/*! ./destroy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js") -const { addAbortSignal } = __webpack_require__(/*! ./add-abort-signal */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(/*! ./state */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/state.js") -const { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED, - ERR_STREAM_ALREADY_FINISHED, - ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING -} = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js").codes) -const { errorOrDestroy } = destroyImpl -ObjectSetPrototypeOf(Writable.prototype, Stream.prototype) -ObjectSetPrototypeOf(Writable, Stream) -function nop() {} -const kOnFinished = Symbol('kOnFinished') -function WritableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") - - // Object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!(options && options.objectMode) - if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode) - - // The point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write(). - this.highWaterMark = options - ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // if _final has been called. - this.finalCalled = false - - // drain event flag. - this.needDrain = false - // At the start of calling end() - this.ending = false - // When end() has been called, and returned. - this.ended = false - // When 'finish' is emitted. - this.finished = false - - // Has it been destroyed - this.destroyed = false - - // Should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - const noDecode = !!(options && options.decodeStrings === false) - this.decodeStrings = !noDecode - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0 - - // A flag to see when we're in the middle of a write. - this.writing = false - - // When true all writes will be buffered until .uncork() call. - this.corked = 0 - - // A flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true - - // A flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false - - // The callback that's passed to _write(chunk, cb). - this.onwrite = onwrite.bind(undefined, stream) - - // The callback that the user supplies to write(chunk, encoding, cb). - this.writecb = null - - // The amount that is being written when _write is called. - this.writelen = 0 - - // Storage for data passed to the afterWrite() callback in case of - // synchronous _write() completion. - this.afterWriteTickInfo = null - resetBuffer(this) - - // Number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted. - this.pendingcb = 0 - - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - this.constructed = true - - // Emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams. - this.prefinished = false - - // True if the error was already emitted and should not be thrown again. - this.errorEmitted = false - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = !options || options.emitClose !== false - - // Should .destroy() be called after 'finish' (and potentially 'end'). - this.autoDestroy = !options || options.autoDestroy !== false - - // Indicates whether the stream has errored. When true all write() calls - // should return false. This is needed since when autoDestroy - // is disabled we need a way to tell whether the stream has failed. - this.errored = null - - // Indicates whether the stream has finished destroying. - this.closed = false - - // True if close has been emitted or would have been emitted - // depending on emitClose. - this.closeEmitted = false - this[kOnFinished] = [] -} -function resetBuffer(state) { - state.buffered = [] - state.bufferedIndex = 0 - state.allBuffers = true - state.allNoop = true -} -WritableState.prototype.getBuffer = function getBuffer() { - return ArrayPrototypeSlice(this.buffered, this.bufferedIndex) -} -ObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', { - __proto__: null, - get() { - return this.buffered.length - this.bufferedIndex - } -}) -function Writable(options) { - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(/*! ./duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") - if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options) - this._writableState = new WritableState(options, this, isDuplex) - if (options) { - if (typeof options.write === 'function') this._write = options.write - if (typeof options.writev === 'function') this._writev = options.writev - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.final === 'function') this._final = options.final - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - const state = this._writableState - if (!state.writing) { - clearBuffer(this, state) - } - finishMaybe(this, state) - }) -} -ObjectDefineProperty(Writable, SymbolHasInstance, { - __proto__: null, - value: function (object) { - if (FunctionPrototypeSymbolHasInstance(this, object)) return true - if (this !== Writable) return false - return object && object._writableState instanceof WritableState - } -}) - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()) -} -function _write(stream, chunk, encoding, cb) { - const state = stream._writableState - if (typeof encoding === 'function') { - cb = encoding - encoding = state.defaultEncoding - } else { - if (!encoding) encoding = state.defaultEncoding - else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - if (typeof cb !== 'function') cb = nop - } - if (chunk === null) { - throw new ERR_STREAM_NULL_VALUES() - } else if (!state.objectMode) { - if (typeof chunk === 'string') { - if (state.decodeStrings !== false) { - chunk = Buffer.from(chunk, encoding) - encoding = 'buffer' - } - } else if (chunk instanceof Buffer) { - encoding = 'buffer' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) - encoding = 'buffer' - } else { - throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) - } - } - let err - if (state.ending) { - err = new ERR_STREAM_WRITE_AFTER_END() - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('write') - } - if (err) { - process.nextTick(cb, err) - errorOrDestroy(stream, err, true) - return err - } - state.pendingcb++ - return writeOrBuffer(stream, state, chunk, encoding, cb) -} -Writable.prototype.write = function (chunk, encoding, cb) { - return _write(this, chunk, encoding, cb) === true -} -Writable.prototype.cork = function () { - this._writableState.corked++ -} -Writable.prototype.uncork = function () { - const state = this._writableState - if (state.corked) { - state.corked-- - if (!state.writing) clearBuffer(this, state) - } -} -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding) - if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - this._writableState.defaultEncoding = encoding - return this -} - -// If we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, callback) { - const len = state.objectMode ? 1 : chunk.length - state.length += len - - // stream._write resets state.length - const ret = state.length < state.highWaterMark - // We must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true - if (state.writing || state.corked || state.errored || !state.constructed) { - state.buffered.push({ - chunk, - encoding, - callback - }) - if (state.allBuffers && encoding !== 'buffer') { - state.allBuffers = false - } - if (state.allNoop && callback !== nop) { - state.allNoop = false - } - } else { - state.writelen = len - state.writecb = callback - state.writing = true - state.sync = true - stream._write(chunk, encoding, state.onwrite) - state.sync = false - } - - // Return false if errored or destroyed in order to break - // any synchronous while(stream.write(data)) loops. - return ret && !state.errored && !state.destroyed -} -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len - state.writecb = cb - state.writing = true - state.sync = true - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write')) - else if (writev) stream._writev(chunk, state.onwrite) - else stream._write(chunk, encoding, state.onwrite) - state.sync = false -} -function onwriteError(stream, state, er, cb) { - --state.pendingcb - cb(er) - // Ensure callbacks are invoked even when autoDestroy is - // not enabled. Passing `er` here doesn't make sense since - // it's related to one specific write, not to the buffered - // writes. - errorBuffer(state) - // This can emit error, but error must always follow cb. - errorOrDestroy(stream, er) -} -function onwrite(stream, er) { - const state = stream._writableState - const sync = state.sync - const cb = state.writecb - if (typeof cb !== 'function') { - errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK()) - return - } - state.writing = false - state.writecb = null - state.length -= state.writelen - state.writelen = 0 - if (er) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - er.stack // eslint-disable-line no-unused-expressions - - if (!state.errored) { - state.errored = er - } - - // In case of duplex streams we need to notify the readable side of the - // error. - if (stream._readableState && !stream._readableState.errored) { - stream._readableState.errored = er - } - if (sync) { - process.nextTick(onwriteError, stream, state, er, cb) - } else { - onwriteError(stream, state, er, cb) - } - } else { - if (state.buffered.length > state.bufferedIndex) { - clearBuffer(stream, state) - } - if (sync) { - // It is a common case that the callback passed to .write() is always - // the same. In that case, we do not schedule a new nextTick(), but - // rather just increase a counter, to improve performance and avoid - // memory allocations. - if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) { - state.afterWriteTickInfo.count++ - } else { - state.afterWriteTickInfo = { - count: 1, - cb, - stream, - state - } - process.nextTick(afterWriteTick, state.afterWriteTickInfo) - } - } else { - afterWrite(stream, state, 1, cb) - } - } -} -function afterWriteTick({ stream, state, count, cb }) { - state.afterWriteTickInfo = null - return afterWrite(stream, state, count, cb) -} -function afterWrite(stream, state, count, cb) { - const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain - if (needDrain) { - state.needDrain = false - stream.emit('drain') - } - while (count-- > 0) { - state.pendingcb-- - cb() - } - if (state.destroyed) { - errorBuffer(state) - } - finishMaybe(stream, state) -} - -// If there's something in the buffer waiting, then invoke callbacks. -function errorBuffer(state) { - if (state.writing) { - return - } - for (let n = state.bufferedIndex; n < state.buffered.length; ++n) { - var _state$errored - const { chunk, callback } = state.buffered[n] - const len = state.objectMode ? 1 : chunk.length - state.length -= len - callback( - (_state$errored = state.errored) !== null && _state$errored !== undefined - ? _state$errored - : new ERR_STREAM_DESTROYED('write') - ) - } - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - var _state$errored2 - onfinishCallbacks[i]( - (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined - ? _state$errored2 - : new ERR_STREAM_DESTROYED('end') - ) - } - resetBuffer(state) -} - -// If there's something in the buffer waiting, then process it. -function clearBuffer(stream, state) { - if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) { - return - } - const { buffered, bufferedIndex, objectMode } = state - const bufferedLength = buffered.length - bufferedIndex - if (!bufferedLength) { - return - } - let i = bufferedIndex - state.bufferProcessing = true - if (bufferedLength > 1 && stream._writev) { - state.pendingcb -= bufferedLength - 1 - const callback = state.allNoop - ? nop - : (err) => { - for (let n = i; n < buffered.length; ++n) { - buffered[n].callback(err) - } - } - // Make a copy of `buffered` if it's going to be used by `callback` above, - // since `doWrite` will mutate the array. - const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i) - chunks.allBuffers = state.allBuffers - doWrite(stream, state, true, state.length, chunks, '', callback) - resetBuffer(state) - } else { - do { - const { chunk, encoding, callback } = buffered[i] - buffered[i++] = null - const len = objectMode ? 1 : chunk.length - doWrite(stream, state, false, len, chunk, encoding, callback) - } while (i < buffered.length && !state.writing) - if (i === buffered.length) { - resetBuffer(state) - } else if (i > 256) { - buffered.splice(0, i) - state.bufferedIndex = 0 - } else { - state.bufferedIndex = i - } - } - state.bufferProcessing = false -} -Writable.prototype._write = function (chunk, encoding, cb) { - if (this._writev) { - this._writev( - [ - { - chunk, - encoding - } - ], - cb - ) - } else { - throw new ERR_METHOD_NOT_IMPLEMENTED('_write()') - } -} -Writable.prototype._writev = null -Writable.prototype.end = function (chunk, encoding, cb) { - const state = this._writableState - if (typeof chunk === 'function') { - cb = chunk - chunk = null - encoding = null - } else if (typeof encoding === 'function') { - cb = encoding - encoding = null - } - let err - if (chunk !== null && chunk !== undefined) { - const ret = _write(this, chunk, encoding) - if (ret instanceof Error) { - err = ret - } - } - - // .end() fully uncorks. - if (state.corked) { - state.corked = 1 - this.uncork() - } - if (err) { - // Do nothing... - } else if (!state.errored && !state.ending) { - // This is forgiving in terms of unnecessary calls to end() and can hide - // logic errors. However, usually such errors are harmless and causing a - // hard error can be disproportionately destructive. It is not always - // trivial for the user to determine whether end() needs to be called - // or not. - - state.ending = true - finishMaybe(this, state, true) - state.ended = true - } else if (state.finished) { - err = new ERR_STREAM_ALREADY_FINISHED('end') - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('end') - } - if (typeof cb === 'function') { - if (err || state.finished) { - process.nextTick(cb, err) - } else { - state[kOnFinished].push(cb) - } - } - return this -} -function needFinish(state) { - return ( - state.ending && - !state.destroyed && - state.constructed && - state.length === 0 && - !state.errored && - state.buffered.length === 0 && - !state.finished && - !state.writing && - !state.errorEmitted && - !state.closeEmitted - ) -} -function callFinal(stream, state) { - let called = false - function onFinish(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK()) - return - } - called = true - state.pendingcb-- - if (err) { - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i](err) - } - errorOrDestroy(stream, err, state.sync) - } else if (needFinish(state)) { - state.prefinished = true - stream.emit('prefinish') - // Backwards compat. Don't check state.sync here. - // Some streams assume 'finish' will be emitted - // asynchronously relative to _final callback. - state.pendingcb++ - process.nextTick(finish, stream, state) - } - } - state.sync = true - state.pendingcb++ - try { - stream._final(onFinish) - } catch (err) { - onFinish(err) - } - state.sync = false -} -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.finalCalled = true - callFinal(stream, state) - } else { - state.prefinished = true - stream.emit('prefinish') - } - } -} -function finishMaybe(stream, state, sync) { - if (needFinish(state)) { - prefinish(stream, state) - if (state.pendingcb === 0) { - if (sync) { - state.pendingcb++ - process.nextTick( - (stream, state) => { - if (needFinish(state)) { - finish(stream, state) - } else { - state.pendingcb-- - } - }, - stream, - state - ) - } else if (needFinish(state)) { - state.pendingcb++ - finish(stream, state) - } - } - } -} -function finish(stream, state) { - state.pendingcb-- - state.finished = true - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i]() - } - stream.emit('finish') - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well. - const rState = stream._readableState - const autoDestroy = - !rState || - (rState.autoDestroy && - // We don't expect the readable to ever 'end' - // if readable is explicitly set to false. - (rState.endEmitted || rState.readable === false)) - if (autoDestroy) { - stream.destroy() - } - } -} -ObjectDefineProperties(Writable.prototype, { - closed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.closed : false - } - }, - destroyed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.destroyed : false - }, - set(value) { - // Backward compatibility, the user is explicitly managing destroyed. - if (this._writableState) { - this._writableState.destroyed = value - } - } - }, - writable: { - __proto__: null, - get() { - const w = this._writableState - // w.writable === false means that this is part of a Duplex stream - // where the writable side was disabled upon construction. - // Compat. The user might manually disable writable side through - // deprecated setter. - return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended - }, - set(val) { - // Backwards compatible. - if (this._writableState) { - this._writableState.writable = !!val - } - } - }, - writableFinished: { - __proto__: null, - get() { - return this._writableState ? this._writableState.finished : false - } - }, - writableObjectMode: { - __proto__: null, - get() { - return this._writableState ? this._writableState.objectMode : false - } - }, - writableBuffer: { - __proto__: null, - get() { - return this._writableState && this._writableState.getBuffer() - } - }, - writableEnded: { - __proto__: null, - get() { - return this._writableState ? this._writableState.ending : false - } - }, - writableNeedDrain: { - __proto__: null, - get() { - const wState = this._writableState - if (!wState) return false - return !wState.destroyed && !wState.ending && wState.needDrain - } - }, - writableHighWaterMark: { - __proto__: null, - get() { - return this._writableState && this._writableState.highWaterMark - } - }, - writableCorked: { - __proto__: null, - get() { - return this._writableState ? this._writableState.corked : 0 - } - }, - writableLength: { - __proto__: null, - get() { - return this._writableState && this._writableState.length - } - }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._writableState ? this._writableState.errored : null - } - }, - writableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._writableState.writable !== false && - (this._writableState.destroyed || this._writableState.errored) && - !this._writableState.finished - ) - } - } -}) -const destroy = destroyImpl.destroy -Writable.prototype.destroy = function (err, cb) { - const state = this._writableState - - // Invoke pending callbacks. - if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) { - process.nextTick(errorBuffer, state) - } - destroy.call(this, err, cb) - return this -} -Writable.prototype._undestroy = destroyImpl.undestroy -Writable.prototype._destroy = function (err, cb) { - cb(err) -} -Writable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) -} -let webStreamsAdapters - -// Lazy to avoid circular references -function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters -} -Writable.fromWeb = function (writableStream, options) { - return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options) -} -Writable.toWeb = function (streamWritable) { - return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable) -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js": -/*!******************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js ***! - \******************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* eslint jsdoc/require-jsdoc: "error" */ - - - -const { - ArrayIsArray, - ArrayPrototypeIncludes, - ArrayPrototypeJoin, - ArrayPrototypeMap, - NumberIsInteger, - NumberIsNaN, - NumberMAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER, - NumberParseInt, - ObjectPrototypeHasOwnProperty, - RegExpPrototypeExec, - String, - StringPrototypeToUpperCase, - StringPrototypeTrim -} = __webpack_require__(/*! ../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { - hideStackFrames, - codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL } -} = __webpack_require__(/*! ../ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const { normalizeEncoding } = __webpack_require__(/*! ../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") -const { isAsyncFunction, isArrayBufferView } = (__webpack_require__(/*! ../ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js").types) -const signals = {} - -/** - * @param {*} value - * @returns {boolean} - */ -function isInt32(value) { - return value === (value | 0) -} - -/** - * @param {*} value - * @returns {boolean} - */ -function isUint32(value) { - return value === value >>> 0 -} -const octalReg = /^[0-7]+$/ -const modeDesc = 'must be a 32-bit unsigned integer or an octal string' - -/** - * Parse and validate values that will be converted into mode_t (the S_* - * constants). Only valid numbers and octal strings are allowed. They could be - * converted to 32-bit unsigned integers or non-negative signed integers in the - * C++ land, but any value higher than 0o777 will result in platform-specific - * behaviors. - * @param {*} value Values to be validated - * @param {string} name Name of the argument - * @param {number} [def] If specified, will be returned for invalid values - * @returns {number} - */ -function parseFileMode(value, name, def) { - if (typeof value === 'undefined') { - value = def - } - if (typeof value === 'string') { - if (RegExpPrototypeExec(octalReg, value) === null) { - throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc) - } - value = NumberParseInt(value, 8) - } - validateUint32(value, name) - return value -} - -/** - * @callback validateInteger - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - -/** @type {validateInteger} */ -const validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) -}) - -/** - * @callback validateInt32 - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - -/** @type {validateInt32} */ -const validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => { - // The defaults for min and max correspond to the limits of 32-bit integers. - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - } - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) - } -}) - -/** - * @callback validateUint32 - * @param {*} value - * @param {string} name - * @param {number|boolean} [positive=false] - * @returns {asserts value is number} - */ - -/** @type {validateUint32} */ -const validateUint32 = hideStackFrames((value, name, positive = false) => { - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - } - const min = positive ? 1 : 0 - // 2 ** 32 === 4294967296 - const max = 4294967295 - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) - } -}) - -/** - * @callback validateString - * @param {*} value - * @param {string} name - * @returns {asserts value is string} - */ - -/** @type {validateString} */ -function validateString(value, name) { - if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value) -} - -/** - * @callback validateNumber - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - -/** @type {validateNumber} */ -function validateNumber(value, name, min = undefined, max) { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if ( - (min != null && value < min) || - (max != null && value > max) || - ((min != null || max != null) && NumberIsNaN(value)) - ) { - throw new ERR_OUT_OF_RANGE( - name, - `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`, - value - ) - } -} - -/** - * @callback validateOneOf - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} oneOf - */ - -/** @type {validateOneOf} */ -const validateOneOf = hideStackFrames((value, name, oneOf) => { - if (!ArrayPrototypeIncludes(oneOf, value)) { - const allowed = ArrayPrototypeJoin( - ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))), - ', ' - ) - const reason = 'must be one of: ' + allowed - throw new ERR_INVALID_ARG_VALUE(name, value, reason) - } -}) - -/** - * @callback validateBoolean - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean} - */ - -/** @type {validateBoolean} */ -function validateBoolean(value, name) { - if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value) -} - -/** - * @param {any} options - * @param {string} key - * @param {boolean} defaultValue - * @returns {boolean} - */ -function getOwnPropertyValueOrDefault(options, key, defaultValue) { - return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key] -} - -/** - * @callback validateObject - * @param {*} value - * @param {string} name - * @param {{ - * allowArray?: boolean, - * allowFunction?: boolean, - * nullable?: boolean - * }} [options] - */ - -/** @type {validateObject} */ -const validateObject = hideStackFrames((value, name, options = null) => { - const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false) - const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false) - const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false) - if ( - (!nullable && value === null) || - (!allowArray && ArrayIsArray(value)) || - (typeof value !== 'object' && (!allowFunction || typeof value !== 'function')) - ) { - throw new ERR_INVALID_ARG_TYPE(name, 'Object', value) - } -}) - -/** - * @callback validateDictionary - We are using the Web IDL Standard definition - * of "dictionary" here, which means any value - * whose Type is either Undefined, Null, or - * Object (which includes functions). - * @param {*} value - * @param {string} name - * @see https://webidl.spec.whatwg.org/#es-dictionary - * @see https://tc39.es/ecma262/#table-typeof-operator-results - */ - -/** @type {validateDictionary} */ -const validateDictionary = hideStackFrames((value, name) => { - if (value != null && typeof value !== 'object' && typeof value !== 'function') { - throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value) - } -}) - -/** - * @callback validateArray - * @param {*} value - * @param {string} name - * @param {number} [minLength] - * @returns {asserts value is any[]} - */ - -/** @type {validateArray} */ -const validateArray = hideStackFrames((value, name, minLength = 0) => { - if (!ArrayIsArray(value)) { - throw new ERR_INVALID_ARG_TYPE(name, 'Array', value) - } - if (value.length < minLength) { - const reason = `must be longer than ${minLength}` - throw new ERR_INVALID_ARG_VALUE(name, value, reason) - } -}) - -/** - * @callback validateStringArray - * @param {*} value - * @param {string} name - * @returns {asserts value is string[]} - */ - -/** @type {validateStringArray} */ -function validateStringArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateString(value[i], `${name}[${i}]`) - } -} - -/** - * @callback validateBooleanArray - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean[]} - */ - -/** @type {validateBooleanArray} */ -function validateBooleanArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateBoolean(value[i], `${name}[${i}]`) - } -} - -/** - * @callback validateAbortSignalArray - * @param {*} value - * @param {string} name - * @returns {asserts value is AbortSignal[]} - */ - -/** @type {validateAbortSignalArray} */ -function validateAbortSignalArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - const signal = value[i] - const indexedName = `${name}[${i}]` - if (signal == null) { - throw new ERR_INVALID_ARG_TYPE(indexedName, 'AbortSignal', signal) - } - validateAbortSignal(signal, indexedName) - } -} - -/** - * @param {*} signal - * @param {string} [name='signal'] - * @returns {asserts signal is keyof signals} - */ -function validateSignalName(signal, name = 'signal') { - validateString(signal, name) - if (signals[signal] === undefined) { - if (signals[StringPrototypeToUpperCase(signal)] !== undefined) { - throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)') - } - throw new ERR_UNKNOWN_SIGNAL(signal) - } -} - -/** - * @callback validateBuffer - * @param {*} buffer - * @param {string} [name='buffer'] - * @returns {asserts buffer is ArrayBufferView} - */ - -/** @type {validateBuffer} */ -const validateBuffer = hideStackFrames((buffer, name = 'buffer') => { - if (!isArrayBufferView(buffer)) { - throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer) - } -}) - -/** - * @param {string} data - * @param {string} encoding - */ -function validateEncoding(data, encoding) { - const normalizedEncoding = normalizeEncoding(encoding) - const length = data.length - if (normalizedEncoding === 'hex' && length % 2 !== 0) { - throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`) - } -} - -/** - * Check that the port number is not NaN when coerced to a number, - * is an integer and that it falls within the legal range of port numbers. - * @param {*} port - * @param {string} [name='Port'] - * @param {boolean} [allowZero=true] - * @returns {number} - */ -function validatePort(port, name = 'Port', allowZero = true) { - if ( - (typeof port !== 'number' && typeof port !== 'string') || - (typeof port === 'string' && StringPrototypeTrim(port).length === 0) || - +port !== +port >>> 0 || - port > 0xffff || - (port === 0 && !allowZero) - ) { - throw new ERR_SOCKET_BAD_PORT(name, port, allowZero) - } - return port | 0 -} - -/** - * @callback validateAbortSignal - * @param {*} signal - * @param {string} name - */ - -/** @type {validateAbortSignal} */ -const validateAbortSignal = hideStackFrames((signal, name) => { - if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } -}) - -/** - * @callback validateFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - -/** @type {validateFunction} */ -const validateFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) -}) - -/** - * @callback validatePlainFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - -/** @type {validatePlainFunction} */ -const validatePlainFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) -}) - -/** - * @callback validateUndefined - * @param {*} value - * @param {string} name - * @returns {asserts value is undefined} - */ - -/** @type {validateUndefined} */ -const validateUndefined = hideStackFrames((value, name) => { - if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value) -}) - -/** - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} union - */ -function validateUnion(value, name, union) { - if (!ArrayPrototypeIncludes(union, value)) { - throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value) - } -} - -/* - The rules for the Link header field are described here: - https://www.rfc-editor.org/rfc/rfc8288.html#section-3 - - This regex validates any string surrounded by angle brackets - (not necessarily a valid URI reference) followed by zero or more - link-params separated by semicolons. -*/ -const linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/ - -/** - * @param {any} value - * @param {string} name - */ -function validateLinkHeaderFormat(value, name) { - if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) { - throw new ERR_INVALID_ARG_VALUE( - name, - value, - 'must be an array or string of format "; rel=preload; as=style"' - ) - } -} - -/** - * @param {any} hints - * @return {string} - */ -function validateLinkHeaderValue(hints) { - if (typeof hints === 'string') { - validateLinkHeaderFormat(hints, 'hints') - return hints - } else if (ArrayIsArray(hints)) { - const hintsLength = hints.length - let result = '' - if (hintsLength === 0) { - return result - } - for (let i = 0; i < hintsLength; i++) { - const link = hints[i] - validateLinkHeaderFormat(link, 'hints') - result += link - if (i !== hintsLength - 1) { - result += ', ' - } - } - return result - } - throw new ERR_INVALID_ARG_VALUE( - 'hints', - hints, - 'must be an array or string of format "; rel=preload; as=style"' - ) -} -module.exports = { - isInt32, - isUint32, - parseFileMode, - validateArray, - validateStringArray, - validateBooleanArray, - validateAbortSignalArray, - validateBoolean, - validateBuffer, - validateDictionary, - validateEncoding, - validateFunction, - validateInt32, - validateInteger, - validateNumber, - validateObject, - validateOneOf, - validatePlainFunction, - validatePort, - validateSignalName, - validateString, - validateUint32, - validateUndefined, - validateUnion, - validateAbortSignal, - validateLinkHeaderValue -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/browser.js": -/*!***********************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/browser.js ***! - \***********************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const CustomStream = __webpack_require__(/*! ../stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream.js") -const promises = __webpack_require__(/*! ../stream/promises */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream/promises.js") -const originalDestroy = CustomStream.Readable.destroy -module.exports = CustomStream.Readable - -// Explicit export naming is needed for ESM -module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer -module.exports._isUint8Array = CustomStream._isUint8Array -module.exports.isDisturbed = CustomStream.isDisturbed -module.exports.isErrored = CustomStream.isErrored -module.exports.isReadable = CustomStream.isReadable -module.exports.Readable = CustomStream.Readable -module.exports.Writable = CustomStream.Writable -module.exports.Duplex = CustomStream.Duplex -module.exports.Transform = CustomStream.Transform -module.exports.PassThrough = CustomStream.PassThrough -module.exports.addAbortSignal = CustomStream.addAbortSignal -module.exports.finished = CustomStream.finished -module.exports.destroy = CustomStream.destroy -module.exports.destroy = originalDestroy -module.exports.pipeline = CustomStream.pipeline -module.exports.compose = CustomStream.compose -Object.defineProperty(CustomStream, 'promises', { - configurable: true, - enumerable: true, - get() { - return promises - } -}) -module.exports.Stream = CustomStream.Stream - -// Allow default importing -module.exports["default"] = module.exports - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js": -/*!**********************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js ***! - \**********************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { format, inspect, AggregateError: CustomAggregateError } = __webpack_require__(/*! ./util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") - -/* - This file is a reduced and adapted version of the main lib/internal/errors.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/errors.js - - Don't try to replace with the original file and keep it up to date (starting from E(...) definitions) - with the upstream file. -*/ - -const AggregateError = globalThis.AggregateError || CustomAggregateError -const kIsNodeError = Symbol('kIsNodeError') -const kTypes = [ - 'string', - 'function', - 'number', - 'object', - // Accept 'Function' and 'Object' as alternative to the lower cased version. - 'Function', - 'Object', - 'boolean', - 'bigint', - 'symbol' -] -const classRegExp = /^([A-Z][a-z0-9]*)+$/ -const nodeInternalPrefix = '__node_internal_' -const codes = {} -function assert(value, message) { - if (!value) { - throw new codes.ERR_INTERNAL_ASSERTION(message) - } -} - -// Only use this for integers! Decimal numbers do not work with this function. -function addNumericalSeparator(val) { - let res = '' - let i = val.length - const start = val[0] === '-' ? 1 : 0 - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}` - } - return `${val.slice(0, i)}${res}` -} -function getMessage(key, msg, args) { - if (typeof msg === 'function') { - assert( - msg.length <= args.length, - // Default options do not count. - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).` - ) - return msg(...args) - } - const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length - assert( - expectedLength === args.length, - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` - ) - if (args.length === 0) { - return msg - } - return format(msg, ...args) -} -function E(code, message, Base) { - if (!Base) { - Base = Error - } - class NodeError extends Base { - constructor(...args) { - super(getMessage(code, message, args)) - } - toString() { - return `${this.name} [${code}]: ${this.message}` - } - } - Object.defineProperties(NodeError.prototype, { - name: { - value: Base.name, - writable: true, - enumerable: false, - configurable: true - }, - toString: { - value() { - return `${this.name} [${code}]: ${this.message}` - }, - writable: true, - enumerable: false, - configurable: true - } - }) - NodeError.prototype.code = code - NodeError.prototype[kIsNodeError] = true - codes[code] = NodeError -} -function hideStackFrames(fn) { - // We rename the functions that will be hidden to cut off the stacktrace - // at the outermost one - const hidden = nodeInternalPrefix + fn.name - Object.defineProperty(fn, 'name', { - value: hidden - }) - return fn -} -function aggregateTwoErrors(innerError, outerError) { - if (innerError && outerError && innerError !== outerError) { - if (Array.isArray(outerError.errors)) { - // If `outerError` is already an `AggregateError`. - outerError.errors.push(innerError) - return outerError - } - const err = new AggregateError([outerError, innerError], outerError.message) - err.code = outerError.code - return err - } - return innerError || outerError -} -class AbortError extends Error { - constructor(message = 'The operation was aborted', options = undefined) { - if (options !== undefined && typeof options !== 'object') { - throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options) - } - super(message, options) - this.code = 'ABORT_ERR' - this.name = 'AbortError' - } -} -E('ERR_ASSERTION', '%s', Error) -E( - 'ERR_INVALID_ARG_TYPE', - (name, expected, actual) => { - assert(typeof name === 'string', "'name' must be a string") - if (!Array.isArray(expected)) { - expected = [expected] - } - let msg = 'The ' - if (name.endsWith(' argument')) { - // For cases like 'first argument' - msg += `${name} ` - } else { - msg += `"${name}" ${name.includes('.') ? 'property' : 'argument'} ` - } - msg += 'must be ' - const types = [] - const instances = [] - const other = [] - for (const value of expected) { - assert(typeof value === 'string', 'All expected entries have to be of type string') - if (kTypes.includes(value)) { - types.push(value.toLowerCase()) - } else if (classRegExp.test(value)) { - instances.push(value) - } else { - assert(value !== 'object', 'The value "object" should be written as "Object"') - other.push(value) - } - } - - // Special handle `object` in case other instances are allowed to outline - // the differences between each other. - if (instances.length > 0) { - const pos = types.indexOf('object') - if (pos !== -1) { - types.splice(types, pos, 1) - instances.push('Object') - } - } - if (types.length > 0) { - switch (types.length) { - case 1: - msg += `of type ${types[0]}` - break - case 2: - msg += `one of type ${types[0]} or ${types[1]}` - break - default: { - const last = types.pop() - msg += `one of type ${types.join(', ')}, or ${last}` - } - } - if (instances.length > 0 || other.length > 0) { - msg += ' or ' - } - } - if (instances.length > 0) { - switch (instances.length) { - case 1: - msg += `an instance of ${instances[0]}` - break - case 2: - msg += `an instance of ${instances[0]} or ${instances[1]}` - break - default: { - const last = instances.pop() - msg += `an instance of ${instances.join(', ')}, or ${last}` - } - } - if (other.length > 0) { - msg += ' or ' - } - } - switch (other.length) { - case 0: - break - case 1: - if (other[0].toLowerCase() !== other[0]) { - msg += 'an ' - } - msg += `${other[0]}` - break - case 2: - msg += `one of ${other[0]} or ${other[1]}` - break - default: { - const last = other.pop() - msg += `one of ${other.join(', ')}, or ${last}` - } - } - if (actual == null) { - msg += `. Received ${actual}` - } else if (typeof actual === 'function' && actual.name) { - msg += `. Received function ${actual.name}` - } else if (typeof actual === 'object') { - var _actual$constructor - if ( - (_actual$constructor = actual.constructor) !== null && - _actual$constructor !== undefined && - _actual$constructor.name - ) { - msg += `. Received an instance of ${actual.constructor.name}` - } else { - const inspected = inspect(actual, { - depth: -1 - }) - msg += `. Received ${inspected}` - } - } else { - let inspected = inspect(actual, { - colors: false - }) - if (inspected.length > 25) { - inspected = `${inspected.slice(0, 25)}...` - } - msg += `. Received type ${typeof actual} (${inspected})` - } - return msg - }, - TypeError -) -E( - 'ERR_INVALID_ARG_VALUE', - (name, value, reason = 'is invalid') => { - let inspected = inspect(value) - if (inspected.length > 128) { - inspected = inspected.slice(0, 128) + '...' - } - const type = name.includes('.') ? 'property' : 'argument' - return `The ${type} '${name}' ${reason}. Received ${inspected}` - }, - TypeError -) -E( - 'ERR_INVALID_RETURN_VALUE', - (input, name, value) => { - var _value$constructor - const type = - value !== null && - value !== undefined && - (_value$constructor = value.constructor) !== null && - _value$constructor !== undefined && - _value$constructor.name - ? `instance of ${value.constructor.name}` - : `type ${typeof value}` - return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.` - }, - TypeError -) -E( - 'ERR_MISSING_ARGS', - (...args) => { - assert(args.length > 0, 'At least one arg needs to be specified') - let msg - const len = args.length - args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`).join(' or ') - switch (len) { - case 1: - msg += `The ${args[0]} argument` - break - case 2: - msg += `The ${args[0]} and ${args[1]} arguments` - break - default: - { - const last = args.pop() - msg += `The ${args.join(', ')}, and ${last} arguments` - } - break - } - return `${msg} must be specified` - }, - TypeError -) -E( - 'ERR_OUT_OF_RANGE', - (str, range, input) => { - assert(range, 'Missing "range" argument') - let received - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)) - } else if (typeof input === 'bigint') { - received = String(input) - if (input > 2n ** 32n || input < -(2n ** 32n)) { - received = addNumericalSeparator(received) - } - received += 'n' - } else { - received = inspect(input) - } - return `The value of "${str}" is out of range. It must be ${range}. Received ${received}` - }, - RangeError -) -E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error) -E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error) -E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error) -E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error) -E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error) -E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError) -E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error) -E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error) -E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error) -E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error) -E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError) -module.exports = { - AbortError, - aggregateTwoErrors: hideStackFrames(aggregateTwoErrors), - hideStackFrames, - codes -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js": -/*!***************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js ***! - \***************************************************************************************************/ -/***/ (function(module) { - -"use strict"; - - -/* - This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js - - Don't try to replace with the original file and keep it up to date with the upstream file. -*/ -module.exports = { - ArrayIsArray(self) { - return Array.isArray(self) - }, - ArrayPrototypeIncludes(self, el) { - return self.includes(el) - }, - ArrayPrototypeIndexOf(self, el) { - return self.indexOf(el) - }, - ArrayPrototypeJoin(self, sep) { - return self.join(sep) - }, - ArrayPrototypeMap(self, fn) { - return self.map(fn) - }, - ArrayPrototypePop(self, el) { - return self.pop(el) - }, - ArrayPrototypePush(self, el) { - return self.push(el) - }, - ArrayPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - Error, - FunctionPrototypeCall(fn, thisArgs, ...args) { - return fn.call(thisArgs, ...args) - }, - FunctionPrototypeSymbolHasInstance(self, instance) { - return Function.prototype[Symbol.hasInstance].call(self, instance) - }, - MathFloor: Math.floor, - Number, - NumberIsInteger: Number.isInteger, - NumberIsNaN: Number.isNaN, - NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER, - NumberParseInt: Number.parseInt, - ObjectDefineProperties(self, props) { - return Object.defineProperties(self, props) - }, - ObjectDefineProperty(self, name, prop) { - return Object.defineProperty(self, name, prop) - }, - ObjectGetOwnPropertyDescriptor(self, name) { - return Object.getOwnPropertyDescriptor(self, name) - }, - ObjectKeys(obj) { - return Object.keys(obj) - }, - ObjectSetPrototypeOf(target, proto) { - return Object.setPrototypeOf(target, proto) - }, - Promise, - PromisePrototypeCatch(self, fn) { - return self.catch(fn) - }, - PromisePrototypeThen(self, thenFn, catchFn) { - return self.then(thenFn, catchFn) - }, - PromiseReject(err) { - return Promise.reject(err) - }, - PromiseResolve(val) { - return Promise.resolve(val) - }, - ReflectApply: Reflect.apply, - RegExpPrototypeTest(self, value) { - return self.test(value) - }, - SafeSet: Set, - String, - StringPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - StringPrototypeToLowerCase(self) { - return self.toLowerCase() - }, - StringPrototypeToUpperCase(self) { - return self.toUpperCase() - }, - StringPrototypeTrim(self) { - return self.trim() - }, - Symbol, - SymbolFor: Symbol.for, - SymbolAsyncIterator: Symbol.asyncIterator, - SymbolHasInstance: Symbol.hasInstance, - SymbolIterator: Symbol.iterator, - SymbolDispose: Symbol.dispose || Symbol('Symbol.dispose'), - SymbolAsyncDispose: Symbol.asyncDispose || Symbol('Symbol.asyncDispose'), - TypedArrayPrototypeSet(self, buf, len) { - return self.set(buf, len) - }, - Boolean: Boolean, - Uint8Array -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js": -/*!********************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js ***! - \********************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const bufferModule = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { kResistStopPropagation, SymbolDispose } = __webpack_require__(/*! ./primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const AbortSignal = globalThis.AbortSignal || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortSignal) -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor -const Blob = globalThis.Blob || bufferModule.Blob -/* eslint-disable indent */ -const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - // eslint-disable-next-line indent - return b instanceof Blob - } - : function isBlob(b) { - return false - } -/* eslint-enable indent */ - -const validateAbortSignal = (signal, name) => { - if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } -} -const validateFunction = (value, name) => { - if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) -} - -// This is a simplified version of AggregateError -class AggregateError extends Error { - constructor(errors) { - if (!Array.isArray(errors)) { - throw new TypeError(`Expected input to be an Array, got ${typeof errors}`) - } - let message = '' - for (let i = 0; i < errors.length; i++) { - message += ` ${errors[i].stack}\n` - } - super(message) - this.name = 'AggregateError' - this.errors = errors - } -} -module.exports = { - AggregateError, - kEmptyObject: Object.freeze({}), - once(callback) { - let called = false - return function (...args) { - if (called) { - return - } - called = true - callback.apply(this, args) - } - }, - createDeferredPromise: function () { - let resolve - let reject - - // eslint-disable-next-line promise/param-names - const promise = new Promise((res, rej) => { - resolve = res - reject = rej - }) - return { - promise, - resolve, - reject - } - }, - promisify(fn) { - return new Promise((resolve, reject) => { - fn((err, ...args) => { - if (err) { - return reject(err) - } - return resolve(...args) - }) - }) - }, - debuglog() { - return function () {} - }, - format(format, ...args) { - // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args - return format.replace(/%([sdifj])/g, function (...[_unused, type]) { - const replacement = args.shift() - if (type === 'f') { - return replacement.toFixed(6) - } else if (type === 'j') { - return JSON.stringify(replacement) - } else if (type === 's' && typeof replacement === 'object') { - const ctor = replacement.constructor !== Object ? replacement.constructor.name : '' - return `${ctor} {}`.trim() - } else { - return replacement.toString() - } - }) - }, - inspect(value) { - // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options - switch (typeof value) { - case 'string': - if (value.includes("'")) { - if (!value.includes('"')) { - return `"${value}"` - } else if (!value.includes('`') && !value.includes('${')) { - return `\`${value}\`` - } - } - return `'${value}'` - case 'number': - if (isNaN(value)) { - return 'NaN' - } else if (Object.is(value, -0)) { - return String(value) - } - return value - case 'bigint': - return `${String(value)}n` - case 'boolean': - case 'undefined': - return String(value) - case 'object': - return '{}' - } - }, - types: { - isAsyncFunction(fn) { - return fn instanceof AsyncFunction - }, - isArrayBufferView(arr) { - return ArrayBuffer.isView(arr) - } - }, - isBlob, - deprecate(fn, message) { - return fn - }, - addAbortListener: - (__webpack_require__(/*! events */ "./node_modules/events/events.js").addAbortListener) || - function addAbortListener(signal, listener) { - if (signal === undefined) { - throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal) - } - validateAbortSignal(signal, 'signal') - validateFunction(listener, 'listener') - let removeEventListener - if (signal.aborted) { - queueMicrotask(() => listener()) - } else { - signal.addEventListener('abort', listener, { - __proto__: null, - once: true, - [kResistStopPropagation]: true - }) - removeEventListener = () => { - signal.removeEventListener('abort', listener) - } - } - return { - __proto__: null, - [SymbolDispose]() { - var _removeEventListener - ;(_removeEventListener = removeEventListener) === null || _removeEventListener === undefined - ? undefined - : _removeEventListener() - } - } - }, - AbortSignalAny: - AbortSignal.any || - function AbortSignalAny(signals) { - // Fast path if there is only one signal. - if (signals.length === 1) { - return signals[0] - } - const ac = new AbortController() - const abort = () => ac.abort() - signals.forEach((signal) => { - validateAbortSignal(signal, 'signals') - signal.addEventListener('abort', abort, { - once: true - }) - }) - ac.signal.addEventListener( - 'abort', - () => { - signals.forEach((signal) => signal.removeEventListener('abort', abort)) - }, - { - once: true - } - ) - return ac.signal - } -} -module.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom') - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream.js": -/*!*****************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream.js ***! - \*****************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") - -/* replacement end */ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -;('use strict') -const { ObjectDefineProperty, ObjectKeys, ReflectApply } = __webpack_require__(/*! ./ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { - promisify: { custom: customPromisify } -} = __webpack_require__(/*! ./ours/util */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js") -const { streamReturningOperators, promiseReturningOperators } = __webpack_require__(/*! ./internal/streams/operators */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/operators.js") -const { - codes: { ERR_ILLEGAL_CONSTRUCTOR } -} = __webpack_require__(/*! ./ours/errors */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js") -const compose = __webpack_require__(/*! ./internal/streams/compose */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/compose.js") -const { setDefaultHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(/*! ./internal/streams/state */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/state.js") -const { pipeline } = __webpack_require__(/*! ./internal/streams/pipeline */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/pipeline.js") -const { destroyer } = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js") -const eos = __webpack_require__(/*! ./internal/streams/end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const internalBuffer = {} -const promises = __webpack_require__(/*! ./stream/promises */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream/promises.js") -const utils = __webpack_require__(/*! ./internal/streams/utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const Stream = (module.exports = __webpack_require__(/*! ./internal/streams/legacy */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/legacy.js").Stream) -Stream.isDestroyed = utils.isDestroyed -Stream.isDisturbed = utils.isDisturbed -Stream.isErrored = utils.isErrored -Stream.isReadable = utils.isReadable -Stream.isWritable = utils.isWritable -Stream.Readable = __webpack_require__(/*! ./internal/streams/readable */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/readable.js") -for (const key of ObjectKeys(streamReturningOperators)) { - const op = streamReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() - } - return Stream.Readable.from(ReflectApply(op, this, args)) - } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name - }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length - }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true - }) -} -for (const key of ObjectKeys(promiseReturningOperators)) { - const op = promiseReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() - } - return ReflectApply(op, this, args) - } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name - }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length - }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true - }) -} -Stream.Writable = __webpack_require__(/*! ./internal/streams/writable */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/writable.js") -Stream.Duplex = __webpack_require__(/*! ./internal/streams/duplex */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js") -Stream.Transform = __webpack_require__(/*! ./internal/streams/transform */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/transform.js") -Stream.PassThrough = __webpack_require__(/*! ./internal/streams/passthrough */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/passthrough.js") -Stream.pipeline = pipeline -const { addAbortSignal } = __webpack_require__(/*! ./internal/streams/add-abort-signal */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -Stream.addAbortSignal = addAbortSignal -Stream.finished = eos -Stream.destroy = destroyer -Stream.compose = compose -Stream.setDefaultHighWaterMark = setDefaultHighWaterMark -Stream.getDefaultHighWaterMark = getDefaultHighWaterMark -ObjectDefineProperty(Stream, 'promises', { - __proto__: null, - configurable: true, - enumerable: true, - get() { - return promises - } -}) -ObjectDefineProperty(pipeline, customPromisify, { - __proto__: null, - enumerable: true, - get() { - return promises.pipeline - } -}) -ObjectDefineProperty(eos, customPromisify, { - __proto__: null, - enumerable: true, - get() { - return promises.finished - } -}) - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream -Stream._isUint8Array = function isUint8Array(value) { - return value instanceof Uint8Array -} -Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream/promises.js": -/*!**************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream/promises.js ***! - \**************************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { ArrayPrototypePop, Promise } = __webpack_require__(/*! ../ours/primordials */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js") -const { isIterable, isNodeStream, isWebStream } = __webpack_require__(/*! ../internal/streams/utils */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js") -const { pipelineImpl: pl } = __webpack_require__(/*! ../internal/streams/pipeline */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/pipeline.js") -const { finished } = __webpack_require__(/*! ../internal/streams/end-of-stream */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -__webpack_require__(/*! ../../lib/stream.js */ "./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream.js") -function pipeline(...streams) { - return new Promise((resolve, reject) => { - let signal - let end - const lastArg = streams[streams.length - 1] - if ( - lastArg && - typeof lastArg === 'object' && - !isNodeStream(lastArg) && - !isIterable(lastArg) && - !isWebStream(lastArg) - ) { - const options = ArrayPrototypePop(streams) - signal = options.signal - end = options.end - } - pl( - streams, - (err, value) => { - if (err) { - reject(err) - } else { - resolve(value) - } - }, - { - signal, - end - } - ) - }) -} -module.exports = { - finished, - pipeline -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/safe-buffer/index.js": -/*!********************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/safe-buffer/index.js ***! - \********************************************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -/*! safe-buffer. MIT License. Feross Aboukhadijeh */ -/* eslint-disable node/no-deprecated-api */ -var buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.prototype = Object.create(Buffer.prototype) - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - - -/***/ }), - -/***/ "./node_modules/jsonld-streaming-parser/node_modules/string_decoder/lib/string_decoder.js": -/*!************************************************************************************************!*\ - !*** ./node_modules/jsonld-streaming-parser/node_modules/string_decoder/lib/string_decoder.js ***! - \************************************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -/**/ - -var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/jsonld-streaming-parser/node_modules/safe-buffer/index.js").Buffer); -/**/ - -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; - -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; - -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} - -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; - -StringDecoder.prototype.end = utf8End; - -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; - -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; - -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} - -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; - } - return 0; -} - -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} - -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} - -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} - -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} - -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} - -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} - -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} - -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} - -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} - -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js": -/*!***********************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js ***! - \***********************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { SymbolDispose } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { AbortError, codes } = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { isNodeStream, isWebStream, kControllerErrorFunction } = __webpack_require__(/*! ./utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const { ERR_INVALID_ARG_TYPE } = codes -let addAbortListener - -// This method is inlined here for readable-stream -// It also does not allow for signal to not exist on the stream -// https://github.com/nodejs/node/pull/36061#discussion_r533718029 -const validateAbortSignal = (signal, name) => { - if (typeof signal !== 'object' || !('aborted' in signal)) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } -} -module.exports.addAbortSignal = function addAbortSignal(signal, stream) { - validateAbortSignal(signal, 'signal') - if (!isNodeStream(stream) && !isWebStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) - } - return module.exports.addAbortSignalNoValidate(signal, stream) -} -module.exports.addAbortSignalNoValidate = function (signal, stream) { - if (typeof signal !== 'object' || !('aborted' in signal)) { - return stream - } - const onAbort = isNodeStream(stream) - ? () => { - stream.destroy( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } - : () => { - stream[kControllerErrorFunction]( - new AbortError(undefined, { - cause: signal.reason - }) - ) - } - if (signal.aborted) { - onAbort() - } else { - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - const disposable = addAbortListener(signal, onAbort) - eos(stream, disposable[SymbolDispose]) - } - return stream -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/buffer_list.js": -/*!******************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/buffer_list.js ***! - \******************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { inspect } = __webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") -module.exports = class BufferList { - constructor() { - this.head = null - this.tail = null - this.length = 0 - } - push(v) { - const entry = { - data: v, - next: null - } - if (this.length > 0) this.tail.next = entry - else this.head = entry - this.tail = entry - ++this.length - } - unshift(v) { - const entry = { - data: v, - next: this.head - } - if (this.length === 0) this.tail = entry - this.head = entry - ++this.length - } - shift() { - if (this.length === 0) return - const ret = this.head.data - if (this.length === 1) this.head = this.tail = null - else this.head = this.head.next - --this.length - return ret - } - clear() { - this.head = this.tail = null - this.length = 0 - } - join(s) { - if (this.length === 0) return '' - let p = this.head - let ret = '' + p.data - while ((p = p.next) !== null) ret += s + p.data - return ret - } - concat(n) { - if (this.length === 0) return Buffer.alloc(0) - const ret = Buffer.allocUnsafe(n >>> 0) - let p = this.head - let i = 0 - while (p) { - TypedArrayPrototypeSet(ret, p.data, i) - i += p.data.length - p = p.next - } - return ret - } - - // Consumes a specified amount of bytes or characters from the buffered data. - consume(n, hasStrings) { - const data = this.head.data - if (n < data.length) { - // `slice` is the same for buffers and strings. - const slice = data.slice(0, n) - this.head.data = data.slice(n) - return slice - } - if (n === data.length) { - // First chunk is a perfect match. - return this.shift() - } - // Result spans more than one buffer. - return hasStrings ? this._getString(n) : this._getBuffer(n) - } - first() { - return this.head.data - } - *[SymbolIterator]() { - for (let p = this.head; p; p = p.next) { - yield p.data - } - } - - // Consumes a specified amount of characters from the buffered data. - _getString(n) { - let ret = '' - let p = this.head - let c = 0 - do { - const str = p.data - if (n > str.length) { - ret += str - n -= str.length - } else { - if (n === str.length) { - ret += str - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - ret += StringPrototypeSlice(str, 0, n) - this.head = p - p.data = StringPrototypeSlice(str, n) - } - break - } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret - } - - // Consumes a specified amount of bytes from the buffered data. - _getBuffer(n) { - const ret = Buffer.allocUnsafe(n) - const retLen = n - let p = this.head - let c = 0 - do { - const buf = p.data - if (n > buf.length) { - TypedArrayPrototypeSet(ret, buf, retLen - n) - n -= buf.length - } else { - if (n === buf.length) { - TypedArrayPrototypeSet(ret, buf, retLen - n) - ++c - if (p.next) this.head = p.next - else this.head = this.tail = null - } else { - TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n) - this.head = p - p.data = buf.slice(n) - } - break - } - ++c - } while ((p = p.next) !== null) - this.length -= c - return ret - } - - // Make sure the linked list only shows the minimal necessary information. - [Symbol.for('nodejs.util.inspect.custom')](_, options) { - return inspect(this, { - ...options, - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - }) - } -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/compose.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/compose.js ***! - \**************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { pipeline } = __webpack_require__(/*! ./pipeline */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/pipeline.js") -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") -const { destroyer } = __webpack_require__(/*! ./destroy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js") -const { - isNodeStream, - isReadable, - isWritable, - isWebStream, - isTransformStream, - isWritableStream, - isReadableStream -} = __webpack_require__(/*! ./utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const { - AbortError, - codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS } -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -module.exports = function compose(...streams) { - if (streams.length === 0) { - throw new ERR_MISSING_ARGS('streams') - } - if (streams.length === 1) { - return Duplex.from(streams[0]) - } - const orgStreams = [...streams] - if (typeof streams[0] === 'function') { - streams[0] = Duplex.from(streams[0]) - } - if (typeof streams[streams.length - 1] === 'function') { - const idx = streams.length - 1 - streams[idx] = Duplex.from(streams[idx]) - } - for (let n = 0; n < streams.length; ++n) { - if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) { - // TODO(ronag): Add checks for non streams. - continue - } - if ( - n < streams.length - 1 && - !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n])) - ) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable') - } - if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) { - throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable') - } - } - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } else if (!readable && !writable) { - d.destroy() - } - } - const head = streams[0] - const tail = pipeline(streams, onfinished) - const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head)) - const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail)) - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplex({ - // TODO (ronag): highWaterMark? - writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode), - readableObjectMode: !!(tail !== null && tail !== undefined && tail.readableObjectMode), - writable, - readable - }) - if (writable) { - if (isNodeStream(head)) { - d._write = function (chunk, encoding, callback) { - if (head.write(chunk, encoding)) { - callback() - } else { - ondrain = callback - } - } - d._final = function (callback) { - head.end() - onfinish = callback - } - head.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() - } - }) - } else if (isWebStream(head)) { - const writable = isTransformStream(head) ? head.writable : head - const writer = writable.getWriter() - d._write = async function (chunk, encoding, callback) { - try { - await writer.ready - writer.write(chunk).catch(() => {}) - callback() - } catch (err) { - callback(err) - } - } - d._final = async function (callback) { - try { - await writer.ready - writer.close().catch(() => {}) - onfinish = callback - } catch (err) { - callback(err) - } - } - } - const toRead = isTransformStream(tail) ? tail.readable : tail - eos(toRead, () => { - if (onfinish) { - const cb = onfinish - onfinish = null - cb() - } - }) - } - if (readable) { - if (isNodeStream(tail)) { - tail.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() - } - }) - tail.on('end', function () { - d.push(null) - }) - d._read = function () { - while (true) { - const buf = tail.read() - if (buf === null) { - onreadable = d._read - return - } - if (!d.push(buf)) { - return - } - } - } - } else if (isWebStream(tail)) { - const readable = isTransformStream(tail) ? tail.readable : tail - const reader = readable.getReader() - d._read = async function () { - while (true) { - try { - const { value, done } = await reader.read() - if (!d.push(value)) { - return - } - if (done) { - d.push(null) - return - } - } catch { - return - } - } - } - } - } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() - } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) - } else { - onclose = callback - if (isNodeStream(tail)) { - destroyer(tail, err) - } - } - } - return d -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js": -/*!**************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js ***! - \**************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ - -const { - aggregateTwoErrors, - codes: { ERR_MULTIPLE_CALLBACK }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { Symbol } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { kIsDestroyed, isDestroyed, isFinished, isServerRequest } = __webpack_require__(/*! ./utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const kDestroy = Symbol('kDestroy') -const kConstruct = Symbol('kConstruct') -function checkError(err, w, r) { - if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - } -} - -// Backwards compat. cb() is undocumented and unused in core but -// unfortunately might be used by modules. -function destroy(err, cb) { - const r = this._readableState - const w = this._writableState - // With duplex streams we use the writable side for state. - const s = w || r - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - if (typeof cb === 'function') { - cb() - } - return this - } - - // We set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - checkError(err, w, r) - if (w) { - w.destroyed = true - } - if (r) { - r.destroyed = true - } - - // If still constructing then defer calling _destroy. - if (!s.constructed) { - this.once(kDestroy, function (er) { - _destroy(this, aggregateTwoErrors(er, err), cb) - }) - } else { - _destroy(this, err, cb) - } - return this -} -function _destroy(self, err, cb) { - let called = false - function onDestroy(err) { - if (called) { - return - } - called = true - const r = self._readableState - const w = self._writableState - checkError(err, w, r) - if (w) { - w.closed = true - } - if (r) { - r.closed = true - } - if (typeof cb === 'function') { - cb(err) - } - if (err) { - process.nextTick(emitErrorCloseNT, self, err) - } else { - process.nextTick(emitCloseNT, self) - } - } - try { - self._destroy(err || null, onDestroy) - } catch (err) { - onDestroy(err) - } -} -function emitErrorCloseNT(self, err) { - emitErrorNT(self, err) - emitCloseNT(self) -} -function emitCloseNT(self) { - const r = self._readableState - const w = self._writableState - if (w) { - w.closeEmitted = true - } - if (r) { - r.closeEmitted = true - } - if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) { - self.emit('close') - } -} -function emitErrorNT(self, err) { - const r = self._readableState - const w = self._writableState - if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) { - return - } - if (w) { - w.errorEmitted = true - } - if (r) { - r.errorEmitted = true - } - self.emit('error', err) -} -function undestroy() { - const r = this._readableState - const w = this._writableState - if (r) { - r.constructed = true - r.closed = false - r.closeEmitted = false - r.destroyed = false - r.errored = null - r.errorEmitted = false - r.reading = false - r.ended = r.readable === false - r.endEmitted = r.readable === false - } - if (w) { - w.constructed = true - w.destroyed = false - w.closed = false - w.closeEmitted = false - w.errored = null - w.errorEmitted = false - w.finalCalled = false - w.prefinished = false - w.ended = w.writable === false - w.ending = w.writable === false - w.finished = w.writable === false - } -} -function errorOrDestroy(stream, err, sync) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - - const r = stream._readableState - const w = stream._writableState - if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) { - return this - } - if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy)) - stream.destroy(err) - else if (err) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - err.stack // eslint-disable-line no-unused-expressions - - if (w && !w.errored) { - w.errored = err - } - if (r && !r.errored) { - r.errored = err - } - if (sync) { - process.nextTick(emitErrorNT, stream, err) - } else { - emitErrorNT(stream, err) - } - } -} -function construct(stream, cb) { - if (typeof stream._construct !== 'function') { - return - } - const r = stream._readableState - const w = stream._writableState - if (r) { - r.constructed = false - } - if (w) { - w.constructed = false - } - stream.once(kConstruct, cb) - if (stream.listenerCount(kConstruct) > 1) { - // Duplex - return - } - process.nextTick(constructNT, stream) -} -function constructNT(stream) { - let called = false - function onConstruct(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK()) - return - } - called = true - const r = stream._readableState - const w = stream._writableState - const s = w || r - if (r) { - r.constructed = true - } - if (w) { - w.constructed = true - } - if (s.destroyed) { - stream.emit(kDestroy, err) - } else if (err) { - errorOrDestroy(stream, err, true) - } else { - process.nextTick(emitConstructNT, stream) - } - } - try { - stream._construct((err) => { - process.nextTick(onConstruct, err) - }) - } catch (err) { - process.nextTick(onConstruct, err) - } -} -function emitConstructNT(stream) { - stream.emit(kConstruct) -} -function isRequest(stream) { - return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function' -} -function emitCloseLegacy(stream) { - stream.emit('close') -} -function emitErrorCloseLegacy(stream, err) { - stream.emit('error', err) - process.nextTick(emitCloseLegacy, stream) -} - -// Normalize destroy for legacy. -function destroyer(stream, err) { - if (!stream || isDestroyed(stream)) { - return - } - if (!err && !isFinished(stream)) { - err = new AbortError() - } - - // TODO: Remove isRequest branches. - if (isServerRequest(stream)) { - stream.socket = null - stream.destroy(err) - } else if (isRequest(stream)) { - stream.abort() - } else if (isRequest(stream.req)) { - stream.req.abort() - } else if (typeof stream.destroy === 'function') { - stream.destroy(err) - } else if (typeof stream.close === 'function') { - // TODO: Don't lose err? - stream.close() - } else if (err) { - process.nextTick(emitErrorCloseLegacy, stream, err) - } else { - process.nextTick(emitCloseLegacy, stream) - } - if (!stream.destroyed) { - stream[kIsDestroyed] = true - } -} -module.exports = { - construct, - destroyer, - destroy, - undestroy, - errorOrDestroy -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js": -/*!*************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js ***! - \*************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototype inheritance, this class -// prototypically inherits from Readable, and then parasitically from -// Writable. - - - -const { - ObjectDefineProperties, - ObjectGetOwnPropertyDescriptor, - ObjectKeys, - ObjectSetPrototypeOf -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Duplex -const Readable = __webpack_require__(/*! ./readable */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js") -const Writable = __webpack_require__(/*! ./writable */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/writable.js") -ObjectSetPrototypeOf(Duplex.prototype, Readable.prototype) -ObjectSetPrototypeOf(Duplex, Readable) -{ - const keys = ObjectKeys(Writable.prototype) - // Allow the keys array to be GC'ed. - for (let i = 0; i < keys.length; i++) { - const method = keys[i] - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method] - } -} -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options) - Readable.call(this, options) - Writable.call(this, options) - if (options) { - this.allowHalfOpen = options.allowHalfOpen !== false - if (options.readable === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if (options.writable === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } else { - this.allowHalfOpen = true - } -} -ObjectDefineProperties(Duplex.prototype, { - writable: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable') - }, - writableHighWaterMark: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark') - }, - writableObjectMode: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode') - }, - writableBuffer: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer') - }, - writableLength: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength') - }, - writableFinished: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished') - }, - writableCorked: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked') - }, - writableEnded: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded') - }, - writableNeedDrain: { - __proto__: null, - ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain') - }, - destroyed: { - __proto__: null, - get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false - } - return this._readableState.destroyed && this._writableState.destroyed - }, - set(value) { - // Backward compatibility, the user is explicitly - // managing destroyed. - if (this._readableState && this._writableState) { - this._readableState.destroyed = value - this._writableState.destroyed = value - } - } - } -}) -let webStreamsAdapters - -// Lazy to avoid circular references -function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters -} -Duplex.fromWeb = function (pair, options) { - return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options) -} -Duplex.toWeb = function (duplex) { - return lazyWebStreams().newReadableWritablePairFromDuplex(duplex) -} -let duplexify -Duplex.from = function (body) { - if (!duplexify) { - duplexify = __webpack_require__(/*! ./duplexify */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplexify.js") - } - return duplexify(body, 'body') -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplexify.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplexify.js ***! - \****************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ - -;('use strict') -const bufferModule = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { - isReadable, - isWritable, - isIterable, - isNodeStream, - isReadableNodeStream, - isWritableNodeStream, - isDuplexNodeStream, - isReadableStream, - isWritableStream -} = __webpack_require__(/*! ./utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const { - AbortError, - codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE } -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { destroyer } = __webpack_require__(/*! ./destroy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js") -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") -const Readable = __webpack_require__(/*! ./readable */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js") -const Writable = __webpack_require__(/*! ./writable */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/writable.js") -const { createDeferredPromise } = __webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") -const from = __webpack_require__(/*! ./from */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/from.js") -const Blob = globalThis.Blob || bufferModule.Blob -const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - return b instanceof Blob - } - : function isBlob(b) { - return false - } -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -const { FunctionPrototypeCall } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") - -// This is needed for pre node 17. -class Duplexify extends Duplex { - constructor(options) { - super(options) - - // https://github.com/nodejs/node/pull/34385 - - if ((options === null || options === undefined ? undefined : options.readable) === false) { - this._readableState.readable = false - this._readableState.ended = true - this._readableState.endEmitted = true - } - if ((options === null || options === undefined ? undefined : options.writable) === false) { - this._writableState.writable = false - this._writableState.ending = true - this._writableState.ended = true - this._writableState.finished = true - } - } -} -module.exports = function duplexify(body, name) { - if (isDuplexNodeStream(body)) { - return body - } - if (isReadableNodeStream(body)) { - return _duplexify({ - readable: body - }) - } - if (isWritableNodeStream(body)) { - return _duplexify({ - writable: body - }) - } - if (isNodeStream(body)) { - return _duplexify({ - writable: false, - readable: false - }) - } - if (isReadableStream(body)) { - return _duplexify({ - readable: Readable.fromWeb(body) - }) - } - if (isWritableStream(body)) { - return _duplexify({ - writable: Writable.fromWeb(body) - }) - } - if (typeof body === 'function') { - const { value, write, final, destroy } = fromAsyncGen(body) - if (isIterable(value)) { - return from(Duplexify, value, { - // TODO (ronag): highWaterMark? - objectMode: true, - write, - final, - destroy - }) - } - const then = value === null || value === undefined ? undefined : value.then - if (typeof then === 'function') { - let d - const promise = FunctionPrototypeCall( - then, - value, - (val) => { - if (val != null) { - throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val) - } - }, - (err) => { - destroyer(d, err) - } - ) - return (d = new Duplexify({ - // TODO (ronag): highWaterMark? - objectMode: true, - readable: false, - write, - final(cb) { - final(async () => { - try { - await promise - process.nextTick(cb, null) - } catch (err) { - process.nextTick(cb, err) - } - }) - }, - destroy - })) - } - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value) - } - if (isBlob(body)) { - return duplexify(body.arrayBuffer()) - } - if (isIterable(body)) { - return from(Duplexify, body, { - // TODO (ronag): highWaterMark? - objectMode: true, - writable: false - }) - } - if ( - isReadableStream(body === null || body === undefined ? undefined : body.readable) && - isWritableStream(body === null || body === undefined ? undefined : body.writable) - ) { - return Duplexify.fromWeb(body) - } - if ( - typeof (body === null || body === undefined ? undefined : body.writable) === 'object' || - typeof (body === null || body === undefined ? undefined : body.readable) === 'object' - ) { - const readable = - body !== null && body !== undefined && body.readable - ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable) - ? body === null || body === undefined - ? undefined - : body.readable - : duplexify(body.readable) - : undefined - const writable = - body !== null && body !== undefined && body.writable - ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable) - ? body === null || body === undefined - ? undefined - : body.writable - : duplexify(body.writable) - : undefined - return _duplexify({ - readable, - writable - }) - } - const then = body === null || body === undefined ? undefined : body.then - if (typeof then === 'function') { - let d - FunctionPrototypeCall( - then, - body, - (val) => { - if (val != null) { - d.push(val) - } - d.push(null) - }, - (err) => { - destroyer(d, err) - } - ) - return (d = new Duplexify({ - objectMode: true, - writable: false, - read() {} - })) - } - throw new ERR_INVALID_ARG_TYPE( - name, - [ - 'Blob', - 'ReadableStream', - 'WritableStream', - 'Stream', - 'Iterable', - 'AsyncIterable', - 'Function', - '{ readable, writable } pair', - 'Promise' - ], - body - ) -} -function fromAsyncGen(fn) { - let { promise, resolve } = createDeferredPromise() - const ac = new AbortController() - const signal = ac.signal - const value = fn( - (async function* () { - while (true) { - const _promise = promise - promise = null - const { chunk, done, cb } = await _promise - process.nextTick(cb) - if (done) return - if (signal.aborted) - throw new AbortError(undefined, { - cause: signal.reason - }) - ;({ promise, resolve } = createDeferredPromise()) - yield chunk - } - })(), - { - signal - } - ) - return { - value, - write(chunk, encoding, cb) { - const _resolve = resolve - resolve = null - _resolve({ - chunk, - done: false, - cb - }) - }, - final(cb) { - const _resolve = resolve - resolve = null - _resolve({ - done: true, - cb - }) - }, - destroy(err, cb) { - ac.abort() - cb(err) - } - } -} -function _duplexify(pair) { - const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable - const w = pair.writable - let readable = !!isReadable(r) - let writable = !!isWritable(w) - let ondrain - let onfinish - let onreadable - let onclose - let d - function onfinished(err) { - const cb = onclose - onclose = null - if (cb) { - cb(err) - } else if (err) { - d.destroy(err) - } - } - - // TODO(ronag): Avoid double buffering. - // Implement Writable/Readable/Duplex traits. - // See, https://github.com/nodejs/node/pull/33515. - d = new Duplexify({ - // TODO (ronag): highWaterMark? - readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode), - writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode), - readable, - writable - }) - if (writable) { - eos(w, (err) => { - writable = false - if (err) { - destroyer(r, err) - } - onfinished(err) - }) - d._write = function (chunk, encoding, callback) { - if (w.write(chunk, encoding)) { - callback() - } else { - ondrain = callback - } - } - d._final = function (callback) { - w.end() - onfinish = callback - } - w.on('drain', function () { - if (ondrain) { - const cb = ondrain - ondrain = null - cb() - } - }) - w.on('finish', function () { - if (onfinish) { - const cb = onfinish - onfinish = null - cb() - } - }) - } - if (readable) { - eos(r, (err) => { - readable = false - if (err) { - destroyer(r, err) - } - onfinished(err) - }) - r.on('readable', function () { - if (onreadable) { - const cb = onreadable - onreadable = null - cb() - } - }) - r.on('end', function () { - d.push(null) - }) - d._read = function () { - while (true) { - const buf = r.read() - if (buf === null) { - onreadable = d._read - return - } - if (!d.push(buf)) { - return - } - } - } - } - d._destroy = function (err, callback) { - if (!err && onclose !== null) { - err = new AbortError() - } - onreadable = null - ondrain = null - onfinish = null - if (onclose === null) { - callback(err) - } else { - onclose = callback - destroyer(w, err) - destroyer(r, err) - } - } - return d -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js": -/*!********************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***! - \********************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). - -;('use strict') -const { AbortError, codes } = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes -const { kEmptyObject, once } = __webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") -const { validateAbortSignal, validateFunction, validateObject, validateBoolean } = __webpack_require__(/*! ../validators */ "./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js") -const { Promise, PromisePrototypeThen, SymbolDispose } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { - isClosed, - isReadable, - isReadableNodeStream, - isReadableStream, - isReadableFinished, - isReadableErrored, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableFinished, - isWritableErrored, - isNodeStream, - willEmitClose: _willEmitClose, - kIsClosedPromise -} = __webpack_require__(/*! ./utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -let addAbortListener -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function' -} -const nop = () => {} -function eos(stream, options, callback) { - var _options$readable, _options$writable - if (arguments.length === 2) { - callback = options - options = kEmptyObject - } else if (options == null) { - options = kEmptyObject - } else { - validateObject(options, 'options') - } - validateFunction(callback, 'callback') - validateAbortSignal(options.signal, 'options.signal') - callback = once(callback) - if (isReadableStream(stream) || isWritableStream(stream)) { - return eosWeb(stream, options, callback) - } - if (!isNodeStream(stream)) { - throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream) - } - const readable = - (_options$readable = options.readable) !== null && _options$readable !== undefined - ? _options$readable - : isReadableNodeStream(stream) - const writable = - (_options$writable = options.writable) !== null && _options$writable !== undefined - ? _options$writable - : isWritableNodeStream(stream) - const wState = stream._writableState - const rState = stream._readableState - const onlegacyfinish = () => { - if (!stream.writable) { - onfinish() - } - } - - // TODO (ronag): Improve soft detection to include core modules and - // common ecosystem modules that do properly emit 'close' but fail - // this generic check. - let willEmitClose = - _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable - let writableFinished = isWritableFinished(stream, false) - const onfinish = () => { - writableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false - } - if (willEmitClose && (!stream.readable || readable)) { - return - } - if (!readable || readableFinished) { - callback.call(stream) - } - } - let readableFinished = isReadableFinished(stream, false) - const onend = () => { - readableFinished = true - // Stream should not be destroyed here. If it is that - // means that user space is doing something differently and - // we cannot trust willEmitClose. - if (stream.destroyed) { - willEmitClose = false - } - if (willEmitClose && (!stream.writable || writable)) { - return - } - if (!writable || writableFinished) { - callback.call(stream) - } - } - const onerror = (err) => { - callback.call(stream, err) - } - let closed = isClosed(stream) - const onclose = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } - if (readable && !readableFinished && isReadableNodeStream(stream, true)) { - if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - if (writable && !writableFinished) { - if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE()) - } - callback.call(stream) - } - const onclosed = () => { - closed = true - const errored = isWritableErrored(stream) || isReadableErrored(stream) - if (errored && typeof errored !== 'boolean') { - return callback.call(stream, errored) - } - callback.call(stream) - } - const onrequest = () => { - stream.req.on('finish', onfinish) - } - if (isRequest(stream)) { - stream.on('complete', onfinish) - if (!willEmitClose) { - stream.on('abort', onclose) - } - if (stream.req) { - onrequest() - } else { - stream.on('request', onrequest) - } - } else if (writable && !wState) { - // legacy streams - stream.on('end', onlegacyfinish) - stream.on('close', onlegacyfinish) - } - - // Not all streams will emit 'close' after 'aborted'. - if (!willEmitClose && typeof stream.aborted === 'boolean') { - stream.on('aborted', onclose) - } - stream.on('end', onend) - stream.on('finish', onfinish) - if (options.error !== false) { - stream.on('error', onerror) - } - stream.on('close', onclose) - if (closed) { - process.nextTick(onclose) - } else if ( - (wState !== null && wState !== undefined && wState.errorEmitted) || - (rState !== null && rState !== undefined && rState.errorEmitted) - ) { - if (!willEmitClose) { - process.nextTick(onclosed) - } - } else if ( - !readable && - (!willEmitClose || isReadable(stream)) && - (writableFinished || isWritable(stream) === false) - ) { - process.nextTick(onclosed) - } else if ( - !writable && - (!willEmitClose || isWritable(stream)) && - (readableFinished || isReadable(stream) === false) - ) { - process.nextTick(onclosed) - } else if (rState && stream.req && stream.aborted) { - process.nextTick(onclosed) - } - const cleanup = () => { - callback = nop - stream.removeListener('aborted', onclose) - stream.removeListener('complete', onfinish) - stream.removeListener('abort', onclose) - stream.removeListener('request', onrequest) - if (stream.req) stream.req.removeListener('finish', onfinish) - stream.removeListener('end', onlegacyfinish) - stream.removeListener('close', onlegacyfinish) - stream.removeListener('finish', onfinish) - stream.removeListener('end', onend) - stream.removeListener('error', onerror) - stream.removeListener('close', onclose) - } - if (options.signal && !closed) { - const abort = () => { - // Keep it because cleanup removes it. - const endCallback = callback - cleanup() - endCallback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - const disposable = addAbortListener(options.signal, abort) - const originalCallback = callback - callback = once((...args) => { - disposable[SymbolDispose]() - originalCallback.apply(stream, args) - }) - } - } - return cleanup -} -function eosWeb(stream, options, callback) { - let isAborted = false - let abort = nop - if (options.signal) { - abort = () => { - isAborted = true - callback.call( - stream, - new AbortError(undefined, { - cause: options.signal.reason - }) - ) - } - if (options.signal.aborted) { - process.nextTick(abort) - } else { - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - const disposable = addAbortListener(options.signal, abort) - const originalCallback = callback - callback = once((...args) => { - disposable[SymbolDispose]() - originalCallback.apply(stream, args) - }) - } - } - const resolverFn = (...args) => { - if (!isAborted) { - process.nextTick(() => callback.apply(stream, args)) - } - } - PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn) - return nop -} -function finished(stream, opts) { - var _opts - let autoCleanup = false - if (opts === null) { - opts = kEmptyObject - } - if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) { - validateBoolean(opts.cleanup, 'cleanup') - autoCleanup = opts.cleanup - } - return new Promise((resolve, reject) => { - const cleanup = eos(stream, opts, (err) => { - if (autoCleanup) { - cleanup() - } - if (err) { - reject(err) - } else { - resolve() - } - }) - }) -} -module.exports = eos -module.exports.finished = finished - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/from.js": -/*!***********************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/from.js ***! - \***********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ - -const { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js").codes) -function from(Readable, iterable, opts) { - let iterator - if (typeof iterable === 'string' || iterable instanceof Buffer) { - return new Readable({ - objectMode: true, - ...opts, - read() { - this.push(iterable) - this.push(null) - } - }) - } - let isAsync - if (iterable && iterable[SymbolAsyncIterator]) { - isAsync = true - iterator = iterable[SymbolAsyncIterator]() - } else if (iterable && iterable[SymbolIterator]) { - isAsync = false - iterator = iterable[SymbolIterator]() - } else { - throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable) - } - const readable = new Readable({ - objectMode: true, - highWaterMark: 1, - // TODO(ronag): What options should be allowed? - ...opts - }) - - // Flag to protect against _read - // being called before last iteration completion. - let reading = false - readable._read = function () { - if (!reading) { - reading = true - next() - } - } - readable._destroy = function (error, cb) { - PromisePrototypeThen( - close(error), - () => process.nextTick(cb, error), - // nextTick is here in case cb throws - (e) => process.nextTick(cb, e || error) - ) - } - async function close(error) { - const hadError = error !== undefined && error !== null - const hasThrow = typeof iterator.throw === 'function' - if (hadError && hasThrow) { - const { value, done } = await iterator.throw(error) - await value - if (done) { - return - } - } - if (typeof iterator.return === 'function') { - const { value } = await iterator.return() - await value - } - } - async function next() { - for (;;) { - try { - const { value, done } = isAsync ? await iterator.next() : iterator.next() - if (done) { - readable.push(null) - } else { - const res = value && typeof value.then === 'function' ? await value : value - if (res === null) { - reading = false - throw new ERR_STREAM_NULL_VALUES() - } else if (readable.push(res)) { - continue - } else { - reading = false - } - } - } catch (err) { - readable.destroy(err) - } - break - } - } - return readable -} -module.exports = from - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/legacy.js": -/*!*************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/legacy.js ***! - \*************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { ArrayIsArray, ObjectSetPrototypeOf } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { EventEmitter: EE } = __webpack_require__(/*! events */ "./node_modules/events/events.js") -function Stream(opts) { - EE.call(this, opts) -} -ObjectSetPrototypeOf(Stream.prototype, EE.prototype) -ObjectSetPrototypeOf(Stream, EE) -Stream.prototype.pipe = function (dest, options) { - const source = this - function ondata(chunk) { - if (dest.writable && dest.write(chunk) === false && source.pause) { - source.pause() - } - } - source.on('data', ondata) - function ondrain() { - if (source.readable && source.resume) { - source.resume() - } - } - dest.on('drain', ondrain) - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend) - source.on('close', onclose) - } - let didOnEnd = false - function onend() { - if (didOnEnd) return - didOnEnd = true - dest.end() - } - function onclose() { - if (didOnEnd) return - didOnEnd = true - if (typeof dest.destroy === 'function') dest.destroy() - } - - // Don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup() - if (EE.listenerCount(this, 'error') === 0) { - this.emit('error', er) - } - } - prependListener(source, 'error', onerror) - prependListener(dest, 'error', onerror) - - // Remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata) - dest.removeListener('drain', ondrain) - source.removeListener('end', onend) - source.removeListener('close', onclose) - source.removeListener('error', onerror) - dest.removeListener('error', onerror) - source.removeListener('end', cleanup) - source.removeListener('close', cleanup) - dest.removeListener('close', cleanup) - } - source.on('end', cleanup) - source.on('close', cleanup) - dest.on('close', cleanup) - dest.emit('pipe', source) - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest -} -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn) - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn) - else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn) - else emitter._events[event] = [fn, emitter._events[event]] -} -module.exports = { - Stream, - prependListener -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/operators.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/operators.js ***! - \****************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -const { - codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { validateAbortSignal, validateInteger, validateObject } = __webpack_require__(/*! ../validators */ "./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js") -const kWeakHandler = (__webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js").Symbol)('kWeak') -const kResistStopPropagation = (__webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js").Symbol)('kResistStopPropagation') -const { finished } = __webpack_require__(/*! ./end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const staticCompose = __webpack_require__(/*! ./compose */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/compose.js") -const { addAbortSignalNoValidate } = __webpack_require__(/*! ./add-abort-signal */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -const { isWritable, isNodeStream } = __webpack_require__(/*! ./utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const { deprecate } = __webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") -const { - ArrayPrototypePush, - Boolean, - MathFloor, - Number, - NumberIsNaN, - Promise, - PromiseReject, - PromiseResolve, - PromisePrototypeThen, - Symbol -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const kEmpty = Symbol('kEmpty') -const kEof = Symbol('kEof') -function compose(stream, options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - if (isNodeStream(stream) && !isWritable(stream)) { - throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable') - } - const composedStream = staticCompose(this, stream) - if (options !== null && options !== undefined && options.signal) { - // Not validating as we already validated before - addAbortSignalNoValidate(options.signal, composedStream) - } - return composedStream -} -function map(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - let concurrency = 1 - if ((options === null || options === undefined ? undefined : options.concurrency) != null) { - concurrency = MathFloor(options.concurrency) - } - let highWaterMark = concurrency - 1 - if ((options === null || options === undefined ? undefined : options.highWaterMark) != null) { - highWaterMark = MathFloor(options.highWaterMark) - } - validateInteger(concurrency, 'options.concurrency', 1) - validateInteger(highWaterMark, 'options.highWaterMark', 0) - highWaterMark += concurrency - return async function* map() { - const signal = (__webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js").AbortSignalAny)( - [options === null || options === undefined ? undefined : options.signal].filter(Boolean) - ) - const stream = this - const queue = [] - const signalOpt = { - signal - } - let next - let resume - let done = false - let cnt = 0 - function onCatch() { - done = true - afterItemProcessed() - } - function afterItemProcessed() { - cnt -= 1 - maybeResume() - } - function maybeResume() { - if (resume && !done && cnt < concurrency && queue.length < highWaterMark) { - resume() - resume = null - } - } - async function pump() { - try { - for await (let val of stream) { - if (done) { - return - } - if (signal.aborted) { - throw new AbortError() - } - try { - val = fn(val, signalOpt) - if (val === kEmpty) { - continue - } - val = PromiseResolve(val) - } catch (err) { - val = PromiseReject(err) - } - cnt += 1 - PromisePrototypeThen(val, afterItemProcessed, onCatch) - queue.push(val) - if (next) { - next() - next = null - } - if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) { - await new Promise((resolve) => { - resume = resolve - }) - } - } - queue.push(kEof) - } catch (err) { - const val = PromiseReject(err) - PromisePrototypeThen(val, afterItemProcessed, onCatch) - queue.push(val) - } finally { - done = true - if (next) { - next() - next = null - } - } - } - pump() - try { - while (true) { - while (queue.length > 0) { - const val = await queue[0] - if (val === kEof) { - return - } - if (signal.aborted) { - throw new AbortError() - } - if (val !== kEmpty) { - yield val - } - queue.shift() - maybeResume() - } - await new Promise((resolve) => { - next = resolve - }) - } - } finally { - done = true - if (resume) { - resume() - resume = null - } - } - }.call(this) -} -function asIndexedPairs(options = undefined) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - return async function* asIndexedPairs() { - let index = 0 - for await (const val of this) { - var _options$signal - if ( - options !== null && - options !== undefined && - (_options$signal = options.signal) !== null && - _options$signal !== undefined && - _options$signal.aborted - ) { - throw new AbortError({ - cause: options.signal.reason - }) - } - yield [index++, val] - } - }.call(this) -} -async function some(fn, options = undefined) { - for await (const unused of filter.call(this, fn, options)) { - return true - } - return false -} -async function every(fn, options = undefined) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - // https://en.wikipedia.org/wiki/De_Morgan%27s_laws - return !(await some.call( - this, - async (...args) => { - return !(await fn(...args)) - }, - options - )) -} -async function find(fn, options) { - for await (const result of filter.call(this, fn, options)) { - return result - } - return undefined -} -async function forEach(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - async function forEachFn(value, options) { - await fn(value, options) - return kEmpty - } - // eslint-disable-next-line no-unused-vars - for await (const unused of map.call(this, forEachFn, options)); -} -function filter(fn, options) { - if (typeof fn !== 'function') { - throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn) - } - async function filterFn(value, options) { - if (await fn(value, options)) { - return value - } - return kEmpty - } - return map.call(this, filterFn, options) -} - -// Specific to provide better error to reduce since the argument is only -// missing if the stream has no items in it - but the code is still appropriate -class ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS { - constructor() { - super('reduce') - this.message = 'Reduce of an empty stream requires an initial value' - } -} -async function reduce(reducer, initialValue, options) { - var _options$signal2 - if (typeof reducer !== 'function') { - throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer) - } - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - let hasInitialValue = arguments.length > 1 - if ( - options !== null && - options !== undefined && - (_options$signal2 = options.signal) !== null && - _options$signal2 !== undefined && - _options$signal2.aborted - ) { - const err = new AbortError(undefined, { - cause: options.signal.reason - }) - this.once('error', () => {}) // The error is already propagated - await finished(this.destroy(err)) - throw err - } - const ac = new AbortController() - const signal = ac.signal - if (options !== null && options !== undefined && options.signal) { - const opts = { - once: true, - [kWeakHandler]: this, - [kResistStopPropagation]: true - } - options.signal.addEventListener('abort', () => ac.abort(), opts) - } - let gotAnyItemFromStream = false - try { - for await (const value of this) { - var _options$signal3 - gotAnyItemFromStream = true - if ( - options !== null && - options !== undefined && - (_options$signal3 = options.signal) !== null && - _options$signal3 !== undefined && - _options$signal3.aborted - ) { - throw new AbortError() - } - if (!hasInitialValue) { - initialValue = value - hasInitialValue = true - } else { - initialValue = await reducer(initialValue, value, { - signal - }) - } - } - if (!gotAnyItemFromStream && !hasInitialValue) { - throw new ReduceAwareErrMissingArgs() - } - } finally { - ac.abort() - } - return initialValue -} -async function toArray(options) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - const result = [] - for await (const val of this) { - var _options$signal4 - if ( - options !== null && - options !== undefined && - (_options$signal4 = options.signal) !== null && - _options$signal4 !== undefined && - _options$signal4.aborted - ) { - throw new AbortError(undefined, { - cause: options.signal.reason - }) - } - ArrayPrototypePush(result, val) - } - return result -} -function flatMap(fn, options) { - const values = map.call(this, fn, options) - return async function* flatMap() { - for await (const val of values) { - yield* val - } - }.call(this) -} -function toIntegerOrInfinity(number) { - // We coerce here to align with the spec - // https://github.com/tc39/proposal-iterator-helpers/issues/169 - number = Number(number) - if (NumberIsNaN(number)) { - return 0 - } - if (number < 0) { - throw new ERR_OUT_OF_RANGE('number', '>= 0', number) - } - return number -} -function drop(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - number = toIntegerOrInfinity(number) - return async function* drop() { - var _options$signal5 - if ( - options !== null && - options !== undefined && - (_options$signal5 = options.signal) !== null && - _options$signal5 !== undefined && - _options$signal5.aborted - ) { - throw new AbortError() - } - for await (const val of this) { - var _options$signal6 - if ( - options !== null && - options !== undefined && - (_options$signal6 = options.signal) !== null && - _options$signal6 !== undefined && - _options$signal6.aborted - ) { - throw new AbortError() - } - if (number-- <= 0) { - yield val - } - } - }.call(this) -} -function take(number, options = undefined) { - if (options != null) { - validateObject(options, 'options') - } - if ((options === null || options === undefined ? undefined : options.signal) != null) { - validateAbortSignal(options.signal, 'options.signal') - } - number = toIntegerOrInfinity(number) - return async function* take() { - var _options$signal7 - if ( - options !== null && - options !== undefined && - (_options$signal7 = options.signal) !== null && - _options$signal7 !== undefined && - _options$signal7.aborted - ) { - throw new AbortError() - } - for await (const val of this) { - var _options$signal8 - if ( - options !== null && - options !== undefined && - (_options$signal8 = options.signal) !== null && - _options$signal8 !== undefined && - _options$signal8.aborted - ) { - throw new AbortError() - } - if (number-- > 0) { - yield val - } - - // Don't get another item from iterator in case we reached the end - if (number <= 0) { - return - } - } - }.call(this) -} -module.exports.streamReturningOperators = { - asIndexedPairs: deprecate(asIndexedPairs, 'readable.asIndexedPairs will be removed in a future version.'), - drop, - filter, - flatMap, - map, - take, - compose -} -module.exports.promiseReturningOperators = { - every, - forEach, - reduce, - toArray, - some, - find -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/passthrough.js": -/*!******************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/passthrough.js ***! - \******************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - - - -const { ObjectSetPrototypeOf } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = PassThrough -const Transform = __webpack_require__(/*! ./transform */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/transform.js") -ObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype) -ObjectSetPrototypeOf(PassThrough, Transform) -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options) - Transform.call(this, options) -} -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk) -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/pipeline.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/pipeline.js ***! - \***************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). - -;('use strict') -const { ArrayIsArray, Promise, SymbolAsyncIterator, SymbolDispose } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const { once } = __webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") -const destroyImpl = __webpack_require__(/*! ./destroy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js") -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") -const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_INVALID_RETURN_VALUE, - ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED, - ERR_STREAM_PREMATURE_CLOSE - }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { validateFunction, validateAbortSignal } = __webpack_require__(/*! ../validators */ "./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js") -const { - isIterable, - isReadable, - isReadableNodeStream, - isNodeStream, - isTransformStream, - isWebStream, - isReadableStream, - isReadableFinished -} = __webpack_require__(/*! ./utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -let PassThrough -let Readable -let addAbortListener -function destroyer(stream, reading, writing) { - let finished = false - stream.on('close', () => { - finished = true - }) - const cleanup = eos( - stream, - { - readable: reading, - writable: writing - }, - (err) => { - finished = !err - } - ) - return { - destroy: (err) => { - if (finished) return - finished = true - destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe')) - }, - cleanup - } -} -function popCallback(streams) { - // Streams should never be an empty array. It should always contain at least - // a single stream. Therefore optimize for the average case instead of - // checking for length === 0 as well. - validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]') - return streams.pop() -} -function makeAsyncIterable(val) { - if (isIterable(val)) { - return val - } else if (isReadableNodeStream(val)) { - // Legacy streams are not Iterable. - return fromReadable(val) - } - throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val) -} -async function* fromReadable(val) { - if (!Readable) { - Readable = __webpack_require__(/*! ./readable */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js") - } - yield* Readable.prototype[SymbolAsyncIterator].call(val) -} -async function pumpToNode(iterable, writable, finish, { end }) { - let error - let onresolve = null - const resume = (err) => { - if (err) { - error = err - } - if (onresolve) { - const callback = onresolve - onresolve = null - callback() - } - } - const wait = () => - new Promise((resolve, reject) => { - if (error) { - reject(error) - } else { - onresolve = () => { - if (error) { - reject(error) - } else { - resolve() - } - } - } - }) - writable.on('drain', resume) - const cleanup = eos( - writable, - { - readable: false - }, - resume - ) - try { - if (writable.writableNeedDrain) { - await wait() - } - for await (const chunk of iterable) { - if (!writable.write(chunk)) { - await wait() - } - } - if (end) { - writable.end() - await wait() - } - finish() - } catch (err) { - finish(error !== err ? aggregateTwoErrors(error, err) : err) - } finally { - cleanup() - writable.off('drain', resume) - } -} -async function pumpToWeb(readable, writable, finish, { end }) { - if (isTransformStream(writable)) { - writable = writable.writable - } - // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure - const writer = writable.getWriter() - try { - for await (const chunk of readable) { - await writer.ready - writer.write(chunk).catch(() => {}) - } - await writer.ready - if (end) { - await writer.close() - } - finish() - } catch (err) { - try { - await writer.abort(err) - finish(err) - } catch (err) { - finish(err) - } - } -} -function pipeline(...streams) { - return pipelineImpl(streams, once(popCallback(streams))) -} -function pipelineImpl(streams, callback, opts) { - if (streams.length === 1 && ArrayIsArray(streams[0])) { - streams = streams[0] - } - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams') - } - const ac = new AbortController() - const signal = ac.signal - const outerSignal = opts === null || opts === undefined ? undefined : opts.signal - - // Need to cleanup event listeners if last stream is readable - // https://github.com/nodejs/node/issues/35452 - const lastStreamCleanup = [] - validateAbortSignal(outerSignal, 'options.signal') - function abort() { - finishImpl(new AbortError()) - } - addAbortListener = addAbortListener || (__webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js").addAbortListener) - let disposable - if (outerSignal) { - disposable = addAbortListener(outerSignal, abort) - } - let error - let value - const destroys = [] - let finishCount = 0 - function finish(err) { - finishImpl(err, --finishCount === 0) - } - function finishImpl(err, final) { - var _disposable - if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { - error = err - } - if (!error && !final) { - return - } - while (destroys.length) { - destroys.shift()(error) - } - ;(_disposable = disposable) === null || _disposable === undefined ? undefined : _disposable[SymbolDispose]() - ac.abort() - if (final) { - if (!error) { - lastStreamCleanup.forEach((fn) => fn()) - } - process.nextTick(callback, error, value) - } - } - let ret - for (let i = 0; i < streams.length; i++) { - const stream = streams[i] - const reading = i < streams.length - 1 - const writing = i > 0 - const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false - const isLastStream = i === streams.length - 1 - if (isNodeStream(stream)) { - if (end) { - const { destroy, cleanup } = destroyer(stream, reading, writing) - destroys.push(destroy) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - - // Catch stream errors that occur after pipe/pump has completed. - function onError(err) { - if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - finish(err) - } - } - stream.on('error', onError) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(() => { - stream.removeListener('error', onError) - }) - } - } - if (i === 0) { - if (typeof stream === 'function') { - ret = stream({ - signal - }) - if (!isIterable(ret)) { - throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret) - } - } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) { - ret = stream - } else { - ret = Duplex.from(stream) - } - } else if (typeof stream === 'function') { - if (isTransformStream(ret)) { - var _ret - ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable) - } else { - ret = makeAsyncIterable(ret) - } - ret = stream(ret, { - signal - }) - if (reading) { - if (!isIterable(ret, true)) { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret) - } - } else { - var _ret2 - if (!PassThrough) { - PassThrough = __webpack_require__(/*! ./passthrough */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/passthrough.js") - } - - // If the last argument to pipeline is not a stream - // we must create a proxy stream so that pipeline(...) - // always returns a stream which can be further - // composed through `.pipe(stream)`. - - const pt = new PassThrough({ - objectMode: true - }) - - // Handle Promises/A+ spec, `then` could be a getter that throws on - // second use. - const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then - if (typeof then === 'function') { - finishCount++ - then.call( - ret, - (val) => { - value = val - if (val != null) { - pt.write(val) - } - if (end) { - pt.end() - } - process.nextTick(finish) - }, - (err) => { - pt.destroy(err) - process.nextTick(finish, err) - } - ) - } else if (isIterable(ret, true)) { - finishCount++ - pumpToNode(ret, pt, finish, { - end - }) - } else if (isReadableStream(ret) || isTransformStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, pt, finish, { - end - }) - } else { - throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret) - } - ret = pt - const { destroy, cleanup } = destroyer(ret, false, true) - destroys.push(destroy) - if (isLastStream) { - lastStreamCleanup.push(cleanup) - } - } - } else if (isNodeStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount += 2 - const cleanup = pipe(ret, stream, finish, { - end - }) - if (isReadable(stream) && isLastStream) { - lastStreamCleanup.push(cleanup) - } - } else if (isTransformStream(ret) || isReadableStream(ret)) { - const toRead = ret.readable || ret - finishCount++ - pumpToNode(toRead, stream, finish, { - end - }) - } else if (isIterable(ret)) { - finishCount++ - pumpToNode(ret, stream, finish, { - end - }) - } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret - ) - } - ret = stream - } else if (isWebStream(stream)) { - if (isReadableNodeStream(ret)) { - finishCount++ - pumpToWeb(makeAsyncIterable(ret), stream, finish, { - end - }) - } else if (isReadableStream(ret) || isIterable(ret)) { - finishCount++ - pumpToWeb(ret, stream, finish, { - end - }) - } else if (isTransformStream(ret)) { - finishCount++ - pumpToWeb(ret.readable, stream, finish, { - end - }) - } else { - throw new ERR_INVALID_ARG_TYPE( - 'val', - ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'], - ret - ) - } - ret = stream - } else { - ret = Duplex.from(stream) - } - } - if ( - (signal !== null && signal !== undefined && signal.aborted) || - (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted) - ) { - process.nextTick(abort) - } - return ret -} -function pipe(src, dst, finish, { end }) { - let ended = false - dst.on('close', () => { - if (!ended) { - // Finish if the destination closes before the source has completed. - finish(new ERR_STREAM_PREMATURE_CLOSE()) - } - }) - src.pipe(dst, { - end: false - }) // If end is true we already will have a listener to end dst. - - if (end) { - // Compat. Before node v10.12.0 stdio used to throw an error so - // pipe() did/does not end() stdio destinations. - // Now they allow it but "secretly" don't close the underlying fd. - - function endFn() { - ended = true - dst.end() - } - if (isReadableFinished(src)) { - // End the destination if the source has already ended. - process.nextTick(endFn) - } else { - src.once('end', endFn) - } - } else { - finish() - } - eos( - src, - { - readable: true, - writable: false - }, - (err) => { - const rState = src._readableState - if ( - err && - err.code === 'ERR_STREAM_PREMATURE_CLOSE' && - rState && - rState.ended && - !rState.errored && - !rState.errorEmitted - ) { - // Some readable streams will emit 'close' before 'end'. However, since - // this is on the readable side 'end' should still be emitted if the - // stream has been ended and no error emitted. This should be allowed in - // favor of backwards compatibility. Since the stream is piped to a - // destination this should not result in any observable difference. - // We don't need to check if this is a writable premature close since - // eos will only fail with premature close on the reading side for - // duplex streams. - src.once('end', finish).once('error', finish) - } else { - finish(err) - } - } - ) - return eos( - dst, - { - readable: false, - writable: true - }, - finish - ) -} -module.exports = { - pipelineImpl, - pipeline -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js ***! - \***************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -;('use strict') -const { - ArrayPrototypeIndexOf, - NumberIsInteger, - NumberIsNaN, - NumberParseInt, - ObjectDefineProperties, - ObjectKeys, - ObjectSetPrototypeOf, - Promise, - SafeSet, - SymbolAsyncDispose, - SymbolAsyncIterator, - Symbol -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Readable -Readable.ReadableState = ReadableState -const { EventEmitter: EE } = __webpack_require__(/*! events */ "./node_modules/events/events.js") -const { Stream, prependListener } = __webpack_require__(/*! ./legacy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/legacy.js") -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { addAbortSignal } = __webpack_require__(/*! ./add-abort-signal */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -const eos = __webpack_require__(/*! ./end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -let debug = (__webpack_require__(/*! ../../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js").debuglog)('stream', (fn) => { - debug = fn -}) -const BufferList = __webpack_require__(/*! ./buffer_list */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/buffer_list.js") -const destroyImpl = __webpack_require__(/*! ./destroy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js") -const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(/*! ./state */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/state.js") -const { - aggregateTwoErrors, - codes: { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_OUT_OF_RANGE, - ERR_STREAM_PUSH_AFTER_EOF, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT - }, - AbortError -} = __webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { validateObject } = __webpack_require__(/*! ../validators */ "./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js") -const kPaused = Symbol('kPaused') -const { StringDecoder } = __webpack_require__(/*! string_decoder */ "./node_modules/n3/node_modules/string_decoder/lib/string_decoder.js") -const from = __webpack_require__(/*! ./from */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/from.js") -ObjectSetPrototypeOf(Readable.prototype, Stream.prototype) -ObjectSetPrototypeOf(Readable, Stream) -const nop = () => {} -const { errorOrDestroy } = destroyImpl -const kObjectMode = 1 << 0 -const kEnded = 1 << 1 -const kEndEmitted = 1 << 2 -const kReading = 1 << 3 -const kConstructed = 1 << 4 -const kSync = 1 << 5 -const kNeedReadable = 1 << 6 -const kEmittedReadable = 1 << 7 -const kReadableListening = 1 << 8 -const kResumeScheduled = 1 << 9 -const kErrorEmitted = 1 << 10 -const kEmitClose = 1 << 11 -const kAutoDestroy = 1 << 12 -const kDestroyed = 1 << 13 -const kClosed = 1 << 14 -const kCloseEmitted = 1 << 15 -const kMultiAwaitDrain = 1 << 16 -const kReadingMore = 1 << 17 -const kDataEmitted = 1 << 18 - -// TODO(benjamingr) it is likely slower to do it this way than with free functions -function makeBitMapDescriptor(bit) { - return { - enumerable: false, - get() { - return (this.state & bit) !== 0 - }, - set(value) { - if (value) this.state |= bit - else this.state &= ~bit - } - } -} -ObjectDefineProperties(ReadableState.prototype, { - objectMode: makeBitMapDescriptor(kObjectMode), - ended: makeBitMapDescriptor(kEnded), - endEmitted: makeBitMapDescriptor(kEndEmitted), - reading: makeBitMapDescriptor(kReading), - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - constructed: makeBitMapDescriptor(kConstructed), - // A flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - sync: makeBitMapDescriptor(kSync), - // Whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - needReadable: makeBitMapDescriptor(kNeedReadable), - emittedReadable: makeBitMapDescriptor(kEmittedReadable), - readableListening: makeBitMapDescriptor(kReadableListening), - resumeScheduled: makeBitMapDescriptor(kResumeScheduled), - // True if the error was already emitted and should not be thrown again. - errorEmitted: makeBitMapDescriptor(kErrorEmitted), - emitClose: makeBitMapDescriptor(kEmitClose), - autoDestroy: makeBitMapDescriptor(kAutoDestroy), - // Has it been destroyed. - destroyed: makeBitMapDescriptor(kDestroyed), - // Indicates whether the stream has finished destroying. - closed: makeBitMapDescriptor(kClosed), - // True if close has been emitted or would have been emitted - // depending on emitClose. - closeEmitted: makeBitMapDescriptor(kCloseEmitted), - multiAwaitDrain: makeBitMapDescriptor(kMultiAwaitDrain), - // If true, a maybeReadMore has been scheduled. - readingMore: makeBitMapDescriptor(kReadingMore), - dataEmitted: makeBitMapDescriptor(kDataEmitted) -}) -function ReadableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") - - // Bit map field to store ReadableState more effciently with 1 bit per field - // instead of a V8 slot per field. - this.state = kEmitClose | kAutoDestroy | kConstructed | kSync - // Object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away. - if (options && options.objectMode) this.state |= kObjectMode - if (isDuplex && options && options.readableObjectMode) this.state |= kObjectMode - - // The point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - this.highWaterMark = options - ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift(). - this.buffer = new BufferList() - this.length = 0 - this.pipes = [] - this.flowing = null - this[kPaused] = null - - // Should close be emitted on destroy. Defaults to true. - if (options && options.emitClose === false) this.state &= ~kEmitClose - - // Should .destroy() be called after 'end' (and potentially 'finish'). - if (options && options.autoDestroy === false) this.state &= ~kAutoDestroy - - // Indicates whether the stream has errored. When true no further - // _read calls, 'data' or 'readable' events should occur. This is needed - // since when autoDestroy is disabled we need a way to tell whether the - // stream has failed. - this.errored = null - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Ref the piped dest which we need a drain event on it - // type: null | Writable | Set. - this.awaitDrainWriters = null - this.decoder = null - this.encoding = null - if (options && options.encoding) { - this.decoder = new StringDecoder(options.encoding) - this.encoding = options.encoding - } -} -function Readable(options) { - if (!(this instanceof Readable)) return new Readable(options) - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") - this._readableState = new ReadableState(options, this, isDuplex) - if (options) { - if (typeof options.read === 'function') this._read = options.read - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal && !isDuplex) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - if (this._readableState.needReadable) { - maybeReadMore(this, this._readableState) - } - }) -} -Readable.prototype.destroy = destroyImpl.destroy -Readable.prototype._undestroy = destroyImpl.undestroy -Readable.prototype._destroy = function (err, cb) { - cb(err) -} -Readable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) -} -Readable.prototype[SymbolAsyncDispose] = function () { - let error - if (!this.destroyed) { - error = this.readableEnded ? null : new AbortError() - this.destroy(error) - } - return new Promise((resolve, reject) => eos(this, (err) => (err && err !== error ? reject(err) : resolve(null)))) -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, false) -} - -// Unshift should *always* be something directly out of read(). -Readable.prototype.unshift = function (chunk, encoding) { - return readableAddChunk(this, chunk, encoding, true) -} -function readableAddChunk(stream, chunk, encoding, addToFront) { - debug('readableAddChunk', chunk) - const state = stream._readableState - let err - if ((state.state & kObjectMode) === 0) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding - if (state.encoding !== encoding) { - if (addToFront && state.encoding) { - // When unshifting, if state.encoding is set, we have to save - // the string in the BufferList with the state encoding. - chunk = Buffer.from(chunk, encoding).toString(state.encoding) - } else { - chunk = Buffer.from(chunk, encoding) - encoding = '' - } - } - } else if (chunk instanceof Buffer) { - encoding = '' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) - encoding = '' - } else if (chunk != null) { - err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) - } - } - if (err) { - errorOrDestroy(stream, err) - } else if (chunk === null) { - state.state &= ~kReading - onEofChunk(stream, state) - } else if ((state.state & kObjectMode) !== 0 || (chunk && chunk.length > 0)) { - if (addToFront) { - if ((state.state & kEndEmitted) !== 0) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT()) - else if (state.destroyed || state.errored) return false - else addChunk(stream, state, chunk, true) - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()) - } else if (state.destroyed || state.errored) { - return false - } else { - state.state &= ~kReading - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk) - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false) - else maybeReadMore(stream, state) - } else { - addChunk(stream, state, chunk, false) - } - } - } else if (!addToFront) { - state.state &= ~kReading - maybeReadMore(stream, state) - } - - // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - return !state.ended && (state.length < state.highWaterMark || state.length === 0) -} -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) { - // Use the guard to avoid creating `Set()` repeatedly - // when we have multiple pipes. - if ((state.state & kMultiAwaitDrain) !== 0) { - state.awaitDrainWriters.clear() - } else { - state.awaitDrainWriters = null - } - state.dataEmitted = true - stream.emit('data', chunk) - } else { - // Update the buffer info. - state.length += state.objectMode ? 1 : chunk.length - if (addToFront) state.buffer.unshift(chunk) - else state.buffer.push(chunk) - if ((state.state & kNeedReadable) !== 0) emitReadable(stream) - } - maybeReadMore(stream, state) -} -Readable.prototype.isPaused = function () { - const state = this._readableState - return state[kPaused] === true || state.flowing === false -} - -// Backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - const decoder = new StringDecoder(enc) - this._readableState.decoder = decoder - // If setEncoding(null), decoder.encoding equals utf8. - this._readableState.encoding = this._readableState.decoder.encoding - const buffer = this._readableState.buffer - // Iterate over current buffer to convert already stored Buffers: - let content = '' - for (const data of buffer) { - content += decoder.write(data) - } - buffer.clear() - if (content !== '') buffer.push(content) - this._readableState.length = content.length - return this -} - -// Don't raise the hwm > 1GB. -const MAX_HWM = 0x40000000 -function computeNewHighWaterMark(n) { - if (n > MAX_HWM) { - throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n) - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts. - n-- - n |= n >>> 1 - n |= n >>> 2 - n |= n >>> 4 - n |= n >>> 8 - n |= n >>> 16 - n++ - } - return n -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || (state.length === 0 && state.ended)) return 0 - if ((state.state & kObjectMode) !== 0) return 1 - if (NumberIsNaN(n)) { - // Only flow one buffer at a time. - if (state.flowing && state.length) return state.buffer.first().length - return state.length - } - if (n <= state.length) return n - return state.ended ? state.length : 0 -} - -// You can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n) - // Same as parseInt(undefined, 10), however V8 7.3 performance regressed - // in this scenario, so we are doing it manually. - if (n === undefined) { - n = NaN - } else if (!NumberIsInteger(n)) { - n = NumberParseInt(n, 10) - } - const state = this._readableState - const nOrig = n - - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n) - if (n !== 0) state.state &= ~kEmittedReadable - - // If we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if ( - n === 0 && - state.needReadable && - ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended) - ) { - debug('read: emitReadable', state.length, state.ended) - if (state.length === 0 && state.ended) endReadable(this) - else emitReadable(this) - return null - } - n = howMuchToRead(n, state) - - // If we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this) - return null - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - let doRead = (state.state & kNeedReadable) !== 0 - debug('need readable', doRead) - - // If we currently have less than the highWaterMark, then also read some. - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true - debug('length less than watermark', doRead) - } - - // However, if we've ended, then there's no point, if we're already - // reading, then it's unnecessary, if we're constructing we have to wait, - // and if we're destroyed or errored, then it's not allowed, - if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) { - doRead = false - debug('reading, ended or constructing', doRead) - } else if (doRead) { - debug('do read') - state.state |= kReading | kSync - // If the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.state |= kNeedReadable - - // Call internal read method - try { - this._read(state.highWaterMark) - } catch (err) { - errorOrDestroy(this, err) - } - state.state &= ~kSync - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state) - } - let ret - if (n > 0) ret = fromList(n, state) - else ret = null - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark - n = 0 - } else { - state.length -= n - if (state.multiAwaitDrain) { - state.awaitDrainWriters.clear() - } else { - state.awaitDrainWriters = null - } - } - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this) - } - if (ret !== null && !state.errorEmitted && !state.closeEmitted) { - state.dataEmitted = true - this.emit('data', ret) - } - return ret -} -function onEofChunk(stream, state) { - debug('onEofChunk') - if (state.ended) return - if (state.decoder) { - const chunk = state.decoder.end() - if (chunk && chunk.length) { - state.buffer.push(chunk) - state.length += state.objectMode ? 1 : chunk.length - } - } - state.ended = true - if (state.sync) { - // If we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call. - emitReadable(stream) - } else { - // Emit 'readable' now to make sure it gets picked up. - state.needReadable = false - state.emittedReadable = true - // We have to emit readable now that we are EOF. Modules - // in the ecosystem (e.g. dicer) rely on this event being sync. - emitReadable_(stream) - } -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - const state = stream._readableState - debug('emitReadable', state.needReadable, state.emittedReadable) - state.needReadable = false - if (!state.emittedReadable) { - debug('emitReadable', state.flowing) - state.emittedReadable = true - process.nextTick(emitReadable_, stream) - } -} -function emitReadable_(stream) { - const state = stream._readableState - debug('emitReadable_', state.destroyed, state.length, state.ended) - if (!state.destroyed && !state.errored && (state.length || state.ended)) { - stream.emit('readable') - state.emittedReadable = false - } - - // The stream needs another readable event if: - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark - flow(stream) -} - -// At this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore && state.constructed) { - state.readingMore = true - process.nextTick(maybeReadMore_, stream, state) - } -} -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while ( - !state.reading && - !state.ended && - (state.length < state.highWaterMark || (state.flowing && state.length === 0)) - ) { - const len = state.length - debug('maybeReadMore read 0') - stream.read(0) - if (len === state.length) - // Didn't get any data, stop spinning. - break - } - state.readingMore = false -} - -// Abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_read()') -} -Readable.prototype.pipe = function (dest, pipeOpts) { - const src = this - const state = this._readableState - if (state.pipes.length === 1) { - if (!state.multiAwaitDrain) { - state.multiAwaitDrain = true - state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : []) - } - } - state.pipes.push(dest) - debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts) - const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr - const endFn = doEnd ? onend : unpipe - if (state.endEmitted) process.nextTick(endFn) - else src.once('end', endFn) - dest.on('unpipe', onunpipe) - function onunpipe(readable, unpipeInfo) { - debug('onunpipe') - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true - cleanup() - } - } - } - function onend() { - debug('onend') - dest.end() - } - let ondrain - let cleanedUp = false - function cleanup() { - debug('cleanup') - // Cleanup event handlers once the pipe is broken. - dest.removeListener('close', onclose) - dest.removeListener('finish', onfinish) - if (ondrain) { - dest.removeListener('drain', ondrain) - } - dest.removeListener('error', onerror) - dest.removeListener('unpipe', onunpipe) - src.removeListener('end', onend) - src.removeListener('end', unpipe) - src.removeListener('data', ondata) - cleanedUp = true - - // If the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain() - } - function pause() { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if (!cleanedUp) { - if (state.pipes.length === 1 && state.pipes[0] === dest) { - debug('false write response, pause', 0) - state.awaitDrainWriters = dest - state.multiAwaitDrain = false - } else if (state.pipes.length > 1 && state.pipes.includes(dest)) { - debug('false write response, pause', state.awaitDrainWriters.size) - state.awaitDrainWriters.add(dest) - } - src.pause() - } - if (!ondrain) { - // When the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - ondrain = pipeOnDrain(src, dest) - dest.on('drain', ondrain) - } - } - src.on('data', ondata) - function ondata(chunk) { - debug('ondata') - const ret = dest.write(chunk) - debug('dest.write', ret) - if (ret === false) { - pause() - } - } - - // If the dest has an error, then stop piping into it. - // However, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er) - unpipe() - dest.removeListener('error', onerror) - if (dest.listenerCount('error') === 0) { - const s = dest._writableState || dest._readableState - if (s && !s.errorEmitted) { - // User incorrectly emitted 'error' directly on the stream. - errorOrDestroy(dest, er) - } else { - dest.emit('error', er) - } - } - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror) - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish) - unpipe() - } - dest.once('close', onclose) - function onfinish() { - debug('onfinish') - dest.removeListener('close', onclose) - unpipe() - } - dest.once('finish', onfinish) - function unpipe() { - debug('unpipe') - src.unpipe(dest) - } - - // Tell the dest that it's being piped to. - dest.emit('pipe', src) - - // Start the flow if it hasn't been started already. - - if (dest.writableNeedDrain === true) { - pause() - } else if (!state.flowing) { - debug('pipe resume') - src.resume() - } - return dest -} -function pipeOnDrain(src, dest) { - return function pipeOnDrainFunctionResult() { - const state = src._readableState - - // `ondrain` will call directly, - // `this` maybe not a reference to dest, - // so we use the real dest here. - if (state.awaitDrainWriters === dest) { - debug('pipeOnDrain', 1) - state.awaitDrainWriters = null - } else if (state.multiAwaitDrain) { - debug('pipeOnDrain', state.awaitDrainWriters.size) - state.awaitDrainWriters.delete(dest) - } - if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) { - src.resume() - } - } -} -Readable.prototype.unpipe = function (dest) { - const state = this._readableState - const unpipeInfo = { - hasUnpiped: false - } - - // If we're not piping anywhere, then do nothing. - if (state.pipes.length === 0) return this - if (!dest) { - // remove all. - const dests = state.pipes - state.pipes = [] - this.pause() - for (let i = 0; i < dests.length; i++) - dests[i].emit('unpipe', this, { - hasUnpiped: false - }) - return this - } - - // Try to find the right one. - const index = ArrayPrototypeIndexOf(state.pipes, dest) - if (index === -1) return this - state.pipes.splice(index, 1) - if (state.pipes.length === 0) this.pause() - dest.emit('unpipe', this, unpipeInfo) - return this -} - -// Set up data events if they are asked for -// Ensure readable listeners eventually get something. -Readable.prototype.on = function (ev, fn) { - const res = Stream.prototype.on.call(this, ev, fn) - const state = this._readableState - if (ev === 'data') { - // Update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0 - - // Try start flowing on next tick if stream isn't explicitly paused. - if (state.flowing !== false) this.resume() - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true - state.flowing = false - state.emittedReadable = false - debug('on readable', state.length, state.reading) - if (state.length) { - emitReadable(this) - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this) - } - } - } - return res -} -Readable.prototype.addListener = Readable.prototype.on -Readable.prototype.removeListener = function (ev, fn) { - const res = Stream.prototype.removeListener.call(this, ev, fn) - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res -} -Readable.prototype.off = Readable.prototype.removeListener -Readable.prototype.removeAllListeners = function (ev) { - const res = Stream.prototype.removeAllListeners.apply(this, arguments) - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this) - } - return res -} -function updateReadableListening(self) { - const state = self._readableState - state.readableListening = self.listenerCount('readable') > 0 - if (state.resumeScheduled && state[kPaused] === false) { - // Flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true - - // Crude way to check if we should resume. - } else if (self.listenerCount('data') > 0) { - self.resume() - } else if (!state.readableListening) { - state.flowing = null - } -} -function nReadingNextTick(self) { - debug('readable nexttick read 0') - self.read(0) -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - const state = this._readableState - if (!state.flowing) { - debug('resume') - // We flow only if there is no one listening - // for readable, but we still have to call - // resume(). - state.flowing = !state.readableListening - resume(this, state) - } - state[kPaused] = false - return this -} -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true - process.nextTick(resume_, stream, state) - } -} -function resume_(stream, state) { - debug('resume', state.reading) - if (!state.reading) { - stream.read(0) - } - state.resumeScheduled = false - stream.emit('resume') - flow(stream) - if (state.flowing && !state.reading) stream.read(0) -} -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing) - if (this._readableState.flowing !== false) { - debug('pause') - this._readableState.flowing = false - this.emit('pause') - } - this._readableState[kPaused] = true - return this -} -function flow(stream) { - const state = stream._readableState - debug('flow', state.flowing) - while (state.flowing && stream.read() !== null); -} - -// Wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - let paused = false - - // TODO (ronag): Should this.destroy(err) emit - // 'error' on the wrapped stream? Would require - // a static factory method, e.g. Readable.wrap(stream). - - stream.on('data', (chunk) => { - if (!this.push(chunk) && stream.pause) { - paused = true - stream.pause() - } - }) - stream.on('end', () => { - this.push(null) - }) - stream.on('error', (err) => { - errorOrDestroy(this, err) - }) - stream.on('close', () => { - this.destroy() - }) - stream.on('destroy', () => { - this.destroy() - }) - this._read = () => { - if (paused && stream.resume) { - paused = false - stream.resume() - } - } - - // Proxy all the other methods. Important when wrapping filters and duplexes. - const streamKeys = ObjectKeys(stream) - for (let j = 1; j < streamKeys.length; j++) { - const i = streamKeys[j] - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = stream[i].bind(stream) - } - } - return this -} -Readable.prototype[SymbolAsyncIterator] = function () { - return streamToAsyncIterator(this) -} -Readable.prototype.iterator = function (options) { - if (options !== undefined) { - validateObject(options, 'options') - } - return streamToAsyncIterator(this, options) -} -function streamToAsyncIterator(stream, options) { - if (typeof stream.read !== 'function') { - stream = Readable.wrap(stream, { - objectMode: true - }) - } - const iter = createAsyncIterator(stream, options) - iter.stream = stream - return iter -} -async function* createAsyncIterator(stream, options) { - let callback = nop - function next(resolve) { - if (this === stream) { - callback() - callback = nop - } else { - callback = resolve - } - } - stream.on('readable', next) - let error - const cleanup = eos( - stream, - { - writable: false - }, - (err) => { - error = err ? aggregateTwoErrors(error, err) : null - callback() - callback = nop - } - ) - try { - while (true) { - const chunk = stream.destroyed ? null : stream.read() - if (chunk !== null) { - yield chunk - } else if (error) { - throw error - } else if (error === null) { - return - } else { - await new Promise(next) - } - } - } catch (err) { - error = aggregateTwoErrors(error, err) - throw error - } finally { - if ( - (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) && - (error === undefined || stream._readableState.autoDestroy) - ) { - destroyImpl.destroyer(stream, null) - } else { - stream.off('readable', next) - cleanup() - } - } -} - -// Making it explicit these properties are not enumerable -// because otherwise some prototype manipulation in -// userland will fail. -ObjectDefineProperties(Readable.prototype, { - readable: { - __proto__: null, - get() { - const r = this._readableState - // r.readable === false means that this is part of a Duplex stream - // where the readable side was disabled upon construction. - // Compat. The user might manually disable readable side through - // deprecated setter. - return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted - }, - set(val) { - // Backwards compat. - if (this._readableState) { - this._readableState.readable = !!val - } - } - }, - readableDidRead: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.dataEmitted - } - }, - readableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._readableState.readable !== false && - (this._readableState.destroyed || this._readableState.errored) && - !this._readableState.endEmitted - ) - } - }, - readableHighWaterMark: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.highWaterMark - } - }, - readableBuffer: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState && this._readableState.buffer - } - }, - readableFlowing: { - __proto__: null, - enumerable: false, - get: function () { - return this._readableState.flowing - }, - set: function (state) { - if (this._readableState) { - this._readableState.flowing = state - } - } - }, - readableLength: { - __proto__: null, - enumerable: false, - get() { - return this._readableState.length - } - }, - readableObjectMode: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.objectMode : false - } - }, - readableEncoding: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.encoding : null - } - }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.errored : null - } - }, - closed: { - __proto__: null, - get() { - return this._readableState ? this._readableState.closed : false - } - }, - destroyed: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.destroyed : false - }, - set(value) { - // We ignore the value if the stream - // has not been initialized yet. - if (!this._readableState) { - return - } - - // Backward compatibility, the user is explicitly - // managing destroyed. - this._readableState.destroyed = value - } - }, - readableEnded: { - __proto__: null, - enumerable: false, - get() { - return this._readableState ? this._readableState.endEmitted : false - } - } -}) -ObjectDefineProperties(ReadableState.prototype, { - // Legacy getter for `pipesCount`. - pipesCount: { - __proto__: null, - get() { - return this.pipes.length - } - }, - // Legacy property for `paused`. - paused: { - __proto__: null, - get() { - return this[kPaused] !== false - }, - set(value) { - this[kPaused] = !!value - } - } -}) - -// Exposed for testing purposes only. -Readable._fromList = fromList - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered. - if (state.length === 0) return null - let ret - if (state.objectMode) ret = state.buffer.shift() - else if (!n || n >= state.length) { - // Read it all, truncate the list. - if (state.decoder) ret = state.buffer.join('') - else if (state.buffer.length === 1) ret = state.buffer.first() - else ret = state.buffer.concat(state.length) - state.buffer.clear() - } else { - // read part of list. - ret = state.buffer.consume(n, state.decoder) - } - return ret -} -function endReadable(stream) { - const state = stream._readableState - debug('endReadable', state.endEmitted) - if (!state.endEmitted) { - state.ended = true - process.nextTick(endReadableNT, state, stream) - } -} -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length) - - // Check that we didn't get one last unshift. - if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) { - state.endEmitted = true - stream.emit('end') - if (stream.writable && stream.allowHalfOpen === false) { - process.nextTick(endWritableNT, stream) - } else if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well. - const wState = stream._writableState - const autoDestroy = - !wState || - (wState.autoDestroy && - // We don't expect the writable to ever 'finish' - // if writable is explicitly set to false. - (wState.finished || wState.writable === false)) - if (autoDestroy) { - stream.destroy() - } - } - } -} -function endWritableNT(stream) { - const writable = stream.writable && !stream.writableEnded && !stream.destroyed - if (writable) { - stream.end() - } -} -Readable.from = function (iterable, opts) { - return from(Readable, iterable, opts) -} -let webStreamsAdapters - -// Lazy to avoid circular references -function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters -} -Readable.fromWeb = function (readableStream, options) { - return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options) -} -Readable.toWeb = function (streamReadable, options) { - return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options) -} -Readable.wrap = function (src, options) { - var _ref, _src$readableObjectMo - return new Readable({ - objectMode: - (_ref = - (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined - ? _src$readableObjectMo - : src.objectMode) !== null && _ref !== undefined - ? _ref - : true, - ...options, - destroy(err, callback) { - destroyImpl.destroyer(src, err) - callback(err) - } - }).wrap(src) -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/state.js": -/*!************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/state.js ***! - \************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { MathFloor, NumberIsInteger } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { validateInteger } = __webpack_require__(/*! ../validators */ "./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js") -const { ERR_INVALID_ARG_VALUE } = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js").codes) -let defaultHighWaterMarkBytes = 16 * 1024 -let defaultHighWaterMarkObjectMode = 16 -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null -} -function getDefaultHighWaterMark(objectMode) { - return objectMode ? defaultHighWaterMarkObjectMode : defaultHighWaterMarkBytes -} -function setDefaultHighWaterMark(objectMode, value) { - validateInteger(value, 'value', 0) - if (objectMode) { - defaultHighWaterMarkObjectMode = value - } else { - defaultHighWaterMarkBytes = value - } -} -function getHighWaterMark(state, options, duplexKey, isDuplex) { - const hwm = highWaterMarkFrom(options, isDuplex, duplexKey) - if (hwm != null) { - if (!NumberIsInteger(hwm) || hwm < 0) { - const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark' - throw new ERR_INVALID_ARG_VALUE(name, hwm) - } - return MathFloor(hwm) - } - - // Default value - return getDefaultHighWaterMark(state.objectMode) -} -module.exports = { - getHighWaterMark, - getDefaultHighWaterMark, - setDefaultHighWaterMark -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/transform.js": -/*!****************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/transform.js ***! - \****************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - - - -const { ObjectSetPrototypeOf, Symbol } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Transform -const { ERR_METHOD_NOT_IMPLEMENTED } = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js").codes) -const Duplex = __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") -const { getHighWaterMark } = __webpack_require__(/*! ./state */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/state.js") -ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype) -ObjectSetPrototypeOf(Transform, Duplex) -const kCallback = Symbol('kCallback') -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options) - - // TODO (ronag): This should preferably always be - // applied but would be semver-major. Or even better; - // make Transform a Readable with the Writable interface. - const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null - if (readableHighWaterMark === 0) { - // A Duplex will buffer both on the writable and readable side while - // a Transform just wants to buffer hwm number of elements. To avoid - // buffering twice we disable buffering on the writable side. - options = { - ...options, - highWaterMark: null, - readableHighWaterMark, - // TODO (ronag): 0 is not optimal since we have - // a "bug" where we check needDrain before calling _write and not after. - // Refs: https://github.com/nodejs/node/pull/32887 - // Refs: https://github.com/nodejs/node/pull/35941 - writableHighWaterMark: options.writableHighWaterMark || 0 - } - } - Duplex.call(this, options) - - // We have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false - this[kCallback] = null - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform - if (typeof options.flush === 'function') this._flush = options.flush - } - - // When the writable side finishes, then flush out anything remaining. - // Backwards compat. Some Transform streams incorrectly implement _final - // instead of or in addition to _flush. By using 'prefinish' instead of - // implementing _final we continue supporting this unfortunate use case. - this.on('prefinish', prefinish) -} -function final(cb) { - if (typeof this._flush === 'function' && !this.destroyed) { - this._flush((er, data) => { - if (er) { - if (cb) { - cb(er) - } else { - this.destroy(er) - } - return - } - if (data != null) { - this.push(data) - } - this.push(null) - if (cb) { - cb() - } - }) - } else { - this.push(null) - if (cb) { - cb() - } - } -} -function prefinish() { - if (this._final !== final) { - final.call(this) - } -} -Transform.prototype._final = final -Transform.prototype._transform = function (chunk, encoding, callback) { - throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()') -} -Transform.prototype._write = function (chunk, encoding, callback) { - const rState = this._readableState - const wState = this._writableState - const length = rState.length - this._transform(chunk, encoding, (err, val) => { - if (err) { - callback(err) - return - } - if (val != null) { - this.push(val) - } - if ( - wState.ended || - // Backwards compat. - length === rState.length || - // Backwards compat. - rState.length < rState.highWaterMark - ) { - callback() - } else { - this[kCallback] = callback - } - }) -} -Transform.prototype._read = function () { - if (this[kCallback]) { - const callback = this[kCallback] - this[kCallback] = null - callback() - } -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js": -/*!************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js ***! - \************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { SymbolAsyncIterator, SymbolIterator, SymbolFor } = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") - -// We need to use SymbolFor to make these globally available -// for interopt with readable-stream, i.e. readable-stream -// and node core needs to be able to read/write private state -// from each other for proper interoperability. -const kIsDestroyed = SymbolFor('nodejs.stream.destroyed') -const kIsErrored = SymbolFor('nodejs.stream.errored') -const kIsReadable = SymbolFor('nodejs.stream.readable') -const kIsWritable = SymbolFor('nodejs.stream.writable') -const kIsDisturbed = SymbolFor('nodejs.stream.disturbed') -const kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise') -const kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction') -function isReadableNodeStream(obj, strict = false) { - var _obj$_readableState - return !!( - ( - obj && - typeof obj.pipe === 'function' && - typeof obj.on === 'function' && - (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) && - (!obj._writableState || - ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined - ? undefined - : _obj$_readableState.readable) !== false) && - // Duplex - (!obj._writableState || obj._readableState) - ) // Writable has .pipe. - ) -} - -function isWritableNodeStream(obj) { - var _obj$_writableState - return !!( - ( - obj && - typeof obj.write === 'function' && - typeof obj.on === 'function' && - (!obj._readableState || - ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined - ? undefined - : _obj$_writableState.writable) !== false) - ) // Duplex - ) -} - -function isDuplexNodeStream(obj) { - return !!( - obj && - typeof obj.pipe === 'function' && - obj._readableState && - typeof obj.on === 'function' && - typeof obj.write === 'function' - ) -} -function isNodeStream(obj) { - return ( - obj && - (obj._readableState || - obj._writableState || - (typeof obj.write === 'function' && typeof obj.on === 'function') || - (typeof obj.pipe === 'function' && typeof obj.on === 'function')) - ) -} -function isReadableStream(obj) { - return !!( - obj && - !isNodeStream(obj) && - typeof obj.pipeThrough === 'function' && - typeof obj.getReader === 'function' && - typeof obj.cancel === 'function' - ) -} -function isWritableStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function') -} -function isTransformStream(obj) { - return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object') -} -function isWebStream(obj) { - return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj) -} -function isIterable(obj, isAsync) { - if (obj == null) return false - if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function' - if (isAsync === false) return typeof obj[SymbolIterator] === 'function' - return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function' -} -function isDestroyed(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState - return !!(stream.destroyed || stream[kIsDestroyed] || (state !== null && state !== undefined && state.destroyed)) -} - -// Have been end():d. -function isWritableEnded(stream) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableEnded === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null - return wState.ended -} - -// Have emitted 'finish'. -function isWritableFinished(stream, strict) { - if (!isWritableNodeStream(stream)) return null - if (stream.writableFinished === true) return true - const wState = stream._writableState - if (wState !== null && wState !== undefined && wState.errored) return false - if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null - return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0)) -} - -// Have been push(null):d. -function isReadableEnded(stream) { - if (!isReadableNodeStream(stream)) return null - if (stream.readableEnded === true) return true - const rState = stream._readableState - if (!rState || rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null - return rState.ended -} - -// Have emitted 'end'. -function isReadableFinished(stream, strict) { - if (!isReadableNodeStream(stream)) return null - const rState = stream._readableState - if (rState !== null && rState !== undefined && rState.errored) return false - if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null - return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0)) -} -function isReadable(stream) { - if (stream && stream[kIsReadable] != null) return stream[kIsReadable] - if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream) -} -function isWritable(stream) { - if (stream && stream[kIsWritable] != null) return stream[kIsWritable] - if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null - if (isDestroyed(stream)) return false - return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream) -} -function isFinished(stream, opts) { - if (!isNodeStream(stream)) { - return null - } - if (isDestroyed(stream)) { - return true - } - if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) { - return false - } - if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) { - return false - } - return true -} -function isWritableErrored(stream) { - var _stream$_writableStat, _stream$_writableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.writableErrored) { - return stream.writableErrored - } - return (_stream$_writableStat = - (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined - ? undefined - : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined - ? _stream$_writableStat - : null -} -function isReadableErrored(stream) { - var _stream$_readableStat, _stream$_readableStat2 - if (!isNodeStream(stream)) { - return null - } - if (stream.readableErrored) { - return stream.readableErrored - } - return (_stream$_readableStat = - (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined - ? undefined - : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined - ? _stream$_readableStat - : null -} -function isClosed(stream) { - if (!isNodeStream(stream)) { - return null - } - if (typeof stream.closed === 'boolean') { - return stream.closed - } - const wState = stream._writableState - const rState = stream._readableState - if ( - typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' || - typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean' - ) { - return ( - (wState === null || wState === undefined ? undefined : wState.closed) || - (rState === null || rState === undefined ? undefined : rState.closed) - ) - } - if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) { - return stream._closed - } - return null -} -function isOutgoingMessage(stream) { - return ( - typeof stream._closed === 'boolean' && - typeof stream._defaultKeepAlive === 'boolean' && - typeof stream._removedConnection === 'boolean' && - typeof stream._removedContLen === 'boolean' - ) -} -function isServerResponse(stream) { - return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream) -} -function isServerRequest(stream) { - var _stream$req - return ( - typeof stream._consuming === 'boolean' && - typeof stream._dumped === 'boolean' && - ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) === - undefined - ) -} -function willEmitClose(stream) { - if (!isNodeStream(stream)) return null - const wState = stream._writableState - const rState = stream._readableState - const state = wState || rState - return ( - (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false) - ) -} -function isDisturbed(stream) { - var _stream$kIsDisturbed - return !!( - stream && - ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined - ? _stream$kIsDisturbed - : stream.readableDidRead || stream.readableAborted) - ) -} -function isErrored(stream) { - var _ref, - _ref2, - _ref3, - _ref4, - _ref5, - _stream$kIsErrored, - _stream$_readableStat3, - _stream$_writableStat3, - _stream$_readableStat4, - _stream$_writableStat4 - return !!( - stream && - ((_ref = - (_ref2 = - (_ref3 = - (_ref4 = - (_ref5 = - (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined - ? _stream$kIsErrored - : stream.readableErrored) !== null && _ref5 !== undefined - ? _ref5 - : stream.writableErrored) !== null && _ref4 !== undefined - ? _ref4 - : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined - ? undefined - : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined - ? _ref3 - : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined - ? undefined - : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined - ? _ref2 - : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined - ? undefined - : _stream$_readableStat4.errored) !== null && _ref !== undefined - ? _ref - : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined - ? undefined - : _stream$_writableStat4.errored) - ) -} -module.exports = { - isDestroyed, - kIsDestroyed, - isDisturbed, - kIsDisturbed, - isErrored, - kIsErrored, - isReadable, - kIsReadable, - kIsClosedPromise, - kControllerErrorFunction, - kIsWritable, - isClosed, - isDuplexNodeStream, - isFinished, - isIterable, - isReadableNodeStream, - isReadableStream, - isReadableEnded, - isReadableFinished, - isReadableErrored, - isNodeStream, - isWebStream, - isWritable, - isWritableNodeStream, - isWritableStream, - isWritableEnded, - isWritableFinished, - isWritableErrored, - isServerRequest, - isServerResponse, - willEmitClose, - isTransformStream -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/writable.js": -/*!***************************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/streams/writable.js ***! - \***************************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const process = __webpack_require__(/*! process/ */ "./node_modules/process/browser.js") - -/* replacement end */ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -;('use strict') -const { - ArrayPrototypeSlice, - Error, - FunctionPrototypeSymbolHasInstance, - ObjectDefineProperty, - ObjectDefineProperties, - ObjectSetPrototypeOf, - StringPrototypeToLowerCase, - Symbol, - SymbolHasInstance -} = __webpack_require__(/*! ../../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -module.exports = Writable -Writable.WritableState = WritableState -const { EventEmitter: EE } = __webpack_require__(/*! events */ "./node_modules/events/events.js") -const Stream = (__webpack_require__(/*! ./legacy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/legacy.js").Stream) -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const destroyImpl = __webpack_require__(/*! ./destroy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js") -const { addAbortSignal } = __webpack_require__(/*! ./add-abort-signal */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -const { getHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(/*! ./state */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/state.js") -const { - ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED, - ERR_STREAM_ALREADY_FINISHED, - ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING -} = (__webpack_require__(/*! ../../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js").codes) -const { errorOrDestroy } = destroyImpl -ObjectSetPrototypeOf(Writable.prototype, Stream.prototype) -ObjectSetPrototypeOf(Writable, Stream) -function nop() {} -const kOnFinished = Symbol('kOnFinished') -function WritableState(options, stream, isDuplex) { - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") - - // Object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!(options && options.objectMode) - if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode) - - // The point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write(). - this.highWaterMark = options - ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex) - : getDefaultHighWaterMark(false) - - // if _final has been called. - this.finalCalled = false - - // drain event flag. - this.needDrain = false - // At the start of calling end() - this.ending = false - // When end() has been called, and returned. - this.ended = false - // When 'finish' is emitted. - this.finished = false - - // Has it been destroyed - this.destroyed = false - - // Should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - const noDecode = !!(options && options.decodeStrings === false) - this.decodeStrings = !noDecode - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = (options && options.defaultEncoding) || 'utf8' - - // Not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0 - - // A flag to see when we're in the middle of a write. - this.writing = false - - // When true all writes will be buffered until .uncork() call. - this.corked = 0 - - // A flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true - - // A flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false - - // The callback that's passed to _write(chunk, cb). - this.onwrite = onwrite.bind(undefined, stream) - - // The callback that the user supplies to write(chunk, encoding, cb). - this.writecb = null - - // The amount that is being written when _write is called. - this.writelen = 0 - - // Storage for data passed to the afterWrite() callback in case of - // synchronous _write() completion. - this.afterWriteTickInfo = null - resetBuffer(this) - - // Number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted. - this.pendingcb = 0 - - // Stream is still being constructed and cannot be - // destroyed until construction finished or failed. - // Async construction is opt in, therefore we start as - // constructed. - this.constructed = true - - // Emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams. - this.prefinished = false - - // True if the error was already emitted and should not be thrown again. - this.errorEmitted = false - - // Should close be emitted on destroy. Defaults to true. - this.emitClose = !options || options.emitClose !== false - - // Should .destroy() be called after 'finish' (and potentially 'end'). - this.autoDestroy = !options || options.autoDestroy !== false - - // Indicates whether the stream has errored. When true all write() calls - // should return false. This is needed since when autoDestroy - // is disabled we need a way to tell whether the stream has failed. - this.errored = null - - // Indicates whether the stream has finished destroying. - this.closed = false - - // True if close has been emitted or would have been emitted - // depending on emitClose. - this.closeEmitted = false - this[kOnFinished] = [] -} -function resetBuffer(state) { - state.buffered = [] - state.bufferedIndex = 0 - state.allBuffers = true - state.allNoop = true -} -WritableState.prototype.getBuffer = function getBuffer() { - return ArrayPrototypeSlice(this.buffered, this.bufferedIndex) -} -ObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', { - __proto__: null, - get() { - return this.buffered.length - this.bufferedIndex - } -}) -function Writable(options) { - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5. - const isDuplex = this instanceof __webpack_require__(/*! ./duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") - if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options) - this._writableState = new WritableState(options, this, isDuplex) - if (options) { - if (typeof options.write === 'function') this._write = options.write - if (typeof options.writev === 'function') this._writev = options.writev - if (typeof options.destroy === 'function') this._destroy = options.destroy - if (typeof options.final === 'function') this._final = options.final - if (typeof options.construct === 'function') this._construct = options.construct - if (options.signal) addAbortSignal(options.signal, this) - } - Stream.call(this, options) - destroyImpl.construct(this, () => { - const state = this._writableState - if (!state.writing) { - clearBuffer(this, state) - } - finishMaybe(this, state) - }) -} -ObjectDefineProperty(Writable, SymbolHasInstance, { - __proto__: null, - value: function (object) { - if (FunctionPrototypeSymbolHasInstance(this, object)) return true - if (this !== Writable) return false - return object && object._writableState instanceof WritableState - } -}) - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()) -} -function _write(stream, chunk, encoding, cb) { - const state = stream._writableState - if (typeof encoding === 'function') { - cb = encoding - encoding = state.defaultEncoding - } else { - if (!encoding) encoding = state.defaultEncoding - else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - if (typeof cb !== 'function') cb = nop - } - if (chunk === null) { - throw new ERR_STREAM_NULL_VALUES() - } else if (!state.objectMode) { - if (typeof chunk === 'string') { - if (state.decodeStrings !== false) { - chunk = Buffer.from(chunk, encoding) - encoding = 'buffer' - } - } else if (chunk instanceof Buffer) { - encoding = 'buffer' - } else if (Stream._isUint8Array(chunk)) { - chunk = Stream._uint8ArrayToBuffer(chunk) - encoding = 'buffer' - } else { - throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk) - } - } - let err - if (state.ending) { - err = new ERR_STREAM_WRITE_AFTER_END() - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('write') - } - if (err) { - process.nextTick(cb, err) - errorOrDestroy(stream, err, true) - return err - } - state.pendingcb++ - return writeOrBuffer(stream, state, chunk, encoding, cb) -} -Writable.prototype.write = function (chunk, encoding, cb) { - return _write(this, chunk, encoding, cb) === true -} -Writable.prototype.cork = function () { - this._writableState.corked++ -} -Writable.prototype.uncork = function () { - const state = this._writableState - if (state.corked) { - state.corked-- - if (!state.writing) clearBuffer(this, state) - } -} -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding) - if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding) - this._writableState.defaultEncoding = encoding - return this -} - -// If we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, callback) { - const len = state.objectMode ? 1 : chunk.length - state.length += len - - // stream._write resets state.length - const ret = state.length < state.highWaterMark - // We must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true - if (state.writing || state.corked || state.errored || !state.constructed) { - state.buffered.push({ - chunk, - encoding, - callback - }) - if (state.allBuffers && encoding !== 'buffer') { - state.allBuffers = false - } - if (state.allNoop && callback !== nop) { - state.allNoop = false - } - } else { - state.writelen = len - state.writecb = callback - state.writing = true - state.sync = true - stream._write(chunk, encoding, state.onwrite) - state.sync = false - } - - // Return false if errored or destroyed in order to break - // any synchronous while(stream.write(data)) loops. - return ret && !state.errored && !state.destroyed -} -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len - state.writecb = cb - state.writing = true - state.sync = true - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write')) - else if (writev) stream._writev(chunk, state.onwrite) - else stream._write(chunk, encoding, state.onwrite) - state.sync = false -} -function onwriteError(stream, state, er, cb) { - --state.pendingcb - cb(er) - // Ensure callbacks are invoked even when autoDestroy is - // not enabled. Passing `er` here doesn't make sense since - // it's related to one specific write, not to the buffered - // writes. - errorBuffer(state) - // This can emit error, but error must always follow cb. - errorOrDestroy(stream, er) -} -function onwrite(stream, er) { - const state = stream._writableState - const sync = state.sync - const cb = state.writecb - if (typeof cb !== 'function') { - errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK()) - return - } - state.writing = false - state.writecb = null - state.length -= state.writelen - state.writelen = 0 - if (er) { - // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364 - er.stack // eslint-disable-line no-unused-expressions - - if (!state.errored) { - state.errored = er - } - - // In case of duplex streams we need to notify the readable side of the - // error. - if (stream._readableState && !stream._readableState.errored) { - stream._readableState.errored = er - } - if (sync) { - process.nextTick(onwriteError, stream, state, er, cb) - } else { - onwriteError(stream, state, er, cb) - } - } else { - if (state.buffered.length > state.bufferedIndex) { - clearBuffer(stream, state) - } - if (sync) { - // It is a common case that the callback passed to .write() is always - // the same. In that case, we do not schedule a new nextTick(), but - // rather just increase a counter, to improve performance and avoid - // memory allocations. - if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) { - state.afterWriteTickInfo.count++ - } else { - state.afterWriteTickInfo = { - count: 1, - cb, - stream, - state - } - process.nextTick(afterWriteTick, state.afterWriteTickInfo) - } - } else { - afterWrite(stream, state, 1, cb) - } - } -} -function afterWriteTick({ stream, state, count, cb }) { - state.afterWriteTickInfo = null - return afterWrite(stream, state, count, cb) -} -function afterWrite(stream, state, count, cb) { - const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain - if (needDrain) { - state.needDrain = false - stream.emit('drain') - } - while (count-- > 0) { - state.pendingcb-- - cb() - } - if (state.destroyed) { - errorBuffer(state) - } - finishMaybe(stream, state) -} - -// If there's something in the buffer waiting, then invoke callbacks. -function errorBuffer(state) { - if (state.writing) { - return - } - for (let n = state.bufferedIndex; n < state.buffered.length; ++n) { - var _state$errored - const { chunk, callback } = state.buffered[n] - const len = state.objectMode ? 1 : chunk.length - state.length -= len - callback( - (_state$errored = state.errored) !== null && _state$errored !== undefined - ? _state$errored - : new ERR_STREAM_DESTROYED('write') - ) - } - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - var _state$errored2 - onfinishCallbacks[i]( - (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined - ? _state$errored2 - : new ERR_STREAM_DESTROYED('end') - ) - } - resetBuffer(state) -} - -// If there's something in the buffer waiting, then process it. -function clearBuffer(stream, state) { - if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) { - return - } - const { buffered, bufferedIndex, objectMode } = state - const bufferedLength = buffered.length - bufferedIndex - if (!bufferedLength) { - return - } - let i = bufferedIndex - state.bufferProcessing = true - if (bufferedLength > 1 && stream._writev) { - state.pendingcb -= bufferedLength - 1 - const callback = state.allNoop - ? nop - : (err) => { - for (let n = i; n < buffered.length; ++n) { - buffered[n].callback(err) - } - } - // Make a copy of `buffered` if it's going to be used by `callback` above, - // since `doWrite` will mutate the array. - const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i) - chunks.allBuffers = state.allBuffers - doWrite(stream, state, true, state.length, chunks, '', callback) - resetBuffer(state) - } else { - do { - const { chunk, encoding, callback } = buffered[i] - buffered[i++] = null - const len = objectMode ? 1 : chunk.length - doWrite(stream, state, false, len, chunk, encoding, callback) - } while (i < buffered.length && !state.writing) - if (i === buffered.length) { - resetBuffer(state) - } else if (i > 256) { - buffered.splice(0, i) - state.bufferedIndex = 0 - } else { - state.bufferedIndex = i - } - } - state.bufferProcessing = false -} -Writable.prototype._write = function (chunk, encoding, cb) { - if (this._writev) { - this._writev( - [ - { - chunk, - encoding - } - ], - cb - ) - } else { - throw new ERR_METHOD_NOT_IMPLEMENTED('_write()') - } -} -Writable.prototype._writev = null -Writable.prototype.end = function (chunk, encoding, cb) { - const state = this._writableState - if (typeof chunk === 'function') { - cb = chunk - chunk = null - encoding = null - } else if (typeof encoding === 'function') { - cb = encoding - encoding = null - } - let err - if (chunk !== null && chunk !== undefined) { - const ret = _write(this, chunk, encoding) - if (ret instanceof Error) { - err = ret - } - } - - // .end() fully uncorks. - if (state.corked) { - state.corked = 1 - this.uncork() - } - if (err) { - // Do nothing... - } else if (!state.errored && !state.ending) { - // This is forgiving in terms of unnecessary calls to end() and can hide - // logic errors. However, usually such errors are harmless and causing a - // hard error can be disproportionately destructive. It is not always - // trivial for the user to determine whether end() needs to be called - // or not. - - state.ending = true - finishMaybe(this, state, true) - state.ended = true - } else if (state.finished) { - err = new ERR_STREAM_ALREADY_FINISHED('end') - } else if (state.destroyed) { - err = new ERR_STREAM_DESTROYED('end') - } - if (typeof cb === 'function') { - if (err || state.finished) { - process.nextTick(cb, err) - } else { - state[kOnFinished].push(cb) - } - } - return this -} -function needFinish(state) { - return ( - state.ending && - !state.destroyed && - state.constructed && - state.length === 0 && - !state.errored && - state.buffered.length === 0 && - !state.finished && - !state.writing && - !state.errorEmitted && - !state.closeEmitted - ) -} -function callFinal(stream, state) { - let called = false - function onFinish(err) { - if (called) { - errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK()) - return - } - called = true - state.pendingcb-- - if (err) { - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i](err) - } - errorOrDestroy(stream, err, state.sync) - } else if (needFinish(state)) { - state.prefinished = true - stream.emit('prefinish') - // Backwards compat. Don't check state.sync here. - // Some streams assume 'finish' will be emitted - // asynchronously relative to _final callback. - state.pendingcb++ - process.nextTick(finish, stream, state) - } - } - state.sync = true - state.pendingcb++ - try { - stream._final(onFinish) - } catch (err) { - onFinish(err) - } - state.sync = false -} -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.finalCalled = true - callFinal(stream, state) - } else { - state.prefinished = true - stream.emit('prefinish') - } - } -} -function finishMaybe(stream, state, sync) { - if (needFinish(state)) { - prefinish(stream, state) - if (state.pendingcb === 0) { - if (sync) { - state.pendingcb++ - process.nextTick( - (stream, state) => { - if (needFinish(state)) { - finish(stream, state) - } else { - state.pendingcb-- - } - }, - stream, - state - ) - } else if (needFinish(state)) { - state.pendingcb++ - finish(stream, state) - } - } - } -} -function finish(stream, state) { - state.pendingcb-- - state.finished = true - const onfinishCallbacks = state[kOnFinished].splice(0) - for (let i = 0; i < onfinishCallbacks.length; i++) { - onfinishCallbacks[i]() - } - stream.emit('finish') - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the readable side is ready for autoDestroy as well. - const rState = stream._readableState - const autoDestroy = - !rState || - (rState.autoDestroy && - // We don't expect the readable to ever 'end' - // if readable is explicitly set to false. - (rState.endEmitted || rState.readable === false)) - if (autoDestroy) { - stream.destroy() - } - } -} -ObjectDefineProperties(Writable.prototype, { - closed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.closed : false - } - }, - destroyed: { - __proto__: null, - get() { - return this._writableState ? this._writableState.destroyed : false - }, - set(value) { - // Backward compatibility, the user is explicitly managing destroyed. - if (this._writableState) { - this._writableState.destroyed = value - } - } - }, - writable: { - __proto__: null, - get() { - const w = this._writableState - // w.writable === false means that this is part of a Duplex stream - // where the writable side was disabled upon construction. - // Compat. The user might manually disable writable side through - // deprecated setter. - return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended - }, - set(val) { - // Backwards compatible. - if (this._writableState) { - this._writableState.writable = !!val - } - } - }, - writableFinished: { - __proto__: null, - get() { - return this._writableState ? this._writableState.finished : false - } - }, - writableObjectMode: { - __proto__: null, - get() { - return this._writableState ? this._writableState.objectMode : false - } - }, - writableBuffer: { - __proto__: null, - get() { - return this._writableState && this._writableState.getBuffer() - } - }, - writableEnded: { - __proto__: null, - get() { - return this._writableState ? this._writableState.ending : false - } - }, - writableNeedDrain: { - __proto__: null, - get() { - const wState = this._writableState - if (!wState) return false - return !wState.destroyed && !wState.ending && wState.needDrain - } - }, - writableHighWaterMark: { - __proto__: null, - get() { - return this._writableState && this._writableState.highWaterMark - } - }, - writableCorked: { - __proto__: null, - get() { - return this._writableState ? this._writableState.corked : 0 - } - }, - writableLength: { - __proto__: null, - get() { - return this._writableState && this._writableState.length - } - }, - errored: { - __proto__: null, - enumerable: false, - get() { - return this._writableState ? this._writableState.errored : null - } - }, - writableAborted: { - __proto__: null, - enumerable: false, - get: function () { - return !!( - this._writableState.writable !== false && - (this._writableState.destroyed || this._writableState.errored) && - !this._writableState.finished - ) - } - } -}) -const destroy = destroyImpl.destroy -Writable.prototype.destroy = function (err, cb) { - const state = this._writableState - - // Invoke pending callbacks. - if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) { - process.nextTick(errorBuffer, state) - } - destroy.call(this, err, cb) - return this -} -Writable.prototype._undestroy = destroyImpl.undestroy -Writable.prototype._destroy = function (err, cb) { - cb(err) -} -Writable.prototype[EE.captureRejectionSymbol] = function (err) { - this.destroy(err) -} -let webStreamsAdapters - -// Lazy to avoid circular references -function lazyWebStreams() { - if (webStreamsAdapters === undefined) webStreamsAdapters = {} - return webStreamsAdapters -} -Writable.fromWeb = function (writableStream, options) { - return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options) -} -Writable.toWeb = function (streamWritable) { - return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable) -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js ***! - \*********************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; -/* eslint jsdoc/require-jsdoc: "error" */ - - - -const { - ArrayIsArray, - ArrayPrototypeIncludes, - ArrayPrototypeJoin, - ArrayPrototypeMap, - NumberIsInteger, - NumberIsNaN, - NumberMAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER, - NumberParseInt, - ObjectPrototypeHasOwnProperty, - RegExpPrototypeExec, - String, - StringPrototypeToUpperCase, - StringPrototypeTrim -} = __webpack_require__(/*! ../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { - hideStackFrames, - codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL } -} = __webpack_require__(/*! ../ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const { normalizeEncoding } = __webpack_require__(/*! ../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") -const { isAsyncFunction, isArrayBufferView } = (__webpack_require__(/*! ../ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js").types) -const signals = {} - -/** - * @param {*} value - * @returns {boolean} - */ -function isInt32(value) { - return value === (value | 0) -} - -/** - * @param {*} value - * @returns {boolean} - */ -function isUint32(value) { - return value === value >>> 0 -} -const octalReg = /^[0-7]+$/ -const modeDesc = 'must be a 32-bit unsigned integer or an octal string' - -/** - * Parse and validate values that will be converted into mode_t (the S_* - * constants). Only valid numbers and octal strings are allowed. They could be - * converted to 32-bit unsigned integers or non-negative signed integers in the - * C++ land, but any value higher than 0o777 will result in platform-specific - * behaviors. - * @param {*} value Values to be validated - * @param {string} name Name of the argument - * @param {number} [def] If specified, will be returned for invalid values - * @returns {number} - */ -function parseFileMode(value, name, def) { - if (typeof value === 'undefined') { - value = def - } - if (typeof value === 'string') { - if (RegExpPrototypeExec(octalReg, value) === null) { - throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc) - } - value = NumberParseInt(value, 8) - } - validateUint32(value, name) - return value -} - -/** - * @callback validateInteger - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - -/** @type {validateInteger} */ -const validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) -}) - -/** - * @callback validateInt32 - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - -/** @type {validateInt32} */ -const validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => { - // The defaults for min and max correspond to the limits of 32-bit integers. - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - } - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) - } -}) - -/** - * @callback validateUint32 - * @param {*} value - * @param {string} name - * @param {number|boolean} [positive=false] - * @returns {asserts value is number} - */ - -/** @type {validateUint32} */ -const validateUint32 = hideStackFrames((value, name, positive = false) => { - if (typeof value !== 'number') { - throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - } - if (!NumberIsInteger(value)) { - throw new ERR_OUT_OF_RANGE(name, 'an integer', value) - } - const min = positive ? 1 : 0 - // 2 ** 32 === 4294967296 - const max = 4294967295 - if (value < min || value > max) { - throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value) - } -}) - -/** - * @callback validateString - * @param {*} value - * @param {string} name - * @returns {asserts value is string} - */ - -/** @type {validateString} */ -function validateString(value, name) { - if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value) -} - -/** - * @callback validateNumber - * @param {*} value - * @param {string} name - * @param {number} [min] - * @param {number} [max] - * @returns {asserts value is number} - */ - -/** @type {validateNumber} */ -function validateNumber(value, name, min = undefined, max) { - if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value) - if ( - (min != null && value < min) || - (max != null && value > max) || - ((min != null || max != null) && NumberIsNaN(value)) - ) { - throw new ERR_OUT_OF_RANGE( - name, - `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`, - value - ) - } -} - -/** - * @callback validateOneOf - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} oneOf - */ - -/** @type {validateOneOf} */ -const validateOneOf = hideStackFrames((value, name, oneOf) => { - if (!ArrayPrototypeIncludes(oneOf, value)) { - const allowed = ArrayPrototypeJoin( - ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))), - ', ' - ) - const reason = 'must be one of: ' + allowed - throw new ERR_INVALID_ARG_VALUE(name, value, reason) - } -}) - -/** - * @callback validateBoolean - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean} - */ - -/** @type {validateBoolean} */ -function validateBoolean(value, name) { - if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value) -} - -/** - * @param {any} options - * @param {string} key - * @param {boolean} defaultValue - * @returns {boolean} - */ -function getOwnPropertyValueOrDefault(options, key, defaultValue) { - return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key] -} - -/** - * @callback validateObject - * @param {*} value - * @param {string} name - * @param {{ - * allowArray?: boolean, - * allowFunction?: boolean, - * nullable?: boolean - * }} [options] - */ - -/** @type {validateObject} */ -const validateObject = hideStackFrames((value, name, options = null) => { - const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false) - const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false) - const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false) - if ( - (!nullable && value === null) || - (!allowArray && ArrayIsArray(value)) || - (typeof value !== 'object' && (!allowFunction || typeof value !== 'function')) - ) { - throw new ERR_INVALID_ARG_TYPE(name, 'Object', value) - } -}) - -/** - * @callback validateDictionary - We are using the Web IDL Standard definition - * of "dictionary" here, which means any value - * whose Type is either Undefined, Null, or - * Object (which includes functions). - * @param {*} value - * @param {string} name - * @see https://webidl.spec.whatwg.org/#es-dictionary - * @see https://tc39.es/ecma262/#table-typeof-operator-results - */ - -/** @type {validateDictionary} */ -const validateDictionary = hideStackFrames((value, name) => { - if (value != null && typeof value !== 'object' && typeof value !== 'function') { - throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value) - } -}) - -/** - * @callback validateArray - * @param {*} value - * @param {string} name - * @param {number} [minLength] - * @returns {asserts value is any[]} - */ - -/** @type {validateArray} */ -const validateArray = hideStackFrames((value, name, minLength = 0) => { - if (!ArrayIsArray(value)) { - throw new ERR_INVALID_ARG_TYPE(name, 'Array', value) - } - if (value.length < minLength) { - const reason = `must be longer than ${minLength}` - throw new ERR_INVALID_ARG_VALUE(name, value, reason) - } -}) - -/** - * @callback validateStringArray - * @param {*} value - * @param {string} name - * @returns {asserts value is string[]} - */ - -/** @type {validateStringArray} */ -function validateStringArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateString(value[i], `${name}[${i}]`) - } -} - -/** - * @callback validateBooleanArray - * @param {*} value - * @param {string} name - * @returns {asserts value is boolean[]} - */ - -/** @type {validateBooleanArray} */ -function validateBooleanArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - validateBoolean(value[i], `${name}[${i}]`) - } -} - -/** - * @callback validateAbortSignalArray - * @param {*} value - * @param {string} name - * @returns {asserts value is AbortSignal[]} - */ - -/** @type {validateAbortSignalArray} */ -function validateAbortSignalArray(value, name) { - validateArray(value, name) - for (let i = 0; i < value.length; i++) { - const signal = value[i] - const indexedName = `${name}[${i}]` - if (signal == null) { - throw new ERR_INVALID_ARG_TYPE(indexedName, 'AbortSignal', signal) - } - validateAbortSignal(signal, indexedName) - } -} - -/** - * @param {*} signal - * @param {string} [name='signal'] - * @returns {asserts signal is keyof signals} - */ -function validateSignalName(signal, name = 'signal') { - validateString(signal, name) - if (signals[signal] === undefined) { - if (signals[StringPrototypeToUpperCase(signal)] !== undefined) { - throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)') - } - throw new ERR_UNKNOWN_SIGNAL(signal) - } -} - -/** - * @callback validateBuffer - * @param {*} buffer - * @param {string} [name='buffer'] - * @returns {asserts buffer is ArrayBufferView} - */ - -/** @type {validateBuffer} */ -const validateBuffer = hideStackFrames((buffer, name = 'buffer') => { - if (!isArrayBufferView(buffer)) { - throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer) - } -}) - -/** - * @param {string} data - * @param {string} encoding - */ -function validateEncoding(data, encoding) { - const normalizedEncoding = normalizeEncoding(encoding) - const length = data.length - if (normalizedEncoding === 'hex' && length % 2 !== 0) { - throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`) - } -} - -/** - * Check that the port number is not NaN when coerced to a number, - * is an integer and that it falls within the legal range of port numbers. - * @param {*} port - * @param {string} [name='Port'] - * @param {boolean} [allowZero=true] - * @returns {number} - */ -function validatePort(port, name = 'Port', allowZero = true) { - if ( - (typeof port !== 'number' && typeof port !== 'string') || - (typeof port === 'string' && StringPrototypeTrim(port).length === 0) || - +port !== +port >>> 0 || - port > 0xffff || - (port === 0 && !allowZero) - ) { - throw new ERR_SOCKET_BAD_PORT(name, port, allowZero) - } - return port | 0 -} - -/** - * @callback validateAbortSignal - * @param {*} signal - * @param {string} name - */ - -/** @type {validateAbortSignal} */ -const validateAbortSignal = hideStackFrames((signal, name) => { - if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } -}) - -/** - * @callback validateFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - -/** @type {validateFunction} */ -const validateFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) -}) - -/** - * @callback validatePlainFunction - * @param {*} value - * @param {string} name - * @returns {asserts value is Function} - */ - -/** @type {validatePlainFunction} */ -const validatePlainFunction = hideStackFrames((value, name) => { - if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) -}) - -/** - * @callback validateUndefined - * @param {*} value - * @param {string} name - * @returns {asserts value is undefined} - */ - -/** @type {validateUndefined} */ -const validateUndefined = hideStackFrames((value, name) => { - if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value) -}) - -/** - * @template T - * @param {T} value - * @param {string} name - * @param {T[]} union - */ -function validateUnion(value, name, union) { - if (!ArrayPrototypeIncludes(union, value)) { - throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value) - } -} - -/* - The rules for the Link header field are described here: - https://www.rfc-editor.org/rfc/rfc8288.html#section-3 - - This regex validates any string surrounded by angle brackets - (not necessarily a valid URI reference) followed by zero or more - link-params separated by semicolons. -*/ -const linkValueRegExp = /^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/ - -/** - * @param {any} value - * @param {string} name - */ -function validateLinkHeaderFormat(value, name) { - if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) { - throw new ERR_INVALID_ARG_VALUE( - name, - value, - 'must be an array or string of format "; rel=preload; as=style"' - ) - } -} - -/** - * @param {any} hints - * @return {string} - */ -function validateLinkHeaderValue(hints) { - if (typeof hints === 'string') { - validateLinkHeaderFormat(hints, 'hints') - return hints - } else if (ArrayIsArray(hints)) { - const hintsLength = hints.length - let result = '' - if (hintsLength === 0) { - return result - } - for (let i = 0; i < hintsLength; i++) { - const link = hints[i] - validateLinkHeaderFormat(link, 'hints') - result += link - if (i !== hintsLength - 1) { - result += ', ' - } - } - return result - } - throw new ERR_INVALID_ARG_VALUE( - 'hints', - hints, - 'must be an array or string of format "; rel=preload; as=style"' - ) -} -module.exports = { - isInt32, - isUint32, - parseFileMode, - validateArray, - validateStringArray, - validateBooleanArray, - validateAbortSignalArray, - validateBoolean, - validateBuffer, - validateDictionary, - validateEncoding, - validateFunction, - validateInt32, - validateInteger, - validateNumber, - validateObject, - validateOneOf, - validatePlainFunction, - validatePort, - validateSignalName, - validateString, - validateUint32, - validateUndefined, - validateUnion, - validateAbortSignal, - validateLinkHeaderValue -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/ours/browser.js": -/*!**************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/ours/browser.js ***! - \**************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const CustomStream = __webpack_require__(/*! ../stream */ "./node_modules/n3/node_modules/readable-stream/lib/stream.js") -const promises = __webpack_require__(/*! ../stream/promises */ "./node_modules/n3/node_modules/readable-stream/lib/stream/promises.js") -const originalDestroy = CustomStream.Readable.destroy -module.exports = CustomStream.Readable - -// Explicit export naming is needed for ESM -module.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer -module.exports._isUint8Array = CustomStream._isUint8Array -module.exports.isDisturbed = CustomStream.isDisturbed -module.exports.isErrored = CustomStream.isErrored -module.exports.isReadable = CustomStream.isReadable -module.exports.Readable = CustomStream.Readable -module.exports.Writable = CustomStream.Writable -module.exports.Duplex = CustomStream.Duplex -module.exports.Transform = CustomStream.Transform -module.exports.PassThrough = CustomStream.PassThrough -module.exports.addAbortSignal = CustomStream.addAbortSignal -module.exports.finished = CustomStream.finished -module.exports.destroy = CustomStream.destroy -module.exports.destroy = originalDestroy -module.exports.pipeline = CustomStream.pipeline -module.exports.compose = CustomStream.compose -Object.defineProperty(CustomStream, 'promises', { - configurable: true, - enumerable: true, - get() { - return promises - } -}) -module.exports.Stream = CustomStream.Stream - -// Allow default importing -module.exports["default"] = module.exports - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js": -/*!*************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js ***! - \*************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { format, inspect, AggregateError: CustomAggregateError } = __webpack_require__(/*! ./util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") - -/* - This file is a reduced and adapted version of the main lib/internal/errors.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/errors.js - - Don't try to replace with the original file and keep it up to date (starting from E(...) definitions) - with the upstream file. -*/ - -const AggregateError = globalThis.AggregateError || CustomAggregateError -const kIsNodeError = Symbol('kIsNodeError') -const kTypes = [ - 'string', - 'function', - 'number', - 'object', - // Accept 'Function' and 'Object' as alternative to the lower cased version. - 'Function', - 'Object', - 'boolean', - 'bigint', - 'symbol' -] -const classRegExp = /^([A-Z][a-z0-9]*)+$/ -const nodeInternalPrefix = '__node_internal_' -const codes = {} -function assert(value, message) { - if (!value) { - throw new codes.ERR_INTERNAL_ASSERTION(message) - } -} - -// Only use this for integers! Decimal numbers do not work with this function. -function addNumericalSeparator(val) { - let res = '' - let i = val.length - const start = val[0] === '-' ? 1 : 0 - for (; i >= start + 4; i -= 3) { - res = `_${val.slice(i - 3, i)}${res}` - } - return `${val.slice(0, i)}${res}` -} -function getMessage(key, msg, args) { - if (typeof msg === 'function') { - assert( - msg.length <= args.length, - // Default options do not count. - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).` - ) - return msg(...args) - } - const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length - assert( - expectedLength === args.length, - `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).` - ) - if (args.length === 0) { - return msg - } - return format(msg, ...args) -} -function E(code, message, Base) { - if (!Base) { - Base = Error - } - class NodeError extends Base { - constructor(...args) { - super(getMessage(code, message, args)) - } - toString() { - return `${this.name} [${code}]: ${this.message}` - } - } - Object.defineProperties(NodeError.prototype, { - name: { - value: Base.name, - writable: true, - enumerable: false, - configurable: true - }, - toString: { - value() { - return `${this.name} [${code}]: ${this.message}` - }, - writable: true, - enumerable: false, - configurable: true - } - }) - NodeError.prototype.code = code - NodeError.prototype[kIsNodeError] = true - codes[code] = NodeError -} -function hideStackFrames(fn) { - // We rename the functions that will be hidden to cut off the stacktrace - // at the outermost one - const hidden = nodeInternalPrefix + fn.name - Object.defineProperty(fn, 'name', { - value: hidden - }) - return fn -} -function aggregateTwoErrors(innerError, outerError) { - if (innerError && outerError && innerError !== outerError) { - if (Array.isArray(outerError.errors)) { - // If `outerError` is already an `AggregateError`. - outerError.errors.push(innerError) - return outerError - } - const err = new AggregateError([outerError, innerError], outerError.message) - err.code = outerError.code - return err - } - return innerError || outerError -} -class AbortError extends Error { - constructor(message = 'The operation was aborted', options = undefined) { - if (options !== undefined && typeof options !== 'object') { - throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options) - } - super(message, options) - this.code = 'ABORT_ERR' - this.name = 'AbortError' - } -} -E('ERR_ASSERTION', '%s', Error) -E( - 'ERR_INVALID_ARG_TYPE', - (name, expected, actual) => { - assert(typeof name === 'string', "'name' must be a string") - if (!Array.isArray(expected)) { - expected = [expected] - } - let msg = 'The ' - if (name.endsWith(' argument')) { - // For cases like 'first argument' - msg += `${name} ` - } else { - msg += `"${name}" ${name.includes('.') ? 'property' : 'argument'} ` - } - msg += 'must be ' - const types = [] - const instances = [] - const other = [] - for (const value of expected) { - assert(typeof value === 'string', 'All expected entries have to be of type string') - if (kTypes.includes(value)) { - types.push(value.toLowerCase()) - } else if (classRegExp.test(value)) { - instances.push(value) - } else { - assert(value !== 'object', 'The value "object" should be written as "Object"') - other.push(value) - } - } - - // Special handle `object` in case other instances are allowed to outline - // the differences between each other. - if (instances.length > 0) { - const pos = types.indexOf('object') - if (pos !== -1) { - types.splice(types, pos, 1) - instances.push('Object') - } - } - if (types.length > 0) { - switch (types.length) { - case 1: - msg += `of type ${types[0]}` - break - case 2: - msg += `one of type ${types[0]} or ${types[1]}` - break - default: { - const last = types.pop() - msg += `one of type ${types.join(', ')}, or ${last}` - } - } - if (instances.length > 0 || other.length > 0) { - msg += ' or ' - } - } - if (instances.length > 0) { - switch (instances.length) { - case 1: - msg += `an instance of ${instances[0]}` - break - case 2: - msg += `an instance of ${instances[0]} or ${instances[1]}` - break - default: { - const last = instances.pop() - msg += `an instance of ${instances.join(', ')}, or ${last}` - } - } - if (other.length > 0) { - msg += ' or ' - } - } - switch (other.length) { - case 0: - break - case 1: - if (other[0].toLowerCase() !== other[0]) { - msg += 'an ' - } - msg += `${other[0]}` - break - case 2: - msg += `one of ${other[0]} or ${other[1]}` - break - default: { - const last = other.pop() - msg += `one of ${other.join(', ')}, or ${last}` - } - } - if (actual == null) { - msg += `. Received ${actual}` - } else if (typeof actual === 'function' && actual.name) { - msg += `. Received function ${actual.name}` - } else if (typeof actual === 'object') { - var _actual$constructor - if ( - (_actual$constructor = actual.constructor) !== null && - _actual$constructor !== undefined && - _actual$constructor.name - ) { - msg += `. Received an instance of ${actual.constructor.name}` - } else { - const inspected = inspect(actual, { - depth: -1 - }) - msg += `. Received ${inspected}` - } - } else { - let inspected = inspect(actual, { - colors: false - }) - if (inspected.length > 25) { - inspected = `${inspected.slice(0, 25)}...` - } - msg += `. Received type ${typeof actual} (${inspected})` - } - return msg - }, - TypeError -) -E( - 'ERR_INVALID_ARG_VALUE', - (name, value, reason = 'is invalid') => { - let inspected = inspect(value) - if (inspected.length > 128) { - inspected = inspected.slice(0, 128) + '...' - } - const type = name.includes('.') ? 'property' : 'argument' - return `The ${type} '${name}' ${reason}. Received ${inspected}` - }, - TypeError -) -E( - 'ERR_INVALID_RETURN_VALUE', - (input, name, value) => { - var _value$constructor - const type = - value !== null && - value !== undefined && - (_value$constructor = value.constructor) !== null && - _value$constructor !== undefined && - _value$constructor.name - ? `instance of ${value.constructor.name}` - : `type ${typeof value}` - return `Expected ${input} to be returned from the "${name}"` + ` function but got ${type}.` - }, - TypeError -) -E( - 'ERR_MISSING_ARGS', - (...args) => { - assert(args.length > 0, 'At least one arg needs to be specified') - let msg - const len = args.length - args = (Array.isArray(args) ? args : [args]).map((a) => `"${a}"`).join(' or ') - switch (len) { - case 1: - msg += `The ${args[0]} argument` - break - case 2: - msg += `The ${args[0]} and ${args[1]} arguments` - break - default: - { - const last = args.pop() - msg += `The ${args.join(', ')}, and ${last} arguments` - } - break - } - return `${msg} must be specified` - }, - TypeError -) -E( - 'ERR_OUT_OF_RANGE', - (str, range, input) => { - assert(range, 'Missing "range" argument') - let received - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { - received = addNumericalSeparator(String(input)) - } else if (typeof input === 'bigint') { - received = String(input) - if (input > 2n ** 32n || input < -(2n ** 32n)) { - received = addNumericalSeparator(received) - } - received += 'n' - } else { - received = inspect(input) - } - return `The value of "${str}" is out of range. It must be ${range}. Received ${received}` - }, - RangeError -) -E('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error) -E('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error) -E('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error) -E('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error) -E('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error) -E('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError) -E('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error) -E('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error) -E('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error) -E('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error) -E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError) -module.exports = { - AbortError, - aggregateTwoErrors: hideStackFrames(aggregateTwoErrors), - hideStackFrames, - codes -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js": -/*!******************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js ***! - \******************************************************************************/ -/***/ (function(module) { - -"use strict"; - - -/* - This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at - - https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js - - Don't try to replace with the original file and keep it up to date with the upstream file. -*/ -module.exports = { - ArrayIsArray(self) { - return Array.isArray(self) - }, - ArrayPrototypeIncludes(self, el) { - return self.includes(el) - }, - ArrayPrototypeIndexOf(self, el) { - return self.indexOf(el) - }, - ArrayPrototypeJoin(self, sep) { - return self.join(sep) - }, - ArrayPrototypeMap(self, fn) { - return self.map(fn) - }, - ArrayPrototypePop(self, el) { - return self.pop(el) - }, - ArrayPrototypePush(self, el) { - return self.push(el) - }, - ArrayPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - Error, - FunctionPrototypeCall(fn, thisArgs, ...args) { - return fn.call(thisArgs, ...args) - }, - FunctionPrototypeSymbolHasInstance(self, instance) { - return Function.prototype[Symbol.hasInstance].call(self, instance) - }, - MathFloor: Math.floor, - Number, - NumberIsInteger: Number.isInteger, - NumberIsNaN: Number.isNaN, - NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER, - NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER, - NumberParseInt: Number.parseInt, - ObjectDefineProperties(self, props) { - return Object.defineProperties(self, props) - }, - ObjectDefineProperty(self, name, prop) { - return Object.defineProperty(self, name, prop) - }, - ObjectGetOwnPropertyDescriptor(self, name) { - return Object.getOwnPropertyDescriptor(self, name) - }, - ObjectKeys(obj) { - return Object.keys(obj) - }, - ObjectSetPrototypeOf(target, proto) { - return Object.setPrototypeOf(target, proto) - }, - Promise, - PromisePrototypeCatch(self, fn) { - return self.catch(fn) - }, - PromisePrototypeThen(self, thenFn, catchFn) { - return self.then(thenFn, catchFn) - }, - PromiseReject(err) { - return Promise.reject(err) - }, - PromiseResolve(val) { - return Promise.resolve(val) - }, - ReflectApply: Reflect.apply, - RegExpPrototypeTest(self, value) { - return self.test(value) - }, - SafeSet: Set, - String, - StringPrototypeSlice(self, start, end) { - return self.slice(start, end) - }, - StringPrototypeToLowerCase(self) { - return self.toLowerCase() - }, - StringPrototypeToUpperCase(self) { - return self.toUpperCase() - }, - StringPrototypeTrim(self) { - return self.trim() - }, - Symbol, - SymbolFor: Symbol.for, - SymbolAsyncIterator: Symbol.asyncIterator, - SymbolHasInstance: Symbol.hasInstance, - SymbolIterator: Symbol.iterator, - SymbolDispose: Symbol.dispose || Symbol('Symbol.dispose'), - SymbolAsyncDispose: Symbol.asyncDispose || Symbol('Symbol.asyncDispose'), - TypedArrayPrototypeSet(self, buf, len) { - return self.set(buf, len) - }, - Boolean: Boolean, - Uint8Array -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js": -/*!***********************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/ours/util.js ***! - \***********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const bufferModule = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -const { kResistStopPropagation, SymbolDispose } = __webpack_require__(/*! ./primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const AbortSignal = globalThis.AbortSignal || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortSignal) -const AbortController = globalThis.AbortController || (__webpack_require__(/*! abort-controller */ "./node_modules/abort-controller/browser.js").AbortController) -const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor -const Blob = globalThis.Blob || bufferModule.Blob -/* eslint-disable indent */ -const isBlob = - typeof Blob !== 'undefined' - ? function isBlob(b) { - // eslint-disable-next-line indent - return b instanceof Blob - } - : function isBlob(b) { - return false - } -/* eslint-enable indent */ - -const validateAbortSignal = (signal, name) => { - if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) { - throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal) - } -} -const validateFunction = (value, name) => { - if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value) -} - -// This is a simplified version of AggregateError -class AggregateError extends Error { - constructor(errors) { - if (!Array.isArray(errors)) { - throw new TypeError(`Expected input to be an Array, got ${typeof errors}`) - } - let message = '' - for (let i = 0; i < errors.length; i++) { - message += ` ${errors[i].stack}\n` - } - super(message) - this.name = 'AggregateError' - this.errors = errors - } -} -module.exports = { - AggregateError, - kEmptyObject: Object.freeze({}), - once(callback) { - let called = false - return function (...args) { - if (called) { - return - } - called = true - callback.apply(this, args) - } - }, - createDeferredPromise: function () { - let resolve - let reject - - // eslint-disable-next-line promise/param-names - const promise = new Promise((res, rej) => { - resolve = res - reject = rej - }) - return { - promise, - resolve, - reject - } - }, - promisify(fn) { - return new Promise((resolve, reject) => { - fn((err, ...args) => { - if (err) { - return reject(err) - } - return resolve(...args) - }) - }) - }, - debuglog() { - return function () {} - }, - format(format, ...args) { - // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args - return format.replace(/%([sdifj])/g, function (...[_unused, type]) { - const replacement = args.shift() - if (type === 'f') { - return replacement.toFixed(6) - } else if (type === 'j') { - return JSON.stringify(replacement) - } else if (type === 's' && typeof replacement === 'object') { - const ctor = replacement.constructor !== Object ? replacement.constructor.name : '' - return `${ctor} {}`.trim() - } else { - return replacement.toString() - } - }) - }, - inspect(value) { - // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options - switch (typeof value) { - case 'string': - if (value.includes("'")) { - if (!value.includes('"')) { - return `"${value}"` - } else if (!value.includes('`') && !value.includes('${')) { - return `\`${value}\`` - } - } - return `'${value}'` - case 'number': - if (isNaN(value)) { - return 'NaN' - } else if (Object.is(value, -0)) { - return String(value) - } - return value - case 'bigint': - return `${String(value)}n` - case 'boolean': - case 'undefined': - return String(value) - case 'object': - return '{}' - } - }, - types: { - isAsyncFunction(fn) { - return fn instanceof AsyncFunction - }, - isArrayBufferView(arr) { - return ArrayBuffer.isView(arr) - } - }, - isBlob, - deprecate(fn, message) { - return fn - }, - addAbortListener: - (__webpack_require__(/*! events */ "./node_modules/events/events.js").addAbortListener) || - function addAbortListener(signal, listener) { - if (signal === undefined) { - throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal) - } - validateAbortSignal(signal, 'signal') - validateFunction(listener, 'listener') - let removeEventListener - if (signal.aborted) { - queueMicrotask(() => listener()) - } else { - signal.addEventListener('abort', listener, { - __proto__: null, - once: true, - [kResistStopPropagation]: true - }) - removeEventListener = () => { - signal.removeEventListener('abort', listener) - } - } - return { - __proto__: null, - [SymbolDispose]() { - var _removeEventListener - ;(_removeEventListener = removeEventListener) === null || _removeEventListener === undefined - ? undefined - : _removeEventListener() - } - } - }, - AbortSignalAny: - AbortSignal.any || - function AbortSignalAny(signals) { - // Fast path if there is only one signal. - if (signals.length === 1) { - return signals[0] - } - const ac = new AbortController() - const abort = () => ac.abort() - signals.forEach((signal) => { - validateAbortSignal(signal, 'signals') - signal.addEventListener('abort', abort, { - once: true - }) - }) - ac.signal.addEventListener( - 'abort', - () => { - signals.forEach((signal) => signal.removeEventListener('abort', abort)) - }, - { - once: true - } - ) - return ac.signal - } -} -module.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom') - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/stream.js": -/*!********************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/stream.js ***! - \********************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/* replacement start */ - -const { Buffer } = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") - -/* replacement end */ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -;('use strict') -const { ObjectDefineProperty, ObjectKeys, ReflectApply } = __webpack_require__(/*! ./ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { - promisify: { custom: customPromisify } -} = __webpack_require__(/*! ./ours/util */ "./node_modules/n3/node_modules/readable-stream/lib/ours/util.js") -const { streamReturningOperators, promiseReturningOperators } = __webpack_require__(/*! ./internal/streams/operators */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/operators.js") -const { - codes: { ERR_ILLEGAL_CONSTRUCTOR } -} = __webpack_require__(/*! ./ours/errors */ "./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js") -const compose = __webpack_require__(/*! ./internal/streams/compose */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/compose.js") -const { setDefaultHighWaterMark, getDefaultHighWaterMark } = __webpack_require__(/*! ./internal/streams/state */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/state.js") -const { pipeline } = __webpack_require__(/*! ./internal/streams/pipeline */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/pipeline.js") -const { destroyer } = __webpack_require__(/*! ./internal/streams/destroy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js") -const eos = __webpack_require__(/*! ./internal/streams/end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -const internalBuffer = {} -const promises = __webpack_require__(/*! ./stream/promises */ "./node_modules/n3/node_modules/readable-stream/lib/stream/promises.js") -const utils = __webpack_require__(/*! ./internal/streams/utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const Stream = (module.exports = __webpack_require__(/*! ./internal/streams/legacy */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/legacy.js").Stream) -Stream.isDestroyed = utils.isDestroyed -Stream.isDisturbed = utils.isDisturbed -Stream.isErrored = utils.isErrored -Stream.isReadable = utils.isReadable -Stream.isWritable = utils.isWritable -Stream.Readable = __webpack_require__(/*! ./internal/streams/readable */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js") -for (const key of ObjectKeys(streamReturningOperators)) { - const op = streamReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() - } - return Stream.Readable.from(ReflectApply(op, this, args)) - } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name - }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length - }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true - }) -} -for (const key of ObjectKeys(promiseReturningOperators)) { - const op = promiseReturningOperators[key] - function fn(...args) { - if (new.target) { - throw ERR_ILLEGAL_CONSTRUCTOR() - } - return ReflectApply(op, this, args) - } - ObjectDefineProperty(fn, 'name', { - __proto__: null, - value: op.name - }) - ObjectDefineProperty(fn, 'length', { - __proto__: null, - value: op.length - }) - ObjectDefineProperty(Stream.Readable.prototype, key, { - __proto__: null, - value: fn, - enumerable: false, - configurable: true, - writable: true - }) -} -Stream.Writable = __webpack_require__(/*! ./internal/streams/writable */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/writable.js") -Stream.Duplex = __webpack_require__(/*! ./internal/streams/duplex */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js") -Stream.Transform = __webpack_require__(/*! ./internal/streams/transform */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/transform.js") -Stream.PassThrough = __webpack_require__(/*! ./internal/streams/passthrough */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/passthrough.js") -Stream.pipeline = pipeline -const { addAbortSignal } = __webpack_require__(/*! ./internal/streams/add-abort-signal */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js") -Stream.addAbortSignal = addAbortSignal -Stream.finished = eos -Stream.destroy = destroyer -Stream.compose = compose -Stream.setDefaultHighWaterMark = setDefaultHighWaterMark -Stream.getDefaultHighWaterMark = getDefaultHighWaterMark -ObjectDefineProperty(Stream, 'promises', { - __proto__: null, - configurable: true, - enumerable: true, - get() { - return promises - } -}) -ObjectDefineProperty(pipeline, customPromisify, { - __proto__: null, - enumerable: true, - get() { - return promises.pipeline - } -}) -ObjectDefineProperty(eos, customPromisify, { - __proto__: null, - enumerable: true, - get() { - return promises.finished - } -}) - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream -Stream._isUint8Array = function isUint8Array(value) { - return value instanceof Uint8Array -} -Stream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength) -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/readable-stream/lib/stream/promises.js": -/*!*****************************************************************************!*\ - !*** ./node_modules/n3/node_modules/readable-stream/lib/stream/promises.js ***! - \*****************************************************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - - -const { ArrayPrototypePop, Promise } = __webpack_require__(/*! ../ours/primordials */ "./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js") -const { isIterable, isNodeStream, isWebStream } = __webpack_require__(/*! ../internal/streams/utils */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js") -const { pipelineImpl: pl } = __webpack_require__(/*! ../internal/streams/pipeline */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/pipeline.js") -const { finished } = __webpack_require__(/*! ../internal/streams/end-of-stream */ "./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js") -__webpack_require__(/*! ../../lib/stream.js */ "./node_modules/n3/node_modules/readable-stream/lib/stream.js") -function pipeline(...streams) { - return new Promise((resolve, reject) => { - let signal - let end - const lastArg = streams[streams.length - 1] - if ( - lastArg && - typeof lastArg === 'object' && - !isNodeStream(lastArg) && - !isIterable(lastArg) && - !isWebStream(lastArg) - ) { - const options = ArrayPrototypePop(streams) - signal = options.signal - end = options.end - } - pl( - streams, - (err, value) => { - if (err) { - reject(err) - } else { - resolve(value) - } - }, - { - signal, - end - } - ) - }) -} -module.exports = { - finished, - pipeline -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/safe-buffer/index.js": -/*!***********************************************************!*\ - !*** ./node_modules/n3/node_modules/safe-buffer/index.js ***! - \***********************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -/*! safe-buffer. MIT License. Feross Aboukhadijeh */ -/* eslint-disable node/no-deprecated-api */ -var buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js") -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.prototype = Object.create(Buffer.prototype) - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - - -/***/ }), - -/***/ "./node_modules/n3/node_modules/string_decoder/lib/string_decoder.js": -/*!***************************************************************************!*\ - !*** ./node_modules/n3/node_modules/string_decoder/lib/string_decoder.js ***! - \***************************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - - - -/**/ - -var Buffer = (__webpack_require__(/*! safe-buffer */ "./node_modules/n3/node_modules/safe-buffer/index.js").Buffer); -/**/ - -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; - -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; - -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} - -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; - -StringDecoder.prototype.end = utf8End; - -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; - -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; - -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} - -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; - } - return 0; -} - -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} - -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} - -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} - -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} - -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} - -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} - -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} - -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} - -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} - -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} - -/***/ }), - -/***/ "./node_modules/n3/src/IRIs.js": -/*!*************************************!*\ - !*** ./node_modules/n3/src/IRIs.js ***! - \*************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', - XSD = 'http://www.w3.org/2001/XMLSchema#', - SWAP = 'http://www.w3.org/2000/10/swap/'; - -/* harmony default export */ __webpack_exports__["default"] = ({ - xsd: { - decimal: `${XSD}decimal`, - boolean: `${XSD}boolean`, - double: `${XSD}double`, - integer: `${XSD}integer`, - string: `${XSD}string`, - }, - rdf: { - type: `${RDF}type`, - nil: `${RDF}nil`, - first: `${RDF}first`, - rest: `${RDF}rest`, - langString: `${RDF}langString`, - }, - owl: { - sameAs: 'http://www.w3.org/2002/07/owl#sameAs', - }, - r: { - forSome: `${SWAP}reify#forSome`, - forAll: `${SWAP}reify#forAll`, - }, - log: { - implies: `${SWAP}log#implies`, - }, -}); - - -/***/ }), - -/***/ "./node_modules/n3/src/N3DataFactory.js": -/*!**********************************************!*\ - !*** ./node_modules/n3/src/N3DataFactory.js ***! - \**********************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ BlankNode: function() { return /* binding */ BlankNode; }, -/* harmony export */ DefaultGraph: function() { return /* binding */ DefaultGraph; }, -/* harmony export */ Literal: function() { return /* binding */ Literal; }, -/* harmony export */ NamedNode: function() { return /* binding */ NamedNode; }, -/* harmony export */ Quad: function() { return /* binding */ Quad; }, -/* harmony export */ Term: function() { return /* binding */ Term; }, -/* harmony export */ Triple: function() { return /* binding */ Quad; }, -/* harmony export */ Variable: function() { return /* binding */ Variable; }, -/* harmony export */ escapeQuotes: function() { return /* binding */ escapeQuotes; }, -/* harmony export */ termFromId: function() { return /* binding */ termFromId; }, -/* harmony export */ termToId: function() { return /* binding */ termToId; }, -/* harmony export */ unescapeQuotes: function() { return /* binding */ unescapeQuotes; } -/* harmony export */ }); -/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js"); -/* harmony import */ var _N3Util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Util */ "./node_modules/n3/src/N3Util.js"); -// N3.js implementations of the RDF/JS core data types -// See https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md - - - -const { rdf, xsd } = _IRIs__WEBPACK_IMPORTED_MODULE_0__["default"]; - -// eslint-disable-next-line prefer-const -let DEFAULTGRAPH; -let _blankNodeCounter = 0; - -const escapedLiteral = /^"(.*".*)(?="[^"]*$)/; - -// ## DataFactory singleton -const DataFactory = { - namedNode, - blankNode, - variable, - literal, - defaultGraph, - quad, - triple: quad, -}; -/* harmony default export */ __webpack_exports__["default"] = (DataFactory); - -// ## Term constructor -class Term { - constructor(id) { - this.id = id; - } - - // ### The value of this term - get value() { - return this.id; - } - - // ### Returns whether this object represents the same term as the other - equals(other) { - // If both terms were created by this library, - // equality can be computed through ids - if (other instanceof Term) - return this.id === other.id; - // Otherwise, compare term type and value - return !!other && this.termType === other.termType && - this.value === other.value; - } - - // ### Implement hashCode for Immutable.js, since we implement `equals` - // https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode() - hashCode() { - return 0; - } - - // ### Returns a plain object representation of this term - toJSON() { - return { - termType: this.termType, - value: this.value, - }; - } -} - - -// ## NamedNode constructor -class NamedNode extends Term { - // ### The term type of this term - get termType() { - return 'NamedNode'; - } -} - -// ## Literal constructor -class Literal extends Term { - // ### The term type of this term - get termType() { - return 'Literal'; - } - - // ### The text value of this literal - get value() { - return this.id.substring(1, this.id.lastIndexOf('"')); - } - - // ### The language of this literal - get language() { - // Find the last quotation mark (e.g., '"abc"@en-us') - const id = this.id; - let atPos = id.lastIndexOf('"') + 1; - // If "@" it follows, return the remaining substring; empty otherwise - return atPos < id.length && id[atPos++] === '@' ? id.substr(atPos).toLowerCase() : ''; - } - - // ### The datatype IRI of this literal - get datatype() { - return new NamedNode(this.datatypeString); - } - - // ### The datatype string of this literal - get datatypeString() { - // Find the last quotation mark (e.g., '"abc"^^http://ex.org/types#t') - const id = this.id, dtPos = id.lastIndexOf('"') + 1; - const char = dtPos < id.length ? id[dtPos] : ''; - // If "^" it follows, return the remaining substring - return char === '^' ? id.substr(dtPos + 2) : - // If "@" follows, return rdf:langString; xsd:string otherwise - (char !== '@' ? xsd.string : rdf.langString); - } - - // ### Returns whether this object represents the same term as the other - equals(other) { - // If both literals were created by this library, - // equality can be computed through ids - if (other instanceof Literal) - return this.id === other.id; - // Otherwise, compare term type, value, language, and datatype - return !!other && !!other.datatype && - this.termType === other.termType && - this.value === other.value && - this.language === other.language && - this.datatype.value === other.datatype.value; - } - - toJSON() { - return { - termType: this.termType, - value: this.value, - language: this.language, - datatype: { termType: 'NamedNode', value: this.datatypeString }, - }; - } -} - -// ## BlankNode constructor -class BlankNode extends Term { - constructor(name) { - super(`_:${name}`); - } - - // ### The term type of this term - get termType() { - return 'BlankNode'; - } - - // ### The name of this blank node - get value() { - return this.id.substr(2); - } -} - -class Variable extends Term { - constructor(name) { - super(`?${name}`); - } - - // ### The term type of this term - get termType() { - return 'Variable'; - } - - // ### The name of this variable - get value() { - return this.id.substr(1); - } -} - -// ## DefaultGraph constructor -class DefaultGraph extends Term { - constructor() { - super(''); - return DEFAULTGRAPH || this; - } - - // ### The term type of this term - get termType() { - return 'DefaultGraph'; - } - - // ### Returns whether this object represents the same term as the other - equals(other) { - // If both terms were created by this library, - // equality can be computed through strict equality; - // otherwise, compare term types. - return (this === other) || (!!other && (this.termType === other.termType)); - } -} - -// ## DefaultGraph singleton -DEFAULTGRAPH = new DefaultGraph(); - -// ### Constructs a term from the given internal string ID -// The third 'nested' parameter of this function is to aid -// with recursion over nested terms. It should not be used -// by consumers of this library. -// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725 -function termFromId(id, factory, nested) { - factory = factory || DataFactory; - - // Falsy value or empty string indicate the default graph - if (!id) - return factory.defaultGraph(); - - // Identify the term type based on the first character - switch (id[0]) { - case '?': - return factory.variable(id.substr(1)); - case '_': - return factory.blankNode(id.substr(2)); - case '"': - // Shortcut for internal literals - if (factory === DataFactory) - return new Literal(id); - // Literal without datatype or language - if (id[id.length - 1] === '"') - return factory.literal(id.substr(1, id.length - 2)); - // Literal with datatype or language - const endPos = id.lastIndexOf('"', id.length - 1); - return factory.literal(id.substr(1, endPos - 1), - id[endPos + 1] === '@' ? id.substr(endPos + 2) - : factory.namedNode(id.substr(endPos + 3))); - case '[': - id = JSON.parse(id); - break; - default: - if (!nested || !Array.isArray(id)) { - return factory.namedNode(id); - } - } - return factory.quad( - termFromId(id[0], factory, true), - termFromId(id[1], factory, true), - termFromId(id[2], factory, true), - id[3] && termFromId(id[3], factory, true) - ); -} - -// ### Constructs an internal string ID from the given term or ID string -// The third 'nested' parameter of this function is to aid -// with recursion over nested terms. It should not be used -// by consumers of this library. -// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725 -function termToId(term, nested) { - if (typeof term === 'string') - return term; - if (term instanceof Term && term.termType !== 'Quad') - return term.id; - if (!term) - return DEFAULTGRAPH.id; - - // Term instantiated with another library - switch (term.termType) { - case 'NamedNode': return term.value; - case 'BlankNode': return `_:${term.value}`; - case 'Variable': return `?${term.value}`; - case 'DefaultGraph': return ''; - case 'Literal': return `"${term.value}"${ - term.language ? `@${term.language}` : - (term.datatype && term.datatype.value !== xsd.string ? `^^${term.datatype.value}` : '')}`; - case 'Quad': - const res = [ - termToId(term.subject, true), - termToId(term.predicate, true), - termToId(term.object, true), - ]; - if (!(0,_N3Util__WEBPACK_IMPORTED_MODULE_1__.isDefaultGraph)(term.graph)) { - res.push(termToId(term.graph, true)); - } - return nested ? res : JSON.stringify(res); - default: throw new Error(`Unexpected termType: ${term.termType}`); - } -} - - -// ## Quad constructor -class Quad extends Term { - constructor(subject, predicate, object, graph) { - super(''); - this._subject = subject; - this._predicate = predicate; - this._object = object; - this._graph = graph || DEFAULTGRAPH; - } - - // ### The term type of this term - get termType() { - return 'Quad'; - } - - get subject() { - return this._subject; - } - - get predicate() { - return this._predicate; - } - - get object() { - return this._object; - } - - get graph() { - return this._graph; - } - - // ### Returns a plain object representation of this quad - toJSON() { - return { - termType: this.termType, - subject: this._subject.toJSON(), - predicate: this._predicate.toJSON(), - object: this._object.toJSON(), - graph: this._graph.toJSON(), - }; - } - - // ### Returns whether this object represents the same quad as the other - equals(other) { - return !!other && this._subject.equals(other.subject) && - this._predicate.equals(other.predicate) && - this._object.equals(other.object) && - this._graph.equals(other.graph); - } -} - - -// ### Escapes the quotes within the given literal -function escapeQuotes(id) { - return id.replace(escapedLiteral, (_, quoted) => `"${quoted.replace(/"/g, '""')}`); -} - -// ### Unescapes the quotes within the given literal -function unescapeQuotes(id) { - return id.replace(escapedLiteral, (_, quoted) => `"${quoted.replace(/""/g, '"')}`); -} - -// ### Creates an IRI -function namedNode(iri) { - return new NamedNode(iri); -} - -// ### Creates a blank node -function blankNode(name) { - return new BlankNode(name || `n3-${_blankNodeCounter++}`); -} - -// ### Creates a literal -function literal(value, languageOrDataType) { - // Create a language-tagged string - if (typeof languageOrDataType === 'string') - return new Literal(`"${value}"@${languageOrDataType.toLowerCase()}`); - - // Automatically determine datatype for booleans and numbers - let datatype = languageOrDataType ? languageOrDataType.value : ''; - if (datatype === '') { - // Convert a boolean - if (typeof value === 'boolean') - datatype = xsd.boolean; - // Convert an integer or double - else if (typeof value === 'number') { - if (Number.isFinite(value)) - datatype = Number.isInteger(value) ? xsd.integer : xsd.double; - else { - datatype = xsd.double; - if (!Number.isNaN(value)) - value = value > 0 ? 'INF' : '-INF'; - } - } - } - - // Create a datatyped literal - return (datatype === '' || datatype === xsd.string) ? - new Literal(`"${value}"`) : - new Literal(`"${value}"^^${datatype}`); -} - -// ### Creates a variable -function variable(name) { - return new Variable(name); -} - -// ### Returns the default graph -function defaultGraph() { - return DEFAULTGRAPH; -} - -// ### Creates a quad -function quad(subject, predicate, object, graph) { - return new Quad(subject, predicate, object, graph); -} - - -/***/ }), - -/***/ "./node_modules/n3/src/N3Lexer.js": -/*!****************************************!*\ - !*** ./node_modules/n3/src/N3Lexer.js ***! - \****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ N3Lexer; } -/* harmony export */ }); -/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js"); -/* harmony import */ var queue_microtask__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! queue-microtask */ "./node_modules/queue-microtask/index.js"); -/* harmony import */ var queue_microtask__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(queue_microtask__WEBPACK_IMPORTED_MODULE_0__); -// **N3Lexer** tokenizes N3 documents. - - - -const { xsd } = _IRIs__WEBPACK_IMPORTED_MODULE_1__["default"]; - -// Regular expression and replacement string to escape N3 strings -const escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g; -const escapeReplacements = { - '\\': '\\', "'": "'", '"': '"', - 'n': '\n', 'r': '\r', 't': '\t', 'f': '\f', 'b': '\b', - '_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&', - '(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=', - '/': '/', '?': '?', '#': '#', '@': '@', '%': '%', -}; -const illegalIriChars = /[\x00-\x20<>\\"\{\}\|\^\`]/; - -const lineModeRegExps = { - _iri: true, - _unescapedIri: true, - _simpleQuotedString: true, - _langcode: true, - _blank: true, - _newline: true, - _comment: true, - _whitespace: true, - _endOfFile: true, -}; -const invalidRegExp = /$0^/; - -// ## Constructor -class N3Lexer { - constructor(options) { - // ## Regular expressions - // It's slightly faster to have these as properties than as in-scope variables - this._iri = /^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/; // IRI with escape sequences; needs sanity check after unescaping - this._unescapedIri = /^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/; // IRI without escape sequences; no unescaping - this._simpleQuotedString = /^"([^"\\\r\n]*)"(?=[^"])/; // string without escape sequences - this._simpleApostropheString = /^'([^'\\\r\n]*)'(?=[^'])/; - this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i; - this._prefix = /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/; - this._prefixed = /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/; - this._variable = /^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/; - this._blank = /^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/; - this._number = /^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/; - this._boolean = /^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/; - this._keyword = /^@[a-z]+(?=[\s#<:])/i; - this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i; - this._shortPredicates = /^a(?=[\s#()\[\]\{\}"'<>])/; - this._newline = /^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/; - this._comment = /#([^\n\r]*)/; - this._whitespace = /^[ \t]+/; - this._endOfFile = /^(?:#[^\n\r]*)?$/; - options = options || {}; - - // In line mode (N-Triples or N-Quads), only simple features may be parsed - if (this._lineMode = !!options.lineMode) { - this._n3Mode = false; - // Don't tokenize special literals - for (const key in this) { - if (!(key in lineModeRegExps) && this[key] instanceof RegExp) - this[key] = invalidRegExp; - } - } - // When not in line mode, enable N3 functionality by default - else { - this._n3Mode = options.n3 !== false; - } - // Don't output comment tokens by default - this._comments = !!options.comments; - // Cache the last tested closing position of long literals - this._literalClosingPos = 0; - } - - // ## Private methods - - // ### `_tokenizeToEnd` tokenizes as for as possible, emitting tokens through the callback - _tokenizeToEnd(callback, inputFinished) { - // Continue parsing as far as possible; the loop will return eventually - let input = this._input; - let currentLineLength = input.length; - while (true) { - // Count and skip whitespace lines - let whiteSpaceMatch, comment; - while (whiteSpaceMatch = this._newline.exec(input)) { - // Try to find a comment - if (this._comments && (comment = this._comment.exec(whiteSpaceMatch[0]))) - emitToken('comment', comment[1], '', this._line, whiteSpaceMatch[0].length); - // Advance the input - input = input.substr(whiteSpaceMatch[0].length, input.length); - currentLineLength = input.length; - this._line++; - } - // Skip whitespace on current line - if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input))) - input = input.substr(whiteSpaceMatch[0].length, input.length); - - // Stop for now if we're at the end - if (this._endOfFile.test(input)) { - // If the input is finished, emit EOF - if (inputFinished) { - // Try to find a final comment - if (this._comments && (comment = this._comment.exec(input))) - emitToken('comment', comment[1], '', this._line, input.length); - input = null; - emitToken('eof', '', '', this._line, 0); - } - return this._input = input; - } - - // Look for specific token types based on the first character - const line = this._line, firstChar = input[0]; - let type = '', value = '', prefix = '', - match = null, matchLength = 0, inconclusive = false; - switch (firstChar) { - case '^': - // We need at least 3 tokens lookahead to distinguish ^^ and ^^pre:fixed - if (input.length < 3) - break; - // Try to match a type - else if (input[1] === '^') { - this._previousMarker = '^^'; - // Move to type IRI or prefixed name - input = input.substr(2); - if (input[0] !== '<') { - inconclusive = true; - break; - } - } - // If no type, it must be a path expression - else { - if (this._n3Mode) { - matchLength = 1; - type = '^'; - } - break; - } - // Fall through in case the type is an IRI - case '<': - // Try to find a full IRI without escape sequences - if (match = this._unescapedIri.exec(input)) - type = 'IRI', value = match[1]; - // Try to find a full IRI with escape sequences - else if (match = this._iri.exec(input)) { - value = this._unescape(match[1]); - if (value === null || illegalIriChars.test(value)) - return reportSyntaxError(this); - type = 'IRI'; - } - // Try to find a nested triple - else if (input.length > 1 && input[1] === '<') - type = '<<', matchLength = 2; - // Try to find a backwards implication arrow - else if (this._n3Mode && input.length > 1 && input[1] === '=') - type = 'inverse', matchLength = 2, value = '>'; - break; - - case '>': - if (input.length > 1 && input[1] === '>') - type = '>>', matchLength = 2; - break; - - case '_': - // Try to find a blank node. Since it can contain (but not end with) a dot, - // we always need a non-dot character before deciding it is a blank node. - // Therefore, try inserting a space if we're at the end of the input. - if ((match = this._blank.exec(input)) || - inputFinished && (match = this._blank.exec(`${input} `))) - type = 'blank', prefix = '_', value = match[1]; - break; - - case '"': - // Try to find a literal without escape sequences - if (match = this._simpleQuotedString.exec(input)) - value = match[1]; - // Try to find a literal wrapped in three pairs of quotes - else { - ({ value, matchLength } = this._parseLiteral(input)); - if (value === null) - return reportSyntaxError(this); - } - if (match !== null || matchLength !== 0) { - type = 'literal'; - this._literalClosingPos = 0; - } - break; - - case "'": - if (!this._lineMode) { - // Try to find a literal without escape sequences - if (match = this._simpleApostropheString.exec(input)) - value = match[1]; - // Try to find a literal wrapped in three pairs of quotes - else { - ({ value, matchLength } = this._parseLiteral(input)); - if (value === null) - return reportSyntaxError(this); - } - if (match !== null || matchLength !== 0) { - type = 'literal'; - this._literalClosingPos = 0; - } - } - break; - - case '?': - // Try to find a variable - if (this._n3Mode && (match = this._variable.exec(input))) - type = 'var', value = match[0]; - break; - - case '@': - // Try to find a language code - if (this._previousMarker === 'literal' && (match = this._langcode.exec(input))) - type = 'langcode', value = match[1]; - // Try to find a keyword - else if (match = this._keyword.exec(input)) - type = match[0]; - break; - - case '.': - // Try to find a dot as punctuation - if (input.length === 1 ? inputFinished : (input[1] < '0' || input[1] > '9')) { - type = '.'; - matchLength = 1; - break; - } - // Fall through to numerical case (could be a decimal dot) - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '+': - case '-': - // Try to find a number. Since it can contain (but not end with) a dot, - // we always need a non-dot character before deciding it is a number. - // Therefore, try inserting a space if we're at the end of the input. - if (match = this._number.exec(input) || - inputFinished && (match = this._number.exec(`${input} `))) { - type = 'literal', value = match[0]; - prefix = (typeof match[1] === 'string' ? xsd.double : - (typeof match[2] === 'string' ? xsd.decimal : xsd.integer)); - } - break; - - case 'B': - case 'b': - case 'p': - case 'P': - case 'G': - case 'g': - // Try to find a SPARQL-style keyword - if (match = this._sparqlKeyword.exec(input)) - type = match[0].toUpperCase(); - else - inconclusive = true; - break; - - case 'f': - case 't': - // Try to match a boolean - if (match = this._boolean.exec(input)) - type = 'literal', value = match[0], prefix = xsd.boolean; - else - inconclusive = true; - break; - - case 'a': - // Try to find an abbreviated predicate - if (match = this._shortPredicates.exec(input)) - type = 'abbreviation', value = 'a'; - else - inconclusive = true; - break; - - case '=': - // Try to find an implication arrow or equals sign - if (this._n3Mode && input.length > 1) { - type = 'abbreviation'; - if (input[1] !== '>') - matchLength = 1, value = '='; - else - matchLength = 2, value = '>'; - } - break; - - case '!': - if (!this._n3Mode) - break; - case ',': - case ';': - case '[': - case ']': - case '(': - case ')': - case '}': - if (!this._lineMode) { - matchLength = 1; - type = firstChar; - } - break; - case '{': - // We need at least 2 tokens lookahead to distinguish "{|" and "{ " - if (!this._lineMode && input.length >= 2) { - // Try to find a quoted triple annotation start - if (input[1] === '|') - type = '{|', matchLength = 2; - else - type = firstChar, matchLength = 1; - } - break; - case '|': - // We need 2 tokens lookahead to parse "|}" - // Try to find a quoted triple annotation end - if (input.length >= 2 && input[1] === '}') - type = '|}', matchLength = 2; - break; - - default: - inconclusive = true; - } - - // Some first characters do not allow an immediate decision, so inspect more - if (inconclusive) { - // Try to find a prefix - if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') && - (match = this._prefix.exec(input))) - type = 'prefix', value = match[1] || ''; - // Try to find a prefixed name. Since it can contain (but not end with) a dot, - // we always need a non-dot character before deciding it is a prefixed name. - // Therefore, try inserting a space if we're at the end of the input. - else if ((match = this._prefixed.exec(input)) || - inputFinished && (match = this._prefixed.exec(`${input} `))) - type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]); - } - - // A type token is special: it can only be emitted after an IRI or prefixed name is read - if (this._previousMarker === '^^') { - switch (type) { - case 'prefixed': type = 'type'; break; - case 'IRI': type = 'typeIRI'; break; - default: type = ''; - } - } - - // What if nothing of the above was found? - if (!type) { - // We could be in streaming mode, and then we just wait for more input to arrive. - // Otherwise, a syntax error has occurred in the input. - // One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal). - if (inputFinished || (!/^'''|^"""/.test(input) && /\n|\r/.test(input))) - return reportSyntaxError(this); - else - return this._input = input; - } - - // Emit the parsed token - const length = matchLength || match[0].length; - const token = emitToken(type, value, prefix, line, length); - this.previousToken = token; - this._previousMarker = type; - - // Advance to next part to tokenize - input = input.substr(length, input.length); - } - - // Emits the token through the callback - function emitToken(type, value, prefix, line, length) { - const start = input ? currentLineLength - input.length : currentLineLength; - const end = start + length; - const token = { type, value, prefix, line, start, end }; - callback(null, token); - return token; - } - // Signals the syntax error through the callback - function reportSyntaxError(self) { callback(self._syntaxError(/^\S*/.exec(input)[0])); } - } - - // ### `_unescape` replaces N3 escape codes by their corresponding characters - _unescape(item) { - let invalid = false; - const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => { - // 4-digit unicode character - if (typeof unicode4 === 'string') - return String.fromCharCode(Number.parseInt(unicode4, 16)); - // 8-digit unicode character - if (typeof unicode8 === 'string') { - let charCode = Number.parseInt(unicode8, 16); - return charCode <= 0xFFFF ? String.fromCharCode(Number.parseInt(unicode8, 16)) : - String.fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF)); - } - // fixed escape sequence - if (escapedChar in escapeReplacements) - return escapeReplacements[escapedChar]; - // invalid escape sequence - invalid = true; - return ''; - }); - return invalid ? null : replaced; - } - - // ### `_parseLiteral` parses a literal into an unescaped value - _parseLiteral(input) { - // Ensure we have enough lookahead to identify triple-quoted strings - if (input.length >= 3) { - // Identify the opening quote(s) - const opening = input.match(/^(?:"""|"|'''|'|)/)[0]; - const openingLength = opening.length; - - // Find the next candidate closing quotes - let closingPos = Math.max(this._literalClosingPos, openingLength); - while ((closingPos = input.indexOf(opening, closingPos)) > 0) { - // Count backslashes right before the closing quotes - let backslashCount = 0; - while (input[closingPos - backslashCount - 1] === '\\') - backslashCount++; - - // An even number of backslashes (in particular 0) - // means these are actual, non-escaped closing quotes - if (backslashCount % 2 === 0) { - // Extract and unescape the value - const raw = input.substring(openingLength, closingPos); - const lines = raw.split(/\r\n|\r|\n/).length - 1; - const matchLength = closingPos + openingLength; - // Only triple-quoted strings can be multi-line - if (openingLength === 1 && lines !== 0 || - openingLength === 3 && this._lineMode) - break; - this._line += lines; - return { value: this._unescape(raw), matchLength }; - } - closingPos++; - } - this._literalClosingPos = input.length - openingLength + 1; - } - return { value: '', matchLength: 0 }; - } - - // ### `_syntaxError` creates a syntax error for the given issue - _syntaxError(issue) { - this._input = null; - const err = new Error(`Unexpected "${issue}" on line ${this._line}.`); - err.context = { - token: undefined, - line: this._line, - previousToken: this.previousToken, - }; - return err; - } - - // ### Strips off any starting UTF BOM mark. - _readStartingBom(input) { - return input.startsWith('\ufeff') ? input.substr(1) : input; - } - - // ## Public methods - - // ### `tokenize` starts the transformation of an N3 document into an array of tokens. - // The input can be a string or a stream. - tokenize(input, callback) { - this._line = 1; - - // If the input is a string, continuously emit tokens through the callback until the end - if (typeof input === 'string') { - this._input = this._readStartingBom(input); - // If a callback was passed, asynchronously call it - if (typeof callback === 'function') - queue_microtask__WEBPACK_IMPORTED_MODULE_0___default()(() => this._tokenizeToEnd(callback, true)); - // If no callback was passed, tokenize synchronously and return - else { - const tokens = []; - let error; - this._tokenizeToEnd((e, t) => e ? (error = e) : tokens.push(t), true); - if (error) throw error; - return tokens; - } - } - // Otherwise, the input must be a stream - else { - this._pendingBuffer = null; - if (typeof input.setEncoding === 'function') - input.setEncoding('utf8'); - // Adds the data chunk to the buffer and parses as far as possible - input.on('data', data => { - if (this._input !== null && data.length !== 0) { - // Prepend any previous pending writes - if (this._pendingBuffer) { - data = Buffer.concat([this._pendingBuffer, data]); - this._pendingBuffer = null; - } - // Hold if the buffer ends in an incomplete unicode sequence - if (data[data.length - 1] & 0x80) { - this._pendingBuffer = data; - } - // Otherwise, tokenize as far as possible - else { - // Only read a BOM at the start - if (typeof this._input === 'undefined') - this._input = this._readStartingBom(typeof data === 'string' ? data : data.toString()); - else - this._input += data; - this._tokenizeToEnd(callback, false); - } - } - }); - // Parses until the end - input.on('end', () => { - if (typeof this._input === 'string') - this._tokenizeToEnd(callback, true); - }); - input.on('error', callback); - } - } -} - - -/***/ }), - -/***/ "./node_modules/n3/src/N3Parser.js": -/*!*****************************************!*\ - !*** ./node_modules/n3/src/N3Parser.js ***! - \*****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ N3Parser; } -/* harmony export */ }); -/* harmony import */ var _N3Lexer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./N3Lexer */ "./node_modules/n3/src/N3Lexer.js"); -/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js"); -/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js"); -// **N3Parser** parses N3 documents. - - - - -let blankNodePrefix = 0; - -// ## Constructor -class N3Parser { - constructor(options) { - this._contextStack = []; - this._graph = null; - - // Set the document IRI - options = options || {}; - this._setBase(options.baseIRI); - options.factory && initDataFactory(this, options.factory); - - // Set supported features depending on the format - const format = (typeof options.format === 'string') ? - options.format.match(/\w*$/)[0].toLowerCase() : '', - isTurtle = /turtle/.test(format), isTriG = /trig/.test(format), - isNTriples = /triple/.test(format), isNQuads = /quad/.test(format), - isN3 = this._n3Mode = /n3/.test(format), - isLineMode = isNTriples || isNQuads; - if (!(this._supportsNamedGraphs = !(isTurtle || isN3))) - this._readPredicateOrNamedGraph = this._readPredicate; - // Support triples in other graphs - this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3); - // Support nesting of triples - this._supportsRDFStar = format === '' || /star|\*$/.test(format); - // Disable relative IRIs in N-Triples or N-Quads mode - if (isLineMode) - this._resolveRelativeIRI = iri => { return null; }; - this._blankNodePrefix = typeof options.blankNodePrefix !== 'string' ? '' : - options.blankNodePrefix.replace(/^(?!_:)/, '_:'); - this._lexer = options.lexer || new _N3Lexer__WEBPACK_IMPORTED_MODULE_0__["default"]({ lineMode: isLineMode, n3: isN3 }); - // Disable explicit quantifiers by default - this._explicitQuantifiers = !!options.explicitQuantifiers; - } - - // ## Static class methods - - // ### `_resetBlankNodePrefix` restarts blank node prefix identification - static _resetBlankNodePrefix() { - blankNodePrefix = 0; - } - - // ## Private methods - - // ### `_setBase` sets the base IRI to resolve relative IRIs - _setBase(baseIRI) { - if (!baseIRI) { - this._base = ''; - this._basePath = ''; - } - else { - // Remove fragment if present - const fragmentPos = baseIRI.indexOf('#'); - if (fragmentPos >= 0) - baseIRI = baseIRI.substr(0, fragmentPos); - // Set base IRI and its components - this._base = baseIRI; - this._basePath = baseIRI.indexOf('/') < 0 ? baseIRI : - baseIRI.replace(/[^\/?]*(?:\?.*)?$/, ''); - baseIRI = baseIRI.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i); - this._baseRoot = baseIRI[0]; - this._baseScheme = baseIRI[1]; - } - } - - // ### `_saveContext` stores the current parsing context - // when entering a new scope (list, blank node, formula) - _saveContext(type, graph, subject, predicate, object) { - const n3Mode = this._n3Mode; - this._contextStack.push({ - type, - subject, predicate, object, graph, - inverse: n3Mode ? this._inversePredicate : false, - blankPrefix: n3Mode ? this._prefixes._ : '', - quantified: n3Mode ? this._quantified : null, - }); - // The settings below only apply to N3 streams - if (n3Mode) { - // Every new scope resets the predicate direction - this._inversePredicate = false; - // In N3, blank nodes are scoped to a formula - // (using a dot as separator, as a blank node label cannot start with it) - this._prefixes._ = (this._graph ? `${this._graph.value}.` : '.'); - // Quantifiers are scoped to a formula - this._quantified = Object.create(this._quantified); - } - } - - // ### `_restoreContext` restores the parent context - // when leaving a scope (list, blank node, formula) - _restoreContext(type, token) { - // Obtain the previous context - const context = this._contextStack.pop(); - if (!context || context.type !== type) - return this._error(`Unexpected ${token.type}`, token); - - // Restore the quad of the previous context - this._subject = context.subject; - this._predicate = context.predicate; - this._object = context.object; - this._graph = context.graph; - - // Restore N3 context settings - if (this._n3Mode) { - this._inversePredicate = context.inverse; - this._prefixes._ = context.blankPrefix; - this._quantified = context.quantified; - } - } - - // ### `_readInTopContext` reads a token when in the top context - _readInTopContext(token) { - switch (token.type) { - // If an EOF token arrives in the top context, signal that we're done - case 'eof': - if (this._graph !== null) - return this._error('Unclosed graph', token); - delete this._prefixes._; - return this._callback(null, null, this._prefixes); - // It could be a prefix declaration - case 'PREFIX': - this._sparqlStyle = true; - case '@prefix': - return this._readPrefix; - // It could be a base declaration - case 'BASE': - this._sparqlStyle = true; - case '@base': - return this._readBaseIRI; - // It could be a graph - case '{': - if (this._supportsNamedGraphs) { - this._graph = ''; - this._subject = null; - return this._readSubject; - } - case 'GRAPH': - if (this._supportsNamedGraphs) - return this._readNamedGraphLabel; - // Otherwise, the next token must be a subject - default: - return this._readSubject(token); - } - } - - // ### `_readEntity` reads an IRI, prefixed name, blank node, or variable - _readEntity(token, quantifier) { - let value; - switch (token.type) { - // Read a relative or absolute IRI - case 'IRI': - case 'typeIRI': - const iri = this._resolveIRI(token.value); - if (iri === null) - return this._error('Invalid IRI', token); - value = this._namedNode(iri); - break; - // Read a prefixed name - case 'type': - case 'prefixed': - const prefix = this._prefixes[token.prefix]; - if (prefix === undefined) - return this._error(`Undefined prefix "${token.prefix}:"`, token); - value = this._namedNode(prefix + token.value); - break; - // Read a blank node - case 'blank': - value = this._blankNode(this._prefixes[token.prefix] + token.value); - break; - // Read a variable - case 'var': - value = this._variable(token.value.substr(1)); - break; - // Everything else is not an entity - default: - return this._error(`Expected entity but got ${token.type}`, token); - } - // In N3 mode, replace the entity if it is quantified - if (!quantifier && this._n3Mode && (value.id in this._quantified)) - value = this._quantified[value.id]; - return value; - } - - // ### `_readSubject` reads a quad's subject - _readSubject(token) { - this._predicate = null; - switch (token.type) { - case '[': - // Start a new quad with a new blank node as subject - this._saveContext('blank', this._graph, - this._subject = this._blankNode(), null, null); - return this._readBlankNodeHead; - case '(': - // Start a new list - this._saveContext('list', this._graph, this.RDF_NIL, null, null); - this._subject = null; - return this._readListItem; - case '{': - // Start a new formula - if (!this._n3Mode) - return this._error('Unexpected graph', token); - this._saveContext('formula', this._graph, - this._graph = this._blankNode(), null, null); - return this._readSubject; - case '}': - // No subject; the graph in which we are reading is closed instead - return this._readPunctuation(token); - case '@forSome': - if (!this._n3Mode) - return this._error('Unexpected "@forSome"', token); - this._subject = null; - this._predicate = this.N3_FORSOME; - this._quantifier = this._blankNode; - return this._readQuantifierList; - case '@forAll': - if (!this._n3Mode) - return this._error('Unexpected "@forAll"', token); - this._subject = null; - this._predicate = this.N3_FORALL; - this._quantifier = this._variable; - return this._readQuantifierList; - case 'literal': - if (!this._n3Mode) - return this._error('Unexpected literal', token); - - if (token.prefix.length === 0) { - this._literalValue = token.value; - return this._completeSubjectLiteral; - } - else - this._subject = this._literal(token.value, this._namedNode(token.prefix)); - - break; - case '<<': - if (!this._supportsRDFStar) - return this._error('Unexpected RDF* syntax', token); - this._saveContext('<<', this._graph, null, null, null); - this._graph = null; - return this._readSubject; - default: - // Read the subject entity - if ((this._subject = this._readEntity(token)) === undefined) - return; - // In N3 mode, the subject might be a path - if (this._n3Mode) - return this._getPathReader(this._readPredicateOrNamedGraph); - } - - // The next token must be a predicate, - // or, if the subject was actually a graph IRI, a named graph - return this._readPredicateOrNamedGraph; - } - - // ### `_readPredicate` reads a quad's predicate - _readPredicate(token) { - const type = token.type; - switch (type) { - case 'inverse': - this._inversePredicate = true; - case 'abbreviation': - this._predicate = this.ABBREVIATIONS[token.value]; - break; - case '.': - case ']': - case '}': - // Expected predicate didn't come, must have been trailing semicolon - if (this._predicate === null) - return this._error(`Unexpected ${type}`, token); - this._subject = null; - return type === ']' ? this._readBlankNodeTail(token) : this._readPunctuation(token); - case ';': - // Additional semicolons can be safely ignored - return this._predicate !== null ? this._readPredicate : - this._error('Expected predicate but got ;', token); - case '[': - if (this._n3Mode) { - // Start a new quad with a new blank node as subject - this._saveContext('blank', this._graph, this._subject, - this._subject = this._blankNode(), null); - return this._readBlankNodeHead; - } - case 'blank': - if (!this._n3Mode) - return this._error('Disallowed blank node as predicate', token); - default: - if ((this._predicate = this._readEntity(token)) === undefined) - return; - } - // The next token must be an object - return this._readObject; - } - - // ### `_readObject` reads a quad's object - _readObject(token) { - switch (token.type) { - case 'literal': - // Regular literal, can still get a datatype or language - if (token.prefix.length === 0) { - this._literalValue = token.value; - return this._readDataTypeOrLang; - } - // Pre-datatyped string literal (prefix stores the datatype) - else - this._object = this._literal(token.value, this._namedNode(token.prefix)); - break; - case '[': - // Start a new quad with a new blank node as subject - this._saveContext('blank', this._graph, this._subject, this._predicate, - this._subject = this._blankNode()); - return this._readBlankNodeHead; - case '(': - // Start a new list - this._saveContext('list', this._graph, this._subject, this._predicate, this.RDF_NIL); - this._subject = null; - return this._readListItem; - case '{': - // Start a new formula - if (!this._n3Mode) - return this._error('Unexpected graph', token); - this._saveContext('formula', this._graph, this._subject, this._predicate, - this._graph = this._blankNode()); - return this._readSubject; - case '<<': - if (!this._supportsRDFStar) - return this._error('Unexpected RDF* syntax', token); - this._saveContext('<<', this._graph, this._subject, this._predicate, null); - this._graph = null; - return this._readSubject; - default: - // Read the object entity - if ((this._object = this._readEntity(token)) === undefined) - return; - // In N3 mode, the object might be a path - if (this._n3Mode) - return this._getPathReader(this._getContextEndReader()); - } - return this._getContextEndReader(); - } - - // ### `_readPredicateOrNamedGraph` reads a quad's predicate, or a named graph - _readPredicateOrNamedGraph(token) { - return token.type === '{' ? this._readGraph(token) : this._readPredicate(token); - } - - // ### `_readGraph` reads a graph - _readGraph(token) { - if (token.type !== '{') - return this._error(`Expected graph but got ${token.type}`, token); - // The "subject" we read is actually the GRAPH's label - this._graph = this._subject, this._subject = null; - return this._readSubject; - } - - // ### `_readBlankNodeHead` reads the head of a blank node - _readBlankNodeHead(token) { - if (token.type === ']') { - this._subject = null; - return this._readBlankNodeTail(token); - } - else { - this._predicate = null; - return this._readPredicate(token); - } - } - - // ### `_readBlankNodeTail` reads the end of a blank node - _readBlankNodeTail(token) { - if (token.type !== ']') - return this._readBlankNodePunctuation(token); - - // Store blank node quad - if (this._subject !== null) - this._emit(this._subject, this._predicate, this._object, this._graph); - - // Restore the parent context containing this blank node - const empty = this._predicate === null; - this._restoreContext('blank', token); - // If the blank node was the object, restore previous context and read punctuation - if (this._object !== null) - return this._getContextEndReader(); - // If the blank node was the predicate, continue reading the object - else if (this._predicate !== null) - return this._readObject; - // If the blank node was the subject, continue reading the predicate - else - // If the blank node was empty, it could be a named graph label - return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank; - } - - // ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node - _readPredicateAfterBlank(token) { - switch (token.type) { - case '.': - case '}': - // No predicate is coming if the triple is terminated here - this._subject = null; - return this._readPunctuation(token); - default: - return this._readPredicate(token); - } - } - - // ### `_readListItem` reads items from a list - _readListItem(token) { - let item = null, // The item of the list - list = null, // The list itself - next = this._readListItem; // The next function to execute - const previousList = this._subject, // The previous list that contains this list - stack = this._contextStack, // The stack of parent contexts - parent = stack[stack.length - 1]; // The parent containing the current list - - switch (token.type) { - case '[': - // Stack the current list quad and start a new quad with a blank node as subject - this._saveContext('blank', this._graph, - list = this._blankNode(), this.RDF_FIRST, - this._subject = item = this._blankNode()); - next = this._readBlankNodeHead; - break; - case '(': - // Stack the current list quad and start a new list - this._saveContext('list', this._graph, - list = this._blankNode(), this.RDF_FIRST, this.RDF_NIL); - this._subject = null; - break; - case ')': - // Closing the list; restore the parent context - this._restoreContext('list', token); - // If this list is contained within a parent list, return the membership quad here. - // This will be ` rdf:first .`. - if (stack.length !== 0 && stack[stack.length - 1].type === 'list') - this._emit(this._subject, this._predicate, this._object, this._graph); - // Was this list the parent's subject? - if (this._predicate === null) { - // The next token is the predicate - next = this._readPredicate; - // No list tail if this was an empty list - if (this._subject === this.RDF_NIL) - return next; - } - // The list was in the parent context's object - else { - next = this._getContextEndReader(); - // No list tail if this was an empty list - if (this._object === this.RDF_NIL) - return next; - } - // Close the list by making the head nil - list = this.RDF_NIL; - break; - case 'literal': - // Regular literal, can still get a datatype or language - if (token.prefix.length === 0) { - this._literalValue = token.value; - next = this._readListItemDataTypeOrLang; - } - // Pre-datatyped string literal (prefix stores the datatype) - else { - item = this._literal(token.value, this._namedNode(token.prefix)); - next = this._getContextEndReader(); - } - break; - case '{': - // Start a new formula - if (!this._n3Mode) - return this._error('Unexpected graph', token); - this._saveContext('formula', this._graph, this._subject, this._predicate, - this._graph = this._blankNode()); - return this._readSubject; - default: - if ((item = this._readEntity(token)) === undefined) - return; - } - - // Create a new blank node if no item head was assigned yet - if (list === null) - this._subject = list = this._blankNode(); - - // Is this the first element of the list? - if (previousList === null) { - // This list is either the subject or the object of its parent - if (parent.predicate === null) - parent.subject = list; - else - parent.object = list; - } - else { - // Continue the previous list with the current list - this._emit(previousList, this.RDF_REST, list, this._graph); - } - // If an item was read, add it to the list - if (item !== null) { - // In N3 mode, the item might be a path - if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) { - // Create a new context to add the item's path - this._saveContext('item', this._graph, list, this.RDF_FIRST, item); - this._subject = item, this._predicate = null; - // _readPath will restore the context and output the item - return this._getPathReader(this._readListItem); - } - // Output the item - this._emit(list, this.RDF_FIRST, item, this._graph); - } - return next; - } - - // ### `_readDataTypeOrLang` reads an _optional_ datatype or language - _readDataTypeOrLang(token) { - return this._completeObjectLiteral(token, false); - } - - - // ### `_readListItemDataTypeOrLang` reads an _optional_ datatype or language in a list - _readListItemDataTypeOrLang(token) { - return this._completeObjectLiteral(token, true); - } - - // ### `_completeLiteral` completes a literal with an optional datatype or language - _completeLiteral(token) { - // Create a simple string literal by default - let literal = this._literal(this._literalValue); - - switch (token.type) { - // Create a datatyped literal - case 'type': - case 'typeIRI': - const datatype = this._readEntity(token); - if (datatype === undefined) return; // No datatype means an error occurred - literal = this._literal(this._literalValue, datatype); - token = null; - break; - // Create a language-tagged string - case 'langcode': - literal = this._literal(this._literalValue, token.value); - token = null; - break; - } - - return { token, literal }; - } - - // Completes a literal in subject position - _completeSubjectLiteral(token) { - this._subject = this._completeLiteral(token).literal; - return this._readPredicateOrNamedGraph; - } - - // Completes a literal in object position - _completeObjectLiteral(token, listItem) { - const completed = this._completeLiteral(token); - if (!completed) - return; - this._object = completed.literal; - - // If this literal was part of a list, write the item - // (we could also check the context stack, but passing in a flag is faster) - if (listItem) - this._emit(this._subject, this.RDF_FIRST, this._object, this._graph); - // If the token was consumed, continue with the rest of the input - if (completed.token === null) - return this._getContextEndReader(); - // Otherwise, consume the token now - else { - this._readCallback = this._getContextEndReader(); - return this._readCallback(completed.token); - } - } - - // ### `_readFormulaTail` reads the end of a formula - _readFormulaTail(token) { - if (token.type !== '}') - return this._readPunctuation(token); - - // Store the last quad of the formula - if (this._subject !== null) - this._emit(this._subject, this._predicate, this._object, this._graph); - - // Restore the parent context containing this formula - this._restoreContext('formula', token); - // If the formula was the subject, continue reading the predicate. - // If the formula was the object, read punctuation. - return this._object === null ? this._readPredicate : this._getContextEndReader(); - } - - // ### `_readPunctuation` reads punctuation between quads or quad parts - _readPunctuation(token) { - let next, graph = this._graph; - const subject = this._subject, inversePredicate = this._inversePredicate; - switch (token.type) { - // A closing brace ends a graph - case '}': - if (this._graph === null) - return this._error('Unexpected graph closing', token); - if (this._n3Mode) - return this._readFormulaTail(token); - this._graph = null; - // A dot just ends the statement, without sharing anything with the next - case '.': - this._subject = null; - next = this._contextStack.length ? this._readSubject : this._readInTopContext; - if (inversePredicate) this._inversePredicate = false; - break; - // Semicolon means the subject is shared; predicate and object are different - case ';': - next = this._readPredicate; - break; - // Comma means both the subject and predicate are shared; the object is different - case ',': - next = this._readObject; - break; - // {| means that the current triple is annotated with predicate-object pairs. - case '{|': - if (!this._supportsRDFStar) - return this._error('Unexpected RDF* syntax', token); - // Continue using the last triple as quoted triple subject for the predicate-object pairs. - const predicate = this._predicate, object = this._object; - this._subject = this._quad(subject, predicate, object, this.DEFAULTGRAPH); - next = this._readPredicate; - break; - // |} means that the current quoted triple in annotation syntax is finalized. - case '|}': - if (this._subject.termType !== 'Quad') - return this._error('Unexpected asserted triple closing', token); - this._subject = null; - next = this._readPunctuation; - break; - default: - // An entity means this is a quad (only allowed if not already inside a graph) - if (this._supportsQuads && this._graph === null && (graph = this._readEntity(token)) !== undefined) { - next = this._readQuadPunctuation; - break; - } - return this._error(`Expected punctuation to follow "${this._object.id}"`, token); - } - // A quad has been completed now, so return it - if (subject !== null) { - const predicate = this._predicate, object = this._object; - if (!inversePredicate) - this._emit(subject, predicate, object, graph); - else - this._emit(object, predicate, subject, graph); - } - return next; - } - - // ### `_readBlankNodePunctuation` reads punctuation in a blank node - _readBlankNodePunctuation(token) { - let next; - switch (token.type) { - // Semicolon means the subject is shared; predicate and object are different - case ';': - next = this._readPredicate; - break; - // Comma means both the subject and predicate are shared; the object is different - case ',': - next = this._readObject; - break; - default: - return this._error(`Expected punctuation to follow "${this._object.id}"`, token); - } - // A quad has been completed now, so return it - this._emit(this._subject, this._predicate, this._object, this._graph); - return next; - } - - // ### `_readQuadPunctuation` reads punctuation after a quad - _readQuadPunctuation(token) { - if (token.type !== '.') - return this._error('Expected dot to follow quad', token); - return this._readInTopContext; - } - - // ### `_readPrefix` reads the prefix of a prefix declaration - _readPrefix(token) { - if (token.type !== 'prefix') - return this._error('Expected prefix to follow @prefix', token); - this._prefix = token.value; - return this._readPrefixIRI; - } - - // ### `_readPrefixIRI` reads the IRI of a prefix declaration - _readPrefixIRI(token) { - if (token.type !== 'IRI') - return this._error(`Expected IRI to follow prefix "${this._prefix}:"`, token); - const prefixNode = this._readEntity(token); - this._prefixes[this._prefix] = prefixNode.value; - this._prefixCallback(this._prefix, prefixNode); - return this._readDeclarationPunctuation; - } - - // ### `_readBaseIRI` reads the IRI of a base declaration - _readBaseIRI(token) { - const iri = token.type === 'IRI' && this._resolveIRI(token.value); - if (!iri) - return this._error('Expected valid IRI to follow base declaration', token); - this._setBase(iri); - return this._readDeclarationPunctuation; - } - - // ### `_readNamedGraphLabel` reads the label of a named graph - _readNamedGraphLabel(token) { - switch (token.type) { - case 'IRI': - case 'blank': - case 'prefixed': - return this._readSubject(token), this._readGraph; - case '[': - return this._readNamedGraphBlankLabel; - default: - return this._error('Invalid graph label', token); - } - } - - // ### `_readNamedGraphLabel` reads a blank node label of a named graph - _readNamedGraphBlankLabel(token) { - if (token.type !== ']') - return this._error('Invalid graph label', token); - this._subject = this._blankNode(); - return this._readGraph; - } - - // ### `_readDeclarationPunctuation` reads the punctuation of a declaration - _readDeclarationPunctuation(token) { - // SPARQL-style declarations don't have punctuation - if (this._sparqlStyle) { - this._sparqlStyle = false; - return this._readInTopContext(token); - } - - if (token.type !== '.') - return this._error('Expected declaration to end with a dot', token); - return this._readInTopContext; - } - - // Reads a list of quantified symbols from a @forSome or @forAll statement - _readQuantifierList(token) { - let entity; - switch (token.type) { - case 'IRI': - case 'prefixed': - if ((entity = this._readEntity(token, true)) !== undefined) - break; - default: - return this._error(`Unexpected ${token.type}`, token); - } - // Without explicit quantifiers, map entities to a quantified entity - if (!this._explicitQuantifiers) - this._quantified[entity.id] = this._quantifier(this._blankNode().value); - // With explicit quantifiers, output the reified quantifier - else { - // If this is the first item, start a new quantifier list - if (this._subject === null) - this._emit(this._graph || this.DEFAULTGRAPH, this._predicate, - this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH); - // Otherwise, continue the previous list - else - this._emit(this._subject, this.RDF_REST, - this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH); - // Output the list item - this._emit(this._subject, this.RDF_FIRST, entity, this.QUANTIFIERS_GRAPH); - } - return this._readQuantifierPunctuation; - } - - // Reads punctuation from a @forSome or @forAll statement - _readQuantifierPunctuation(token) { - // Read more quantifiers - if (token.type === ',') - return this._readQuantifierList; - // End of the quantifier list - else { - // With explicit quantifiers, close the quantifier list - if (this._explicitQuantifiers) { - this._emit(this._subject, this.RDF_REST, this.RDF_NIL, this.QUANTIFIERS_GRAPH); - this._subject = null; - } - // Read a dot - this._readCallback = this._getContextEndReader(); - return this._readCallback(token); - } - } - - // ### `_getPathReader` reads a potential path and then resumes with the given function - _getPathReader(afterPath) { - this._afterPath = afterPath; - return this._readPath; - } - - // ### `_readPath` reads a potential path - _readPath(token) { - switch (token.type) { - // Forward path - case '!': return this._readForwardPath; - // Backward path - case '^': return this._readBackwardPath; - // Not a path; resume reading where we left off - default: - const stack = this._contextStack, parent = stack.length && stack[stack.length - 1]; - // If we were reading a list item, we still need to output it - if (parent && parent.type === 'item') { - // The list item is the remaining subejct after reading the path - const item = this._subject; - // Switch back to the context of the list - this._restoreContext('item', token); - // Output the list item - this._emit(this._subject, this.RDF_FIRST, item, this._graph); - } - return this._afterPath(token); - } - } - - // ### `_readForwardPath` reads a '!' path - _readForwardPath(token) { - let subject, predicate; - const object = this._blankNode(); - // The next token is the predicate - if ((predicate = this._readEntity(token)) === undefined) - return; - // If we were reading a subject, replace the subject by the path's object - if (this._predicate === null) - subject = this._subject, this._subject = object; - // If we were reading an object, replace the subject by the path's object - else - subject = this._object, this._object = object; - // Emit the path's current quad and read its next section - this._emit(subject, predicate, object, this._graph); - return this._readPath; - } - - // ### `_readBackwardPath` reads a '^' path - _readBackwardPath(token) { - const subject = this._blankNode(); - let predicate, object; - // The next token is the predicate - if ((predicate = this._readEntity(token)) === undefined) - return; - // If we were reading a subject, replace the subject by the path's subject - if (this._predicate === null) - object = this._subject, this._subject = subject; - // If we were reading an object, replace the subject by the path's subject - else - object = this._object, this._object = subject; - // Emit the path's current quad and read its next section - this._emit(subject, predicate, object, this._graph); - return this._readPath; - } - - // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF* quad or the end of a nested RDF* triple - _readRDFStarTailOrGraph(token) { - if (token.type !== '>>') { - // An entity means this is a quad (only allowed if not already inside a graph) - if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== undefined) - return this._readRDFStarTail; - return this._error(`Expected >> to follow "${this._object.id}"`, token); - } - return this._readRDFStarTail(token); - } - - // ### `_readRDFStarTail` reads the end of a nested RDF* triple - _readRDFStarTail(token) { - if (token.type !== '>>') - return this._error(`Expected >> but got ${token.type}`, token); - // Read the quad and restore the previous context - const quad = this._quad(this._subject, this._predicate, this._object, - this._graph || this.DEFAULTGRAPH); - this._restoreContext('<<', token); - // If the triple was the subject, continue by reading the predicate. - if (this._subject === null) { - this._subject = quad; - return this._readPredicate; - } - // If the triple was the object, read context end. - else { - this._object = quad; - return this._getContextEndReader(); - } - } - - // ### `_getContextEndReader` gets the next reader function at the end of a context - _getContextEndReader() { - const contextStack = this._contextStack; - if (!contextStack.length) - return this._readPunctuation; - - switch (contextStack[contextStack.length - 1].type) { - case 'blank': - return this._readBlankNodeTail; - case 'list': - return this._readListItem; - case 'formula': - return this._readFormulaTail; - case '<<': - return this._readRDFStarTailOrGraph; - } - } - - // ### `_emit` sends a quad through the callback - _emit(subject, predicate, object, graph) { - this._callback(null, this._quad(subject, predicate, object, graph || this.DEFAULTGRAPH)); - } - - // ### `_error` emits an error message through the callback - _error(message, token) { - const err = new Error(`${message} on line ${token.line}.`); - err.context = { - token: token, - line: token.line, - previousToken: this._lexer.previousToken, - }; - this._callback(err); - this._callback = noop; - } - - // ### `_resolveIRI` resolves an IRI against the base path - _resolveIRI(iri) { - return /^[a-z][a-z0-9+.-]*:/i.test(iri) ? iri : this._resolveRelativeIRI(iri); - } - - // ### `_resolveRelativeIRI` resolves an IRI against the base path, - // assuming that a base path has been set and that the IRI is indeed relative - _resolveRelativeIRI(iri) { - // An empty relative IRI indicates the base IRI - if (!iri.length) - return this._base; - // Decide resolving strategy based in the first character - switch (iri[0]) { - // Resolve relative fragment IRIs against the base IRI - case '#': return this._base + iri; - // Resolve relative query string IRIs by replacing the query string - case '?': return this._base.replace(/(?:\?.*)?$/, iri); - // Resolve root-relative IRIs at the root of the base IRI - case '/': - // Resolve scheme-relative IRIs to the scheme - return (iri[1] === '/' ? this._baseScheme : this._baseRoot) + this._removeDotSegments(iri); - // Resolve all other IRIs at the base IRI's path - default: - // Relative IRIs cannot contain a colon in the first path segment - return (/^[^/:]*:/.test(iri)) ? null : this._removeDotSegments(this._basePath + iri); - } - } - - // ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986 - _removeDotSegments(iri) { - // Don't modify the IRI if it does not contain any dot segments - if (!/(^|\/)\.\.?($|[/#?])/.test(iri)) - return iri; - - // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../' - const length = iri.length; - let result = '', i = -1, pathStart = -1, segmentStart = 0, next = '/'; - - while (i < length) { - switch (next) { - // The path starts with the first slash after the authority - case ':': - if (pathStart < 0) { - // Skip two slashes before the authority - if (iri[++i] === '/' && iri[++i] === '/') - // Skip to slash after the authority - while ((pathStart = i + 1) < length && iri[pathStart] !== '/') - i = pathStart; - } - break; - // Don't modify a query string or fragment - case '?': - case '#': - i = length; - break; - // Handle '/.' or '/..' path segments - case '/': - if (iri[i + 1] === '.') { - next = iri[++i + 1]; - switch (next) { - // Remove a '/.' segment - case '/': - result += iri.substring(segmentStart, i - 1); - segmentStart = i + 1; - break; - // Remove a trailing '/.' segment - case undefined: - case '?': - case '#': - return result + iri.substring(segmentStart, i) + iri.substr(i + 1); - // Remove a '/..' segment - case '.': - next = iri[++i + 1]; - if (next === undefined || next === '/' || next === '?' || next === '#') { - result += iri.substring(segmentStart, i - 2); - // Try to remove the parent path from result - if ((segmentStart = result.lastIndexOf('/')) >= pathStart) - result = result.substr(0, segmentStart); - // Remove a trailing '/..' segment - if (next !== '/') - return `${result}/${iri.substr(i + 1)}`; - segmentStart = i + 1; - } - } - } - } - next = iri[++i]; - } - return result + iri.substring(segmentStart); - } - - // ## Public methods - - // ### `parse` parses the N3 input and emits each parsed quad through the callback - parse(input, quadCallback, prefixCallback) { - // The read callback is the next function to be executed when a token arrives. - // We start reading in the top context. - this._readCallback = this._readInTopContext; - this._sparqlStyle = false; - this._prefixes = Object.create(null); - this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2) - : `b${blankNodePrefix++}_`; - this._prefixCallback = prefixCallback || noop; - this._inversePredicate = false; - this._quantified = Object.create(null); - - // Parse synchronously if no quad callback is given - if (!quadCallback) { - const quads = []; - let error; - this._callback = (e, t) => { e ? (error = e) : t && quads.push(t); }; - this._lexer.tokenize(input).every(token => { - return this._readCallback = this._readCallback(token); - }); - if (error) throw error; - return quads; - } - - // Parse asynchronously otherwise, executing the read callback when a token arrives - this._callback = quadCallback; - this._lexer.tokenize(input, (error, token) => { - if (error !== null) - this._callback(error), this._callback = noop; - else if (this._readCallback) - this._readCallback = this._readCallback(token); - }); - } -} - -// The empty function -function noop() {} - -// Initializes the parser with the given data factory -function initDataFactory(parser, factory) { - // Set factory methods - const namedNode = factory.namedNode; - parser._namedNode = namedNode; - parser._blankNode = factory.blankNode; - parser._literal = factory.literal; - parser._variable = factory.variable; - parser._quad = factory.quad; - parser.DEFAULTGRAPH = factory.defaultGraph(); - - // Set common named nodes - parser.RDF_FIRST = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.first); - parser.RDF_REST = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.rest); - parser.RDF_NIL = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.nil); - parser.N3_FORALL = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].r.forAll); - parser.N3_FORSOME = namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].r.forSome); - parser.ABBREVIATIONS = { - 'a': namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].rdf.type), - '=': namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].owl.sameAs), - '>': namedNode(_IRIs__WEBPACK_IMPORTED_MODULE_1__["default"].log.implies), - }; - parser.QUANTIFIERS_GRAPH = namedNode('urn:n3:quantifiers'); -} -initDataFactory(N3Parser.prototype, _N3DataFactory__WEBPACK_IMPORTED_MODULE_2__["default"]); - - -/***/ }), - -/***/ "./node_modules/n3/src/N3Store.js": -/*!****************************************!*\ - !*** ./node_modules/n3/src/N3Store.js ***! - \****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ N3Store; } -/* harmony export */ }); -/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js"); -/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! readable-stream */ "./node_modules/n3/node_modules/readable-stream/lib/ours/browser.js"); -/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(readable_stream__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js"); -/* harmony import */ var _N3Util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./N3Util */ "./node_modules/n3/src/N3Util.js"); -// **N3Store** objects store N3 quads by graph in memory. - - - - - -// ## Constructor -class N3Store { - constructor(quads, options) { - // The number of quads is initially zero - this._size = 0; - // `_graphs` contains subject, predicate, and object indexes per graph - this._graphs = Object.create(null); - // `_ids` maps entities such as `http://xmlns.com/foaf/0.1/name` to numbers, - // saving memory by using only numbers as keys in `_graphs` - this._id = 0; - this._ids = Object.create(null); - this._entities = Object.create(null); // inverse of `_ids` - // `_blankNodeIndex` is the index of the last automatically named blank node - this._blankNodeIndex = 0; - - // Shift parameters if `quads` is not given - if (!options && quads && !quads[0]) - options = quads, quads = null; - options = options || {}; - this._factory = options.factory || _N3DataFactory__WEBPACK_IMPORTED_MODULE_1__["default"]; - - // Add quads if passed - if (quads) - this.addQuads(quads); - } - - _termFromId(id, factory) { - if (id[0] === '.') { - const entities = this._entities; - const terms = id.split('.'); - const q = this._factory.quad( - this._termFromId(entities[terms[1]]), - this._termFromId(entities[terms[2]]), - this._termFromId(entities[terms[3]]), - terms[4] && this._termFromId(entities[terms[4]]) - ); - return q; - } - return (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termFromId)(id, factory); - } - - _termToNumericId(term) { - if (term.termType === 'Quad') { - const s = this._termToNumericId(term.subject), - p = this._termToNumericId(term.predicate), - o = this._termToNumericId(term.object); - let g; - - return s && p && o && ((0,_N3Util__WEBPACK_IMPORTED_MODULE_2__.isDefaultGraph)(term.graph) || (g = this._termToNumericId(term.graph))) && - this._ids[g ? `.${s}.${p}.${o}.${g}` : `.${s}.${p}.${o}`]; - } - return this._ids[(0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(term)]; - } - - _termToNewNumericId(term) { - // This assumes that no graph term is present - we may wish to error if there is one - const str = term && term.termType === 'Quad' ? - `.${this._termToNewNumericId(term.subject)}.${this._termToNewNumericId(term.predicate)}.${this._termToNewNumericId(term.object)}${ - (0,_N3Util__WEBPACK_IMPORTED_MODULE_2__.isDefaultGraph)(term.graph) ? '' : `.${this._termToNewNumericId(term.graph)}` - }` - : (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(term); - - return this._ids[str] || (this._ids[this._entities[++this._id] = str] = this._id); - } - - // ## Public properties - - // ### `size` returns the number of quads in the store - get size() { - // Return the quad count if if was cached - let size = this._size; - if (size !== null) - return size; - - // Calculate the number of quads by counting to the deepest level - size = 0; - const graphs = this._graphs; - let subjects, subject; - for (const graphKey in graphs) - for (const subjectKey in (subjects = graphs[graphKey].subjects)) - for (const predicateKey in (subject = subjects[subjectKey])) - size += Object.keys(subject[predicateKey]).length; - return this._size = size; - } - - // ## Private methods - - // ### `_addToIndex` adds a quad to a three-layered index. - // Returns if the index has changed, if the entry did not already exist. - _addToIndex(index0, key0, key1, key2) { - // Create layers as necessary - const index1 = index0[key0] || (index0[key0] = {}); - const index2 = index1[key1] || (index1[key1] = {}); - // Setting the key to _any_ value signals the presence of the quad - const existed = key2 in index2; - if (!existed) - index2[key2] = null; - return !existed; - } - - // ### `_removeFromIndex` removes a quad from a three-layered index - _removeFromIndex(index0, key0, key1, key2) { - // Remove the quad from the index - const index1 = index0[key0], index2 = index1[key1]; - delete index2[key2]; - - // Remove intermediary index layers if they are empty - for (const key in index2) return; - delete index1[key1]; - for (const key in index1) return; - delete index0[key0]; - } - - // ### `_findInIndex` finds a set of quads in a three-layered index. - // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`. - // Any of these keys can be undefined, which is interpreted as a wildcard. - // `name0`, `name1`, and `name2` are the names of the keys at each level, - // used when reconstructing the resulting quad - // (for instance: _subject_, _predicate_, and _object_). - // Finally, `graphId` will be the graph of the created quads. - *_findInIndex(index0, key0, key1, key2, name0, name1, name2, graphId) { - let tmp, index1, index2; - const entityKeys = this._entities; - const graph = this._termFromId(graphId, this._factory); - const parts = { subject: null, predicate: null, object: null }; - - // If a key is specified, use only that part of index 0. - if (key0) (tmp = index0, index0 = {})[key0] = tmp[key0]; - for (const value0 in index0) { - if (index1 = index0[value0]) { - parts[name0] = this._termFromId(entityKeys[value0], this._factory); - // If a key is specified, use only that part of index 1. - if (key1) (tmp = index1, index1 = {})[key1] = tmp[key1]; - for (const value1 in index1) { - if (index2 = index1[value1]) { - parts[name1] = this._termFromId(entityKeys[value1], this._factory); - // If a key is specified, use only that part of index 2, if it exists. - const values = key2 ? (key2 in index2 ? [key2] : []) : Object.keys(index2); - // Create quads for all items found in index 2. - for (let l = 0; l < values.length; l++) { - parts[name2] = this._termFromId(entityKeys[values[l]], this._factory); - yield this._factory.quad(parts.subject, parts.predicate, parts.object, graph); - } - } - } - } - } - } - - // ### `_loop` executes the callback on all keys of index 0 - _loop(index0, callback) { - for (const key0 in index0) - callback(key0); - } - - // ### `_loopByKey0` executes the callback on all keys of a certain entry in index 0 - _loopByKey0(index0, key0, callback) { - let index1, key1; - if (index1 = index0[key0]) { - for (key1 in index1) - callback(key1); - } - } - - // ### `_loopByKey1` executes the callback on given keys of all entries in index 0 - _loopByKey1(index0, key1, callback) { - let key0, index1; - for (key0 in index0) { - index1 = index0[key0]; - if (index1[key1]) - callback(key0); - } - } - - // ### `_loopBy2Keys` executes the callback on given keys of certain entries in index 2 - _loopBy2Keys(index0, key0, key1, callback) { - let index1, index2, key2; - if ((index1 = index0[key0]) && (index2 = index1[key1])) { - for (key2 in index2) - callback(key2); - } - } - - // ### `_countInIndex` counts matching quads in a three-layered index. - // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`. - // Any of these keys can be undefined, which is interpreted as a wildcard. - _countInIndex(index0, key0, key1, key2) { - let count = 0, tmp, index1, index2; - - // If a key is specified, count only that part of index 0 - if (key0) (tmp = index0, index0 = {})[key0] = tmp[key0]; - for (const value0 in index0) { - if (index1 = index0[value0]) { - // If a key is specified, count only that part of index 1 - if (key1) (tmp = index1, index1 = {})[key1] = tmp[key1]; - for (const value1 in index1) { - if (index2 = index1[value1]) { - // If a key is specified, count the quad if it exists - if (key2) (key2 in index2) && count++; - // Otherwise, count all quads - else count += Object.keys(index2).length; - } - } - } - } - return count; - } - - // ### `_getGraphs` returns an array with the given graph, - // or all graphs if the argument is null or undefined. - _getGraphs(graph) { - if (!isString(graph)) - return this._graphs; - const graphs = {}; - graphs[graph] = this._graphs[graph]; - return graphs; - } - - // ### `_uniqueEntities` returns a function that accepts an entity ID - // and passes the corresponding entity to callback if it hasn't occurred before. - _uniqueEntities(callback) { - const uniqueIds = Object.create(null); - return id => { - if (!(id in uniqueIds)) { - uniqueIds[id] = true; - callback(this._termFromId(this._entities[id], this._factory)); - } - }; - } - - // ## Public methods - - // ### `add` adds the specified quad to the dataset. - // Returns the dataset instance it was called on. - // Existing quads, as defined in Quad.equals, will be ignored. - add(quad) { - this.addQuad(quad); - return this; - } - - // ### `addQuad` adds a new quad to the store. - // Returns if the quad index has changed, if the quad did not already exist. - addQuad(subject, predicate, object, graph) { - // Shift arguments if a quad object is given instead of components - if (!predicate) - graph = subject.graph, object = subject.object, - predicate = subject.predicate, subject = subject.subject; - - // Convert terms to internal string representation - graph = (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(graph); - - // Find the graph that will contain the triple - let graphItem = this._graphs[graph]; - // Create the graph if it doesn't exist yet - if (!graphItem) { - graphItem = this._graphs[graph] = { subjects: {}, predicates: {}, objects: {} }; - // Freezing a graph helps subsequent `add` performance, - // and properties will never be modified anyway - Object.freeze(graphItem); - } - - // Since entities can often be long IRIs, we avoid storing them in every index. - // Instead, we have a separate index that maps entities to numbers, - // which are then used as keys in the other indexes. - subject = this._termToNewNumericId(subject); - predicate = this._termToNewNumericId(predicate); - object = this._termToNewNumericId(object); - - const changed = this._addToIndex(graphItem.subjects, subject, predicate, object); - this._addToIndex(graphItem.predicates, predicate, object, subject); - this._addToIndex(graphItem.objects, object, subject, predicate); - - // The cached quad count is now invalid - this._size = null; - return changed; - } - - // ### `addQuads` adds multiple quads to the store - addQuads(quads) { - for (let i = 0; i < quads.length; i++) - this.addQuad(quads[i]); - } - - // ### `delete` removes the specified quad from the dataset. - // Returns the dataset instance it was called on. - delete(quad) { - this.removeQuad(quad); - return this; - } - - // ### `has` determines whether a dataset includes a certain quad or quad pattern. - has(subjectOrQuad, predicate, object, graph) { - if (subjectOrQuad && subjectOrQuad.subject) - ({ subject: subjectOrQuad, predicate, object, graph } = subjectOrQuad); - return !this.readQuads(subjectOrQuad, predicate, object, graph).next().done; - } - - // ### `import` adds a stream of quads to the store - import(stream) { - stream.on('data', quad => { this.addQuad(quad); }); - return stream; - } - - // ### `removeQuad` removes a quad from the store if it exists - removeQuad(subject, predicate, object, graph) { - // Shift arguments if a quad object is given instead of components - if (!predicate) - graph = subject.graph, object = subject.object, - predicate = subject.predicate, subject = subject.subject; - - // Convert terms to internal string representation - graph = (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(graph); - - // Find internal identifiers for all components - // and verify the quad exists. - const graphs = this._graphs; - let graphItem, subjects, predicates; - if (!(subject = subject && this._termToNumericId(subject)) || !(predicate = predicate && this._termToNumericId(predicate)) || - !(object = object && this._termToNumericId(object)) || !(graphItem = graphs[graph]) || - !(subjects = graphItem.subjects[subject]) || - !(predicates = subjects[predicate]) || - !(object in predicates)) - return false; - - // Remove it from all indexes - this._removeFromIndex(graphItem.subjects, subject, predicate, object); - this._removeFromIndex(graphItem.predicates, predicate, object, subject); - this._removeFromIndex(graphItem.objects, object, subject, predicate); - if (this._size !== null) this._size--; - - // Remove the graph if it is empty - for (subject in graphItem.subjects) return true; - delete graphs[graph]; - return true; - } - - // ### `removeQuads` removes multiple quads from the store - removeQuads(quads) { - for (let i = 0; i < quads.length; i++) - this.removeQuad(quads[i]); - } - - // ### `remove` removes a stream of quads from the store - remove(stream) { - stream.on('data', quad => { this.removeQuad(quad); }); - return stream; - } - - // ### `removeMatches` removes all matching quads from the store - // Setting any field to `undefined` or `null` indicates a wildcard. - removeMatches(subject, predicate, object, graph) { - const stream = new readable_stream__WEBPACK_IMPORTED_MODULE_0__.Readable({ objectMode: true }); - - stream._read = () => { - for (const quad of this.readQuads(subject, predicate, object, graph)) - stream.push(quad); - stream.push(null); - }; - - return this.remove(stream); - } - - // ### `deleteGraph` removes all triples with the given graph from the store - deleteGraph(graph) { - return this.removeMatches(null, null, null, graph); - } - - // ### `getQuads` returns an array of quads matching a pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - getQuads(subject, predicate, object, graph) { - return [...this.readQuads(subject, predicate, object, graph)]; - } - - // ### `readQuads` returns an generator of quads matching a pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - *readQuads(subject, predicate, object, graph) { - // Convert terms to internal string representation - graph = graph && (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(graph); - - const graphs = this._getGraphs(graph); - let content, subjectId, predicateId, objectId; - - // Translate IRIs to internal index keys. - if (subject && !(subjectId = this._termToNumericId(subject)) || - predicate && !(predicateId = this._termToNumericId(predicate)) || - object && !(objectId = this._termToNumericId(object))) - return; - - for (const graphId in graphs) { - // Only if the specified graph contains triples, there can be results - if (content = graphs[graphId]) { - // Choose the optimal index, based on what fields are present - if (subjectId) { - if (objectId) - // If subject and object are given, the object index will be the fastest - yield* this._findInIndex(content.objects, objectId, subjectId, predicateId, - 'object', 'subject', 'predicate', graphId); - else - // If only subject and possibly predicate are given, the subject index will be the fastest - yield* this._findInIndex(content.subjects, subjectId, predicateId, null, - 'subject', 'predicate', 'object', graphId); - } - else if (predicateId) - // If only predicate and possibly object are given, the predicate index will be the fastest - yield* this._findInIndex(content.predicates, predicateId, objectId, null, - 'predicate', 'object', 'subject', graphId); - else if (objectId) - // If only object is given, the object index will be the fastest - yield* this._findInIndex(content.objects, objectId, null, null, - 'object', 'subject', 'predicate', graphId); - else - // If nothing is given, iterate subjects and predicates first - yield* this._findInIndex(content.subjects, null, null, null, - 'subject', 'predicate', 'object', graphId); - } - } - } - - // ### `match` returns a new dataset that is comprised of all quads in the current instance matching the given arguments. - // The logic described in Quad Matching is applied for each quad in this dataset to check if it should be included in the output dataset. - // Note: This method always returns a new DatasetCore, even if that dataset contains no quads. - // Note: Since a DatasetCore is an unordered set, the order of the quads within the returned sequence is arbitrary. - // Setting any field to `undefined` or `null` indicates a wildcard. - // For backwards compatibility, the object return also implements the Readable stream interface. - match(subject, predicate, object, graph) { - return new DatasetCoreAndReadableStream(this, subject, predicate, object, graph); - } - - // ### `countQuads` returns the number of quads matching a pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - countQuads(subject, predicate, object, graph) { - // Convert terms to internal string representation - graph = graph && (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(graph); - - const graphs = this._getGraphs(graph); - let count = 0, content, subjectId, predicateId, objectId; - - // Translate IRIs to internal index keys. - if (subject && !(subjectId = this._termToNumericId(subject)) || - predicate && !(predicateId = this._termToNumericId(predicate)) || - object && !(objectId = this._termToNumericId(object))) - return 0; - - for (const graphId in graphs) { - // Only if the specified graph contains triples, there can be results - if (content = graphs[graphId]) { - // Choose the optimal index, based on what fields are present - if (subject) { - if (object) - // If subject and object are given, the object index will be the fastest - count += this._countInIndex(content.objects, objectId, subjectId, predicateId); - else - // If only subject and possibly predicate are given, the subject index will be the fastest - count += this._countInIndex(content.subjects, subjectId, predicateId, objectId); - } - else if (predicate) { - // If only predicate and possibly object are given, the predicate index will be the fastest - count += this._countInIndex(content.predicates, predicateId, objectId, subjectId); - } - else { - // If only object is possibly given, the object index will be the fastest - count += this._countInIndex(content.objects, objectId, subjectId, predicateId); - } - } - } - return count; - } - - // ### `forEach` executes the callback on all quads. - // Setting any field to `undefined` or `null` indicates a wildcard. - forEach(callback, subject, predicate, object, graph) { - this.some(quad => { - callback(quad); - return false; - }, subject, predicate, object, graph); - } - - // ### `every` executes the callback on all quads, - // and returns `true` if it returns truthy for all them. - // Setting any field to `undefined` or `null` indicates a wildcard. - every(callback, subject, predicate, object, graph) { - let some = false; - const every = !this.some(quad => { - some = true; - return !callback(quad); - }, subject, predicate, object, graph); - return some && every; - } - - // ### `some` executes the callback on all quads, - // and returns `true` if it returns truthy for any of them. - // Setting any field to `undefined` or `null` indicates a wildcard. - some(callback, subject, predicate, object, graph) { - for (const quad of this.readQuads(subject, predicate, object, graph)) - if (callback(quad)) - return true; - return false; - } - - // ### `getSubjects` returns all subjects that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - getSubjects(predicate, object, graph) { - const results = []; - this.forSubjects(s => { results.push(s); }, predicate, object, graph); - return results; - } - - // ### `forSubjects` executes the callback on all subjects that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - forSubjects(callback, predicate, object, graph) { - // Convert terms to internal string representation - graph = graph && (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(graph); - - const graphs = this._getGraphs(graph); - let content, predicateId, objectId; - callback = this._uniqueEntities(callback); - - // Translate IRIs to internal index keys. - if (predicate && !(predicateId = this._termToNumericId(predicate)) || - object && !(objectId = this._termToNumericId(object))) - return; - - for (graph in graphs) { - // Only if the specified graph contains triples, there can be results - if (content = graphs[graph]) { - // Choose optimal index based on which fields are wildcards - if (predicateId) { - if (objectId) - // If predicate and object are given, the POS index is best. - this._loopBy2Keys(content.predicates, predicateId, objectId, callback); - else - // If only predicate is given, the SPO index is best. - this._loopByKey1(content.subjects, predicateId, callback); - } - else if (objectId) - // If only object is given, the OSP index is best. - this._loopByKey0(content.objects, objectId, callback); - else - // If no params given, iterate all the subjects - this._loop(content.subjects, callback); - } - } - } - - // ### `getPredicates` returns all predicates that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - getPredicates(subject, object, graph) { - const results = []; - this.forPredicates(p => { results.push(p); }, subject, object, graph); - return results; - } - - // ### `forPredicates` executes the callback on all predicates that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - forPredicates(callback, subject, object, graph) { - // Convert terms to internal string representation - graph = graph && (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(graph); - - const graphs = this._getGraphs(graph); - let content, subjectId, objectId; - callback = this._uniqueEntities(callback); - - // Translate IRIs to internal index keys. - if (subject && !(subjectId = this._termToNumericId(subject)) || - object && !(objectId = this._termToNumericId(object))) - return; - - for (graph in graphs) { - // Only if the specified graph contains triples, there can be results - if (content = graphs[graph]) { - // Choose optimal index based on which fields are wildcards - if (subjectId) { - if (objectId) - // If subject and object are given, the OSP index is best. - this._loopBy2Keys(content.objects, objectId, subjectId, callback); - else - // If only subject is given, the SPO index is best. - this._loopByKey0(content.subjects, subjectId, callback); - } - else if (objectId) - // If only object is given, the POS index is best. - this._loopByKey1(content.predicates, objectId, callback); - else - // If no params given, iterate all the predicates. - this._loop(content.predicates, callback); - } - } - } - - // ### `getObjects` returns all objects that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - getObjects(subject, predicate, graph) { - const results = []; - this.forObjects(o => { results.push(o); }, subject, predicate, graph); - return results; - } - - // ### `forObjects` executes the callback on all objects that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - forObjects(callback, subject, predicate, graph) { - // Convert terms to internal string representation - graph = graph && (0,_N3DataFactory__WEBPACK_IMPORTED_MODULE_1__.termToId)(graph); - - const graphs = this._getGraphs(graph); - let content, subjectId, predicateId; - callback = this._uniqueEntities(callback); - - // Translate IRIs to internal index keys. - if (subject && !(subjectId = this._termToNumericId(subject)) || - predicate && !(predicateId = this._termToNumericId(predicate))) - return; - - for (graph in graphs) { - // Only if the specified graph contains triples, there can be results - if (content = graphs[graph]) { - // Choose optimal index based on which fields are wildcards - if (subjectId) { - if (predicateId) - // If subject and predicate are given, the SPO index is best. - this._loopBy2Keys(content.subjects, subjectId, predicateId, callback); - else - // If only subject is given, the OSP index is best. - this._loopByKey1(content.objects, subjectId, callback); - } - else if (predicateId) - // If only predicate is given, the POS index is best. - this._loopByKey0(content.predicates, predicateId, callback); - else - // If no params given, iterate all the objects. - this._loop(content.objects, callback); - } - } - } - - // ### `getGraphs` returns all graphs that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - getGraphs(subject, predicate, object) { - const results = []; - this.forGraphs(g => { results.push(g); }, subject, predicate, object); - return results; - } - - // ### `forGraphs` executes the callback on all graphs that match the pattern. - // Setting any field to `undefined` or `null` indicates a wildcard. - forGraphs(callback, subject, predicate, object) { - for (const graph in this._graphs) { - this.some(quad => { - callback(quad.graph); - return true; // Halt iteration of some() - }, subject, predicate, object, graph); - } - } - - // ### `createBlankNode` creates a new blank node, returning its name - createBlankNode(suggestedName) { - let name, index; - // Generate a name based on the suggested name - if (suggestedName) { - name = suggestedName = `_:${suggestedName}`, index = 1; - while (this._ids[name]) - name = suggestedName + index++; - } - // Generate a generic blank node name - else { - do { name = `_:b${this._blankNodeIndex++}`; } - while (this._ids[name]); - } - // Add the blank node to the entities, avoiding the generation of duplicates - this._ids[name] = ++this._id; - this._entities[this._id] = name; - return this._factory.blankNode(name.substr(2)); - } - - // ### `extractLists` finds and removes all list triples - // and returns the items per list. - extractLists({ remove = false, ignoreErrors = false } = {}) { - const lists = {}; // has scalar keys so could be a simple Object - const onError = ignoreErrors ? (() => true) : - ((node, message) => { throw new Error(`${node.value} ${message}`); }); - - // Traverse each list from its tail - const tails = this.getQuads(null, _IRIs__WEBPACK_IMPORTED_MODULE_3__["default"].rdf.rest, _IRIs__WEBPACK_IMPORTED_MODULE_3__["default"].rdf.nil, null); - const toRemove = remove ? [...tails] : []; - tails.forEach(tailQuad => { - const items = []; // the members found as objects of rdf:first quads - let malformed = false; // signals whether the current list is malformed - let head; // the head of the list (_:b1 in above example) - let headPos; // set to subject or object when head is set - const graph = tailQuad.graph; // make sure list is in exactly one graph - - // Traverse the list from tail to end - let current = tailQuad.subject; - while (current && !malformed) { - const objectQuads = this.getQuads(null, null, current, null); - const subjectQuads = this.getQuads(current, null, null, null); - let quad, first = null, rest = null, parent = null; - - // Find the first and rest of this list node - for (let i = 0; i < subjectQuads.length && !malformed; i++) { - quad = subjectQuads[i]; - if (!quad.graph.equals(graph)) - malformed = onError(current, 'not confined to single graph'); - else if (head) - malformed = onError(current, 'has non-list arcs out'); - - // one rdf:first - else if (quad.predicate.value === _IRIs__WEBPACK_IMPORTED_MODULE_3__["default"].rdf.first) { - if (first) - malformed = onError(current, 'has multiple rdf:first arcs'); - else - toRemove.push(first = quad); - } - - // one rdf:rest - else if (quad.predicate.value === _IRIs__WEBPACK_IMPORTED_MODULE_3__["default"].rdf.rest) { - if (rest) - malformed = onError(current, 'has multiple rdf:rest arcs'); - else - toRemove.push(rest = quad); - } - - // alien triple - else if (objectQuads.length) - malformed = onError(current, 'can\'t be subject and object'); - else { - head = quad; // e.g. { (1 2 3) :p :o } - headPos = 'subject'; - } - } - - // { :s :p (1 2) } arrives here with no head - // { (1 2) :p :o } arrives here with head set to the list. - for (let i = 0; i < objectQuads.length && !malformed; ++i) { - quad = objectQuads[i]; - if (head) - malformed = onError(current, 'can\'t have coreferences'); - // one rdf:rest - else if (quad.predicate.value === _IRIs__WEBPACK_IMPORTED_MODULE_3__["default"].rdf.rest) { - if (parent) - malformed = onError(current, 'has incoming rdf:rest arcs'); - else - parent = quad; - } - else { - head = quad; // e.g. { :s :p (1 2) } - headPos = 'object'; - } - } - - // Store the list item and continue with parent - if (!first) - malformed = onError(current, 'has no list head'); - else - items.unshift(first.object); - current = parent && parent.subject; - } - - // Don't remove any quads if the list is malformed - if (malformed) - remove = false; - // Store the list under the value of its head - else if (head) - lists[head[headPos].value] = items; - }); - - // Remove list quads if requested - if (remove) - this.removeQuads(toRemove); - return lists; - } - - // ### Store is an iterable. - // Can be used where iterables are expected: for...of loops, array spread operator, - // `yield*`, and destructuring assignment (order is not guaranteed). - *[Symbol.iterator]() { - yield* this.readQuads(); - } -} - -// Determines whether the argument is a string -function isString(s) { - return typeof s === 'string' || s instanceof String; -} - -/** - * A class that implements both DatasetCore and Readable. - */ -class DatasetCoreAndReadableStream extends readable_stream__WEBPACK_IMPORTED_MODULE_0__.Readable { - constructor(n3Store, subject, predicate, object, graph) { - super({ objectMode: true }); - Object.assign(this, { n3Store, subject, predicate, object, graph }); - } - - get filtered() { - if (!this._filtered) { - const { n3Store, graph, object, predicate, subject } = this; - const newStore = this._filtered = new N3Store({ factory: n3Store._factory }); - for (const quad of n3Store.readQuads(subject, predicate, object, graph)) - newStore.addQuad(quad); - } - return this._filtered; - } - - get size() { - return this.filtered.size; - } - - _read() { - for (const quad of this) - this.push(quad); - this.push(null); - } - - add(quad) { - return this.filtered.add(quad); - } - - delete(quad) { - return this.filtered.delete(quad); - } - - has(quad) { - return this.filtered.has(quad); - } - - match(subject, predicate, object, graph) { - return new DatasetCoreAndReadableStream(this.filtered, subject, predicate, object, graph); - } - - *[Symbol.iterator]() { - yield* this._filtered || this.n3Store.readQuads(this.subject, this.predicate, this.object, this.graph); - } -} - - -/***/ }), - -/***/ "./node_modules/n3/src/N3StreamParser.js": -/*!***********************************************!*\ - !*** ./node_modules/n3/src/N3StreamParser.js ***! - \***********************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ N3StreamParser; } -/* harmony export */ }); -/* harmony import */ var _N3Parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Parser */ "./node_modules/n3/src/N3Parser.js"); -/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! readable-stream */ "./node_modules/n3/node_modules/readable-stream/lib/ours/browser.js"); -/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(readable_stream__WEBPACK_IMPORTED_MODULE_0__); -// **N3StreamParser** parses a text stream into a quad stream. - - - -// ## Constructor -class N3StreamParser extends readable_stream__WEBPACK_IMPORTED_MODULE_0__.Transform { - constructor(options) { - super({ decodeStrings: true }); - this._readableState.objectMode = true; - - // Set up parser with dummy stream to obtain `data` and `end` callbacks - const parser = new _N3Parser__WEBPACK_IMPORTED_MODULE_1__["default"](options); - let onData, onEnd; - parser.parse({ - on: (event, callback) => { - switch (event) { - case 'data': onData = callback; break; - case 'end': onEnd = callback; break; - } - }, - }, - // Handle quads by pushing them down the pipeline - (error, quad) => { error && this.emit('error', error) || quad && this.push(quad); }, - // Emit prefixes through the `prefix` event - (prefix, uri) => { this.emit('prefix', prefix, uri); } - ); - - // Implement Transform methods through parser callbacks - this._transform = (chunk, encoding, done) => { onData(chunk); done(); }; - this._flush = done => { onEnd(); done(); }; - } - - // ### Parses a stream of strings - import(stream) { - stream.on('data', chunk => { this.write(chunk); }); - stream.on('end', () => { this.end(); }); - stream.on('error', error => { this.emit('error', error); }); - return this; - } -} - - -/***/ }), - -/***/ "./node_modules/n3/src/N3StreamWriter.js": -/*!***********************************************!*\ - !*** ./node_modules/n3/src/N3StreamWriter.js ***! - \***********************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ N3StreamWriter; } -/* harmony export */ }); -/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! readable-stream */ "./node_modules/n3/node_modules/readable-stream/lib/ours/browser.js"); -/* harmony import */ var readable_stream__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(readable_stream__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _N3Writer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Writer */ "./node_modules/n3/src/N3Writer.js"); -// **N3StreamWriter** serializes a quad stream into a text stream. - - - -// ## Constructor -class N3StreamWriter extends readable_stream__WEBPACK_IMPORTED_MODULE_0__.Transform { - constructor(options) { - super({ encoding: 'utf8', writableObjectMode: true }); - - // Set up writer with a dummy stream object - const writer = this._writer = new _N3Writer__WEBPACK_IMPORTED_MODULE_1__["default"]({ - write: (quad, encoding, callback) => { this.push(quad); callback && callback(); }, - end: callback => { this.push(null); callback && callback(); }, - }, options); - - // Implement Transform methods on top of writer - this._transform = (quad, encoding, done) => { writer.addQuad(quad, done); }; - this._flush = done => { writer.end(done); }; - } - -// ### Serializes a stream of quads - import(stream) { - stream.on('data', quad => { this.write(quad); }); - stream.on('end', () => { this.end(); }); - stream.on('error', error => { this.emit('error', error); }); - stream.on('prefix', (prefix, iri) => { this._writer.addPrefix(prefix, iri); }); - return this; - } -} - - -/***/ }), - -/***/ "./node_modules/n3/src/N3Util.js": -/*!***************************************!*\ - !*** ./node_modules/n3/src/N3Util.js ***! - \***************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ inDefaultGraph: function() { return /* binding */ inDefaultGraph; }, -/* harmony export */ isBlankNode: function() { return /* binding */ isBlankNode; }, -/* harmony export */ isDefaultGraph: function() { return /* binding */ isDefaultGraph; }, -/* harmony export */ isLiteral: function() { return /* binding */ isLiteral; }, -/* harmony export */ isNamedNode: function() { return /* binding */ isNamedNode; }, -/* harmony export */ isVariable: function() { return /* binding */ isVariable; }, -/* harmony export */ prefix: function() { return /* binding */ prefix; }, -/* harmony export */ prefixes: function() { return /* binding */ prefixes; } -/* harmony export */ }); -/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js"); -// **N3Util** provides N3 utility functions. - - - -// Tests whether the given term represents an IRI -function isNamedNode(term) { - return !!term && term.termType === 'NamedNode'; -} - -// Tests whether the given term represents a blank node -function isBlankNode(term) { - return !!term && term.termType === 'BlankNode'; -} - -// Tests whether the given term represents a literal -function isLiteral(term) { - return !!term && term.termType === 'Literal'; -} - -// Tests whether the given term represents a variable -function isVariable(term) { - return !!term && term.termType === 'Variable'; -} - -// Tests whether the given term represents the default graph -function isDefaultGraph(term) { - return !!term && term.termType === 'DefaultGraph'; -} - -// Tests whether the given quad is in the default graph -function inDefaultGraph(quad) { - return isDefaultGraph(quad.graph); -} - -// Creates a function that prepends the given IRI to a local name -function prefix(iri, factory) { - return prefixes({ '': iri.value || iri }, factory)(''); -} - -// Creates a function that allows registering and expanding prefixes -function prefixes(defaultPrefixes, factory) { - // Add all of the default prefixes - const prefixes = Object.create(null); - for (const prefix in defaultPrefixes) - processPrefix(prefix, defaultPrefixes[prefix]); - // Set the default factory if none was specified - factory = factory || _N3DataFactory__WEBPACK_IMPORTED_MODULE_0__["default"]; - - // Registers a new prefix (if an IRI was specified) - // or retrieves a function that expands an existing prefix (if no IRI was specified) - function processPrefix(prefix, iri) { - // Create a new prefix if an IRI is specified or the prefix doesn't exist - if (typeof iri === 'string') { - // Create a function that expands the prefix - const cache = Object.create(null); - prefixes[prefix] = local => { - return cache[local] || (cache[local] = factory.namedNode(iri + local)); - }; - } - else if (!(prefix in prefixes)) { - throw new Error(`Unknown prefix: ${prefix}`); - } - return prefixes[prefix]; - } - return processPrefix; -} - - -/***/ }), - -/***/ "./node_modules/n3/src/N3Writer.js": -/*!*****************************************!*\ - !*** ./node_modules/n3/src/N3Writer.js ***! - \*****************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ N3Writer; } -/* harmony export */ }); -/* harmony import */ var _IRIs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IRIs */ "./node_modules/n3/src/IRIs.js"); -/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js"); -/* harmony import */ var _N3Util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./N3Util */ "./node_modules/n3/src/N3Util.js"); -// **N3Writer** writes N3 documents. - - - - -const DEFAULTGRAPH = _N3DataFactory__WEBPACK_IMPORTED_MODULE_0__["default"].defaultGraph(); - -const { rdf, xsd } = _IRIs__WEBPACK_IMPORTED_MODULE_1__["default"]; - -// Characters in literals that require escaping -const escape = /["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/, - escapeAll = /["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g, - escapedCharacters = { - '\\': '\\\\', '"': '\\"', '\t': '\\t', - '\n': '\\n', '\r': '\\r', '\b': '\\b', '\f': '\\f', - }; - -// ## Placeholder class to represent already pretty-printed terms -class SerializedTerm extends _N3DataFactory__WEBPACK_IMPORTED_MODULE_0__.Term { - // Pretty-printed nodes are not equal to any other node - // (e.g., [] does not equal []) - equals(other) { - return other === this; - } -} - -// ## Constructor -class N3Writer { - constructor(outputStream, options) { - // ### `_prefixRegex` matches a prefixed name or IRI that begins with one of the added prefixes - this._prefixRegex = /$0^/; - - // Shift arguments if the first argument is not a stream - if (outputStream && typeof outputStream.write !== 'function') - options = outputStream, outputStream = null; - options = options || {}; - this._lists = options.lists; - - // If no output stream given, send the output as string through the end callback - if (!outputStream) { - let output = ''; - this._outputStream = { - write(chunk, encoding, done) { output += chunk; done && done(); }, - end: done => { done && done(null, output); }, - }; - this._endStream = true; - } - else { - this._outputStream = outputStream; - this._endStream = options.end === undefined ? true : !!options.end; - } - - // Initialize writer, depending on the format - this._subject = null; - if (!(/triple|quad/i).test(options.format)) { - this._lineMode = false; - this._graph = DEFAULTGRAPH; - this._prefixIRIs = Object.create(null); - options.prefixes && this.addPrefixes(options.prefixes); - if (options.baseIRI) { - this._baseMatcher = new RegExp(`^${escapeRegex(options.baseIRI) - }${options.baseIRI.endsWith('/') ? '' : '[#?]'}`); - this._baseLength = options.baseIRI.length; - } - } - else { - this._lineMode = true; - this._writeQuad = this._writeQuadLine; - } - } - - // ## Private methods - - // ### Whether the current graph is the default graph - get _inDefaultGraph() { - return DEFAULTGRAPH.equals(this._graph); - } - - // ### `_write` writes the argument to the output stream - _write(string, callback) { - this._outputStream.write(string, 'utf8', callback); - } - - // ### `_writeQuad` writes the quad to the output stream - _writeQuad(subject, predicate, object, graph, done) { - try { - // Write the graph's label if it has changed - if (!graph.equals(this._graph)) { - // Close the previous graph and start the new one - this._write((this._subject === null ? '' : (this._inDefaultGraph ? '.\n' : '\n}\n')) + - (DEFAULTGRAPH.equals(graph) ? '' : `${this._encodeIriOrBlank(graph)} {\n`)); - this._graph = graph; - this._subject = null; - } - // Don't repeat the subject if it's the same - if (subject.equals(this._subject)) { - // Don't repeat the predicate if it's the same - if (predicate.equals(this._predicate)) - this._write(`, ${this._encodeObject(object)}`, done); - // Same subject, different predicate - else - this._write(`;\n ${ - this._encodePredicate(this._predicate = predicate)} ${ - this._encodeObject(object)}`, done); - } - // Different subject; write the whole quad - else - this._write(`${(this._subject === null ? '' : '.\n') + - this._encodeSubject(this._subject = subject)} ${ - this._encodePredicate(this._predicate = predicate)} ${ - this._encodeObject(object)}`, done); - } - catch (error) { done && done(error); } - } - - // ### `_writeQuadLine` writes the quad to the output stream as a single line - _writeQuadLine(subject, predicate, object, graph, done) { - // Write the quad without prefixes - delete this._prefixMatch; - this._write(this.quadToString(subject, predicate, object, graph), done); - } - - // ### `quadToString` serializes a quad as a string - quadToString(subject, predicate, object, graph) { - return `${this._encodeSubject(subject)} ${ - this._encodeIriOrBlank(predicate)} ${ - this._encodeObject(object) - }${graph && graph.value ? ` ${this._encodeIriOrBlank(graph)} .\n` : ' .\n'}`; - } - - // ### `quadsToString` serializes an array of quads as a string - quadsToString(quads) { - return quads.map(t => { - return this.quadToString(t.subject, t.predicate, t.object, t.graph); - }).join(''); - } - - // ### `_encodeSubject` represents a subject - _encodeSubject(entity) { - return entity.termType === 'Quad' ? - this._encodeQuad(entity) : this._encodeIriOrBlank(entity); - } - - // ### `_encodeIriOrBlank` represents an IRI or blank node - _encodeIriOrBlank(entity) { - // A blank node or list is represented as-is - if (entity.termType !== 'NamedNode') { - // If it is a list head, pretty-print it - if (this._lists && (entity.value in this._lists)) - entity = this.list(this._lists[entity.value]); - return 'id' in entity ? entity.id : `_:${entity.value}`; - } - let iri = entity.value; - // Use relative IRIs if requested and possible - if (this._baseMatcher && this._baseMatcher.test(iri)) - iri = iri.substr(this._baseLength); - // Escape special characters - if (escape.test(iri)) - iri = iri.replace(escapeAll, characterReplacer); - // Try to represent the IRI as prefixed name - const prefixMatch = this._prefixRegex.exec(iri); - return !prefixMatch ? `<${iri}>` : - (!prefixMatch[1] ? iri : this._prefixIRIs[prefixMatch[1]] + prefixMatch[2]); - } - - // ### `_encodeLiteral` represents a literal - _encodeLiteral(literal) { - // Escape special characters - let value = literal.value; - if (escape.test(value)) - value = value.replace(escapeAll, characterReplacer); - - // Write a language-tagged literal - if (literal.language) - return `"${value}"@${literal.language}`; - - // Write dedicated literals per data type - if (this._lineMode) { - // Only abbreviate strings in N-Triples or N-Quads - if (literal.datatype.value === xsd.string) - return `"${value}"`; - } - else { - // Use common datatype abbreviations in Turtle or TriG - switch (literal.datatype.value) { - case xsd.string: - return `"${value}"`; - case xsd.boolean: - if (value === 'true' || value === 'false') - return value; - break; - case xsd.integer: - if (/^[+-]?\d+$/.test(value)) - return value; - break; - case xsd.decimal: - if (/^[+-]?\d*\.\d+$/.test(value)) - return value; - break; - case xsd.double: - if (/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(value)) - return value; - break; - } - } - - // Write a regular datatyped literal - return `"${value}"^^${this._encodeIriOrBlank(literal.datatype)}`; - } - - // ### `_encodePredicate` represents a predicate - _encodePredicate(predicate) { - return predicate.value === rdf.type ? 'a' : this._encodeIriOrBlank(predicate); - } - - // ### `_encodeObject` represents an object - _encodeObject(object) { - switch (object.termType) { - case 'Quad': - return this._encodeQuad(object); - case 'Literal': - return this._encodeLiteral(object); - default: - return this._encodeIriOrBlank(object); - } - } - - // ### `_encodeQuad` encodes an RDF* quad - _encodeQuad({ subject, predicate, object, graph }) { - return `<<${ - this._encodeSubject(subject)} ${ - this._encodePredicate(predicate)} ${ - this._encodeObject(object)}${ - (0,_N3Util__WEBPACK_IMPORTED_MODULE_2__.isDefaultGraph)(graph) ? '' : ` ${this._encodeIriOrBlank(graph)}`}>>`; - } - - // ### `_blockedWrite` replaces `_write` after the writer has been closed - _blockedWrite() { - throw new Error('Cannot write because the writer has been closed.'); - } - - // ### `addQuad` adds the quad to the output stream - addQuad(subject, predicate, object, graph, done) { - // The quad was given as an object, so shift parameters - if (object === undefined) - this._writeQuad(subject.subject, subject.predicate, subject.object, subject.graph, predicate); - // The optional `graph` parameter was not provided - else if (typeof graph === 'function') - this._writeQuad(subject, predicate, object, DEFAULTGRAPH, graph); - // The `graph` parameter was provided - else - this._writeQuad(subject, predicate, object, graph || DEFAULTGRAPH, done); - } - - // ### `addQuads` adds the quads to the output stream - addQuads(quads) { - for (let i = 0; i < quads.length; i++) - this.addQuad(quads[i]); - } - - // ### `addPrefix` adds the prefix to the output stream - addPrefix(prefix, iri, done) { - const prefixes = {}; - prefixes[prefix] = iri; - this.addPrefixes(prefixes, done); - } - - // ### `addPrefixes` adds the prefixes to the output stream - addPrefixes(prefixes, done) { - // Ignore prefixes if not supported by the serialization - if (!this._prefixIRIs) - return done && done(); - - // Write all new prefixes - let hasPrefixes = false; - for (let prefix in prefixes) { - let iri = prefixes[prefix]; - if (typeof iri !== 'string') - iri = iri.value; - hasPrefixes = true; - // Finish a possible pending quad - if (this._subject !== null) { - this._write(this._inDefaultGraph ? '.\n' : '\n}\n'); - this._subject = null, this._graph = ''; - } - // Store and write the prefix - this._prefixIRIs[iri] = (prefix += ':'); - this._write(`@prefix ${prefix} <${iri}>.\n`); - } - // Recreate the prefix matcher - if (hasPrefixes) { - let IRIlist = '', prefixList = ''; - for (const prefixIRI in this._prefixIRIs) { - IRIlist += IRIlist ? `|${prefixIRI}` : prefixIRI; - prefixList += (prefixList ? '|' : '') + this._prefixIRIs[prefixIRI]; - } - IRIlist = escapeRegex(IRIlist, /[\]\/\(\)\*\+\?\.\\\$]/g, '\\$&'); - this._prefixRegex = new RegExp(`^(?:${prefixList})[^\/]*$|` + - `^(${IRIlist})([_a-zA-Z][\\-_a-zA-Z0-9]*)$`); - } - // End a prefix block with a newline - this._write(hasPrefixes ? '\n' : '', done); - } - - // ### `blank` creates a blank node with the given content - blank(predicate, object) { - let children = predicate, child, length; - // Empty blank node - if (predicate === undefined) - children = []; - // Blank node passed as blank(Term("predicate"), Term("object")) - else if (predicate.termType) - children = [{ predicate: predicate, object: object }]; - // Blank node passed as blank({ predicate: predicate, object: object }) - else if (!('length' in predicate)) - children = [predicate]; - - switch (length = children.length) { - // Generate an empty blank node - case 0: - return new SerializedTerm('[]'); - // Generate a non-nested one-triple blank node - case 1: - child = children[0]; - if (!(child.object instanceof SerializedTerm)) - return new SerializedTerm(`[ ${this._encodePredicate(child.predicate)} ${ - this._encodeObject(child.object)} ]`); - // Generate a multi-triple or nested blank node - default: - let contents = '['; - // Write all triples in order - for (let i = 0; i < length; i++) { - child = children[i]; - // Write only the object is the predicate is the same as the previous - if (child.predicate.equals(predicate)) - contents += `, ${this._encodeObject(child.object)}`; - // Otherwise, write the predicate and the object - else { - contents += `${(i ? ';\n ' : '\n ') + - this._encodePredicate(child.predicate)} ${ - this._encodeObject(child.object)}`; - predicate = child.predicate; - } - } - return new SerializedTerm(`${contents}\n]`); - } - } - - // ### `list` creates a list node with the given content - list(elements) { - const length = elements && elements.length || 0, contents = new Array(length); - for (let i = 0; i < length; i++) - contents[i] = this._encodeObject(elements[i]); - return new SerializedTerm(`(${contents.join(' ')})`); - } - - // ### `end` signals the end of the output stream - end(done) { - // Finish a possible pending quad - if (this._subject !== null) { - this._write(this._inDefaultGraph ? '.\n' : '\n}\n'); - this._subject = null; - } - // Disallow further writing - this._write = this._blockedWrite; - - // Try to end the underlying stream, ensuring done is called exactly one time - let singleDone = done && ((error, result) => { singleDone = null, done(error, result); }); - if (this._endStream) { - try { return this._outputStream.end(singleDone); } - catch (error) { /* error closing stream */ } - } - singleDone && singleDone(); - } -} - -// Replaces a character by its escaped version -function characterReplacer(character) { - // Replace a single character by its escaped version - let result = escapedCharacters[character]; - if (result === undefined) { - // Replace a single character with its 4-bit unicode escape sequence - if (character.length === 1) { - result = character.charCodeAt(0).toString(16); - result = '\\u0000'.substr(0, 6 - result.length) + result; - } - // Replace a surrogate pair with its 8-bit unicode escape sequence - else { - result = ((character.charCodeAt(0) - 0xD800) * 0x400 + - character.charCodeAt(1) + 0x2400).toString(16); - result = '\\U00000000'.substr(0, 10 - result.length) + result; - } - } - return result; -} - -function escapeRegex(regex) { - return regex.replace(/[\]\/\(\)\*\+\?\.\\\$]/g, '\\$&'); -} - - -/***/ }), - -/***/ "./node_modules/n3/src/index.js": -/*!**************************************!*\ - !*** ./node_modules/n3/src/index.js ***! - \**************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ BlankNode: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.BlankNode; }, -/* harmony export */ DataFactory: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__["default"]; }, -/* harmony export */ DefaultGraph: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.DefaultGraph; }, -/* harmony export */ Lexer: function() { return /* reexport safe */ _N3Lexer__WEBPACK_IMPORTED_MODULE_0__["default"]; }, -/* harmony export */ Literal: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Literal; }, -/* harmony export */ NamedNode: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.NamedNode; }, -/* harmony export */ Parser: function() { return /* reexport safe */ _N3Parser__WEBPACK_IMPORTED_MODULE_1__["default"]; }, -/* harmony export */ Quad: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Quad; }, -/* harmony export */ Store: function() { return /* reexport safe */ _N3Store__WEBPACK_IMPORTED_MODULE_3__["default"]; }, -/* harmony export */ StreamParser: function() { return /* reexport safe */ _N3StreamParser__WEBPACK_IMPORTED_MODULE_4__["default"]; }, -/* harmony export */ StreamWriter: function() { return /* reexport safe */ _N3StreamWriter__WEBPACK_IMPORTED_MODULE_5__["default"]; }, -/* harmony export */ Term: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Term; }, -/* harmony export */ Triple: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Triple; }, -/* harmony export */ Util: function() { return /* reexport module object */ _N3Util__WEBPACK_IMPORTED_MODULE_6__; }, -/* harmony export */ Variable: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Variable; }, -/* harmony export */ Writer: function() { return /* reexport safe */ _N3Writer__WEBPACK_IMPORTED_MODULE_2__["default"]; }, -/* harmony export */ termFromId: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termFromId; }, -/* harmony export */ termToId: function() { return /* reexport safe */ _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termToId; } -/* harmony export */ }); -/* harmony import */ var _N3Lexer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./N3Lexer */ "./node_modules/n3/src/N3Lexer.js"); -/* harmony import */ var _N3Parser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./N3Parser */ "./node_modules/n3/src/N3Parser.js"); -/* harmony import */ var _N3Writer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./N3Writer */ "./node_modules/n3/src/N3Writer.js"); -/* harmony import */ var _N3Store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./N3Store */ "./node_modules/n3/src/N3Store.js"); -/* harmony import */ var _N3StreamParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./N3StreamParser */ "./node_modules/n3/src/N3StreamParser.js"); -/* harmony import */ var _N3StreamWriter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./N3StreamWriter */ "./node_modules/n3/src/N3StreamWriter.js"); -/* harmony import */ var _N3Util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./N3Util */ "./node_modules/n3/src/N3Util.js"); -/* harmony import */ var _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./N3DataFactory */ "./node_modules/n3/src/N3DataFactory.js"); - - - - - - - - - - -// Named exports - - -// Export all named exports as a default object for backward compatibility -/* harmony default export */ __webpack_exports__["default"] = ({ - Lexer: _N3Lexer__WEBPACK_IMPORTED_MODULE_0__["default"], - Parser: _N3Parser__WEBPACK_IMPORTED_MODULE_1__["default"], - Writer: _N3Writer__WEBPACK_IMPORTED_MODULE_2__["default"], - Store: _N3Store__WEBPACK_IMPORTED_MODULE_3__["default"], - StreamParser: _N3StreamParser__WEBPACK_IMPORTED_MODULE_4__["default"], - StreamWriter: _N3StreamWriter__WEBPACK_IMPORTED_MODULE_5__["default"], - Util: _N3Util__WEBPACK_IMPORTED_MODULE_6__, - - DataFactory: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__["default"], - - Term: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Term, - NamedNode: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.NamedNode, - Literal: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Literal, - BlankNode: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.BlankNode, - Variable: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Variable, - DefaultGraph: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.DefaultGraph, - Quad: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Quad, - Triple: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.Triple, - - termFromId: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termFromId, - termToId: _N3DataFactory__WEBPACK_IMPORTED_MODULE_7__.termToId, -}); - - -/***/ }), - -/***/ "./node_modules/process/browser.js": -/*!*****************************************!*\ - !*** ./node_modules/process/browser.js ***! - \*****************************************/ -/***/ (function(module) { - -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - - -/***/ }), - -/***/ "./node_modules/queue-microtask/index.js": -/*!***********************************************!*\ - !*** ./node_modules/queue-microtask/index.js ***! - \***********************************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -/*! queue-microtask. MIT License. Feross Aboukhadijeh */ -let promise - -module.exports = typeof queueMicrotask === 'function' - ? queueMicrotask.bind(typeof window !== 'undefined' ? window : __webpack_require__.g) - // reuse resolved promise, and allocate it lazily - : cb => (promise || (promise = Promise.resolve())) - .then(cb) - .catch(err => setTimeout(() => { throw err }, 0)) - - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/index.js": -/*!************************************************!*\ - !*** ./node_modules/rdf-data-factory/index.js ***! - \************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__webpack_require__(/*! ./lib/BlankNode */ "./node_modules/rdf-data-factory/lib/BlankNode.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/DataFactory */ "./node_modules/rdf-data-factory/lib/DataFactory.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/DefaultGraph */ "./node_modules/rdf-data-factory/lib/DefaultGraph.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/Literal */ "./node_modules/rdf-data-factory/lib/Literal.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/NamedNode */ "./node_modules/rdf-data-factory/lib/NamedNode.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/Quad */ "./node_modules/rdf-data-factory/lib/Quad.js"), exports); -__exportStar(__webpack_require__(/*! ./lib/Variable */ "./node_modules/rdf-data-factory/lib/Variable.js"), exports); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/lib/BlankNode.js": -/*!********************************************************!*\ - !*** ./node_modules/rdf-data-factory/lib/BlankNode.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BlankNode = void 0; -/** - * A term that represents an RDF blank node with a label. - */ -class BlankNode { - constructor(value) { - this.termType = 'BlankNode'; - this.value = value; - } - equals(other) { - return !!other && other.termType === 'BlankNode' && other.value === this.value; - } -} -exports.BlankNode = BlankNode; -//# sourceMappingURL=BlankNode.js.map - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/lib/DataFactory.js": -/*!**********************************************************!*\ - !*** ./node_modules/rdf-data-factory/lib/DataFactory.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DataFactory = void 0; -const BlankNode_1 = __webpack_require__(/*! ./BlankNode */ "./node_modules/rdf-data-factory/lib/BlankNode.js"); -const DefaultGraph_1 = __webpack_require__(/*! ./DefaultGraph */ "./node_modules/rdf-data-factory/lib/DefaultGraph.js"); -const Literal_1 = __webpack_require__(/*! ./Literal */ "./node_modules/rdf-data-factory/lib/Literal.js"); -const NamedNode_1 = __webpack_require__(/*! ./NamedNode */ "./node_modules/rdf-data-factory/lib/NamedNode.js"); -const Quad_1 = __webpack_require__(/*! ./Quad */ "./node_modules/rdf-data-factory/lib/Quad.js"); -const Variable_1 = __webpack_require__(/*! ./Variable */ "./node_modules/rdf-data-factory/lib/Variable.js"); -let dataFactoryCounter = 0; -/** - * A factory for instantiating RDF terms and quads. - */ -class DataFactory { - constructor(options) { - this.blankNodeCounter = 0; - options = options || {}; - this.blankNodePrefix = options.blankNodePrefix || `df_${dataFactoryCounter++}_`; - } - /** - * @param value The IRI for the named node. - * @return A new instance of NamedNode. - * @see NamedNode - */ - namedNode(value) { - return new NamedNode_1.NamedNode(value); - } - /** - * @param value The optional blank node identifier. - * @return A new instance of BlankNode. - * If the `value` parameter is undefined a new identifier - * for the blank node is generated for each call. - * @see BlankNode - */ - blankNode(value) { - return new BlankNode_1.BlankNode(value || `${this.blankNodePrefix}${this.blankNodeCounter++}`); - } - /** - * @param value The literal value. - * @param languageOrDatatype The optional language or datatype. - * If `languageOrDatatype` is a NamedNode, - * then it is used for the value of `NamedNode.datatype`. - * Otherwise `languageOrDatatype` is used for the value - * of `NamedNode.language`. - * @return A new instance of Literal. - * @see Literal - */ - literal(value, languageOrDatatype) { - return new Literal_1.Literal(value, languageOrDatatype); - } - /** - * This method is optional. - * @param value The variable name - * @return A new instance of Variable. - * @see Variable - */ - variable(value) { - return new Variable_1.Variable(value); - } - /** - * @return An instance of DefaultGraph. - */ - defaultGraph() { - return DefaultGraph_1.DefaultGraph.INSTANCE; - } - /** - * @param subject The quad subject term. - * @param predicate The quad predicate term. - * @param object The quad object term. - * @param graph The quad graph term. - * @return A new instance of Quad. - * @see Quad - */ - quad(subject, predicate, object, graph) { - return new Quad_1.Quad(subject, predicate, object, graph || this.defaultGraph()); - } - /** - * Create a deep copy of the given term using this data factory. - * @param original An RDF term. - * @return A deep copy of the given term. - */ - fromTerm(original) { - // TODO: remove nasty any casts when this TS bug has been fixed: - // https://github.com/microsoft/TypeScript/issues/26933 - switch (original.termType) { - case 'NamedNode': - return this.namedNode(original.value); - case 'BlankNode': - return this.blankNode(original.value); - case 'Literal': - if (original.language) { - return this.literal(original.value, original.language); - } - if (!original.datatype.equals(Literal_1.Literal.XSD_STRING)) { - return this.literal(original.value, this.fromTerm(original.datatype)); - } - return this.literal(original.value); - case 'Variable': - return this.variable(original.value); - case 'DefaultGraph': - return this.defaultGraph(); - case 'Quad': - return this.quad(this.fromTerm(original.subject), this.fromTerm(original.predicate), this.fromTerm(original.object), this.fromTerm(original.graph)); - } - } - /** - * Create a deep copy of the given quad using this data factory. - * @param original An RDF quad. - * @return A deep copy of the given quad. - */ - fromQuad(original) { - return this.fromTerm(original); - } - /** - * Reset the internal blank node counter. - */ - resetBlankNodeCounter() { - this.blankNodeCounter = 0; - } -} -exports.DataFactory = DataFactory; -//# sourceMappingURL=DataFactory.js.map - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/lib/DefaultGraph.js": -/*!***********************************************************!*\ - !*** ./node_modules/rdf-data-factory/lib/DefaultGraph.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.DefaultGraph = void 0; -/** - * A singleton term instance that represents the default graph. - * It's only allowed to assign a DefaultGraph to the .graph property of a Quad. - */ -class DefaultGraph { - constructor() { - this.termType = 'DefaultGraph'; - this.value = ''; - // Private constructor - } - equals(other) { - return !!other && other.termType === 'DefaultGraph'; - } -} -exports.DefaultGraph = DefaultGraph; -DefaultGraph.INSTANCE = new DefaultGraph(); -//# sourceMappingURL=DefaultGraph.js.map - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/lib/Literal.js": -/*!******************************************************!*\ - !*** ./node_modules/rdf-data-factory/lib/Literal.js ***! - \******************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Literal = void 0; -const NamedNode_1 = __webpack_require__(/*! ./NamedNode */ "./node_modules/rdf-data-factory/lib/NamedNode.js"); -/** - * A term that represents an RDF literal, containing a string with an optional language tag or datatype. - */ -class Literal { - constructor(value, languageOrDatatype) { - this.termType = 'Literal'; - this.value = value; - if (typeof languageOrDatatype === 'string') { - this.language = languageOrDatatype; - this.datatype = Literal.RDF_LANGUAGE_STRING; - } - else if (languageOrDatatype) { - this.language = ''; - this.datatype = languageOrDatatype; - } - else { - this.language = ''; - this.datatype = Literal.XSD_STRING; - } - } - equals(other) { - return !!other && other.termType === 'Literal' && other.value === this.value && - other.language === this.language && this.datatype.equals(other.datatype); - } -} -exports.Literal = Literal; -Literal.RDF_LANGUAGE_STRING = new NamedNode_1.NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'); -Literal.XSD_STRING = new NamedNode_1.NamedNode('http://www.w3.org/2001/XMLSchema#string'); -//# sourceMappingURL=Literal.js.map - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/lib/NamedNode.js": -/*!********************************************************!*\ - !*** ./node_modules/rdf-data-factory/lib/NamedNode.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.NamedNode = void 0; -/** - * A term that contains an IRI. - */ -class NamedNode { - constructor(value) { - this.termType = 'NamedNode'; - this.value = value; - } - equals(other) { - return !!other && other.termType === 'NamedNode' && other.value === this.value; - } -} -exports.NamedNode = NamedNode; -//# sourceMappingURL=NamedNode.js.map - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/lib/Quad.js": -/*!***************************************************!*\ - !*** ./node_modules/rdf-data-factory/lib/Quad.js ***! - \***************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Quad = void 0; -/** - * An instance of DefaultGraph represents the default graph. - * It's only allowed to assign a DefaultGraph to the .graph property of a Quad. - */ -class Quad { - constructor(subject, predicate, object, graph) { - this.termType = 'Quad'; - this.value = ''; - this.subject = subject; - this.predicate = predicate; - this.object = object; - this.graph = graph; - } - equals(other) { - // `|| !other.termType` is for backwards-compatibility with old factories without RDF* support. - return !!other && (other.termType === 'Quad' || !other.termType) && - this.subject.equals(other.subject) && - this.predicate.equals(other.predicate) && - this.object.equals(other.object) && - this.graph.equals(other.graph); - } -} -exports.Quad = Quad; -//# sourceMappingURL=Quad.js.map - -/***/ }), - -/***/ "./node_modules/rdf-data-factory/lib/Variable.js": -/*!*******************************************************!*\ - !*** ./node_modules/rdf-data-factory/lib/Variable.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Variable = void 0; -/** - * A term that represents a variable. - */ -class Variable { - constructor(value) { - this.termType = 'Variable'; - this.value = value; - } - equals(other) { - return !!other && other.termType === 'Variable' && other.value === this.value; - } -} -exports.Variable = Variable; -//# sourceMappingURL=Variable.js.map - -/***/ }), - -/***/ "./node_modules/relative-to-absolute-iri/index.js": -/*!********************************************************!*\ - !*** ./node_modules/relative-to-absolute-iri/index.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -__exportStar(__webpack_require__(/*! ./lib/Resolve */ "./node_modules/relative-to-absolute-iri/lib/Resolve.js"), exports); -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "./node_modules/relative-to-absolute-iri/lib/Resolve.js": -/*!**************************************************************!*\ - !*** ./node_modules/relative-to-absolute-iri/lib/Resolve.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.removeDotSegmentsOfPath = exports.removeDotSegments = exports.resolve = void 0; -/** - * Convert the given relative IRI to an absolute IRI - * by taking into account the given optional baseIRI. - * - * @param {string} relativeIRI The relative IRI to convert to an absolute IRI. - * @param {string} baseIRI The optional base IRI. - * @return {string} an absolute IRI. - */ -function resolve(relativeIRI, baseIRI) { - baseIRI = baseIRI || ''; - const baseFragmentPos = baseIRI.indexOf('#'); - // Ignore any fragments in the base IRI - if (baseFragmentPos > 0) { - baseIRI = baseIRI.substr(0, baseFragmentPos); - } - // Convert empty value directly to base IRI - if (!relativeIRI.length) { - // At this point, the baseIRI MUST be absolute, otherwise we error - if (baseIRI.indexOf(':') < 0) { - throw new Error(`Found invalid baseIRI '${baseIRI}' for value '${relativeIRI}'`); - } - return baseIRI; - } - // If the value starts with a query character, concat directly (but strip the existing query) - if (relativeIRI.startsWith('?')) { - const baseQueryPos = baseIRI.indexOf('?'); - if (baseQueryPos > 0) { - baseIRI = baseIRI.substr(0, baseQueryPos); - } - return baseIRI + relativeIRI; - } - // If the value starts with a fragment character, concat directly - if (relativeIRI.startsWith('#')) { - return baseIRI + relativeIRI; - } - // Ignore baseIRI if it is empty - if (!baseIRI.length) { - const relativeColonPos = relativeIRI.indexOf(':'); - if (relativeColonPos < 0) { - throw new Error(`Found invalid relative IRI '${relativeIRI}' for a missing baseIRI`); - } - return removeDotSegmentsOfPath(relativeIRI, relativeColonPos); - } - // Ignore baseIRI if the value is absolute - const valueColonPos = relativeIRI.indexOf(':'); - if (valueColonPos >= 0) { - return removeDotSegmentsOfPath(relativeIRI, valueColonPos); - } - // At this point, the baseIRI MUST be absolute, otherwise we error - const baseColonPos = baseIRI.indexOf(':'); - if (baseColonPos < 0) { - throw new Error(`Found invalid baseIRI '${baseIRI}' for value '${relativeIRI}'`); - } - const baseIRIScheme = baseIRI.substr(0, baseColonPos + 1); - // Inherit the baseIRI scheme if the value starts with '//' - if (relativeIRI.indexOf('//') === 0) { - return baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos); - } - // Check cases where '://' occurs in the baseIRI, and where there is no '/' after a ':' anymore. - let baseSlashAfterColonPos; - if (baseIRI.indexOf('//', baseColonPos) === baseColonPos + 1) { - // If there is no additional '/' after the '//'. - baseSlashAfterColonPos = baseIRI.indexOf('/', baseColonPos + 3); - if (baseSlashAfterColonPos < 0) { - // If something other than a '/' follows the '://', append the value after a '/', - // otherwise, prefix the value with only the baseIRI scheme. - if (baseIRI.length > baseColonPos + 3) { - return baseIRI + '/' + removeDotSegmentsOfPath(relativeIRI, valueColonPos); - } - else { - return baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos); - } - } - } - else { - // If there is not even a single '/' after the ':' - baseSlashAfterColonPos = baseIRI.indexOf('/', baseColonPos + 1); - if (baseSlashAfterColonPos < 0) { - // If we don't have a '/' after the ':', - // prefix the value with only the baseIRI scheme. - return baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos); - } - } - // If the value starts with a '/', then prefix it with everything before the first effective slash of the base IRI. - if (relativeIRI.indexOf('/') === 0) { - return baseIRI.substr(0, baseSlashAfterColonPos) + removeDotSegments(relativeIRI); - } - let baseIRIPath = baseIRI.substr(baseSlashAfterColonPos); - const baseIRILastSlashPos = baseIRIPath.lastIndexOf('/'); - // Ignore everything after the last '/' in the baseIRI path - if (baseIRILastSlashPos >= 0 && baseIRILastSlashPos < baseIRIPath.length - 1) { - baseIRIPath = baseIRIPath.substr(0, baseIRILastSlashPos + 1); - // Also remove the first character of the relative path if it starts with '.' (and not '..' or './') - // This change is only allowed if there is something else following the path - if (relativeIRI[0] === '.' && relativeIRI[1] !== '.' && relativeIRI[1] !== '/' && relativeIRI[2]) { - relativeIRI = relativeIRI.substr(1); - } - } - // Prefix the value with the baseIRI path where - relativeIRI = baseIRIPath + relativeIRI; - // Remove dot segment from the IRI - relativeIRI = removeDotSegments(relativeIRI); - // Prefix our transformed value with the part of the baseIRI until the first '/' after the first ':'. - return baseIRI.substr(0, baseSlashAfterColonPos) + relativeIRI; -} -exports.resolve = resolve; -/** - * Remove dot segments from the given path, - * as described in https://www.ietf.org/rfc/rfc3986.txt (page 32). - * @param {string} path An IRI path. - * @return {string} A path, will always start with a '/'. - */ -function removeDotSegments(path) { - // Prepare a buffer with segments between each '/. - // Each segment represents an array of characters. - const segmentBuffers = []; - let i = 0; - while (i < path.length) { - // Remove '/.' or '/..' - switch (path[i]) { - case '/': - if (path[i + 1] === '.') { - if (path[i + 2] === '.') { - // Start a new segment if we find an invalid character after the '.' - if (!isCharacterAllowedAfterRelativePathSegment(path[i + 3])) { - segmentBuffers.push([]); - i++; - break; - } - // Go to parent directory, - // so we remove a parent segment - segmentBuffers.pop(); - // Ensure that we end with a slash if there is a trailing '/..' - if (!path[i + 3]) { - segmentBuffers.push([]); - } - i += 3; - } - else { - // Start a new segment if we find an invalid character after the '.' - if (!isCharacterAllowedAfterRelativePathSegment(path[i + 2])) { - segmentBuffers.push([]); - i++; - break; - } - // Ensure that we end with a slash if there is a trailing '/.' - if (!path[i + 2]) { - segmentBuffers.push([]); - } - // Go to the current directory, - // so we do nothing - i += 2; - } - } - else { - // Start a new segment - segmentBuffers.push([]); - i++; - } - break; - case '#': - case '?': - // Query and fragment string should be appended unchanged - if (!segmentBuffers.length) { - segmentBuffers.push([]); - } - segmentBuffers[segmentBuffers.length - 1].push(path.substr(i)); - // Break the while loop - i = path.length; - break; - default: - // Not a special character, just append it to our buffer - if (!segmentBuffers.length) { - segmentBuffers.push([]); - } - segmentBuffers[segmentBuffers.length - 1].push(path[i]); - i++; - break; - } - } - return '/' + segmentBuffers.map((buffer) => buffer.join('')).join('/'); -} -exports.removeDotSegments = removeDotSegments; -/** - * Removes dot segments of the given IRI. - * @param {string} iri An IRI (or part of IRI). - * @param {number} colonPosition The position of the first ':' in the IRI. - * @return {string} The IRI where dot segments were removed. - */ -function removeDotSegmentsOfPath(iri, colonPosition) { - // Determine where we should start looking for the first '/' that indicates the start of the path - let searchOffset = colonPosition + 1; - if (colonPosition >= 0) { - if (iri[colonPosition + 1] === '/' && iri[colonPosition + 2] === '/') { - searchOffset = colonPosition + 3; - } - } - else { - if (iri[0] === '/' && iri[1] === '/') { - searchOffset = 2; - } - } - // Determine the path - const pathSeparator = iri.indexOf('/', searchOffset); - if (pathSeparator < 0) { - return iri; - } - const base = iri.substr(0, pathSeparator); - const path = iri.substr(pathSeparator); - // Remove dot segments from the path - return base + removeDotSegments(path); -} -exports.removeDotSegmentsOfPath = removeDotSegmentsOfPath; -function isCharacterAllowedAfterRelativePathSegment(character) { - return !character || character === '#' || character === '?' || character === '/'; -} -//# sourceMappingURL=Resolve.js.map - -/***/ }), - -/***/ "./src/access.ts": -/*!***********************!*\ - !*** ./src/access.ts ***! - \***********************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Access = void 0; -/** - * @class - * - * This class is for requesting and managing access to modules/folders on the - * remote. It gets initialized as `remoteStorage.access`. - */ -class Access { - // TODO create custom type for init function - static _rs_init() { - return; - } - constructor() { - this.reset(); - } - /** - * Holds an array of claimed scopes: - * - * ```javascript - * [{ name: "", mode: "" }] - * ``` - * - * @ignore - */ - get scopes() { - return Object.keys(this.scopeModeMap).map((key) => { - return { name: key, mode: this.scopeModeMap[key] }; - }); - } - get scopeParameter() { - return this.scopes.map((scope) => { - return `${this._scopeNameForParameter(scope)}:${scope.mode}`; - }).join(' '); - } - /** - * Claim access on a given scope with given mode. - * - * @param scope - An access scope, such as `contacts` or `calendar` - * @param mode - Access mode. Either `r` for read-only or `rw` for read/write - * - * @example - * ```javascript - * remoteStorage.access.claim('contacts', 'r'); - * remoteStorage.access.claim('pictures', 'rw'); - * ``` - * - * Claiming root access, meaning complete access to all files and folders of a storage, can be done using an asterisk for the scope: - * - * ```javascript - * remoteStorage.access.claim('*', 'rw'); - * ``` - */ - claim(scope, mode) { - if (typeof (scope) !== 'string' || scope.indexOf('/') !== -1 || scope.length === 0) { - throw new Error('Scope should be a non-empty string without forward slashes'); - } - if (!mode.match(/^rw?$/)) { - throw new Error('Mode should be either \'r\' or \'rw\''); - } - this._adjustRootPaths(scope); - this.scopeModeMap[scope] = mode; - } - /** - * Get the access mode for a given scope. - * - * @param scope - Access scope - * @returns Access mode - * @ignore - */ - get(scope) { - return this.scopeModeMap[scope]; - } - /** - * Remove access for the given scope. - * - * @param scope - Access scope - * @ignore - */ - remove(scope) { - const savedMap = {}; - for (const name in this.scopeModeMap) { - savedMap[name] = this.scopeModeMap[name]; - } - this.reset(); - delete savedMap[scope]; - for (const name in savedMap) { - this.claim(name, savedMap[name]); - } - } - /** - * Verify permission for a given scope. - * - * @param scope - Access scope - * @param mode - Access mode - * @returns `true` if the requested access mode is active, `false` otherwise - * @ignore - */ - checkPermission(scope, mode) { - const actualMode = this.get(scope); - return actualMode && (mode === 'r' || actualMode === 'rw'); - } - /** - * Verify permission for a given path. - * - * @param path - Path - * @param mode - Access mode - * @returns true if the requested access mode is active, false otherwise - * @ignore - */ - checkPathPermission(path, mode) { - if (this.checkPermission('*', mode)) { - return true; - } - // TODO check if this is reliable - const scope = this._getModuleName(path); - return !!this.checkPermission(scope, mode); - } - /** - * Reset all access permissions. - * - * @ignore - */ - reset() { - this.rootPaths = []; - this.scopeModeMap = {}; - } - /** - * Return the module name for a given path. - */ - _getModuleName(path) { - if (path[0] !== '/') { - throw new Error('Path should start with a slash'); - } - const moduleMatch = path.replace(/^\/public/, '').match(/^\/([^/]*)\//); - return moduleMatch ? moduleMatch[1] : '*'; - } - /** - * TODO: document - */ - _adjustRootPaths(newScope) { - if ('*' in this.scopeModeMap || newScope === '*') { - this.rootPaths = ['/']; - } - else if (!(newScope in this.scopeModeMap)) { - this.rootPaths.push('/' + newScope + '/'); - this.rootPaths.push('/public/' + newScope + '/'); - } - } - /** - * TODO: document - */ - _scopeNameForParameter(scope) { - if (scope.name === '*' && this.storageType) { - if (this.storageType === '2012.04') { - return ''; - } - else if (this.storageType.match(/remotestorage-0[01]/)) { - return 'root'; - } - } - return scope.name; - } - /** - * Set the storage type of the remote. - * - * @param type - Storage type - * @internal - */ - setStorageType(type) { - this.storageType = type; - } -} -exports.Access = Access; -exports["default"] = Access; - - -/***/ }), - -/***/ "./src/authorize.ts": -/*!**************************!*\ - !*** ./src/authorize.ts ***! - \**************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Authorize = void 0; -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const unauthorized_error_1 = __importDefault(__webpack_require__(/*! ./unauthorized-error */ "./src/unauthorized-error.ts")); -const requests_1 = __webpack_require__(/*! ./requests */ "./src/requests.ts"); -// This is set in _rs_init and needed for removal in _rs_cleanup -let onFeaturesLoaded; -function extractParams(url) { - // FF already decodes the URL fragment in document.location.hash, so use this instead: - // eslint-disable-next-line - const location = url || Authorize.getLocation().href; - const queryParam = {}; - for (const [key, value] of new URL(location).searchParams) { - queryParam[key] = value; - } - const hashPos = location.indexOf('#'); - if (hashPos === -1) { - return queryParam; - } - const urlFragment = location.substring(hashPos + 1); - // if hash is not of the form #key=val&key=val, it's probably not for us - if (!urlFragment.includes('=')) { - return queryParam; - } - return urlFragment.split('&').reduce(function (params, kvs) { - const kv = kvs.split('='); - if (kv[0] === 'state' && kv[1].match(/rsDiscovery/)) { - // extract rsDiscovery data from the state param - let stateValue = decodeURIComponent(kv[1]); - const encodedData = stateValue.substr(stateValue.indexOf('rsDiscovery=')) - .split('&')[0] - .split('=')[1]; - params['rsDiscovery'] = JSON.parse(atob(encodedData)); - // remove rsDiscovery param - stateValue = stateValue.replace(new RegExp('&?rsDiscovery=' + encodedData), ''); - if (stateValue.length > 0) { - params['state'] = stateValue; - } - } - else { - params[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]); - } - return params; - }, queryParam); -} -function buildOAuthURL(options) { - const redirect = new URL(options.redirectUri); - if (!options.state) { - options.state = redirect.hash ? redirect.hash.substring(1) : ''; - } - if (!options.response_type) { - options.response_type = 'token'; - } - const url = new URL(options.authURL); - // We don't add a trailing slash as only pathname to redirectUri. - url.searchParams.set('redirect_uri', options.redirectUri.replace(/#.*$/, '')); - url.searchParams.set('scope', options.scope); - url.searchParams.set('client_id', options.clientId); - for (const key of ['state', 'response_type', 'code_challenge', 'code_challenge_method', 'token_access_type']) { - const value = options[key]; - if (value) { - url.searchParams.set(key, value); - } - } - return url.href; -} -class Authorize { - /** - * Navigates browser to provider's OAuth page. When user grants access, - * browser will navigate back to redirectUri and OAuth will continue - * with onFeaturesLoaded. - */ - static authorize(remoteStorage, options) { - (0, log_1.default)('[Authorize] authURL = ', options.authURL, 'scope = ', options.scope, 'redirectUri = ', options.redirectUri, 'clientId = ', options.clientId, 'response_type =', options.response_type); - if (!options.scope) { - throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?"); - } - // TODO add a test for this - // keep track of the discovery data during redirect if we can't save it in localStorage - if (!(0, util_1.localStorageAvailable)() && remoteStorage.backend === 'remotestorage') { - options.redirectUri += options.redirectUri.indexOf('#') > 0 ? '&' : '#'; - const discoveryData = { - userAddress: remoteStorage.remote.userAddress, - href: remoteStorage.remote.href, - storageApi: remoteStorage.remote.storageApi, - properties: remoteStorage.remote.properties - }; - options.redirectUri += 'rsDiscovery=' + (0, util_1.toBase64)(JSON.stringify(discoveryData)); - } - const url = buildOAuthURL(options); - // FIXME declare potential `cordova` property on global somehow, so we don't have to - // use a string accessor here. - if (util_1.globalContext['cordova']) { - Authorize - .openWindow(url, options.redirectUri, 'location=yes,clearsessioncache=yes,clearcache=yes') - .then((authResult) => { - remoteStorage.remote.configure({ token: authResult.access_token }); - }); - return; - } - Authorize.setLocation(url); - } - /** On success, calls remote.configure() with new access token */ - static refreshAccessToken(rs, remote, refreshToken) { - return __awaiter(this, void 0, void 0, function* () { - var _a, _b, _c; - yield remote.configure({ token: null, tokenType: null }); - const formValues = new URLSearchParams({ - grant_type: 'refresh_token', - client_id: remote.clientId, - refresh_token: refreshToken, - }); - const xhr = yield (0, requests_1.requestWithTimeout)('POST', remote.TOKEN_URL, { - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - body: formValues.toString(), - responseType: 'json' - }); - if ((xhr === null || xhr === void 0 ? void 0 : xhr.status) === 200) { - (0, log_1.default)(`[Authorize] access token good for ${(_a = xhr === null || xhr === void 0 ? void 0 : xhr.response) === null || _a === void 0 ? void 0 : _a.expires_in} seconds`); - const settings = { - token: (_b = xhr === null || xhr === void 0 ? void 0 : xhr.response) === null || _b === void 0 ? void 0 : _b.access_token, - tokenType: (_c = xhr === null || xhr === void 0 ? void 0 : xhr.response) === null || _c === void 0 ? void 0 : _c.token_type, - }; - if (settings.token) { - yield remote.configure(settings); - } - else { - throw new Error(`no access_token in "successful" refresh: ${xhr.response}`); - } - } - else { - yield remote.configure({ refreshToken: null }); - throw new unauthorized_error_1.default("refresh token rejected:" + JSON.stringify(xhr.response)); - } - }); - } - /** - * Set current document location - * - * Override this method if access to document.location is forbidden - */ - static setLocation(location) { - if (typeof location === 'string') { - document.location.href = location; - } - else if (typeof location === 'object') { - document.location = location; - } - else { - throw "Invalid location " + location; - } - } - static _rs_supported() { - return typeof (document) !== 'undefined'; - } - static _rs_cleanup(remoteStorage) { - remoteStorage.removeEventListener('features-loaded', onFeaturesLoaded); - } -} -exports.Authorize = Authorize; -Authorize.IMPLIED_FAKE_TOKEN = false; -/** - * Get current document location - * - * Override this method if access to document.location is forbidden - */ -Authorize.getLocation = function () { - return document.location; -}; -/** - * Open new InAppBrowser window for OAuth in Cordova - */ -Authorize.openWindow = function (url, redirectUri, options) { - return new Promise((resolve, reject) => { - const newWindow = open(url, '_blank', options); - if (!newWindow || newWindow.closed) { - reject('Authorization popup was blocked'); - return; - } - function handleExit() { - reject('Authorization was canceled'); - } - function handleLoadstart(event) { - if (event.url.indexOf(redirectUri) !== 0) { - return; - } - newWindow.removeEventListener('exit', handleExit); - newWindow.close(); - const authResult = extractParams(event.url); - if (!authResult) { - reject('Authorization error'); - return; - } - resolve(authResult); - } - newWindow.addEventListener('loadstart', handleLoadstart); - newWindow.addEventListener('exit', handleExit); - }); -}; -Authorize._rs_init = function (remoteStorage) { - const params = extractParams(); - let location; - if (params) { - location = Authorize.getLocation(); - location.hash = ''; - } - // eslint-disable-next-line - onFeaturesLoaded = function () { - let authParamsUsed = false; - if (!params) { - remoteStorage.remote.stopWaitingForToken(); - return; - } - if (params.error) { - if (params.error === 'access_denied') { - throw new unauthorized_error_1.default('Authorization failed: access denied', { code: 'access_denied' }); - } - else { - throw new unauthorized_error_1.default(`Authorization failed: ${params.error}`); - } - } - // rsDiscovery came with the redirect, because it couldn't be - // saved in localStorage - if (params.rsDiscovery) { - remoteStorage.remote.configure(params.rsDiscovery); - } - if (params.access_token) { - remoteStorage.remote.configure({ token: params.access_token }); - authParamsUsed = true; - } - if (params.remotestorage) { - remoteStorage.connect(params.remotestorage); - authParamsUsed = true; - } - if (params.state) { - location = Authorize.getLocation(); - Authorize.setLocation(location.href.split('#')[0] + '#' + params.state); - } - if (params.code) { // OAuth2 code or PKCE flow - fetchTokens(params.code); // remote.configure() called asynchronously - authParamsUsed = true; - } - if (!authParamsUsed) { - remoteStorage.remote.stopWaitingForToken(); - } - }; - // OAuth2 PKCE flow - function fetchTokens(code) { - return __awaiter(this, void 0, void 0, function* () { - var _a, _b, _c, _d; - const codeVerifier = sessionStorage.getItem('remotestorage:codeVerifier'); - if (!codeVerifier) { - (0, log_1.default)("[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage"); - return; - } - location = Authorize.getLocation(); - let redirectUri = location.origin; - if (location.pathname !== '/') { - redirectUri += location.pathname; - } - const formValues = new URLSearchParams({ - code: code, - grant_type: 'authorization_code', - client_id: remoteStorage.remote.clientId, - redirect_uri: redirectUri, - code_verifier: codeVerifier - }); - const xhr = yield (0, requests_1.requestWithTimeout)('POST', remoteStorage.remote.TOKEN_URL, { - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - body: formValues.toString(), - responseType: 'json' - }); - switch (xhr.status) { - case 200: - (0, log_1.default)(`[Authorize] access token good for ${(_a = xhr === null || xhr === void 0 ? void 0 : xhr.response) === null || _a === void 0 ? void 0 : _a.expires_in} seconds`); - const settings = { - token: (_b = xhr === null || xhr === void 0 ? void 0 : xhr.response) === null || _b === void 0 ? void 0 : _b.access_token, - refreshToken: (_c = xhr === null || xhr === void 0 ? void 0 : xhr.response) === null || _c === void 0 ? void 0 : _c.refresh_token, - tokenType: (_d = xhr === null || xhr === void 0 ? void 0 : xhr.response) === null || _d === void 0 ? void 0 : _d.token_type, - }; - if (settings.token) { - remoteStorage.remote.configure(settings); - } - else { - remoteStorage._emit('error', new Error(`no access_token in "successful" response: ${xhr.response}`)); - } - sessionStorage.removeItem('remotestorage:codeVerifier'); - break; - default: - remoteStorage._emit('error', new Error(`${xhr.statusText}: ${xhr.response}`)); - } - }); - } - remoteStorage.on('features-loaded', onFeaturesLoaded); -}; -exports["default"] = Authorize; - - -/***/ }), - -/***/ "./src/baseclient.ts": -/*!***************************!*\ - !*** ./src/baseclient.ts ***! - \***************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BaseClient = void 0; -const tv4_1 = __importDefault(__webpack_require__(/*! tv4 */ "./node_modules/tv4/tv4.js")); -const types_1 = __importDefault(__webpack_require__(/*! ./types */ "./src/types.ts")); -const schema_not_found_error_1 = __importDefault(__webpack_require__(/*! ./schema-not-found-error */ "./src/schema-not-found-error.ts")); -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const config_1 = __importDefault(__webpack_require__(/*! ./config */ "./src/config.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -function getModuleNameFromBase(path) { - const parts = path.split('/'); - return path.length > 2 ? parts[1] : 'root'; -} -/** - * A `BaseClient` instance is the main endpoint you will use for interacting - * with a connected storage: listing, reading, creating, updating and deleting - * documents, as well as handling incoming changes. - * - * Base clients are usually used in [data modules](../../../data-modules/), - * which are loaded with two `BaseClient` instances by default: one for private - * and one for public documents. - * - * However, you can also instantiate a BaseClient outside of a data module using - * the `remoteStorage.scope()` function. Similarly, you can create a new scoped - * client within another client, using the `BaseClient`'s own {@link scope}. - * - * ## Read/write operations - * - * A `BaseClient` deals with three types of data: folders, objects and files. - * - * * {@link getListing} returns a mapping of all items within a folder. - * - * * {@link getObject} and {@link storeObject} operate on JSON objects. Each object - * has a type. - * - * * {@link getFile} and {@link storeFile} operates on files. Each file has a MIME - * type. - * - * * {@link getAll} returns all objects or files for the given folder path. - * - * * {@link remove} operates on either objects or files (but not folders; folders - * are created and removed implictly). - * - * ## Caching logic for read operations - * - * All functions requesting/reading data will immediately return data from the - * local store, *as long as it is reasonably up-to-date*. If data is assumed to be - * potentially outdated, they will check the remote storage for changes first, and then - * return the requested data. - * - * The default maximum age of requested data is two times the periodic sync - * interval (10 seconds by default). - * - * However, you can adjust this behavior by using the `maxAge` argument with any - * of these functions, thereby changing the maximum age or removing the - * requirement entirely. - * - * * If the `maxAge` requirement is set, and the last sync request for the path - * is further in the past than the maximum age given, the folder will first be - * checked for changes on the remote, and then the promise will be fulfilled - * with the up-to-date document or listing. - * - * * If the `maxAge` requirement is set, and cannot be met because of network - * problems, the promise will be rejected. - * - * * If the `maxAge` requirement is set to `false`, or the library is in - * offline mode, or no remote storage is connected (a.k.a. "anonymous mode"), - * the promise will always be fulfilled with data from the local store. - * - * > [!NOTE] - * > If {@link caching!Caching caching} for the folder is turned off, none of - * > this applies and data will always be requested from the remote store - * > directly. - * - * ## Change events - * - * A `BaseClient` emits only one type of event, named `change`, which you can add - * a handler for using the `.on()` function (same as with {@link RemoteStorage}): - * - * ```js - * client.on('change', function (evt) { - * console.log('data was added, updated, or removed:', evt) - * }); - * ``` - * - * Using this event, your app can stay informed about data changes, both remote - * (from other devices or browsers), as well as locally (e.g. other browser tabs). - * - * In order to determine where a change originated from, look at the `origin` - * property of the event. Possible values are `window`, `local`, `remote`, and - * `conflict`, explained in detail below. - * - * #### Example - * - * ```js - * { - * // Absolute path of the changed node, from the storage root - * path: path, - * // Path of the changed node, relative to this baseclient's scope root - * relativePath: relativePath, - * // See origin descriptions below - * origin: 'window|local|remote|conflict', - * // Old body of the changed node (local version in conflicts; undefined if creation) - * oldValue: oldBody, - * // New body of the changed node (remote version in conflicts; undefined if deletion) - * newValue: newBody, - * // Body when local and remote last agreed; only present in conflict events - * lastCommonValue: lastCommonBody, - * // Old contentType of the changed node (local version for conflicts; undefined if creation) - * oldContentType: oldContentType, - * // New contentType of the changed node (remote version for conflicts; undefined if deletion) - * newContentType: newContentType, - * // ContentType when local and remote last agreed; only present in conflict events - * lastCommonContentType: lastCommonContentType - * } - * ``` - * - * ### `local` - * - * Events with origin `local` are fired conveniently during the page load, so - * that you can fill your views when the page loads. - * - * Example: - * - * ```js - * { - * path: '/public/design/color.txt', - * relativePath: 'color.txt', - * origin: 'local', - * oldValue: undefined, - * newValue: 'white', - * oldContentType: undefined, - * newContentType: 'text/plain' - * } - * ``` - * - * > [!TIP] - * > You may also use for example {@link getAll} instead, and choose to - * > deactivate these. - * - * ### `remote` - * - * Events with origin `remote` are fired when remote changes are discovered - * during sync. - * - * > [!NOTE] - * > Automatically receiving remote changes depends on the {@link caching!Caching} settings - * > for your module/paths. - * - * ### `window` - * - * Events with origin `window` are fired whenever you change a value by calling a - * method on the `BaseClient`; these are disabled by default. - * - * > [!TIP] - * > You can enable them by configuring `changeEvents` for your - * > {@link RemoteStorage remoteStorage} instance. - * - * ### `conflict` - * - * Events with origin `conflict` are fired when a conflict occurs while pushing - * out your local changes to the remote store. - * - * Let's say you changed the content of `color.txt` from `white` to `blue`; if - * you have set `config.changeEvents.window` to `true` for your {@link - * RemoteStorage} instance, then you will receive: - * - * ```js - * { - * path: '/public/design/color.txt', - * relativePath: 'color.txt', - * origin: 'window', - * oldValue: 'white', - * newValue: 'blue', - * oldContentType: 'text/plain', - * newContentType: 'text/plain' - * } - * ``` - * - * But when this change is pushed out by asynchronous synchronization, this change - * may be rejected by the server, if the remote version has in the meantime changed - * from `white` to for instance `red`; this will then lead to a change event with - * origin `conflict` (usually a few seconds after the event with origin `window`, - * if you have those activated). Note that since you already changed it from - * `white` to `blue` in the local version a few seconds ago, `oldValue` is now - * your local value of `blue`: - * - * ```js - * { - * path: '/public/design/color.txt', - * relativePath: 'color.txt', - * origin: 'conflict', - * oldValue: 'blue', - * newValue: 'red', - * oldContentType: 'text/plain', - * newContentType: 'text/plain', - * // Most recent known common ancestor body of local and remote - * lastCommonValue: 'white', - * // Most recent known common ancestor contentType of local and remote - * lastCommonContentType: 'text/plain' - * } - * ``` - * - * #### Conflict Resolution - * - * Conflicts are resolved by calling {@link storeObject} or {@link storeFile} on - * the device where the conflict surfaced. Other devices are not aware of the - * conflict. - * - * If there is an algorithm to merge the differences between local and remote - * versions of the data, conflicts may be automatically resolved. - * {@link storeObject} or {@link storeFile} must not be called synchronously from - * the change event handler, nor by chaining Promises. {@link storeObject} or - * {@link storeFile} must not be called until the next iteration of the JavaScript - * Task Queue, using for example - * [`setTimeout()`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout). - * - * If no algorithm exists, conflict resolution typically involves displaying local - * and remote versions to the user, and having the user merge them, or choose - * which version to keep. - */ -class BaseClient { - constructor(storage, base) { - /** - * TODO document - * - * @private - */ - this.schemas = { - configurable: true, - get() { - return BaseClient.Types.inScope(this.moduleName); - } - }; - if (base[base.length - 1] !== '/') { - throw "Not a folder: " + base; - } - if (base === '/') { - // allow absolute and relative paths for the root scope. - this.makePath = (path) => { - return (path[0] === '/' ? '' : '/') + path; - }; - } - this.storage = storage; - this.base = base; - this.moduleName = getModuleNameFromBase(this.base); - this.addEvents(['change']); - this.on = this.on.bind(this); - storage.onChange(this.base, this._fireChange.bind(this)); - } - /** - * Instantiate a new client, scoped to a subpath of the current client's - * path. - * - * @param path - The path to scope the new client to - * - * @returns A new `BaseClient` operating on a subpath of the current base path - */ - scope(path) { - return new BaseClient(this.storage, this.makePath(path)); - } - /** - * Get a list of child nodes below a given path. - * - * @param path - The path to query. It must end with a forward slash. - * @param maxAge - (optional) Either `false` or the maximum age of cached - * listing in milliseconds. See [caching logic for read - * operations](#caching-logic-for-read-operations). - * - * @returns A promise for a folder listing object - * - * @example - * ```js - * client.getListing().then(listing => console.log(listing)); - * ``` - * - * The folder listing is returned as a JSON object, with the root keys - * representing the pathnames of child nodes. Keys ending in a forward slash - * represent _folder nodes_ (subdirectories), while all other keys represent - * _data nodes_ (files/objects). - * - * Data node information contains the item's ETag, content type and -length. - * - * Example of a listing object: - * - * ```js - * { - * "@context": "http://remotestorage.io/spec/folder-description", - * "items": { - * "thumbnails/": true, - * "screenshot-20170902-1913.png": { - * "ETag": "6749fcb9eef3f9e46bb537ed020aeece", - * "Content-Length": 53698, - * "Content-Type": "image/png;charset=binary" - * }, - * "screenshot-20170823-0142.png": { - * "ETag": "92ab84792ef3f9e46bb537edac9bc3a1", - * "Content-Length": 412401, - * "Content-Type": "image/png;charset=binary" - * } - * } - * } - * ``` - * - * > [!WARNING] - * > At the moment, this function only returns detailed metadata, when - * > caching is turned off. With caching turned on, it will only contain the - * > item names as properties with `true` as value. See issues 721 and 1108 — - * > contributions welcome! - */ - // TODO add real return type - getListing(path, maxAge) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof path !== 'string') { - path = ''; - } - else if (path.length > 0 && !(0, util_1.isFolder)(path)) { - return Promise.reject("Not a folder: " + path); - } - return this.storage.get(this.makePath(path), maxAge).then((r) => { - return r.statusCode === 404 ? {} : r.body; - }); - }); - } - /** - * Get all objects directly below a given path. - * - * @param path - (optional) Path to the folder. Must end in a forward slash. - * @param maxAge - (optional) Either `false` or the maximum age of cached - * objects in milliseconds. See [caching logic for read - * operations](#caching-logic-for-read-operations). - - * - * @returns A promise for a collection of items - * - * @example - * ```js - * client.getAll('example-subdirectory/').then(objects => { - * for (var path in objects) { - * console.log(path, objects[path]); - * } - * }); - * ``` - * - * Example response: - * - * ```js - * { - * "27b8dc16483734625fff9de653a14e03": { - * "@context": "http://remotestorage.io/spec/modules/bookmarks/archive-bookmark", - * "id": "27b8dc16483734625fff9de653a14e03", - * "url": "https://unhosted.org/", - * "title": "Unhosted Web Apps", - * "description": "Freedom from web 2.0's monopoly platforms", - * "tags": [ - * "unhosted", - * "remotestorage" - * ], - * "createdAt": "2017-11-02T15:22:25.289Z", - * "updatedAt": "2019-11-07T17:52:22.643Z" - * }, - * "900a5ca174bf57c56b79af0653053bdc": { - * "@context": "http://remotestorage.io/spec/modules/bookmarks/archive-bookmark", - * "id": "900a5ca174bf57c56b79af0653053bdc", - * "url": "https://remotestorage.io/", - * "title": "remoteStorage", - * "description": "An open protocol for per-user storage on the Web", - * "tags": [ - * "unhosted", - * "remotestorage" - * ], - * "createdAt": "2019-11-07T17:59:34.883Z" - * } - * } - * ``` - * > [!NOTE] - * > For items that are not JSON-stringified objects (for example stored using - * > {@link storeFile} instead of {@link storeObject}), the object's value is - * > filled in with `true`. - * - */ - // TODO add real return type - getAll(path, maxAge) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof path !== 'string') { - path = ''; - } - else if (path.length > 0 && !(0, util_1.isFolder)(path)) { - return Promise.reject("Not a folder: " + path); - } - return this.storage.get(this.makePath(path), maxAge).then((r) => { - if (r.statusCode === 404) { - return {}; - } - if (typeof r.body === 'object') { - const keys = Object.keys(r.body); - // treat this like 404. it probably means a folder listing that - // has changes that haven't been pushed out yet. - if (keys.length === 0) { - return {}; - } - const calls = keys.map((key) => { - return this.storage.get(this.makePath(path + key), maxAge) - .then((o) => { - if (typeof o.body === 'string') { - try { - o.body = JSON.parse(o.body); - } - catch (e) { /* empty */ } - } - if (typeof o.body === 'object') { - r.body[key] = o.body; - } - }); - }); - return Promise.all(calls).then(() => { return r.body; }); - } - }); - }); - } - /** - * Get the file at the given path. A file is raw data, as opposed to - * a JSON object (use {@link getObject} for that). - * - * - * @param path - Relative path from the module root (without leading slash). - * @param maxAge - (optional) Either ``false`` or the maximum age of - * the cached file in milliseconds. See [caching logic for read - * operations](#caching-logic-for-read-operations). - * - * @returns An object containing the content type as well as the file's content: - * - * * `mimeType`
- * String representing the MIME Type of the document. - * * `data`
- * Raw data of the document (either a string or an ArrayBuffer) - * - * @example - * Displaying an image: - * - * ```js - * client.getFile('path/to/some/image').then(file => { - * const blob = new Blob([file.data], { type: file.mimeType }); - * const targetElement = document.findElementById('my-image-element'); - * targetElement.src = window.URL.createObjectURL(blob); - * }); - * ``` - */ - // TODO add real return type - getFile(path, maxAge) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof path !== 'string') { - return Promise.reject('Argument \'path\' of baseClient.getFile must be a string'); - } - return this.storage.get(this.makePath(path), maxAge).then((r) => { - return { - data: r.body, - contentType: r.contentType, - revision: r.revision // (this is new) - }; - }); - }); - } - /** - * Store raw data at a given path. - * - * @param mimeType - MIME media type of the data being stored - * @param path - Path relative to the module root - * @param body - Raw data to store - * - * @returns A promise for the created/updated revision (ETag) - * - * @example - * UTF-8 data: - * - * ```js - * client.storeFile('text/html', 'index.html', '

Hello World!

') - * .then(() => { console.log("File saved") }); - * ``` - * - * Binary data: - * - * ```js - * const input = document.querySelector('form#upload input[type=file]'); - * const file = input.files[0]; - * const fileReader = new FileReader(); - * - * fileReader.onload = function () { - * client.storeFile(file.type, file.name, fileReader.result) - * .then(() => { console.log("File saved") }); - * }; - * - * fileReader.readAsArrayBuffer(file); - * ``` - */ - storeFile(mimeType, path, body) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof mimeType !== 'string') { - return Promise.reject('Argument \'mimeType\' of baseClient.storeFile must be a string'); - } - if (typeof path !== 'string') { - return Promise.reject('Argument \'path\' of baseClient.storeFile must be a string'); - } - if ((typeof body !== 'string') && (typeof body !== 'object')) { - return Promise.reject('Argument \'body\' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView'); - } - if (!this.storage.access.checkPathPermission(this.makePath(path), 'rw')) { - console.warn('WARNING: Editing a document to which only read access (\'r\') was claimed'); - } - return this.storage.put(this.makePath(path), body, mimeType).then((r) => { - if (r.statusCode === 200 || r.statusCode === 201) { - return r.revision; - } - else { - return Promise.reject("Request (PUT " + this.makePath(path) + ") failed with status: " + r.statusCode); - } - }); - }); - } - /** - * Get a JSON object from the given path. - * - * @param path - Relative path from the module root (without leading slash). - * @param maxAge - (optional) Either `false` or the maximum age of - * cached object in milliseconds. See [caching logic for read - * operations](#caching-logic-for-read-operations). - * - * @returns A promise, resolving with the requested object, or `null` if non-existent - * - * @example - * client.getObject('/path/to/object').then(obj => console.log(obj)); - */ - // TODO add real return type - getObject(path, maxAge) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof path !== 'string') { - return Promise.reject('Argument \'path\' of baseClient.getObject must be a string'); - } - return this.storage.get(this.makePath(path), maxAge).then((r) => { - if (typeof r.body === 'object') { // will be the case for documents stored with rs.js <= 0.10.0-beta2 - return r.body; - } - else if (typeof r.body === 'string') { - try { - return JSON.parse(r.body); - } - catch (e) { - throw new Error("Not valid JSON: " + this.makePath(path)); - } - } - else if (typeof r.body !== 'undefined' && r.statusCode === 200) { - return Promise.reject("Not an object: " + this.makePath(path)); - } - }); - }); - } - /** - * Store an object at given path. Triggers synchronization. See {@link - * declareType} and - * [Defining data types](../../../data-modules/defining-data-types) - * for info on object types. - * - * Must not be called more than once per second for any given `path`. - * - * @param typeAlias - Unique type of this object within this module. - * @param path - Path relative to the module root. - * @param object - A JavaScript object to be stored at the given path. - * Must be serializable as JSON. - * - * @returns Resolves with revision on success. Rejects with an error object, - * if schema validations fail. - * - * @example - * const bookmark = { - * url: 'http://unhosted.org', - * description: 'Unhosted Adventures', - * tags: ['unhosted', 'remotestorage', 'no-backend'] - * } - * const path = MD5Hash(bookmark.url); - - * client.storeObject('bookmark', path, bookmark) - * .then(() => console.log('bookmark saved')) - * .catch((err) => console.log(err)); - */ - storeObject(typeAlias, path, object) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof typeAlias !== 'string') { - return Promise.reject('Argument \'typeAlias\' of baseClient.storeObject must be a string'); - } - if (typeof path !== 'string') { - return Promise.reject('Argument \'path\' of baseClient.storeObject must be a string'); - } - if (typeof object !== 'object') { - return Promise.reject('Argument \'object\' of baseClient.storeObject must be an object'); - } - this._attachType(object, typeAlias); - try { - const validationResult = this.validate(object); - if (!validationResult.valid) { - return Promise.reject(validationResult); - } - } - catch (exc) { - return Promise.reject(exc); - } - return this.storage.put(this.makePath(path), JSON.stringify(object), 'application/json; charset=UTF-8').then((r) => { - if (r.statusCode === 200 || r.statusCode === 201) { - return r.revision; - } - else { - return Promise.reject("Request (PUT " + this.makePath(path) + ") failed with status: " + r.statusCode); - } - }); - }); - } - /** - * Remove node at given path from storage. Triggers synchronization. - * - * @param path - Path relative to the module root. - * - * @example - * client.remove('path/to/object').then(() => console.log('item deleted')); - */ - // TODO add real return type - // TODO Don't return the RemoteResponse directly, handle response properly - remove(path) { - if (typeof path !== 'string') { - return Promise.reject('Argument \'path\' of baseClient.remove must be a string'); - } - if (!this.storage.access.checkPathPermission(this.makePath(path), 'rw')) { - console.warn('WARNING: Removing a document to which only read access (\'r\') was claimed'); - } - return this.storage.delete(this.makePath(path)); - } - /** - * Retrieve full URL of a document. Useful for example for sharing the public - * URL of an item in the ``/public`` folder. - * - * @param path - Path relative to the module root. - * - * @returns The full URL of the item, including the storage origin, or `undefined` - * if no remote storage is connected - * - * > [!WARNING] - * > This method currently only works for remoteStorage - * > backends. The GitHub issues for implementing it for Dropbox and Google - * > are 1052 and 1054. - */ - // TODO refactor this into the Remote interface - getItemURL(path) { - if (typeof path !== 'string') { - throw 'Argument \'path\' of baseClient.getItemURL must be a string'; - } - if (this.storage.connected) { - path = (0, util_1.cleanPath)(this.makePath(path)); - return this.storage.remote.href + path; - } - else { - return undefined; - } - } - /** - * Set caching strategy for a given path and its children. - * - * See [Caching strategies](../../caching/classes/Caching.html#caching-strategies) - * for a detailed description of the available strategies. - * - * @param path - Path to cache - * @param strategy - Caching strategy. One of 'ALL', 'SEEN', or FLUSH'. - * Defaults to 'ALL'. - * - * @returns The same `BaseClient` instance this method is called on to allow - * for method chaining - * - * @example - * client.cache('lists/', 'SEEN'); - */ - cache(path, strategy = 'ALL') { - if (typeof path !== 'string') { - throw 'Argument \'path\' of baseClient.cache must be a string'; - } - if (typeof strategy !== 'string') { - throw 'Argument \'strategy\' of baseClient.cache must be a string or undefined'; - } - if (strategy !== 'FLUSH' && - strategy !== 'SEEN' && - strategy !== 'ALL') { - throw 'Argument \'strategy\' of baseclient.cache must be one of ' - + '["FLUSH", "SEEN", "ALL"]'; - } - this.storage.caching.set(this.makePath(path), strategy); - return this; - } - /** - * Declare a remoteStorage object type using a JSON Schema. Visit - * [json-schema.org](http://json-schema.org) for details. - * - * See [Defining data types](../../../data-modules/defining-data-types) for more info. - * - * @param alias - A type alias/shortname - * @param uriOrSchema - JSON-LD URI of the schema, or a JSON Schema object. - * The URI is automatically generated if none given. - * @param schema - (optional) A JSON Schema object describing the object type - * - * @example - * client.declareType('todo-item', { - * "type": "object", - * "properties": { - * "id": { - * "type": "string" - * }, - * "title": { - * "type": "string" - * }, - * "finished": { - * "type": "boolean" - * "default": false - * }, - * "createdAt": { - * "type": "date" - * } - * }, - * "required": ["id", "title"] - * }) - **/ - declareType(alias, uriOrSchema, schema) { - let uri; - if (schema && typeof uriOrSchema === 'string') { - uri = uriOrSchema; - } - else if (!schema && typeof uriOrSchema !== 'string') { - schema = uriOrSchema; - uri = this._defaultTypeURI(alias); - } - else if (!schema && typeof uriOrSchema === 'string') { - throw new Error('declareType() requires a JSON Schema object to be passed, in order to validate object types/formats'); - } - BaseClient.Types.declare(this.moduleName, alias, uri, schema); - } - /** - * Validate an object against the associated schema. - * - * @param object - JS object to validate. Must have a `@context` property. - * - * @returns An object containing information about the validation result - * - * @example - * var result = client.validate(document); - * - * // result: - * // { - * // error: null, - * // missing: [], - * // valid: true - * // } - **/ - validate(object) { - const schema = BaseClient.Types.getSchema(object['@context']); - if (schema) { - return tv4_1.default.validateResult(object, schema); - } - else { - throw new schema_not_found_error_1.default(object['@context']); - } - } - /** - * The default JSON-LD @context URL for RS types/objects/documents - * - * @private - */ - _defaultTypeURI(alias) { - return 'http://remotestorage.io/spec/modules/' + encodeURIComponent(this.moduleName) + '/' + encodeURIComponent(alias); - } - /** - * Attaches the JSON-LD @context to an object - * - * @private - */ - _attachType(object, alias) { - object['@context'] = BaseClient.Types.resolveAlias(this.moduleName + '/' + alias) || this._defaultTypeURI(alias); - } - /** - * TODO: document - * - * @private - */ - makePath(path) { - return this.base + (path || ''); - } - /** - * TODO: document - * - * @private - */ - _fireChange(event) { - if (config_1.default.changeEvents[event.origin]) { - ['new', 'old', 'lastCommon'].forEach(function (fieldNamePrefix) { - if ((!event[fieldNamePrefix + 'ContentType']) - || (/^application\/(.*)json(.*)/.exec(event[fieldNamePrefix + 'ContentType']))) { - if (typeof event[fieldNamePrefix + 'Value'] === 'string') { - try { - event[fieldNamePrefix + 'Value'] = JSON.parse(event[fieldNamePrefix + 'Value']); - } - catch (e) { - // empty - } - } - } - }); - this._emit('change', event); - } - } - static _rs_init() { - return; - } -} -exports.BaseClient = BaseClient; -BaseClient.Types = types_1.default; -(0, util_1.applyMixins)(BaseClient, [eventhandling_1.default]); -exports["default"] = BaseClient; - - -/***/ }), - -/***/ "./src/caching.ts": -/*!************************!*\ - !*** ./src/caching.ts ***! - \************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Caching = void 0; -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -/** - * @class - * - * The caching class gets initialized as `remoteStorage.caching`, unless the - * {@link remotestorage!RemoteStorage RemoteStorage} instance is created with the option `cache: false`, disabling - * caching entirely. - * - * In case your app hasn't explictly configured caching, the default setting is to - * cache any documents that have been either created or requested since your app - * loaded. For offline-capable apps, it usually makes sense to enable full, - * automatic caching of all documents, which is what {@link enable} will do. - * - * Enabling full caching has several benefits: - * - * * Speed of access: locally cached data is available to the app a lot faster. - * * Offline mode: when all data is cached, it can also be read when your app - * starts while being offline. - * * Initial synchronization time: the amount of data your app caches can - * have a significant impact on its startup time. - * - * Caching can be configured on a per-path basis. When caching is enabled for a - * folder, it causes all subdirectories to be cached as well. - * - * ## Caching strategies - * - * For each subtree, you can set the caching strategy to ``ALL``, ``SEEN`` - * (default), and ``FLUSH``. - * - * * `ALL` means that once all outgoing changes have been pushed, sync will - * start retrieving nodes to cache pro-actively. If a local copy exists - * of everything, it will check on each sync whether the ETag of the root - * folder changed, and retrieve remote changes if they exist. - * * `SEEN` does this only for documents and folders that have been either - * read from or written to at least once since connecting to the current - * remote backend, plus their parent/ancestor folders up to the root (to - * make tree-based sync possible). - * * `FLUSH` will only cache outgoing changes, and forget them as soon as - * they have been saved to remote successfully. - **/ -class Caching { - constructor() { - this.pendingActivations = []; - this.reset(); - } - /** - * Configure caching for a given path explicitly. - * - * Not needed when using ``enable``/``disable``. - * - * @param path - Path to cache - * @param strategy - Caching strategy. One of 'ALL', 'SEEN', or 'FLUSH'. - * - * @example - * ```js - * remoteStorage.caching.set('/bookmarks/archive/', 'SEEN'); - * ``` - */ - set(path, strategy) { - if (typeof path !== 'string') { - throw new Error('path should be a string'); - } - if (!(0, util_1.isFolder)(path)) { - throw new Error('path should be a folder'); - } - // FIXME We need to get to the access instance somehow. But I'm not sure - // this check is even necessary in the first place. -raucao - // if (!this._remoteStorage.access.checkPathPermission(path, 'r')) { - // throw new Error('No access to path "' + path + '". You have to claim access to it first.'); - // } - if (!strategy.match(/^(FLUSH|SEEN|ALL)$/)) { - throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'"); - } - this._rootPaths[path] = strategy; - if (strategy === 'ALL') { - if (this.activateHandler) { - this.activateHandler(path); - } - else { - this.pendingActivations.push(path); - } - } - } - /** - * Enable caching for a given path. - * - * Uses caching strategy ``ALL``. - * - * @param path - Path to enable caching for - * @returns - * - * @example - * ```js - * remoteStorage.caching.enable('/bookmarks/'); - * ``` - */ - enable(path) { - this.set(path, 'ALL'); - } - /** - * Disable caching for a given path. - * - * Uses caching strategy ``FLUSH`` (meaning items are only cached until - * successfully pushed to the remote). - * - * @param path - Path to disable caching for - * - * @example - * ```js - * remoteStorage.caching.disable('/bookmarks/'); - * ``` - */ - disable(path) { - this.set(path, 'FLUSH'); - } - /** - * Set a callback for when caching is activated for a path. - * - * @param cb - Callback function - */ - onActivate(cb) { - (0, log_1.default)('[Caching] Setting activate handler', cb, this.pendingActivations); - this.activateHandler = cb; - for (let i = 0; i < this.pendingActivations.length; i++) { - cb(this.pendingActivations[i]); - } - this.pendingActivations = []; - } - /** - * Retrieve caching setting for a given path, or its next parent - * with a caching strategy set. - * - * @param path - Path to retrieve setting for - * @returns caching strategy for the path - * - * @example - * ```js - * remoteStorage.caching.checkPath('documents/').then(strategy => { - * console.log(`caching strategy for 'documents/': ${strategy}`)); - * // "caching strategy for 'documents/': SEEN" - * }); - * ``` - **/ - checkPath(path) { - if (this._rootPaths[path] !== undefined) { - return this._rootPaths[path]; - } - else if (path === '/') { - return 'SEEN'; - } - else { - return this.checkPath((0, util_1.containingFolder)(path)); - } - } - /** - * Reset the state of caching by deleting all caching information. - * - * @example - * ```js - * remoteStorage.caching.reset(); - * ``` - **/ - reset() { - this._rootPaths = {}; - } - /** - * Setup function that is called on initialization. - * - * @internal - **/ - static _rs_init( /*remoteStorage*/) { - return; - } -} -exports.Caching = Caching; -exports["default"] = Caching; - - -/***/ }), - -/***/ "./src/cachinglayer.ts": -/*!*****************************!*\ - !*** ./src/cachinglayer.ts ***! - \*****************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const config_1 = __importDefault(__webpack_require__(/*! ./config */ "./src/config.ts")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -function getLatest(node) { - if (typeof (node) !== 'object' || typeof (node.path) !== 'string') { - return; - } - if ((0, util_1.isFolder)(node.path)) { - if (node.local && node.local.itemsMap) { - return node.local; - } - if (node.common && node.common.itemsMap) { - return node.common; - } - } - else { - if (node.local) { - if (node.local.body && node.local.contentType) { - return node.local; - } - if (node.local.body === false) { - return; - } - } - if (node.common && node.common.body && node.common.contentType) { - return node.common; - } - // Migration code! Once all apps use at least this version of the lib, we - // can publish clean-up code that migrates over any old-format data, and - // stop supporting it. For now, new apps will support data in both - // formats, thanks to this: - if (node.body && node.contentType) { - return { - body: node.body, - contentType: node.contentType - }; - } - } -} -function isOutdated(nodes, maxAge) { - for (const path in nodes) { - if (nodes[path] && nodes[path].remote) { - return true; - } - const nodeVersion = getLatest(nodes[path]); - if (nodeVersion && nodeVersion.timestamp && (new Date().getTime()) - nodeVersion.timestamp <= maxAge) { - return false; - } - else if (!nodeVersion) { - return true; - } - } - return true; -} -function makeNode(path) { - const node = { path: path, common: {} }; - if ((0, util_1.isFolder)(path)) { - node.common.itemsMap = {}; - } - return node; -} -function updateFolderNodeWithItemName(node, itemName) { - if (!node.common) { - node.common = { - itemsMap: {} - }; - } - if (!node.common.itemsMap) { - node.common.itemsMap = {}; - } - if (!node.local) { - node.local = (0, util_1.deepClone)(node.common); - } - if (!node.local.itemsMap) { - node.local.itemsMap = node.common.itemsMap; - } - node.local.itemsMap[itemName] = true; - return node; -} -/** - * This module defines functions that are mixed into remoteStorage.local when - * it is instantiated (currently one of indexeddb.js, localstorage.js, or - * inmemorystorage.js). - * - * All remoteStorage.local implementations should therefore implement - * this.getNodes, this.setNodes, and this.forAllNodes. The rest is blended in - * here to create a GPD (get/put/delete) interface which the BaseClient can - * talk to. - * - * @interface - */ -class CachingLayer { - constructor() { - // FIXME - // this process of updating nodes needs to be heavily documented first, then - // refactored. Right now it's almost impossible to refactor as there's no - // explanation of why things are implemented certain ways or what the goal(s) - // of the behavior are. -slvrbckt (+1 -les) - this._updateNodesRunning = false; - this._updateNodesQueued = []; - } - // -------------------------------------------------- - // TODO: improve our code structure so that this function - // could call sync.queueGetRequest directly instead of needing - // this hacky third parameter as a callback - get(path, maxAge, queueGetRequest) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof (maxAge) === 'number') { - return this.getNodes((0, util_1.pathsFromRoot)(path)) - .then((objs) => { - const node = getLatest(objs[path]); - if (isOutdated(objs, maxAge)) { - return queueGetRequest(path); - } - else if (node) { - return { - statusCode: 200, - body: node.body || node.itemsMap, - contentType: node.contentType - }; - } - else { - return { statusCode: 404 }; - } - }); - } - else { - return this.getNodes([path]) - .then((objs) => { - const node = getLatest(objs[path]); - if (node) { - if ((0, util_1.isFolder)(path)) { - for (const i in node.itemsMap) { - // the hasOwnProperty check here is only because our jshint settings require it: - if (node.itemsMap.hasOwnProperty(i) && node.itemsMap[i] === false) { - delete node.itemsMap[i]; - } - } - } - return { - statusCode: 200, - body: node.body || node.itemsMap, - contentType: node.contentType - }; - } - else { - return { statusCode: 404 }; - } - }); - } - }); - } - put(path, body, contentType) { - return __awaiter(this, void 0, void 0, function* () { - const paths = (0, util_1.pathsFromRoot)(path); - function _processNodes(nodePaths, nodes) { - try { - for (let i = 0, len = nodePaths.length; i < len; i++) { - const nodePath = nodePaths[i]; - let node = nodes[nodePath]; - let previous; - if (!node) { - nodes[nodePath] = node = makeNode(nodePath); - } - // Document - if (i === 0) { - previous = getLatest(node); - node.local = { - body: body, - contentType: contentType, - previousBody: (previous ? previous.body : undefined), - previousContentType: (previous ? previous.contentType : undefined), - }; - } - // Folder - else { - const itemName = nodePaths[i - 1].substring(nodePath.length); - node = updateFolderNodeWithItemName(node, itemName); - } - } - return nodes; - } - catch (e) { - (0, log_1.default)('[Cachinglayer] Error during PUT', nodes, e); - throw e; - } - } - return this._updateNodes(paths, _processNodes); - }); - } - delete(path) { - const paths = (0, util_1.pathsFromRoot)(path); - return this._updateNodes(paths, function (nodePaths, nodes) { - for (let i = 0, len = nodePaths.length; i < len; i++) { - const nodePath = nodePaths[i]; - const node = nodes[nodePath]; - let previous; - if (!node) { - console.error('Cannot delete non-existing node ' + nodePath); - continue; - } - if (i === 0) { - // Document - previous = getLatest(node); - node.local = { - body: false, - previousBody: (previous ? previous.body : undefined), - previousContentType: (previous ? previous.contentType : undefined), - }; - } - else { - // Folder - if (!node.local) { - node.local = (0, util_1.deepClone)(node.common); - } - const itemName = nodePaths[i - 1].substring(nodePath.length); - delete node.local.itemsMap[itemName]; - if (Object.getOwnPropertyNames(node.local.itemsMap).length > 0) { - // This folder still contains other items, don't remove any further ancestors - break; - } - } - } - return nodes; - }); - } - flush(path) { - return this._getAllDescendentPaths(path).then((paths) => { - return this.getNodes(paths); - }).then((nodes) => { - for (const nodePath in nodes) { - const node = nodes[nodePath]; - if (node && node.common && node.local) { - this._emitChange({ - path: node.path, - origin: 'local', - oldValue: (node.local.body === false ? undefined : node.local.body), - newValue: (node.common.body === false ? undefined : node.common.body) - }); - } - nodes[nodePath] = undefined; - } - return this.setNodes(nodes); - }); - } - _emitChange(obj) { - if (config_1.default.changeEvents[obj.origin]) { - this._emit('change', obj); - } - } - fireInitial() { - if (!config_1.default.changeEvents.local) { - return; - } - this.forAllNodes((node) => { - if ((0, util_1.isDocument)(node.path)) { - const latest = getLatest(node); - if (latest) { - this._emitChange({ - path: node.path, - origin: 'local', - oldValue: undefined, - oldContentType: undefined, - newValue: latest.body, - newContentType: latest.contentType - }); - } - } - }).then(() => { - this._emit('local-events-done'); - }); - } - // TODO add proper type - onDiff(diffHandler) { - this.diffHandler = diffHandler; - } - migrate(node) { - if (typeof (node) === 'object' && !node.common) { - node.common = {}; - if (typeof (node.path) === 'string') { - if (node.path.substr(-1) === '/' && typeof (node.body) === 'object') { - node.common.itemsMap = node.body; - } - } - else { - //save legacy content of document node as local version - if (!node.local) { - node.local = {}; - } - node.local.body = node.body; - node.local.contentType = node.contentType; - } - } - return node; - } - _updateNodes(paths, _processNodes) { - return new Promise((resolve, reject) => { - this._doUpdateNodes(paths, _processNodes, { - resolve: resolve, - reject: reject - }); - }); - } - _doUpdateNodes(paths, _processNodes, promise) { - if (this._updateNodesRunning) { - this._updateNodesQueued.push({ - paths: paths, - cb: _processNodes, - promise: promise - }); - return; - } - else { - this._updateNodesRunning = true; - } - this.getNodes(paths).then((nodes) => { - const existingNodes = (0, util_1.deepClone)(nodes); - const changeEvents = []; - nodes = _processNodes(paths, nodes); - for (const path in nodes) { - const node = nodes[path]; - if ((0, util_1.equal)(node, existingNodes[path])) { - delete nodes[path]; - } - else if ((0, util_1.isDocument)(path)) { - if (!(0, util_1.equal)(node.local.body, node.local.previousBody) || - node.local.contentType !== node.local.previousContentType) { - changeEvents.push({ - path: path, - origin: 'window', - oldValue: node.local.previousBody, - newValue: node.local.body === false ? undefined : node.local.body, - oldContentType: node.local.previousContentType, - newContentType: node.local.contentType - }); - } - delete node.local.previousBody; - delete node.local.previousContentType; - } - } - this.setNodes(nodes).then(() => { - this._emitChangeEvents(changeEvents); - promise.resolve({ statusCode: 200 }); - }); - }).then(() => { - return Promise.resolve(); - }, (err) => { - promise.reject(err); - }).then(() => { - this._updateNodesRunning = false; - const nextJob = this._updateNodesQueued.shift(); - if (nextJob) { - this._doUpdateNodes(nextJob.paths, nextJob.cb, nextJob.promise); - } - }); - } - _emitChangeEvents(events) { - for (let i = 0, len = events.length; i < len; i++) { - this._emitChange(events[i]); - if (this.diffHandler) { - this.diffHandler(events[i].path); - } - } - } - _getAllDescendentPaths(path) { - if ((0, util_1.isFolder)(path)) { - return this.getNodes([path]).then((nodes) => { - const allPaths = [path]; - const latest = getLatest(nodes[path]); - const itemNames = Object.keys(latest.itemsMap); - const calls = itemNames.map((itemName) => { - return this._getAllDescendentPaths(path + itemName).then((paths) => { - for (let i = 0, len = paths.length; i < len; i++) { - allPaths.push(paths[i]); - } - }); - }); - return Promise.all(calls).then(() => { - return allPaths; - }); - }); - } - else { - return Promise.resolve([path]); - } - } - // treated as private but made public for unit testing - _getInternals() { - return { - getLatest: getLatest, - makeNode: makeNode, - isOutdated: isOutdated - }; - } -} -(0, util_1.applyMixins)(CachingLayer, [eventhandling_1.default]); -module.exports = CachingLayer; - - -/***/ }), - -/***/ "./src/config.ts": -/*!***********************!*\ - !*** ./src/config.ts ***! - \***********************/ -/***/ (function(module) { - -"use strict"; - -/** - * The default config, merged with the object passed to the constructor of the - * RemoteStorage object - */ -const config = { - cache: true, - changeEvents: { - local: true, - window: false, - remote: true, - conflict: true - }, - cordovaRedirectUri: undefined, - logging: false, - modules: [], - // the following are not public and will probably be moved away from the - // default config - backgroundSyncInterval: 60000, - disableFeatures: [], - discoveryTimeout: 10000, - isBackground: false, - requestTimeout: 30000, - syncInterval: 10000 -}; -module.exports = config; - - -/***/ }), - -/***/ "./src/discover.ts": -/*!*************************!*\ - !*** ./src/discover.ts ***! - \*************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const webfinger_js_1 = __importDefault(__webpack_require__(/*! webfinger.js */ "./node_modules/webfinger.js/src/webfinger.js")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -// feature detection flags -let hasLocalStorage; -// used to store settings in localStorage -const SETTINGS_KEY = 'remotestorage:discover'; -// cache loaded from localStorage -// TODO use class property -let cachedInfo = {}; -/** - * This function deals with the Webfinger lookup, discovering a connecting - * user's storage details. - * - * @param {string} userAddress - user@host or URL - * - * @returns {Promise} A promise for an object with the following properties. - * href - Storage base URL, - * storageApi - RS protocol version, - * authUrl - OAuth URL, - * properties - Webfinger link properties - **/ -const Discover = function Discover(userAddress) { - return new Promise((resolve, reject) => { - if (userAddress in cachedInfo) { - return resolve(cachedInfo[userAddress]); - } - const webFinger = new webfinger_js_1.default({ - tls_only: false, - uri_fallback: true, - request_timeout: 5000 - }); - return webFinger.lookup(userAddress, function (err, response) { - if (err) { - return reject(err); - } - else if ((typeof response.idx.links.remotestorage !== 'object') || - (typeof response.idx.links.remotestorage.length !== 'number') || - (response.idx.links.remotestorage.length <= 0)) { - (0, log_1.default)("[Discover] WebFinger record for " + userAddress + " does not have remotestorage defined in the links section ", JSON.stringify(response.json)); - return reject("WebFinger record for " + userAddress + " does not have remotestorage defined in the links section."); - } - const rs = response.idx.links.remotestorage[0]; - const authURL = rs.properties['http://tools.ietf.org/html/rfc6749#section-4.2'] || - rs.properties['auth-endpoint']; - const storageApi = rs.properties['http://remotestorage.io/spec/version'] || - rs.type; - // cache fetched data - cachedInfo[userAddress] = { - href: rs.href, - storageApi: storageApi, - authURL: authURL, - properties: rs.properties - }; - if (hasLocalStorage) { - localStorage.setItem(SETTINGS_KEY, JSON.stringify({ cache: cachedInfo })); - } - return resolve(cachedInfo[userAddress]); - }); - }); -}; -Discover.DiscoveryError = function (message) { - this.name = 'DiscoveryError'; - this.message = message; - this.stack = (new Error()).stack; -}; -Discover.DiscoveryError.prototype = Object.create(Error.prototype); -Discover.DiscoveryError.prototype.constructor = Discover.DiscoveryError; -Discover._rs_init = function ( /*remoteStorage*/) { - hasLocalStorage = (0, util_1.localStorageAvailable)(); - if (hasLocalStorage) { - try { - const settings = JSON.parse(localStorage[SETTINGS_KEY]); - cachedInfo = settings.cache; - } - catch (e) { - /* empty */ - } - } -}; -Discover._rs_supported = function () { - return Object.prototype.hasOwnProperty.call(util_1.globalContext, 'fetch') || - Object.prototype.hasOwnProperty.call(util_1.globalContext, 'XMLHttpRequest'); -}; -Discover._rs_cleanup = function () { - if (hasLocalStorage) { - delete localStorage[SETTINGS_KEY]; - } -}; -module.exports = Discover; - - -/***/ }), - -/***/ "./src/dropbox.ts": -/*!************************!*\ - !*** ./src/dropbox.ts ***! - \************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const baseclient_1 = __importDefault(__webpack_require__(/*! ./baseclient */ "./src/baseclient.ts")); -const revisioncache_1 = __importDefault(__webpack_require__(/*! ./revisioncache */ "./src/revisioncache.ts")); -const sync_error_1 = __importDefault(__webpack_require__(/*! ./sync-error */ "./src/sync-error.ts")); -const unauthorized_error_1 = __importDefault(__webpack_require__(/*! ./unauthorized-error */ "./src/unauthorized-error.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const requests_1 = __webpack_require__(/*! ./requests */ "./src/requests.ts"); -const remote_1 = __webpack_require__(/*! ./remote */ "./src/remote.ts"); -const authorize_1 = __importDefault(__webpack_require__(/*! ./authorize */ "./src/authorize.ts")); -/** - * WORK IN PROGRESS, NOT RECOMMENDED FOR PRODUCTION USE - * - * Dropbox backend for RemoteStorage.js - * This file exposes a get/put/delete interface which is compatible with - * . - * - * When remoteStorage.backend is set to 'dropbox', this backend will - * initialize and replace remoteStorage.remote with remoteStorage.dropbox. - * - * In order to ensure compatibility with the public folder, - * gets hijacked to return the Dropbox public share URL. - * - * To use this backend, you need to specify the Dropbox app key like so: - * - * @example - * remoteStorage.setApiKeys({ - * dropbox: 'your-app-key' - * }); - * - * An app key can be obtained by registering your app at https://www.dropbox.com/developers/apps - * - * Known issues: - * - * - Storing files larger than 150MB is not yet supported - * - Listing and deleting folders with more than 10'000 files will cause problems - * - Content-Type is not supported; TODO: use file_properties - * - Dropbox preserves cases but is not case-sensitive - * - getItemURL is asynchronous which means it returns useful values - * after the syncCycle - */ -let hasLocalStorage; -const AUTH_URL = 'https://www.dropbox.com/oauth2/authorize'; -const ACCOUNT_URL = 'https://api.dropboxapi.com/2/users/get_current_account'; -const TOKEN_URL = 'https://api.dropboxapi.com/oauth2/token'; -const OAUTH_SCOPE = 'account_info.read files.content.read files.content.write files.metadata.read files.metadata.write'; -const SETTINGS_KEY = 'remotestorage:dropbox'; -const FOLDER_URL = 'https://api.dropboxapi.com/2/files/list_folder'; -const CONTINUE_URL = 'https://api.dropboxapi.com/2/files/list_folder/continue'; -const DOWNLOAD_URL = 'https://content.dropboxapi.com/2/files/download'; -const UPLOAD_URL = 'https://content.dropboxapi.com/2/files/upload'; -const DELETE_URL = 'https://api.dropboxapi.com/2/files/delete'; -const METADATA_URL = 'https://api.dropboxapi.com/2/files/get_metadata'; -const CREATE_SHARED_URL = 'https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings'; -const LIST_SHARED_URL = 'https://api.dropbox.com/2/sharing/list_shared_links'; -const PATH_PREFIX = '/remotestorage'; -const NUM_RETRIES = 3; -/** - * Maps a remoteStorage path to a path in Dropbox. - * - * @param {string} path - Path - * @returns {string} Actual path in Dropbox - * - * @private - */ -function getDropboxPath(path) { - return (PATH_PREFIX + '/' + path).replace(/\/+$/, '').replace(/\/+/g, '/'); -} -// This function is simple and has OK performance compared to more -// complicated ones: https://jsperf.com/json-escape-unicode/4 -const charsToEncode = /[\u007f-\uffff]/g; -function httpHeaderSafeJson(obj) { - return JSON.stringify(obj).replace(charsToEncode, function (c) { - return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4); - }); -} -function compareApiError(response, expect) { - return new RegExp('^' + expect.join('\\/') + '(\\/|$)').test(response.error_summary); -} -function isBinaryData(data) { - return data instanceof ArrayBuffer || (0, requests_1.isArrayBufferView)(data); -} -/** - * @class - */ -class Dropbox extends remote_1.RemoteBase { - constructor(rs) { - super(rs); - this.online = true; // TODO implement offline detection on failed request - this.storageApi = 'draft-dejong-remotestorage-19'; - this._initialFetchDone = false; - this.addEvents(['connected', 'not-connected']); - this.clientId = rs.apiKeys.dropbox.appKey; - this.TOKEN_URL = TOKEN_URL; - this._revCache = new revisioncache_1.default('rev'); - this._fetchDeltaCursor = null; - this._fetchDeltaPromise = null; - this._itemRefs = {}; - hasLocalStorage = (0, util_1.localStorageAvailable)(); - if (hasLocalStorage) { - const settings = (0, util_1.getJSONFromLocalStorage)(SETTINGS_KEY); - if (settings) { - this.configure(settings); // can't await in constructor - } - this._itemRefs = (0, util_1.getJSONFromLocalStorage)(`${SETTINGS_KEY}:shares`) || {}; - } - if (this.connected) { - setTimeout(this._emit.bind(this), 0, 'connected'); - } - } - /** - * Set the backed to 'dropbox' and start the authentication flow in order - * to obtain an API token from Dropbox. - */ - connect() { - return __awaiter(this, void 0, void 0, function* () { - // TODO handling when token is already present - try { - this.rs.setBackend('dropbox'); - if (this.token) { - hookIt(this.rs); - } - else { // OAuth2 PKCE - const { codeVerifier, codeChallenge, state } = yield (0, util_1.generateCodeVerifier)(); - sessionStorage.setItem('remotestorage:codeVerifier', codeVerifier); - sessionStorage.setItem('remotestorage:state', state); - this.rs.authorize({ - authURL: AUTH_URL, - scope: OAUTH_SCOPE, - clientId: this.clientId, - response_type: 'code', - state: state, - code_challenge: codeChallenge, - code_challenge_method: 'S256', - token_access_type: 'offline' - }); - } - } - catch (err) { - this.rs._emit('error', err); - this.rs.setBackend(undefined); - throw err; - } - }); - } - /** - * Sets the connected flag - * Accepts its parameters according to the . - * @param {Object} settings - * @param {string} [settings.userAddress] - The user's email address - * @param {string} [settings.token] - Authorization token - * @param {string} [settings.refreshToken] - OAuth2 PKCE refresh token - * @param {string} [settings.tokenType] - usually 'bearer' - no support for 'mac' tokens yet - * - * @protected - **/ - configure(settings) { - return __awaiter(this, void 0, void 0, function* () { - // We only update this.userAddress if settings.userAddress is set to a string or to null: - if (typeof settings.userAddress !== 'undefined') { - this.userAddress = settings.userAddress; - } - // Same for this.token. If only one of these two is set, we leave the other one at its existing value: - if (typeof settings.token !== 'undefined') { - this.token = settings.token; - } - if (typeof settings.refreshToken !== 'undefined') { - this.refreshToken = settings.refreshToken; - } - if (typeof settings.tokenType !== 'undefined') { - this.tokenType = settings.tokenType; - } - const writeSettingsToCache = () => { - if (hasLocalStorage) { - localStorage.setItem(SETTINGS_KEY, JSON.stringify({ - userAddress: this.userAddress, - token: this.token, - refreshToken: this.refreshToken, - tokenType: this.tokenType, - })); - } - }; - const handleError = () => { - this.connected = false; - if (hasLocalStorage) { - localStorage.removeItem(SETTINGS_KEY); - } - this.rs.setBackend(undefined); - }; - if (this.refreshToken || this.token) { - this.connected = true; - if (this.userAddress) { - this._emit('connected'); - writeSettingsToCache(); - } - else { - try { - const info = yield this.info(); - this.userAddress = info.email; - this._emit('connected'); - writeSettingsToCache(); - } - catch (err) { - this.connected = false; - this.rs._emit('error', new Error('Could not fetch user info.')); - writeSettingsToCache.apply(this); - } - } - } - else { - handleError(); - } - }); - } - /** - * Get all items in a folder. - * - * @param path {string} - path of the folder to get, with leading slash - * @return {Object} - * statusCode - HTTP status code - * body - array of the items found - * contentType - 'application/json; charset=UTF-8' - * revision - revision of the folder - * - * @private - */ - _getFolder(path) { - const revCache = this._revCache; - const processResponse = (resp) => { - let body; - if (resp.status !== 200 && resp.status !== 409) { - return Promise.reject('Unexpected response status: ' + resp.status); - } - try { - body = JSON.parse(resp.responseText); - } - catch (e) { - return Promise.reject(e); - } - if (resp.status === 409) { - if (compareApiError(body, ['path', 'not_found'])) { - // if the folder is not found, handle it as an empty folder - return Promise.resolve({}); - } - return Promise.reject(new Error('API returned an error: ' + body.error_summary)); - } - const listing = body.entries.reduce((map, item) => { - try { - const isDir = item['.tag'] === 'folder'; - const itemName = item.path_display.split('/').slice(-1)[0] + (isDir ? '/' : ''); - if (isDir) { - map[itemName] = { ETag: revCache.get(path + itemName) }; - } - else { - const date = new Date(item.server_modified); - map[itemName] = { ETag: item.rev, 'Content-Length': item.size, 'Last-Modified': date.toUTCString() }; - this._revCache.set(path + itemName, item.rev); - } - } - catch (err) { - console.error(`[Dropbox] folder “${path}” has entry ${JSON.stringify(item)}:`, err); - } - return map; - }, {}); - if (body.has_more) { - return loadNext(body.cursor).then(function (nextListing) { - return Object.assign(listing, nextListing); - }); - } - return Promise.resolve(listing); - }; - const loadNext = (cursor) => { - const params = { - body: { cursor: cursor } - }; - return this._request('POST', CONTINUE_URL, params).then(processResponse); - }; - return this._request('POST', FOLDER_URL, { - body: { - path: getDropboxPath(path) - } - }).then(processResponse).then(function (listing) { - return Promise.resolve({ - statusCode: 200, - body: listing, - contentType: 'application/json; charset=UTF-8', - revision: revCache.get(path) - }); - }); - } - /** - * Checks for the path in ``_revCache`` and decides based on that if file - * has changed. Calls ``_getFolder`` is the path points to a folder. - * - * Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``. - * - * Compatible with ``WireClient.get`` - * - * @param path {string} - path of the folder to get, with leading slash - * @param options {Object} - * - * @protected - */ - get(path, options = {}) { - if (!this.connected) { - return Promise.reject("not connected (path: " + path + ")"); - } - const savedRev = this._revCache.get(path); - if (savedRev === null) { - // file was deleted server side - return Promise.resolve({ statusCode: 404 }); - } - if (options && options.ifNoneMatch) { - // We must wait for local revision cache to be initialized before - // checking if local revision is outdated - if (!this._initialFetchDone) { - return this.fetchDelta().then(() => { - return this.get(path, options); - }); - } - if (savedRev && (savedRev === options.ifNoneMatch)) { - // nothing changed. - return Promise.resolve({ statusCode: 304 }); - } - } - // use _getFolder for folders - if (path.slice(-1) === '/') { - return this._getFolder(path); - } - const params = { - headers: { - 'Dropbox-API-Arg': httpHeaderSafeJson({ path: getDropboxPath(path) }), - }, - responseType: 'arraybuffer' - }; - if (options && options.ifNoneMatch) { - params.headers['If-None-Match'] = options.ifNoneMatch; - } - return this._request('GET', DOWNLOAD_URL, params).then(resp => { - const status = resp.status; - let meta, body, mime, rev; - if (status !== 200 && status !== 409) { - return Promise.resolve({ statusCode: status }); - } - meta = resp.getResponseHeader('Dropbox-API-Result'); - //first encode the response as text, and later check if - //text appears to actually be binary data - return (0, util_1.getTextFromArrayBuffer)(resp.response, 'UTF-8').then(responseText => { - body = responseText; - if (status === 409) { - meta = body; - } - try { - meta = JSON.parse(meta); - } - catch (e) { - return Promise.reject(e); - } - if (status === 409) { - if (compareApiError(meta, ['path', 'not_found'])) { - return { statusCode: 404 }; - } - return Promise.reject(new Error('API error while downloading file ("' + path + '"): ' + meta.error_summary)); - } - mime = resp.getResponseHeader('Content-Type'); - rev = meta.rev; - this._revCache.set(path, rev); - this._shareIfNeeded(path); // There doesn't appear to be a need to await this. - if ((0, util_1.shouldBeTreatedAsBinary)(responseText, mime)) { - // return unprocessed response - body = resp.response; - } - else { - // handling json (always try) - try { - body = JSON.parse(body); - mime = 'application/json; charset=UTF-8'; - } - catch (e) { - //Failed parsing Json, assume it is something else then - } - } - return { - statusCode: status, - body: body, - contentType: mime, - revision: rev - }; - }); - }); - } - /** - * Checks for the path in ``_revCache`` and decides based on that if file - * has changed. - * - * Compatible with ``WireClient`` - * - * Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``. - * - * @param {string} path - path of the folder to put, with leading slash - * @param {XMLHttpRequestBodyInit} body - Blob | BufferSource | FormData | URLSearchParams | string - * @param {string} contentType - MIME type of body - * @param {Object} options - * @param {string} options.ifNoneMatch - When *, only create or update the file if it doesn't yet exist - * @param {string} options.ifMatch - Only saves if this matches current revision - * @returns {Promise} Resolves with an object containing the status code, - * content-type and revision - * @protected - */ - put(path_1, body_1, contentType_1) { - return __awaiter(this, arguments, void 0, function* (path, body, contentType, options = {}) { - if (!this.connected) { - throw new Error("not connected (path: " + path + ")"); - } - // check if file has changed and return 412 - const savedRev = this._revCache.get(path); - if (options && options.ifMatch && - savedRev && (savedRev !== options.ifMatch)) { - return { statusCode: 412, revision: savedRev }; - } - if (options && (options.ifNoneMatch === '*') && - savedRev && (savedRev !== 'rev')) { - return { statusCode: 412, revision: savedRev }; - } - if ((!contentType.match(/charset=/)) && isBinaryData(body)) { - contentType += '; charset=binary'; - } - if (body.length > 150 * 1024 * 1024) { - //https://www.dropbox.com/developers/core/docs#chunked-upload - throw new Error("Cannot upload file larger than 150MB"); - } - const needsMetadata = options && (options.ifMatch || (options.ifNoneMatch === '*')); - const uploadParams = { - body: body, - contentType: contentType, - path: path - }; - if (needsMetadata) { - const metadata = yield this._getMetadata(path); - if (options && (options.ifNoneMatch === '*') && metadata) { - // if !!metadata === true, the file exists - return { - statusCode: 412, - revision: metadata.rev - }; - } - if (options && options.ifMatch && metadata && (metadata.rev !== options.ifMatch)) { - return { - statusCode: 412, - revision: metadata.rev - }; - } - } - const result = yield this._uploadSimple(uploadParams); - this._shareIfNeeded(path); // There doesn't appear to be a need to await this. - return result; - }); - } - /** - * Checks for the path in ``_revCache`` and decides based on that if file - * has changed. - * - * Compatible with ``WireClient.delete`` - * - * Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``. - * - * @param {string} path - path of the folder to delete, with leading slash - * @param {Object} options - * - * @protected - */ - 'delete'(path_1) { - return __awaiter(this, arguments, void 0, function* (path, options = {}) { - if (!this.connected) { - throw new Error("not connected (path: " + path + ")"); - } - // check if file has changed and return 412 - const savedRev = this._revCache.get(path); - if ((options === null || options === void 0 ? void 0 : options.ifMatch) && savedRev && (options.ifMatch !== savedRev)) { - return { statusCode: 412, revision: savedRev }; - } - if (options === null || options === void 0 ? void 0 : options.ifMatch) { - const metadata = yield this._getMetadata(path); - if ((options === null || options === void 0 ? void 0 : options.ifMatch) && metadata && (metadata.rev !== options.ifMatch)) { - return { - statusCode: 412, - revision: metadata.rev - }; - } - } - return this._deleteSimple(path); - }); - } - /** - * Calls share, if the provided path resides in a public folder. - * @private - */ - _shareIfNeeded(path) { - if (path.match(/^\/public\/.*[^/]$/) && this._itemRefs[path] === undefined) { - return this.share(path); - } - } - /** - * Gets a publicly-accessible URL for the path from Dropbox and stores it - * in ``_itemRefs``. - * - * @return {Promise} a promise for the URL - * - * @private - */ - share(path) { - const options = { - body: { path: getDropboxPath(path) } - }; - return this._request('POST', CREATE_SHARED_URL, options).then((response) => { - if (response.status !== 200 && response.status !== 409) { - return Promise.reject(new Error('Invalid response status:' + response.status)); - } - let body; - try { - body = JSON.parse(response.responseText); - } - catch (e) { - return Promise.reject(new Error('Invalid response body: ' + response.responseText)); - } - if (response.status === 409) { - if (compareApiError(body, ['shared_link_already_exists'])) { - return this._getSharedLink(path); - } - return Promise.reject(new Error('API error: ' + body.error_summary)); - } - return Promise.resolve(body.url); - }).then((link) => { - this._itemRefs[path] = link; - if (hasLocalStorage) { - localStorage.setItem(SETTINGS_KEY + ':shares', JSON.stringify(this._itemRefs)); - } - return Promise.resolve(link); - }, (error) => { - error.message = 'Sharing Dropbox file or folder ("' + path + '") failed: ' + error.message; - return Promise.reject(error); - }); - } - /** - * Fetches the user's info from dropbox and returns a promise for it. - * - * @return {Promise} a promise for user info object (email - the user's email address) - * - * @protected - */ - info() { - return this._request('POST', ACCOUNT_URL, {}).then(function (response) { - let email; - try { - const info = JSON.parse(response.responseText); - email = info === null || info === void 0 ? void 0 : info.email; - } - catch (e) { - return Promise.reject(new Error('Could not query current account info: Invalid API response: ' + response.responseText)); - } - return Promise.resolve({ - email: email - }); - }); - } - /** - * Makes a network request. - * - * @param {string} method - Request method - * @param {string} url - Target URL - * @param {object} options - Request options - * @param {number} numAttempts - # of times same request repeated - * @returns {Promise} Resolves with the response of the network request - * - * @private - */ - _request(method_1, url_1, options_1) { - return __awaiter(this, arguments, void 0, function* (method, url, options, numAttempts = 1) { - if (this.isForbiddenRequestMethod(method, url)) { - throw `Don't use ${method} on directories!`; - } - if (!this.token) { - throw new unauthorized_error_1.default("No access token"); - } - if (!options.headers) { - options.headers = {}; - } - options.headers['Authorization'] = 'Bearer ' + this.token; - if (typeof options.body === 'object' && !isBinaryData(options.body)) { - options.body = JSON.stringify(options.body); - options.headers['Content-Type'] = 'application/json; charset=UTF-8'; - } - this.rs._emit('wire-busy', { - method: method, - isFolder: (0, util_1.isFolder)(url) - }); - try { - const xhr = yield (0, requests_1.requestWithTimeout)(method, url, options); - if (!this.online) { - this.online = true; - this.rs._emit('network-online'); - } - this.rs._emit('wire-done', { - method: method, - isFolder: (0, util_1.isFolder)(url), - success: true - }); - if ((xhr === null || xhr === void 0 ? void 0 : xhr.status) === 401 && this.refreshToken) { - if (numAttempts >= NUM_RETRIES) { - console.error(`Abandoned after ${numAttempts} attempts: ${method} ${url}`); - return xhr; - } - else { - this.rs._emit('wire-busy', { - method: method, - isFolder: (0, util_1.isFolder)(url) - }); - yield authorize_1.default.refreshAccessToken(this.rs, this, this.refreshToken); - this.rs._emit('wire-done', { - method: method, - isFolder: (0, util_1.isFolder)(url), - success: true - }); - // re-runs original request - return this._request(method, url, options, numAttempts + 1); - } - } - else if ([503, 429].includes(xhr === null || xhr === void 0 ? void 0 : xhr.status)) { - // 503 Service Unavailable; 429 Too Many Requests - if (this.online) { - this.online = false; - this.rs._emit('network-offline'); - } - if (numAttempts >= NUM_RETRIES) { - console.warn(`Abandoned after ${numAttempts} attempts: ${method} ${url}`); - return xhr; - } - else { - yield new Promise(resolve => setTimeout(resolve, (0, requests_1.retryAfterMs)(xhr))); - // re-runs original request - return this._request(method, url, options, numAttempts + 1); - } - } - else { - return xhr; - } - } - catch (error) { - if (this.online) { - this.online = false; - this.rs._emit('network-offline'); - } - this.rs._emit('wire-done', { - method: method, - isFolder: (0, util_1.isFolder)(url), - success: false - }); - throw error; - } - }); - } - /** - * Fetches the revision of all the files from dropbox API and puts them - * into ``_revCache``. These values can then be used to determine if - * something has changed. - * - * @private - */ - fetchDelta(...args) { - // If fetchDelta was already called, and didn't finish, return the existing - // promise instead of calling Dropbox API again - if (this._fetchDeltaPromise) { - return this._fetchDeltaPromise; - } - /** This should resolve (with no value) on success, and reject on error. */ - const fetch = (cursor) => __awaiter(this, void 0, void 0, function* () { - let url; - let requestBody; - if (typeof cursor === 'string') { - url = CONTINUE_URL; - requestBody = { cursor }; - } - else { - url = FOLDER_URL; - requestBody = { - path: PATH_PREFIX, - recursive: true, - include_deleted: true - }; - } - try { - const response = yield this._request('POST', url, { body: requestBody }); - if (response.status === 401) { - throw new unauthorized_error_1.default(); - } - if (response.status !== 200 && response.status !== 409) { - throw new Error('Invalid response status: ' + response.status); - } - let responseBody; - try { - responseBody = JSON.parse(response.responseText); - } - catch (e) { - throw new Error('Invalid response body: ' + response.responseText); - } - if (response.status === 409) { - if (compareApiError(responseBody, ['path', 'not_found'])) { - responseBody = { - cursor: null, - entries: [], - has_more: false - }; - } - else { - throw new Error('API returned an error: ' + responseBody.error_summary); - } - } - if (!cursor) { - //we are doing a complete fetch, so propagation would introduce unnecessary overhead - this._revCache.deactivatePropagation(); - } - responseBody.entries.forEach(entry => { - const path = entry.path_display.slice(PATH_PREFIX.length); - if (entry['.tag'] === 'deleted') { - // there's no way to know whether the entry was a file or a folder - this._revCache.delete(path); - this._revCache.delete(path + '/'); - } - else if (entry['.tag'] === 'file') { - this._revCache.set(path, entry.rev); - } - }); - this._fetchDeltaCursor = responseBody.cursor; - if (responseBody.has_more) { - return fetch(responseBody.cursor); - } - else { - this._revCache.activatePropagation(); - this._initialFetchDone = true; - } - } - catch (error) { - if (error === 'timeout') { - // Offline is handled elsewhere already, just ignore it here - return; - } - else { - throw error; - } - } - }); - this._fetchDeltaPromise = fetch(this._fetchDeltaCursor).catch(error => { - if (typeof (error) === 'object' && 'message' in error) { - error.message = 'Dropbox: fetchDelta: ' + error.message; - } - else { - error = `Dropbox: fetchDelta: ${error}`; - } - this.rs._emit('error', error); - this._fetchDeltaPromise = null; - return Promise.reject(error); - }).then(() => { - this._fetchDeltaPromise = null; - return Promise.resolve(args); - }); - return this._fetchDeltaPromise; - } - /** - * Gets metadata for a path (can point to either a file or a folder). - * - * @param {string} path - the path to get metadata for - * - * @returns {Promise} A promise for the metadata - * - * @private - */ - _getMetadata(path) { - const requestBody = { - path: getDropboxPath(path) - }; - return this._request('POST', METADATA_URL, { body: requestBody }).then((response) => { - if (response.status !== 200 && response.status !== 409) { - return Promise.reject(new Error('Invalid response status:' + response.status)); - } - let responseBody; - try { - responseBody = JSON.parse(response.responseText); - } - catch (e) { - return Promise.reject(new Error('Invalid response body: ' + response.responseText)); - } - if (response.status === 409) { - if (compareApiError(responseBody, ['path', 'not_found'])) { - return Promise.resolve(); - } - return Promise.reject(new Error('API error: ' + responseBody.error_summary)); - } - return Promise.resolve(responseBody); - }).then(undefined, (error) => { - error.message = 'Could not load metadata for file or folder ("' + path + '"): ' + error.message; - return Promise.reject(error); - }); - } - /** - * Upload a simple file (the size is no more than 150MB). - * - * @param {Object} params - * @param {string} params.ifMatch - Only update the file if its ETag - * matches this string - * @param {string} params.path - path of the file - * @param {string} params.body - contents of the file to upload - * @param {string} params.contentType - mime type of the file * - * @return {Promise} A promise for an object with the following structure: - * statusCode - HTTP status code - * revision - revision of the newly-created file, if any - * - * @private - */ - _uploadSimple(params) { - const args = { - path: getDropboxPath(params.path), - mode: { '.tag': 'overwrite', update: undefined }, - mute: true - }; - if (params.ifMatch) { - args.mode = { '.tag': 'update', update: params.ifMatch }; - } - return this._request('POST', UPLOAD_URL, { - body: params.body, - headers: { - 'Content-Type': 'application/octet-stream', - 'Dropbox-API-Arg': httpHeaderSafeJson(args) - } - }).then(response => { - if (response.status !== 200 && response.status !== 409) { - return Promise.resolve({ statusCode: response.status }); - } - let body; - try { - body = JSON.parse(response.responseText); - } - catch (e) { - return Promise.reject(new Error('Invalid API result: ' + response.responseText)); - } - if (response.status === 409) { - if (compareApiError(body, ['path', 'conflict'])) { - return this._getMetadata(params.path).then(function (metadata) { - return Promise.resolve({ - statusCode: 412, - revision: metadata.rev - }); - }); - } - this.rs._emit('error', new Error(body.error_summary)); - return Promise.resolve({ statusCode: response.status }); - } - this._revCache.set(params.path, body.rev); - return Promise.resolve({ statusCode: response.status, revision: body.rev }); - }); - } - /** - * Deletes a file or a folder. - * - * @param {string} path - the path to delete - * - * @returns {Promise} A promise for an object with the following structure: - * statusCode - HTTP status code - * - * @private - */ - _deleteSimple(path) { - const requestBody = { path: getDropboxPath(path) }; - return this._request('POST', DELETE_URL, { body: requestBody }).then((response) => { - if (response.status !== 200 && response.status !== 409) { - return Promise.resolve({ statusCode: response.status }); - } - let responseBody; - try { - responseBody = JSON.parse(response.responseText); - } - catch (e) { - return Promise.reject(new Error('Invalid response body: ' + response.responseText)); - } - if (response.status === 409) { - if (compareApiError(responseBody, ['path_lookup', 'not_found'])) { - return Promise.resolve({ statusCode: 404 }); - } - this.rs._emit('error', new Error(responseBody.error_summary)); - } - return Promise.resolve({ statusCode: response.status }); - }).then(result => { - if (result.statusCode === 200 || result.statusCode === 404) { - this._revCache.delete(path); - delete this._itemRefs[path]; - } - return Promise.resolve(result); - }, (error) => { - error.message = 'Could not delete Dropbox file or folder ("' + path + '"): ' + error.message; - return Promise.reject(error); - }); - } - /** - * Requests the link for an already-shared file or folder. - * - * @param {string} path - path to the file or folder - * - * @returns {Promise} A promise for the shared link - * - * @private - */ - _getSharedLink(path) { - return __awaiter(this, void 0, void 0, function* () { - const options = { - body: { - path: getDropboxPath(path), - direct_only: true - } - }; - return this._request('POST', LIST_SHARED_URL, options).then((response) => { - if (response.status !== 200 && response.status !== 409) { - return Promise.reject(new Error('Invalid response status: ' + response.status)); - } - let body; - try { - body = JSON.parse(response.responseText); - } - catch (e) { - return Promise.reject(new Error('Invalid response body: ' + response.responseText)); - } - if (response.status === 409) { - return Promise.reject(new Error('API error: ' + (body === null || body === void 0 ? void 0 : body.error_summary) || 0)); - } - if (!body.links.length) { - return Promise.reject(new Error('No links returned')); - } - return Promise.resolve(body.links[0].url); - }, error => { - error.message = 'Could not get link to a shared file or folder ("' + path + '"): ' + error.message; - return Promise.reject(error); - }); - }); - } - /** - * Initialize the Dropbox backend. - * - * @param {object} rs - RemoteStorage instance - * - * @protected - */ - static _rs_init(rs) { - hasLocalStorage = (0, util_1.localStorageAvailable)(); - if (rs.apiKeys.dropbox) { - rs.dropbox = new Dropbox(rs); - } - if (rs.backend === 'dropbox') { - hookIt(rs); - } - } - /** - * Inform about the availability of the Dropbox backend. - * - * @returns {Boolean} - * - * @protected - */ - static _rs_supported() { - return true; - } - /** - * Remove Dropbox as a backend. - * - * @param {object} rs - RemoteStorage instance - * - * @protected - */ - static _rs_cleanup(rs) { - unHookIt(rs); - if (hasLocalStorage) { - localStorage.removeItem(SETTINGS_KEY); - } - rs.setBackend(undefined); - } -} -/** - * Hooking the sync - * - * TODO: document - */ -function hookSync(rs, ...args) { - if (rs._dropboxOrigSync) { - return; - } // already hooked - rs._dropboxOrigSync = rs.sync.sync.bind(rs.sync); - rs.sync.sync = function () { - return this.dropbox.fetchDelta(rs, ...args). - then(rs._dropboxOrigSync, function (err) { - rs._emit('error', new sync_error_1.default(err)); - rs._emit('sync-done'); - }); - }.bind(rs); -} -/** - * Unhooking the sync - * - * TODO: document - */ -function unHookSync(rs) { - if (!rs._dropboxOrigSync) { - return; - } // not hooked - rs.sync.sync = rs._dropboxOrigSync; - delete rs._dropboxOrigSync; -} -/** - * Hook RemoteStorage.syncCycle as it's the first function called - * after RemoteStorage.sync is initialized, so we can then hook - * the sync function - * @param {object} rs RemoteStorage instance - * @param {array} args remaining arguments - */ -function hookSyncCycle(rs, ...args) { - if (rs._dropboxOrigSyncCycle) { - return; - } // already hooked - rs._dropboxOrigSyncCycle = rs.syncCycle; - rs.syncCycle = () => { - if (rs.sync) { - hookSync(rs); - rs._dropboxOrigSyncCycle(rs, ...args); - unHookSyncCycle(rs); - } - else { - throw new Error('expected sync to be initialized by now'); - } - }; -} -/** - * Restore RemoteStorage's syncCycle original implementation - * @param {object} rs RemoteStorage instance - */ -function unHookSyncCycle(rs) { - if (!rs._dropboxOrigSyncCycle) { - return; - } // not hooked - rs.syncCycle = rs._dropboxOrigSyncCycle; - delete rs._dropboxOrigSyncCycle; -} -/** - * Overwrite BaseClient's getItemURL with our own implementation - * - * TODO: getItemURL still needs to be implemented - * - * @param {object} rs - RemoteStorage instance - * - * @private - */ -function hookGetItemURL(rs) { - if (rs._origBaseClientGetItemURL) { - return; - } - rs._origBaseClientGetItemURL = baseclient_1.default.prototype.getItemURL; - baseclient_1.default.prototype.getItemURL = function ( /*path*/) { - throw new Error('getItemURL is not implemented for Dropbox yet'); - }; -} -/** - * Restore BaseClient's getItemURL original implementation - * - * @param {object} rs - RemoteStorage instance - * - * @private - */ -function unHookGetItemURL(rs) { - if (!rs._origBaseClientGetItemURL) { - return; - } - baseclient_1.default.prototype.getItemURL = rs._origBaseClientGetItemURL; - delete rs._origBaseClientGetItemURL; -} -/** - * TODO: document - */ -function hookRemote(rs) { - if (rs._origRemote) { - return; - } - rs._origRemote = rs.remote; - rs.remote = rs.dropbox; -} -/** - * TODO: document - */ -function unHookRemote(rs) { - if (rs._origRemote) { - rs.remote = rs._origRemote; - delete rs._origRemote; - } -} -/** - * TODO: document - */ -function hookIt(rs) { - hookRemote(rs); - if (rs.sync) { - hookSync(rs); - } - else { - // when sync is not available yet, we hook the syncCycle function which is called - // right after sync is initialized - hookSyncCycle(rs); - } - hookGetItemURL(rs); -} -/** - * TODO: document - */ -function unHookIt(rs) { - unHookRemote(rs); - unHookSync(rs); - unHookGetItemURL(rs); - unHookSyncCycle(rs); -} -(0, util_1.applyMixins)(Dropbox, [eventhandling_1.default]); -module.exports = Dropbox; - - -/***/ }), - -/***/ "./src/env.ts": -/*!********************!*\ - !*** ./src/env.ts ***! - \********************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -class Env { - constructor() { - this.addEvents(["background", "foreground"]); - this.mode = typeof (window) !== 'undefined' ? 'browser' : 'node'; - if (this.mode === 'browser') { - this.setBrowserPrefixedNames(); - document.addEventListener(this.visibilityChangeEvent, this.setVisibility.bind(this), false); - this.setVisibility(); - } - } - setBrowserPrefixedNames() { - if (this.mode !== 'browser') { - return; - } - if (typeof document.hidden !== "undefined") { - this.hiddenProperty = "hidden"; - this.visibilityChangeEvent = "visibilitychange"; - } - else if (typeof document["mozHidden"] !== "undefined") { - this.hiddenProperty = "mozHidden"; - this.visibilityChangeEvent = "mozvisibilitychange"; - } - else if (typeof document["msHidden"] !== "undefined") { - this.hiddenProperty = "msHidden"; - this.visibilityChangeEvent = "msvisibilitychange"; - } - else if (typeof document["webkitHidden"] !== "undefined") { - this.hiddenProperty = "webkitHidden"; - this.visibilityChangeEvent = "webkitvisibilitychange"; - } - } - setVisibility() { - if (document[this.hiddenProperty]) { - this.goBackground(); - } - else { - this.goForeground(); - } - } - isBrowser() { - return this.mode === "browser"; - } - isNode() { - return this.mode === "node"; - } - goBackground() { - this._emit("background"); - } - goForeground() { - this._emit("foreground"); - } - static _rs_init( /* remoteStorage */) { - return; - } - static _rs_cleanup( /* remoteStorage */) { - return; - } -} -(0, util_1.applyMixins)(Env, [eventhandling_1.default]); -module.exports = Env; - - -/***/ }), - -/***/ "./src/eventhandling.ts": -/*!******************************!*\ - !*** ./src/eventhandling.ts ***! - \******************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.EventHandling = void 0; -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -class EventHandling { - /** - * Register event names - * - * TODO see if necessary, or can be done on the fly in addEventListener - * - * @internal - */ - addEvents(additionalEvents) { - additionalEvents.forEach(evName => this._addEvent(evName)); - } - /** - * Install an event handler for the given event name - * - * Usually called via [`on()`](#on) - */ - addEventListener(eventName, handler) { - // Check type for public consumption of API - if (typeof (eventName) !== 'string') { - throw new Error('Argument eventName should be a string'); - } - if (typeof (handler) !== 'function') { - throw new Error('Argument handler should be a function'); - } - (0, log_1.default)('[EventHandling] Adding event listener', eventName); - this._validateEvent(eventName); - this._handlers[eventName].push(handler); - } - /** - * Register an event handler for the given event name - * - * Alias for {@link addEventListener} - * - * @param eventName - Name of the event - * @param handler - Function to handle the event - * - * @example - * remoteStorage.on('connected', function() { - * console.log('storage account has been connected'); - * }); - */ - on(eventName, handler) { - return this.addEventListener(eventName, handler); - } - /** - * Remove a previously installed event handler - */ - removeEventListener(eventName, handler) { - this._validateEvent(eventName); - const hl = this._handlers[eventName].length; - for (let i = 0; i < hl; i++) { - if (this._handlers[eventName][i] === handler) { - this._handlers[eventName].splice(i, 1); - return; - } - } - } - /** - * @internal - */ - _emit(eventName, ...args) { - this._validateEvent(eventName); - this._handlers[eventName].slice().forEach((handler) => { - handler.apply(this, args); - }); - } - /** - * @internal - */ - _validateEvent(eventName) { - if (!(eventName in this._handlers)) { - throw new Error("Unknown event: " + eventName); - } - } - /** - * @internal - */ - _delegateEvent(eventName, target) { - target.on(eventName, (event) => { - this._emit(eventName, event); - }); - } - /** - * @internal - */ - _addEvent(eventName) { - if (typeof this._handlers === 'undefined') { - this._handlers = {}; - } - this._handlers[eventName] = []; - } -} -exports.EventHandling = EventHandling; -exports["default"] = EventHandling; - - -/***/ }), - -/***/ "./src/features.ts": -/*!*************************!*\ - !*** ./src/features.ts ***! - \*************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const config_1 = __importDefault(__webpack_require__(/*! ./config */ "./src/config.ts")); -const env_1 = __importDefault(__webpack_require__(/*! ./env */ "./src/env.ts")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const syncedgetputdelete_1 = __importDefault(__webpack_require__(/*! ./syncedgetputdelete */ "./src/syncedgetputdelete.ts")); -const access_1 = __importDefault(__webpack_require__(/*! ./access */ "./src/access.ts")); -const authorize_1 = __importDefault(__webpack_require__(/*! ./authorize */ "./src/authorize.ts")); -const discover_1 = __importDefault(__webpack_require__(/*! ./discover */ "./src/discover.ts")); -const baseclient_1 = __importDefault(__webpack_require__(/*! ./baseclient */ "./src/baseclient.ts")); -const googledrive_1 = __importDefault(__webpack_require__(/*! ./googledrive */ "./src/googledrive.ts")); -const dropbox_1 = __importDefault(__webpack_require__(/*! ./dropbox */ "./src/dropbox.ts")); -const solid_1 = __importDefault(__webpack_require__(/*! ./solid */ "./src/solid.ts")); -const wireclient_1 = __importDefault(__webpack_require__(/*! ./wireclient */ "./src/wireclient.ts")); -const sync_1 = __importDefault(__webpack_require__(/*! ./sync */ "./src/sync.ts")); -// Caching -const caching_1 = __importDefault(__webpack_require__(/*! ./caching */ "./src/caching.ts")); -const indexeddb_1 = __importDefault(__webpack_require__(/*! ./indexeddb */ "./src/indexeddb.ts")); -const localstorage_1 = __importDefault(__webpack_require__(/*! ./localstorage */ "./src/localstorage.ts")); -const inmemorystorage_1 = __importDefault(__webpack_require__(/*! ./inmemorystorage */ "./src/inmemorystorage.ts")); -const Features = { - features: [], - featuresDone: 0, - readyFired: false, - loadFeatures() { - this.features = []; - this.featuresDone = 0; - this.readyFired = false; - this.featureModules = { - 'WireClient': wireclient_1.default, - 'Dropbox': dropbox_1.default, - 'GoogleDrive': googledrive_1.default, - 'Solid': solid_1.default, - 'Access': access_1.default, - 'Discover': discover_1.default, - 'Authorize': authorize_1.default, - 'BaseClient': baseclient_1.default, - 'Env': env_1.default - }; - // enable caching related modules if needed - if (config_1.default.cache) { - // TODO replace util.extend with modern JS {...object, ...object} - (0, util_1.extend)(this.featureModules, { - 'Caching': caching_1.default, - 'IndexedDB': indexeddb_1.default, - 'LocalStorage': localstorage_1.default, - 'InMemoryStorage': inmemorystorage_1.default, - 'Sync': sync_1.default - }); - } - // disable features set in the config object passed to the RemoteStorage - // constructor - // For example: ['IndexedDB'] - config_1.default.disableFeatures.forEach(feature => { - if (this.featureModules[feature]) { - // this.featureModules[feature] = undefined - delete this.featureModules[feature]; - } - }); - this._allLoaded = false; - for (const featureName in this.featureModules) { - // FIXME: this has to push the promised return value into an - // array of promises and use Promise.all to emit `ready` - // instead of increment a counter of loaded features. -les - this.loadFeature(featureName); - } - }, - /** - * Method: hasFeature - * - * Checks whether a feature is enabled or not within remoteStorage. - * Returns a boolean. - * - * Parameters: - * name - Capitalized name of the feature. e.g. Authorize, or IndexedDB - * - * Example: - * (start code) - * if (remoteStorage.hasFeature('LocalStorage')) { - * console.log('LocalStorage is enabled!'); - * } - * (end code) - * - */ - hasFeature(feature) { - for (let i = this.features.length - 1; i >= 0; i--) { - if (this.features[i].name === feature) { - return this.features[i].supported; - } - } - return false; - }, - loadFeature(featureName) { - const feature = this.featureModules[featureName]; - const supported = !feature._rs_supported || feature._rs_supported(); - (0, log_1.default)(`[RemoteStorage] [FEATURE ${featureName}] initializing ...`); - if (typeof supported === 'object') { - supported.then(() => { - this.featureSupported(featureName, true); - this.initFeature(featureName); - }, () => { - this.featureSupported(featureName, false); - }); - } - else if (typeof supported === 'boolean') { - this.featureSupported(featureName, supported); - if (supported) { - this.initFeature(featureName); - } - } - else { - this.featureSupported(featureName, false); - } - }, - initFeature(featureName) { - const feature = this.featureModules[featureName]; - let initResult; - try { - initResult = feature._rs_init(this); - } - catch (e) { - this.featureFailed(featureName, e); - return; - } - if (typeof (initResult) === 'object' && typeof (initResult.then) === 'function') { - initResult.then(() => { this.featureInitialized(featureName); }, (err) => { this.featureFailed(featureName, err); }); - } - else { - this.featureInitialized(featureName); - } - }, - featureFailed(featureName, err) { - (0, log_1.default)(`[RemoteStorage] [FEATURE ${featureName}] initialization failed (${err})`); - this.featureDone(); - }, - featureSupported(featureName, success) { - (0, log_1.default)(`[RemoteStorage] [FEATURE ${featureName}]${success ? '' : 'not '} supported`); - if (!success) { - this.featureDone(); - } - }, - featureInitialized(featureName) { - (0, log_1.default)(`[RemoteStorage] [FEATURE ${featureName}] initialized`); - this.features.push({ - name: featureName, - init: this.featureModules[featureName]._rs_init, - supported: true, - cleanup: this.featureModules[featureName]._rs_cleanup - }); - this.featureDone(); - }, - featureDone() { - this.featuresDone++; - if (this.featuresDone === Object.keys(this.featureModules).length) { - setTimeout(this.featuresLoaded.bind(this), 0); - } - }, - _setCachingModule() { - const cachingModules = ['IndexedDB', 'LocalStorage', 'InMemoryStorage']; - cachingModules.some(cachingLayer => { - if (this.features.some(feature => feature.name === cachingLayer)) { - this.features.local = this.featureModules[cachingLayer]; - return true; - } - }); - }, - _fireReady() { - try { - if (!this.readyFired) { - this._emit('ready'); - this.readyFired = true; - } - } - catch (e) { - console.error("'ready' failed: ", e, e.stack); - this._emit('error', e); - } - }, - featuresLoaded() { - (0, log_1.default)(`[RemoteStorage] All features loaded`); - this._setCachingModule(); - // eslint-disable-next-line new-cap - this.local = config_1.default.cache && this.features.local && new this.features.local(); - // this.remote set by WireClient._rs_init as lazy property on - // RS.prototype - if (this.local && this.remote) { - this._setGPD(syncedgetputdelete_1.default, this); - this._bindChange(this.local); - } - else if (this.remote) { - this._setGPD(this.remote, this.remote); - } - if (this.remote) { - this.remote.on('connected', () => { - this._fireReady(); - this._emit('connected'); - }); - this.remote.on('not-connected', () => { - this._fireReady(); - this._emit('not-connected'); - }); - if (this.remote.connected) { - this._fireReady(); - this._emit('connected'); - } - if (!this.hasFeature('Authorize')) { - this.remote.stopWaitingForToken(); - } - } - this._collectCleanupFunctions(); - try { - this._allLoaded = true; - this._emit('features-loaded'); - } - catch (exc) { - (0, util_1.logError)(exc); - this._emit('error', exc); - } - this._processPending(); - }, - _collectCleanupFunctions() { - this._cleanups = []; - for (let i = 0; i < this.features.length; i++) { - const cleanup = this.features[i].cleanup; - if (typeof (cleanup) === 'function') { - this._cleanups.push(cleanup); - } - } - } -}; -module.exports = Features; - - -/***/ }), - -/***/ "./src/googledrive.ts": -/*!****************************!*\ - !*** ./src/googledrive.ts ***! - \****************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const baseclient_1 = __importDefault(__webpack_require__(/*! ./baseclient */ "./src/baseclient.ts")); -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const requests_1 = __webpack_require__(/*! ./requests */ "./src/requests.ts"); -const remote_1 = __webpack_require__(/*! ./remote */ "./src/remote.ts"); -const BASE_URL = 'https://www.googleapis.com'; -const AUTH_URL = 'https://accounts.google.com/o/oauth2/auth'; -const AUTH_SCOPE = 'https://www.googleapis.com/auth/drive'; -const SETTINGS_KEY = 'remotestorage:googledrive'; -const PATH_PREFIX = '/remotestorage'; -const GD_DIR_MIME_TYPE = 'application/vnd.google-apps.folder'; -const RS_DIR_MIME_TYPE = 'application/json; charset=UTF-8'; -let hasLocalStorage; -/** - * Produce a title from a filename for metadata. - * - * @param {string} filename - * @returns {string} title - * - * @private - */ -function metaTitleFromFileName(filename) { - if (filename.substr(-1) === '/') { - filename = filename.substr(0, filename.length - 1); - } - return decodeURIComponent(filename); -} -/** - * Get the parent directory for the given path. - * - * @param {string} path - * @returns {string} parent directory - * - * @private - */ -function parentPath(path) { - return path.replace(/[^\/]+\/?$/, ''); -} -/** - * Get only the filename from a full path. - * - * @param {string} path - * @returns {string} filename - * - * @private - */ -function baseName(path) { - const parts = path.split('/'); - if (path.substr(-1) === '/') { - return parts[parts.length - 2] + '/'; - } - else { - return parts[parts.length - 1]; - } -} -/** - * Prepend the path with the remoteStorage base directory. - * - * @param {string} path - Path - * @returns {string} Actual path on Google Drive - * - * @private - */ -function googleDrivePath(path) { - return (0, util_1.cleanPath)(`${PATH_PREFIX}/${path}`); -} -/** - * Internal cache object for storing Google file IDs. - * - * @param {number} maxAge - Maximum age (in seconds) the content should be cached for - */ -class FileIdCache { - constructor(maxAge) { - this._items = {}; - this.maxAge = maxAge; - this._items = {}; - } - get(key) { - const item = this._items[key]; - const now = new Date().getTime(); - return (item && item.t >= (now - this.maxAge)) ? item.v : undefined; - } - set(key, value) { - this._items[key] = { - v: value, - t: new Date().getTime() - }; - } -} -/** - * Overwrite BaseClient's getItemURL with our own implementation - * - * TODO: Still needs to be implemented. At the moment it just throws - * and error saying that it's not implemented yet. - * - * @param {object} rs - RemoteStorage instance - * - * @private - */ -function hookGetItemURL(rs) { - if (rs._origBaseClientGetItemURL) { - return; - } - rs._origBaseClientGetItemURL = baseclient_1.default.prototype.getItemURL; - baseclient_1.default.prototype.getItemURL = function ( /* path */) { - throw new Error('getItemURL is not implemented for Google Drive yet'); - }; -} -/** - * Restore BaseClient's getItemURL original implementation - * - * @param {object} rs - RemoteStorage instance - * - * @private - */ -function unHookGetItemURL(rs) { - if (!rs._origBaseClientGetItemURL) { - return; - } - baseclient_1.default.prototype.getItemURL = rs._origBaseClientGetItemURL; - delete rs._origBaseClientGetItemURL; -} -/** - * @class GoogleDrive - * - * To use this backend, you need to specify the app's client ID like so: - * - * @example - * remoteStorage.setApiKeys({ - * googledrive: 'your-client-id' - * }); - * - * A client ID can be obtained by registering your app in the Google - * Developers Console: https://console.developers.google.com/flows/enableapi?apiid=drive - * - * Docs: https://developers.google.com/drive/v3/web/quickstart/js -**/ -class GoogleDrive extends remote_1.RemoteBase { - constructor(remoteStorage, clientId) { - super(remoteStorage); - this.online = true; - this.storageApi = 'draft-dejong-remotestorage-19'; - this.addEvents(['connected', 'not-connected']); - this.clientId = clientId; - this._fileIdCache = new FileIdCache(60 * 5); // IDs expire after 5 minutes (is this a good idea?) - hasLocalStorage = (0, util_1.localStorageAvailable)(); - if (hasLocalStorage) { - const settings = (0, util_1.getJSONFromLocalStorage)(SETTINGS_KEY); - if (settings) { - this.configure(settings); - } - } - } - /** - * Configure the Google Drive backend. - * - * Fetches the user info from Google when no ``userAddress`` is given. - * - * @param {Object} settings - * @param {string} [settings.userAddress] - The user's email address - * @param {string} [settings.token] - Authorization token - * - * @protected - */ - configure(settings) { - // We only update this.userAddress if settings.userAddress is set to a string or to null - if (typeof settings.userAddress !== 'undefined') { - this.userAddress = settings.userAddress; - } - // Same for this.token. If only one of these two is set, we leave the other one at its existing value - if (typeof settings.token !== 'undefined') { - this.token = settings.token; - } - const writeSettingsToCache = function () { - if (hasLocalStorage) { - localStorage.setItem(SETTINGS_KEY, JSON.stringify({ - userAddress: this.userAddress, - token: this.token - })); - } - }; - const handleError = function () { - this.connected = false; - delete this.token; - if (hasLocalStorage) { - localStorage.removeItem(SETTINGS_KEY); - } - }; - if (this.token) { - this.connected = true; - if (this.userAddress) { - this._emit('connected'); - writeSettingsToCache.apply(this); - } - else { - this.info().then((info) => { - this.userAddress = info.user.emailAddress; - this._emit('connected'); - writeSettingsToCache.apply(this); - }).catch(() => { - handleError.apply(this); - this.rs._emit('error', new Error('Could not fetch user info.')); - }); - } - } - else { - handleError.apply(this); - } - } - /** - * Initiate the authorization flow's OAuth dance. - */ - connect() { - this.rs.setBackend('googledrive'); - this.rs.authorize({ authURL: AUTH_URL, scope: AUTH_SCOPE, clientId: this.clientId }); - } - /** - * Request a resource (file or directory). - * - * @param {string} path - Path of the resource - * @param {Object} options - Request options - * @returns {Promise} Resolves with an object containing the status code, - * body, content-type and revision - * - * @protected - */ - get(path, options = {}) { - if ((0, util_1.isFolder)(path)) { - return this._getFolder(googleDrivePath(path)); - } - else { - return this._getFile(googleDrivePath(path), options); - } - } - /** - * Create or update a file. - * - * @param {string} path - File path - * @param body - File content - * @param {string} contentType - File content-type - * @param {Object} options - * @param {string} options.ifNoneMatch - Only create of update the file if the - * current ETag doesn't match this string - * @returns {Promise} Resolves with an object containing the status code, - * content-type and revision - * - * @protected - */ - put(path, body, contentType, options = {}) { - const fullPath = googleDrivePath(path); - function putDone(response) { - if (response.status >= 200 && response.status < 300) { - const meta = JSON.parse(response.responseText); - const etagWithoutQuotes = this.stripQuotes(meta.etag); - return Promise.resolve({ statusCode: 200, contentType: meta.mimeType, revision: etagWithoutQuotes }); - } - else if (response.status === 412) { - return Promise.resolve({ statusCode: 412, revision: 'conflict' }); - } - else { - return Promise.reject("PUT failed with status " + response.status + " (" + response.responseText + ")"); - } - } - return this._getFileId(fullPath).then((id) => { - if (id) { - if (options && (options.ifNoneMatch === '*')) { - return putDone({ status: 412 }); - } - return this._updateFile(id, fullPath, body, contentType, options).then(putDone); - } - else { - return this._createFile(fullPath, body, contentType).then(putDone); - } - }); - } - /** - * Delete a file. - * - * @param {string} path - File path - * @param {Object} options - * @param {string} options.ifMatch - only delete the file if it's ETag - * matches this string - * @returns {Promise} Resolves with an object containing the status code - * - * @protected - */ - delete(path, options = {}) { - const fullPath = googleDrivePath(path); - return this._getFileId(fullPath).then((id) => { - if (!id) { - // File doesn't exist. Ignore. - return Promise.resolve({ statusCode: 200 }); - } - return this._getMeta(id).then((meta) => { - let etagWithoutQuotes; - if ((typeof meta === 'object') && (typeof meta.etag === 'string')) { - etagWithoutQuotes = this.stripQuotes(meta.etag); - } - if (options && options.ifMatch && (options.ifMatch !== etagWithoutQuotes)) { - return { statusCode: 412, revision: etagWithoutQuotes }; - } - return this._request('DELETE', BASE_URL + '/drive/v2/files/' + id, {}).then((response) => { - if (response.status === 200 || response.status === 204) { - return { statusCode: 200 }; - } - else { - return Promise.reject("Delete failed: " + response.status + " (" + response.responseText + ")"); - } - }); - }); - }); - } - /** - * Fetch the user's info from Google. - * - * @returns {Promise} resolves with the user's info. - * - * @protected - */ - info() { - const url = BASE_URL + '/drive/v2/about?fields=user'; - // requesting user info(mainly for userAdress) - return this._request('GET', url, {}).then(function (resp) { - try { - const info = JSON.parse(resp.responseText); - return Promise.resolve(info); - } - catch (e) { - return Promise.reject(e); - } - }); - } - /** - * Update an existing file. - * - * @param {string} id - File ID - * @param {string} path - File path - * @param body - File content - * @param {string} contentType - File content-type - * @param {Object} options - * @param {string} options.ifMatch - Only update the file if its ETag - * matches this string - * @returns {Promise} Resolves with the response of the network request - * - * @private - */ - _updateFile(id, path, body, contentType, options) { - const metadata = { - mimeType: contentType - }; - const headers = { - 'Content-Type': 'application/json; charset=UTF-8' - }; - if (options && options.ifMatch) { - headers['If-Match'] = this.addQuotes(options.ifMatch); - } - return this._request('PUT', BASE_URL + '/upload/drive/v2/files/' + id + '?uploadType=resumable', { - body: JSON.stringify(metadata), - headers: headers - }).then((response) => { - if (response.status === 412) { - return (response); - } - else { - return this._request('PUT', response.getResponseHeader('Location'), { - body: contentType.match(/^application\/json/) ? JSON.stringify(body) : body - }); - } - }); - } - /** - * Create a new file. - * - * @param {string} path - File path - * @param body - File content - * @param {string} contentType - File content-type - * @returns {Promise} Resolves with the response of the network request - * - * @private - */ - _createFile(path, body, contentType) { - return this._getParentId(path).then((parentId) => { - const fileName = baseName(path); - const metadata = { - title: metaTitleFromFileName(fileName), - mimeType: contentType, - parents: [{ - kind: "drive#fileLink", - id: parentId - }] - }; - return this._request('POST', BASE_URL + '/upload/drive/v2/files?uploadType=resumable', { - body: JSON.stringify(metadata), - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - } - }).then((response) => { - return this._request('POST', response.getResponseHeader('Location'), { - body: contentType.match(/^application\/json/) ? JSON.stringify(body) : body - }); - }); - }); - } - /** - * Request a file. - * - * @param {string} path - File path - * @param {Object} options - * @param {string} [options.ifNoneMath] - Only return the file if its ETag - * doesn't match the given string - * @returns {Promise} Resolves with an object containing the status code, - * body, content-type and revision - * - * @private - */ - _getFile(path, options) { - return this._getFileId(path).then((id) => { - return this._getMeta(id).then((meta) => { - let etagWithoutQuotes; - if (typeof (meta) === 'object' && typeof (meta.etag) === 'string') { - etagWithoutQuotes = this.stripQuotes(meta.etag); - } - if (options && options.ifNoneMatch && (etagWithoutQuotes === options.ifNoneMatch)) { - return Promise.resolve({ statusCode: 304 }); - } - if (!meta.downloadUrl) { - if (meta.exportLinks && meta.exportLinks['text/html']) { - // Documents that were generated inside GoogleDocs have no - // downloadUrl, but you can export them to text/html instead: - meta.mimeType += ';export=text/html'; - meta.downloadUrl = meta.exportLinks['text/html']; - } - else { - // empty file - return Promise.resolve({ statusCode: 200, body: '', contentType: meta.mimeType, revision: etagWithoutQuotes }); - } - } - const params = { - responseType: 'arraybuffer' - }; - return this._request('GET', meta.downloadUrl, params).then((response) => { - //first encode the response as text, and later check if - //text appears to actually be binary data - return (0, util_1.getTextFromArrayBuffer)(response.response, 'UTF-8').then(function (responseText) { - let body = responseText; - if (meta.mimeType.match(/^application\/json/)) { - try { - body = JSON.parse(body); - } - catch (e) { - // body couldn't be parsed as JSON, so we'll just return it as is - } - } - else if ((0, util_1.shouldBeTreatedAsBinary)(responseText, meta.mimeType)) { - //return unprocessed response - body = response.response; - } - return { - statusCode: 200, - body: body, - contentType: meta.mimeType, - revision: etagWithoutQuotes - }; - }); - }); - }); - }); - } - /** - * Request a directory. - * - * @param {string} path - Directory path - * @returns {Promise} Resolves with an object containing the status code, - * body and content-type - * - * @private - */ - _getFolder(path) { - return this._getFileId(path).then((id) => { - let data, etagWithoutQuotes, itemsMap; - if (!id) { - return Promise.resolve({ statusCode: 404 }); - } - const query = '\'' + id + '\' in parents'; - const fields = 'items(downloadUrl,etag,fileSize,id,mimeType,title,labels)'; - return this._request('GET', BASE_URL + '/drive/v2/files?' - + 'q=' + encodeURIComponent(query) - + '&fields=' + encodeURIComponent(fields) - + '&maxResults=1000' - + '&trashed=false', {}) - .then((response) => { - var _a; - if (response.status !== 200) { - return Promise.reject('request failed or something: ' + response.status); - } - try { - data = JSON.parse(response.responseText); - } - catch (e) { - return Promise.reject('non-JSON response from GoogleDrive'); - } - itemsMap = {}; - for (const item of data.items) { - if ((_a = item.labels) === null || _a === void 0 ? void 0 : _a.trashed) { - continue; - } // ignore deleted files - etagWithoutQuotes = this.stripQuotes(item.etag); - if (item.mimeType === GD_DIR_MIME_TYPE) { - this._fileIdCache.set(path + (0, util_1.cleanPath)(item.title) + '/', item.id); - itemsMap[item.title + '/'] = { - ETag: etagWithoutQuotes - }; - } - else { - this._fileIdCache.set(path + (0, util_1.cleanPath)(item.title), item.id); - itemsMap[item.title] = { - ETag: etagWithoutQuotes, - 'Content-Type': item.mimeType, - 'Content-Length': item.fileSize - }; - } - } - // FIXME: add revision of folder! - return Promise.resolve({ statusCode: 200, body: itemsMap, contentType: RS_DIR_MIME_TYPE, revision: undefined }); - }); - }); - } - /** - * Get the ID of a parent path. - * - * Creates the directory if it doesn't exist yet. - * - * @param {string} path - Full path of a directory or file - * @returns {Promise} Resolves with ID of the parent directory. - * - * @private - */ - _getParentId(path) { - const foldername = parentPath(path); - return this._getFileId(foldername).then((parentId) => { - if (parentId) { - return Promise.resolve(parentId); - } - else { - return this._createFolder(foldername); - } - }); - } - /** - * Create a directory. - * - * Creates all parent directories as well if any of them didn't exist yet. - * - * @param {string} path - Directory path - * @returns {Promise} Resolves with the ID of the new directory - * - * @private - */ - _createFolder(path) { - return this._getParentId(path).then((parentId) => { - return this._request('POST', BASE_URL + '/drive/v2/files', { - body: JSON.stringify({ - title: metaTitleFromFileName(baseName(path)), - mimeType: GD_DIR_MIME_TYPE, - parents: [{ - id: parentId - }] - }), - headers: { - 'Content-Type': 'application/json; charset=UTF-8' - } - }).then((response) => { - const meta = JSON.parse(response.responseText); - return Promise.resolve(meta.id); - }); - }); - } - /** - * Get the ID of a file. - * - * @param {string} path - File path - * @returns {Promise} Resolves with the ID - * - * @private - */ - _getFileId(path) { - let id; - if (path === '/') { - // "root" is a special alias for the fileId of the root folder - return Promise.resolve('root'); - } - else if ((id = this._fileIdCache.get(path))) { - // id is cached. - return Promise.resolve(id); - } - // id is not cached (or file doesn't exist). - // load parent folder listing to propagate / update id cache. - return this._getFolder(parentPath(path)).then(() => { - id = this._fileIdCache.get(path); - if (!id) { - if (path.substr(-1) === '/') { - return this._createFolder(path).then(() => { - return this._getFileId(path); - }); - } - else { - return Promise.resolve(); - } - } - return Promise.resolve(id); - }); - } - /** - * Get the metadata for a given file ID. - * - * @param {string} id - File ID - * @returns {Promise} Resolves with an object containing the metadata - * - * @private - */ - _getMeta(id) { - return this._request('GET', BASE_URL + '/drive/v2/files/' + id, {}).then(function (response) { - if (response.status === 200) { - return Promise.resolve(JSON.parse(response.responseText)); - } - else { - return Promise.reject("request (getting metadata for " + id + ") failed with status: " + response.status); - } - }); - } - /** - * Make a network request. - * - * @param {string} method - Request method - * @param {string} url - Target URL - * @param {Object} options - Request options - * @returns {Promise} Resolves with the response of the network request - * - * @private - */ - _request(method, url, options) { - if (this.isForbiddenRequestMethod(method, url)) { - return Promise.reject(`Don't use ${method} on directories!`); - } - if (!options.headers) { - options.headers = {}; - } - options.headers['Authorization'] = 'Bearer ' + this.token; - this.rs._emit('wire-busy', { - method: method, - isFolder: (0, util_1.isFolder)(url) - }); - return (0, requests_1.requestWithTimeout)(method, url, options).then((xhr) => { - // Google tokens expire from time to time... - if (xhr && xhr.status === 401) { - this.connect(); - return; - } - else { - if (!this.online) { - this.online = true; - this.rs._emit('network-online'); - } - this.rs._emit('wire-done', { - method: method, - isFolder: (0, util_1.isFolder)(url), - success: true - }); - return Promise.resolve(xhr); - } - }, (error) => { - if (this.online) { - this.online = false; - this.rs._emit('network-offline'); - } - this.rs._emit('wire-done', { - method: method, - isFolder: (0, util_1.isFolder)(url), - success: false - }); - return Promise.reject(error); - }); - } - /** - * Initialize the Google Drive backend. - * - * @param {Object} remoteStorage - RemoteStorage instance - * - * @protected - */ - static _rs_init(remoteStorage) { - const config = remoteStorage.apiKeys.googledrive; - if (config) { - remoteStorage.googledrive = new GoogleDrive(remoteStorage, config.clientId); - if (remoteStorage.backend === 'googledrive') { - remoteStorage._origRemote = remoteStorage.remote; - remoteStorage.remote = remoteStorage.googledrive; - hookGetItemURL(remoteStorage); - } - } - } - /** - * Inform about the availability of the Google Drive backend. - * - * @returns {Boolean} - * - * @protected - */ - static _rs_supported() { - return true; - } - /** - * Remove Google Drive as a backend. - * - * @param {Object} remoteStorage - RemoteStorage instance - * - * @protected - */ - static _rs_cleanup(remoteStorage) { - remoteStorage.setBackend(undefined); - if (remoteStorage._origRemote) { - remoteStorage.remote = remoteStorage._origRemote; - delete remoteStorage._origRemote; - } - unHookGetItemURL(remoteStorage); - } -} -(0, util_1.applyMixins)(GoogleDrive, [eventhandling_1.default]); -module.exports = GoogleDrive; - - -/***/ }), - -/***/ "./src/indexeddb.ts": -/*!**************************!*\ - !*** ./src/indexeddb.ts ***! - \**************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -/** - * TODO rewrite, doesn't expose GPD anymore, it's in cachinglayer now - * - * This file exposes a get/put/delete interface, accessing data in an IndexedDB. - * - * There are multiple parts to this interface: - * - * The RemoteStorage integration: - * - IndexedDB._rs_supported() determines if IndexedDB support - * is available. If it isn't, RemoteStorage won't initialize the feature. - * - IndexedDB._rs_init() initializes the feature. It returns - * a promise that is fulfilled as soon as the database has been opened and - * migrated. - * - * The storage interface (IndexedDB object): - * - Usually this is accessible via "remoteStorage.local" - * - #get() takes a path and returns a promise. - * - #put() takes a path, body and contentType and also returns a promise. - * - #delete() takes a path and also returns a promise. - * - #on('change', ...) events, being fired whenever something changes in - * the storage. Change events roughly follow the StorageEvent pattern. - * They have "oldValue" and "newValue" properties, which can be used to - * distinguish create/update/delete operations and analyze changes in - * change handlers. In addition they carry a "origin" property, which - * is either "window", "local", or "remote". "remote" events are fired - * whenever a change comes in from Sync. - * - * The sync interface (also on IndexedDB object): - * - #getNodes([paths]) returns the requested nodes in a promise. - * - #setNodes(map) stores all the nodes given in the (path -> node) map. - * - * @interface - */ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const cachinglayer_1 = __importDefault(__webpack_require__(/*! ./cachinglayer */ "./src/cachinglayer.ts")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const DB_VERSION = 2; -const DEFAULT_DB_NAME = 'remotestorage'; -// TODO very weird that this is re-assigned -let DEFAULT_DB; -class IndexedDB extends cachinglayer_1.default { - constructor(database) { - super(); - this.addEvents(['change', 'local-events-done']); - this.db = database || DEFAULT_DB; - if (!this.db) { - // TODO shouldn't this throw an error? - (0, log_1.default)("[IndexedDB] Failed to open DB"); - return undefined; - } - this.getsRunning = 0; - this.putsRunning = 0; - /** - * Given a node for which uncommitted changes exist, this cache - * stores either the entire uncommitted node, or false for a deletion. - * The node's path is used as the key. - * - * changesQueued stores changes for which no IndexedDB transaction has - * been started yet. - */ - this.changesQueued = {}; - /** - * Given a node for which uncommitted changes exist, this cache - * stores either the entire uncommitted node, or false for a deletion. - * The node's path is used as the key. - * - * At any time there is at most one IndexedDB transaction running. - * changesRunning stores the changes that are included in that currently - * running IndexedDB transaction, or if none is running, of the last one - * that ran. - */ - this.changesRunning = {}; - // TODO document - this.commitSlownessWarning = null; - } - /** - * TODO: Document - */ - getNodes(paths) { - return __awaiter(this, void 0, void 0, function* () { - const misses = [], fromCache = {}; - for (let i = 0, len = paths.length; i < len; i++) { - if (this.changesQueued[paths[i]] !== undefined) { - fromCache[paths[i]] = (0, util_1.deepClone)(this.changesQueued[paths[i]] || undefined); - } - else if (this.changesRunning[paths[i]] !== undefined) { - fromCache[paths[i]] = (0, util_1.deepClone)(this.changesRunning[paths[i]] || undefined); - } - else { - misses.push(paths[i]); - } - } - if (misses.length > 0) { - return this.getNodesFromDb(misses).then(function (nodes) { - for (const i in fromCache) { - nodes[i] = fromCache[i]; - } - return nodes; - }); - } - else { - return Promise.resolve(fromCache); - } - }); - } - /** - * TODO: Document - */ - setNodes(nodes) { - return __awaiter(this, void 0, void 0, function* () { - for (const i in nodes) { - this.changesQueued[i] = nodes[i] || false; - } - this.maybeFlush(); - return Promise.resolve(); - }); - } - /** - * TODO: Document - */ - maybeFlush() { - if (this.putsRunning === 0) { - this.flushChangesQueued(); - } - else { - if (!this.commitSlownessWarning) { - this.commitSlownessWarning = __webpack_require__.g.setInterval(function () { - console.warn('WARNING: waited more than 10 seconds for previous commit to finish'); - }, 10000); - } - } - } - /** - * TODO: Document - */ - flushChangesQueued() { - if (this.commitSlownessWarning) { - clearInterval(this.commitSlownessWarning); - this.commitSlownessWarning = null; - } - if (Object.keys(this.changesQueued).length > 0) { - this.changesRunning = this.changesQueued; - this.changesQueued = {}; - this.setNodesInDb(this.changesRunning).then(this.flushChangesQueued.bind(this)); - } - } - /** - * TODO: Document - */ - getNodesFromDb(paths) { - return new Promise((resolve, reject) => { - const transaction = this.db.transaction(['nodes'], 'readonly'); - const nodes = transaction.objectStore('nodes'); - const retrievedNodes = {}; - this.getsRunning++; - paths.map((path) => { - nodes.get(path).onsuccess = (evt) => { - retrievedNodes[path] = evt.target.result; - }; - }); - transaction.oncomplete = () => { - resolve(retrievedNodes); - this.getsRunning--; - }; - transaction.onerror = transaction.onabort = () => { - reject('get transaction error/abort'); - this.getsRunning--; - }; - }); - } - /** - * TODO: Document - */ - setNodesInDb(nodes) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - const transaction = this.db.transaction(['nodes'], 'readwrite'); - const nodesStore = transaction.objectStore('nodes'); - const startTime = new Date().getTime(); - this.putsRunning++; - (0, log_1.default)('[IndexedDB] Starting put', nodes, this.putsRunning); - for (const path in nodes) { - const node = nodes[path]; - if (typeof (node) === 'object') { - try { - nodesStore.put(node); - } - catch (e) { - (0, log_1.default)('[IndexedDB] Error while putting', node, e); - throw e; - } - } - else { - try { - nodesStore.delete(path); - } - catch (e) { - (0, log_1.default)('[IndexedDB] Error while removing', nodesStore, node, e); - throw e; - } - } - } - transaction.oncomplete = () => { - this.putsRunning--; - (0, log_1.default)('[IndexedDB] Finished put', nodes, this.putsRunning, (new Date().getTime() - startTime) + 'ms'); - resolve(); - }; - transaction.onerror = () => { - this.putsRunning--; - reject('transaction error'); - }; - transaction.onabort = () => { - reject('transaction abort'); - this.putsRunning--; - }; - }); - }); - } - /** - * TODO: Document - */ - // TODO add real types once known - reset(callback) { - const dbName = this.db.name; - this.db.close(); - IndexedDB.clean(this.db.name, () => { - IndexedDB.open(dbName, (err, other) => { - if (err) { - (0, log_1.default)('[IndexedDB] Error while resetting local storage', err); - } - else { - // hacky! - this.db = other; - } - if (typeof callback === 'function') { - callback(self); - } - }); - }); - } - /** - * TODO: Document - */ - forAllNodes(cb) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve /*, reject*/) => { - const transaction = this.db.transaction(['nodes'], 'readonly'); - const cursorReq = transaction.objectStore('nodes').openCursor(); - cursorReq.onsuccess = (evt) => { - const cursor = evt.target.result; - if (cursor) { - cb(this.migrate(cursor.value)); - cursor.continue(); - } - else { - resolve(); - } - }; - }); - }); - } - closeDB() { - if (this.putsRunning === 0) { // check if we are currently writing to the DB - this.db.close(); - } - else { - setTimeout(this.closeDB.bind(this), 100); // try again a little later - } - } - /** - * TODO: Document - */ - // TODO add real types once known - static open(name, callback) { - const timer = setTimeout(function () { - callback("timeout trying to open db"); - }, 10000); - try { - const req = indexedDB.open(name, DB_VERSION); - req.onerror = function () { - (0, log_1.default)('[IndexedDB] Opening DB failed', req); - clearTimeout(timer); - callback(req.error); - }; - req.onupgradeneeded = function (event) { - const db = req.result; - (0, log_1.default)("[IndexedDB] Upgrade: from ", event.oldVersion, " to ", event.newVersion); - if (event.oldVersion !== 1) { - (0, log_1.default)("[IndexedDB] Creating object store: nodes"); - db.createObjectStore('nodes', { keyPath: 'path' }); - } - (0, log_1.default)("[IndexedDB] Creating object store: changes"); - db.createObjectStore('changes', { keyPath: 'path' }); - }; - req.onsuccess = function () { - clearTimeout(timer); - // check if all object stores exist - const db = req.result; - if (!db.objectStoreNames.contains('nodes') || !db.objectStoreNames.contains('changes')) { - (0, log_1.default)("[IndexedDB] Missing object store. Resetting the database."); - IndexedDB.clean(name, function () { - IndexedDB.open(name, callback); - }); - return; - } - callback(null, req.result); - }; - } - catch (error) { - (0, log_1.default)("[IndexedDB] Failed to open database: " + error); - (0, log_1.default)("[IndexedDB] Resetting database and trying again."); - clearTimeout(timer); - IndexedDB.clean(name, function () { - IndexedDB.open(name, callback); - }); - } - } - /** - * TODO: Document - */ - static clean(databaseName, callback) { - const req = indexedDB.deleteDatabase(databaseName); - req.onsuccess = function () { - (0, log_1.default)('[IndexedDB] Done removing DB'); - callback(); - }; - // TODO check if this does anything as onabort does not exist on type according to ts - req.onerror = req.onabort = function (evt) { - console.error('Failed to remove database "' + databaseName + '"', evt); - }; - } - /** - * Initialize the IndexedDB backend. - * - * @param {Object} remoteStorage - RemoteStorage instance - * - * @protected - */ - // TODO add real type once known - static _rs_init(remoteStorage) { - return new Promise((resolve, reject) => { - IndexedDB.open(DEFAULT_DB_NAME, function (err, db) { - if (err) { - reject(err); - } - else { - DEFAULT_DB = db; - // TODO remove once real type once known - db.onerror = () => { - remoteStorage._emit('error', err); - }; - resolve(); - } - }); - }); - } - /** - * Inform about the availability of the IndexedDB backend. - * - * @param {Object} rs - RemoteStorage instance - * @returns {Boolean} - * - * @protected - */ - static _rs_supported() { - return new Promise((resolve, reject) => { - const context = (0, util_1.getGlobalContext)(); - // FIXME: this is causing an error in chrome - // context.indexedDB = context.indexedDB || context.webkitIndexedDB || - // context.mozIndexedDB || context.oIndexedDB || - // context.msIndexedDB; - // Detect browsers with known IndexedDb issues (e.g. Android pre-4.4) - let poorIndexedDbSupport = false; - if (typeof navigator !== 'undefined' && - navigator.userAgent.match(/Android (2|3|4\.[0-3])/)) { - // Chrome and Firefox support IndexedDB - if (!navigator.userAgent.match(/Chrome|Firefox/)) { - poorIndexedDbSupport = true; - } - } - if ('indexedDB' in context && !poorIndexedDbSupport) { - try { - const check = indexedDB.open("rs-check"); - check.onerror = function ( /* event */) { - reject(); - }; - check.onsuccess = function ( /* event */) { - check.result.close(); - indexedDB.deleteDatabase("rs-check"); - resolve(); - }; - } - catch (e) { - reject(); - } - } - else { - reject(); - } - }); - } - /** - * Remove IndexedDB as a backend. - * - * @param {Object} remoteStorage - RemoteStorage instance - * - * @protected - */ - static _rs_cleanup(remoteStorage) { - return new Promise((resolve /*, reject*/) => { - if (remoteStorage.local) { - remoteStorage.local.closeDB(); - } - IndexedDB.clean(DEFAULT_DB_NAME, resolve); - }); - } - diffHandler() { - // empty - } -} -(0, util_1.applyMixins)(IndexedDB, [eventhandling_1.default]); -module.exports = IndexedDB; - - -/***/ }), - -/***/ "./src/inmemorystorage.ts": -/*!********************************!*\ - !*** ./src/inmemorystorage.ts ***! - \********************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const cachinglayer_1 = __importDefault(__webpack_require__(/*! ./cachinglayer */ "./src/cachinglayer.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -/** - * In-memory caching adapter. Used when no IndexedDB or localStorage - * available. - * - * @class - **/ -class InMemoryStorage extends cachinglayer_1.default { - constructor() { - super(); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this._storage = {}; - this.addEvents(['change', 'local-events-done']); - } - getNodes(paths) { - const nodes = {}; - for (let i = 0, len = paths.length; i < len; i++) { - // Should use a clone of whatever we are retrieving to prevent - // mutation, also to follow the same behavior as localStorage - // and indexeddb. - nodes[paths[i]] = (0, util_1.deepClone)(this._storage[paths[i]]); - } - return Promise.resolve(nodes); - } - setNodes(nodes) { - for (const path in nodes) { - if (nodes[path] === undefined) { - delete this._storage[path]; - } - else { - this._storage[path] = nodes[path]; - } - } - return Promise.resolve(); - } - forAllNodes(cb) { - for (const path in this._storage) { - cb(this.migrate(this._storage[path])); - } - return Promise.resolve(); - } - diffHandler() { - // empty - } - /** - * Initialize the InMemoryStorage backend. - * - * @param {Object} remoteStorage - RemoteStorage instance - * - * @protected - */ - static _rs_init() { - // empty - } - /** - * Inform about the availability of the InMemoryStorage backend. - * - * @returns {Boolean} - * - * @protected - */ - static _rs_supported() { - // In-memory storage is always supported - return true; - } - /** - * Remove InMemoryStorage as a backend. - * - * @protected - */ - static _rs_cleanup() { - // empty - } -} -(0, util_1.applyMixins)(InMemoryStorage, [eventhandling_1.default]); -module.exports = InMemoryStorage; - - -/***/ }), - -/***/ "./src/localstorage.ts": -/*!*****************************!*\ - !*** ./src/localstorage.ts ***! - \*****************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const cachinglayer_1 = __importDefault(__webpack_require__(/*! ./cachinglayer */ "./src/cachinglayer.ts")); -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -/** - * localStorage caching adapter. Used when no IndexedDB available. - **/ -const NODES_PREFIX = "remotestorage:cache:nodes:"; -const CHANGES_PREFIX = "remotestorage:cache:changes:"; -function isRemoteStorageKey(key) { - return key.substr(0, NODES_PREFIX.length) === NODES_PREFIX || - key.substr(0, CHANGES_PREFIX.length) === CHANGES_PREFIX; -} -function isNodeKey(key) { - return key.substr(0, NODES_PREFIX.length) === NODES_PREFIX; -} -class LocalStorage extends cachinglayer_1.default { - constructor() { - super(); - this.addEvents(['change', 'local-events-done']); - } - // TODO fix this - diffHandler(...args) { - return; - } - getNodes(paths) { - const nodes = {}; - for (let i = 0, len = paths.length; i < len; i++) { - try { - nodes[paths[i]] = JSON.parse(localStorage[NODES_PREFIX + paths[i]]); - } - catch (e) { - nodes[paths[i]] = undefined; - } - } - return Promise.resolve(nodes); - } - setNodes(nodes) { - for (const path in nodes) { - // TODO shouldn't we use getItem/setItem? - localStorage[NODES_PREFIX + path] = JSON.stringify(nodes[path]); - } - return Promise.resolve(); - } - forAllNodes(cb) { - let node; - for (let i = 0, len = localStorage.length; i < len; i++) { - if (isNodeKey(localStorage.key(i))) { - try { - // NOTE: this is coming from caching layer todo fix via interface or similar - node = this.migrate(JSON.parse(localStorage[localStorage.key(i)])); - } - catch (e) { - node = undefined; - } - if (node) { - cb(node); - } - } - } - return Promise.resolve(); - } - /** - * Initialize the LocalStorage backend. - * - * @protected - */ - static _rs_init() { - return; - } - /** - * Inform about the availability of the LocalStorage backend. - * - * @protected - */ - static _rs_supported() { - return (0, util_1.localStorageAvailable)(); - } - /** - * Remove LocalStorage as a backend. - * - * @protected - * - * TODO: tests missing! - */ - static _rs_cleanup() { - const keys = []; - for (let i = 0, len = localStorage.length; i < len; i++) { - const key = localStorage.key(i); - if (isRemoteStorageKey(key)) { - keys.push(key); - } - } - keys.forEach((key) => { - (0, log_1.default)('[LocalStorage] Removing', key); - delete localStorage[key]; - }); - } -} -(0, util_1.applyMixins)(LocalStorage, [eventhandling_1.default]); -module.exports = LocalStorage; - - -/***/ }), - -/***/ "./src/log.ts": -/*!********************!*\ - !*** ./src/log.ts ***! - \********************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const config_1 = __importDefault(__webpack_require__(/*! ./config */ "./src/config.ts")); -/** - * Log using console.log, when remoteStorage logging is enabled. - * - * You can enable logging with ``RemoteStorage#enableLog``. - * - * (You can also enable logging during remoteStorage object creation. See: - * {@link RemoteStorage}). - */ -function log(...args) { - if (config_1.default.logging) { - // eslint-disable-next-line no-console - console.log(...args); - } -} -module.exports = log; - - -/***/ }), - -/***/ "./src/remote.ts": -/*!***********************!*\ - !*** ./src/remote.ts ***! - \***********************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RemoteBase = void 0; -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -/** - * The ancestor for WireClient, GoogleDrive & Dropbox - */ -class RemoteBase extends eventhandling_1.default { - constructor(rs) { - super(); - this.rs = rs; - this.connected = false; - // TODO: Should `online` be set true or false for all, here or in configure? - } - stopWaitingForToken() { - if (!this.connected) { - this._emit('not-connected'); - } - } - addQuotes(str) { - if (typeof (str) !== 'string') { - return str; - } - if (str === '*') { - return '*'; - } - return '"' + str + '"'; - } - stripQuotes(str) { - if (typeof (str) !== 'string') { - return str; - } - return str.replace(/^["']|["']$/g, ''); - } - isForbiddenRequestMethod(method, uri) { - if (method === 'PUT' || method === 'DELETE') { - return (0, util_1.isFolder)(uri); - } - else { - return false; - } - } -} -exports.RemoteBase = RemoteBase; - - -/***/ }), - -/***/ "./src/remotestorage.ts": -/*!******************************!*\ - !*** ./src/remotestorage.ts ***! - \******************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.RemoteStorage = void 0; -const config_1 = __importDefault(__webpack_require__(/*! ./config */ "./src/config.ts")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const access_1 = __importDefault(__webpack_require__(/*! ./access */ "./src/access.ts")); -const authorize_1 = __importDefault(__webpack_require__(/*! ./authorize */ "./src/authorize.ts")); -const baseclient_1 = __importDefault(__webpack_require__(/*! ./baseclient */ "./src/baseclient.ts")); -const caching_1 = __importDefault(__webpack_require__(/*! ./caching */ "./src/caching.ts")); -const eventhandling_1 = __webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts"); -const googledrive_1 = __importDefault(__webpack_require__(/*! ./googledrive */ "./src/googledrive.ts")); -const dropbox_1 = __importDefault(__webpack_require__(/*! ./dropbox */ "./src/dropbox.ts")); -const solid_1 = __importDefault(__webpack_require__(/*! ./solid */ "./src/solid.ts")); -const discover_1 = __importDefault(__webpack_require__(/*! ./discover */ "./src/discover.ts")); -const sync_error_1 = __importDefault(__webpack_require__(/*! ./sync-error */ "./src/sync-error.ts")); -const unauthorized_error_1 = __importDefault(__webpack_require__(/*! ./unauthorized-error */ "./src/unauthorized-error.ts")); -const features_1 = __importDefault(__webpack_require__(/*! ./features */ "./src/features.ts")); -// TODO this is assigned to RemoteStorage.util later; check if still needed -const util = __importStar(__webpack_require__(/*! ./util */ "./src/util.ts")); -const globalContext = (0, util_1.getGlobalContext)(); -// declare global { -// interface Window { cordova: any }; -// } -let hasLocalStorage; -// TODO document and/or refactor (seems weird) -function emitUnauthorized(r) { - if (r.statusCode === 403 || r.statusCode === 401) { - this._emit('error', new unauthorized_error_1.default()); - } - return Promise.resolve(r); -} -/** -* Check if interval is valid: numeric and between 2s and 1hr inclusive -*/ -function isValidInterval(interval) { - return (typeof interval === 'number' && - interval >= 2000 && - interval <= 3600000); -} -var ApiKeyType; -(function (ApiKeyType) { - ApiKeyType["GOOGLE"] = "googledrive"; - ApiKeyType["DROPBOX"] = "dropbox"; -})(ApiKeyType || (ApiKeyType = {})); -/** - * Create a `remoteStorage` class instance so: - * - * ```js - * const remoteStorage = new RemoteStorage(); - * ``` - * - * The constructor can optionally be called with a configuration object. This - * example shows all default values: - * - * ```js - * const remoteStorage = new RemoteStorage({ - * cache: true, - * changeEvents: { - * local: true, - * window: false, - * remote: true, - * conflict: true - * }, - * cordovaRedirectUri: undefined, - * logging: false, - * modules: [] - * }); - * ``` - * - * > [!NOTE] - * > In the current version, it is only possible to use a single `remoteStorage` - * > instance. You cannot connect to two different remotes in parallel yet. - * > We intend to support this eventually. - * - * > [!TIP] - * > For the change events configuration, you have to set all events - * > explicitly. Otherwise it disables the unspecified ones. - * - * ## Events - * - * You can add event handlers to your `remoteStorage` instance by using the - * {@link on} function. For example: - * - * ```js - * remoteStorage.on('connected', function() { - * // Storage account has been connected, let’s roll! - * }); - * ``` - * - * ### `ready` - * - * Emitted when all features are loaded and the RS instance is ready to be used - * in your app - * - * ### `not-connected` - * - * Emitted when ready, but no storage connected ("anonymous mode") - * - * ### `connected` - * - * Emitted when a remote storage has been connected - * - * ### `disconnected` - * - * Emitted after disconnect - * - * ### `error` - * - * Emitted when an error occurs; receives an error object as argument - * - * There are a handful of known errors, which are identified by the `name` - * property of the error object: - * - * * `Unauthorized` - * - * Emitted when a network request resulted in a 401 or 403 response. You can - * use this event to handle invalid OAuth tokens in custom UI (i.e. when a - * stored token has been revoked or expired by the RS server). - * - * * `DiscoveryError` - * - * A variety of storage discovery errors, e.g. from user address input - * validation, or user address lookup issues - * - * #### Example - * - * ```js - * remoteStorage.on('error', err => console.log(err)); - * - * // { - * // name: "Unauthorized", - * // message: "App authorization expired or revoked.", - * // stack: "Error↵ at new a.Unauthorized (vendor.js:65710:41870)" - * // } - * ``` - * - * ### `connecting` - * - * Emitted before webfinger lookup - * - * ### `authing` - * - * Emitted before redirecting to the OAuth server - * - * ### `wire-busy` - * - * Emitted when a network request starts - * - * ### `wire-done` - * - * Emitted when a network request completes - * - * ### `sync-req-done` - * - * Emitted when a single sync request has finished. Callback functions - * receive an object as argument, informing the client of remaining items - * in the current sync task queue. - * - * #### Example - * - * ```js - * remoteStorage.on('sync-req-done', result => console.log(result)); - * // { tasksRemaining: 21 } - * ``` - * - * > [!NOTE] - * > The internal task queue holds at most 100 items at the same time, - * > regardless of the overall amount of items to sync. Therefore, this number - * > is only an indicator of sync status, not a precise amount of items left - * > to sync. It can be useful to determine if your app should display any - * > kind of sync status/progress information for the cycle or not. - * - * ### `sync-done` - * - * Emitted when a sync cycle has been completed and a new sync is scheduled. - * - * The callback function receives an object as argument, informing the client - * if the sync process has completed successfully or not. - * - * #### Example - * - * ```js - * remoteStorage.on('sync-done', result => console.log(result)); - * // { completed: true } - * ``` - * - * If `completed` is `false`, it means that some of the sync requests have - * failed and will be retried in the next sync cycle (usually a few seconds - * later in this case). This is not an unusual scenario on mobile networks or - * when doing a large initial sync for example. - * - * For an app's user interface, you may want to consider the sync process as - * ongoing in this case, and wait until your app sees a positive `completed` - * status before updating the UI. - * - * ### `network-offline` - * - * Emitted once when a wire request fails for the first time, and - * `remote.online` is set to false - * - * ### `network-online` - * - * Emitted once when a wire request succeeds for the first time after a failed - * one, and `remote.online` is set back to true - * - * ### `sync-interval-change` - * - * Emitted when the sync interval changes - */ -class RemoteStorage { - constructor(cfg) { - /** - * Pending get/put/delete calls - * @internal - */ - this._pending = []; - /** - * TODO: document - * @internal - */ - this._cleanups = []; - /** - * TODO: document - * @internal - */ - this._pathHandlers = { change: {} }; - /** - * Holds OAuth app keys for Dropbox, Google Drive - * @internal - */ - this.apiKeys = {}; - // - // FEATURES INITIALIZATION - // - /** - * @internal - */ - this._init = features_1.default.loadFeatures; - /** - * @internal - */ - this.features = features_1.default.features; - /** - * @internal - */ - this.loadFeature = features_1.default.loadFeature; - /** - * @internal - */ - this.featureSupported = features_1.default.featureSupported; - /** - * @internal - */ - this.featureDone = features_1.default.featureDone; - /** - * @internal - */ - this.featuresDone = features_1.default.featuresDone; - /** - * @internal - */ - this.featuresLoaded = features_1.default.featuresLoaded; - /** - * @internal - */ - this.featureInitialized = features_1.default.featureInitialized; - /** - * @internal - */ - this.featureFailed = features_1.default.featureFailed; - /** - * @internal - */ - this.hasFeature = features_1.default.hasFeature; - /** - * @internal - */ - this._setCachingModule = features_1.default._setCachingModule; - /** - * @internal - */ - this._collectCleanupFunctions = features_1.default._collectCleanupFunctions; - /** - * @internal - */ - this._fireReady = features_1.default._fireReady; - /** - * @internal - */ - this.initFeature = features_1.default.initFeature; - // Initial configuration property settings. - // TODO use modern JS to merge object properties - if (typeof cfg === 'object') { - (0, util_1.extend)(config_1.default, cfg); - } - this.addEvents([ - 'ready', 'authing', 'connecting', 'pod-not-selected', 'connected', 'disconnected', - 'not-connected', 'conflict', 'error', 'features-loaded', - 'sync-interval-change', 'sync-req-done', 'sync-done', - 'wire-busy', 'wire-done', 'network-offline', 'network-online' - ]); - this._setGPD({ - get: this._pendingGPD('get'), - put: this._pendingGPD('put'), - delete: this._pendingGPD('delete') - }); - hasLocalStorage = (0, util_1.localStorageAvailable)(); - if (hasLocalStorage) { - this.apiKeys = (0, util_1.getJSONFromLocalStorage)('remotestorage:api-keys') || {}; - this.setBackend(localStorage.getItem('remotestorage:backend') || 'remotestorage'); - } - // Keep a reference to the orginal `on` function - const origOn = this.on; - this.on = function (eventName, handler) { - if (this._allLoaded) { - // check if the handler should be called immediately, because the - // event has happened already - switch (eventName) { - case 'features-loaded': - setTimeout(handler, 0); - break; - case 'ready': - if (this.remote) { - setTimeout(handler, 0); - } - break; - case 'connected': - if (this.remote && this.remote.connected) { - setTimeout(handler, 0); - } - break; - case 'not-connected': - if (this.remote && !this.remote.connected) { - setTimeout(handler, 0); - } - break; - case 'pod-not-selected': - if ((this.remote instanceof solid_1.default) - && this.remote.getPodURLs().length > 0 - && this.remote.getPodURL() === null) { - setTimeout(handler, 0); - } - break; - } - } - return origOn.call(this, eventName, handler); - }; - // load all features and emit `ready` - this._init(); - /** - * TODO: document - */ - this.fireInitial = function () { - if (this.local) { - setTimeout(this.local.fireInitial.bind(this.local), 0); - } - }.bind(this); - this.on('ready', this.fireInitial.bind(this)); - this.loadModules(); - } - /** - * Indicating if remoteStorage is currently connected. - */ - get connected() { - return this.remote.connected; - } - /** - * Load all modules passed as arguments - * - * @internal - */ - loadModules() { - config_1.default.modules.forEach(this.addModule.bind(this)); - } - /** - * Initiate the OAuth authorization flow. - * - * @internal - */ - authorize(options) { - this.access.setStorageType(this.remote.storageApi); - if (typeof options.scope === 'undefined') { - options.scope = this.access.scopeParameter; - } - if (globalContext.cordova) { - options.redirectUri = config_1.default.cordovaRedirectUri; - } - else { - const location = authorize_1.default.getLocation(); - let redirectUri = location.origin; - if (location.pathname !== '/') { - redirectUri += location.pathname; - } - options.redirectUri = redirectUri; - } - if (typeof options.clientId === 'undefined') { - options.clientId = options.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]; - } - authorize_1.default.authorize(this, options); - } - /** - * TODO: document - * @internal - */ - impliedauth(storageApi, redirectUri) { - // TODO shouldn't these be default argument values? - storageApi = storageApi || this.remote.storageApi; - redirectUri = redirectUri || String(document.location); - (0, log_1.default)('ImpliedAuth proceeding due to absent authURL; storageApi = ' + storageApi + ' redirectUri = ' + redirectUri); - // Set a fixed access token, signalling to not send it as Bearer - this.remote.configure({ - token: authorize_1.default.IMPLIED_FAKE_TOKEN - }); - document.location.href = redirectUri; - } - /** - * Connect to a remoteStorage server. - * - * Discovers the WebFinger profile of the given user address and initiates - * the OAuth dance. - * - * This method must be called *after* all required access has been claimed. - * When using the connect widget, it will call this method when the user - * clicks/taps the "connect" button. - * - * Special cases: - * - * 1. If a bearer token is supplied as second argument, the OAuth dance - * will be skipped and the supplied token be used instead. This is - * useful outside of browser environments, where the token has been - * acquired in a different way. - * - * 2. If the Webfinger profile for the given user address doesn't contain - * an auth URL, the library will assume that client and server have - * established authorization among themselves, which will omit bearer - * tokens in all requests later on. This is useful for example when using - * Kerberos and similar protocols. - * - * @param userAddress - The user address (user@host) or URL to connect to. - * @param token - (optional) A bearer token acquired beforehand - * - * @example - * remoteStorage.connect('user@example.com'); - */ - connect(userAddress, token) { - this.setBackend('remotestorage'); - if (userAddress.indexOf('@') < 0 && !userAddress.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/)) { - this._emit('error', new RemoteStorage.DiscoveryError("Not a valid user address or URL.")); - return; - } - // Prefix URL with https:// if it's missing - if (userAddress.indexOf('@') < 0 && !userAddress.match(/^https?:\/\//)) { - userAddress = `https://${userAddress}`; - } - if (globalContext.cordova) { - if (typeof config_1.default.cordovaRedirectUri !== 'string') { - this._emit('error', new RemoteStorage.DiscoveryError("Please supply a custom HTTPS redirect URI for your Cordova app")); - return; - } - if (!globalContext.cordova.InAppBrowser) { - this._emit('error', new RemoteStorage.DiscoveryError("Please include the InAppBrowser Cordova plugin to enable OAuth")); - return; - } - } - this.remote.configure({ - userAddress: userAddress - }); - this._emit('connecting'); - const discoveryTimeout = setTimeout(() => { - this._emit('error', new RemoteStorage.DiscoveryError("No storage information found for this user address.")); - }, config_1.default.discoveryTimeout); - (0, discover_1.default)(userAddress).then((info) => { - clearTimeout(discoveryTimeout); - this._emit('authing'); - info.userAddress = userAddress; - this.remote.configure(info); - if (!this.remote.connected) { - if (info.authURL) { - if (typeof token === 'undefined') { - // Normal authorization step; the default way to connect - this.authorize({ authURL: info.authURL }); - } - else if (typeof token === 'string') { - // Token supplied directly by app/developer/user - (0, log_1.default)('Skipping authorization sequence and connecting with known token'); - this.remote.configure({ token: token }); - } - else { - throw new Error("Supplied bearer token must be a string"); - } - } - else { - // In lieu of an excplicit authURL, assume that the browser and - // server handle any authorization needs; for instance, TLS may - // trigger the browser to use a client certificate, or a 401 Not - // Authorized response may make the browser send a Kerberos ticket - // using the SPNEGO method. - this.impliedauth(); - } - } - }, ( /*err*/) => { - clearTimeout(discoveryTimeout); - this._emit('error', new RemoteStorage.DiscoveryError("No storage information found for this user address.")); - }); - } - /** - * Reconnect the remote server to get a new authorization. - * - * Useful when not using the connect widget and encountering an - * `Unauthorized` event. - */ - reconnect() { - this.remote.configure({ token: null }); - if (this.backend === 'remotestorage') { - this.connect(this.remote.userAddress); - } - else { - this.remote.connect(); - } - } - /** - * "Disconnect" from remote server to terminate current session. - * - * This method clears all stored settings and deletes the entire local - * cache. - */ - disconnect() { - if (this.remote) { - this.remote.configure({ - userAddress: null, - href: null, - storageApi: null, - token: null, - properties: null - }); - } - this._setGPD({ - get: this._pendingGPD('get'), - put: this._pendingGPD('put'), - delete: this._pendingGPD('delete') - }); - const n = this._cleanups.length; - let i = 0; - const oneDone = () => { - i++; - if (i >= n) { - this._init(); - // FIXME Re-enable when modules are all imports - // log('Done cleaning up, emitting disconnected and disconnect events'); - this._emit('disconnected'); - } - }; - if (n > 0) { - this._cleanups.forEach((cleanup) => { - const cleanupResult = cleanup(this); - if (typeof (cleanupResult) === 'object' && typeof (cleanupResult.then) === 'function') { - cleanupResult.then(oneDone); - } - else { - oneDone(); - } - }); - } - else { - oneDone(); - } - } - /** - * TODO: document - * @internal - */ - setBackend(what) { - this.backend = what; - if (hasLocalStorage) { - if (what) { - localStorage.setItem('remotestorage:backend', what); - } - else { - localStorage.removeItem('remotestorage:backend'); - } - } - } - /** - * Add a `change` event handler for the given path. Whenever a change - * happens (as determined by the local backend, such as e.g. - * `RemoteStorage.IndexedDB`), and the affected path is equal to or below the - * given 'path', the given handler is called. - * - * > [!TIP] - * > You should usually not use this method, but instead use the - * > `change` events provided by {@link BaseClient}. - * - * @param path - Absolute path to attach handler to - * @param handler - A function to handle the change - * - * @example - * remoteStorage.onChange('/bookmarks/', function() { - * // your code here - * }) - */ - onChange(path, handler) { - if (!this._pathHandlers.change[path]) { - this._pathHandlers.change[path] = []; - } - this._pathHandlers.change[path].push(handler); - } - /** - * Enable remoteStorage debug logging. - * - * Usually done when instantiating remoteStorage: - * - * ```js - * const remoteStorage = new RemoteStorage({ logging: true }); - * ``` - */ - enableLog() { - config_1.default.logging = true; - } - /** - * Disable remoteStorage debug logging - */ - disableLog() { - config_1.default.logging = false; - } - /** - * Log something to the debug log - * - * @internal - */ - log(...args) { - log_1.default.apply(RemoteStorage, args); - } - /** - * Set the OAuth key/ID for GoogleDrive and/or Dropbox backend support. - * - * @param apiKeys - A config object - * - * @example - * remoteStorage.setApiKeys({ - * dropbox: 'your-app-key', - * googledrive: 'your-client-id' - * }); - */ - setApiKeys(apiKeys) { - const validTypes = [ApiKeyType.GOOGLE, ApiKeyType.DROPBOX]; - if (typeof apiKeys !== 'object' || !Object.keys(apiKeys).every(type => validTypes.includes(type))) { - console.error('setApiKeys() was called with invalid arguments'); - return false; - } - Object.keys(apiKeys).forEach(type => { - const key = apiKeys[type]; - if (!key) { - delete this.apiKeys[type]; - return; - } - switch (type) { - case ApiKeyType.DROPBOX: - this.apiKeys[ApiKeyType.DROPBOX] = { appKey: key }; - if (typeof this.dropbox === 'undefined' || - this.dropbox.clientId !== key) { - dropbox_1.default._rs_init(this); - } - break; - case ApiKeyType.GOOGLE: - this.apiKeys[ApiKeyType.GOOGLE] = { clientId: key }; - if (typeof this.googledrive === 'undefined' || - this.googledrive.clientId !== key) { - googledrive_1.default._rs_init(this); - } - break; - } - return true; - }); - if (hasLocalStorage) { - localStorage.setItem('remotestorage:api-keys', JSON.stringify(this.apiKeys)); - } - } - /** - * Set redirect URI to be used for the OAuth redirect within the - * in-app-browser window in Cordova apps. See - * [Usage in Cordova apps](../../../cordova) for details. - * - * @param uri - A valid HTTP(S) URI - * - * @example - * remoteStorage.setCordovaRedirectUri('https://app.example.com'); - */ - setCordovaRedirectUri(uri) { - if (typeof uri !== 'string' || !uri.match(/http(s)?:\/\//)) { - throw new Error("Cordova redirect URI must be a URI string"); - } - config_1.default.cordovaRedirectUri = uri; - } - // - // GET/PUT/DELETE INTERFACE HELPERS - // - /** - * TODO: document - * @internal - */ - _setGPD(impl, context) { - function wrap(func) { - return function (...args) { - return func.apply(context, args) - .then(emitUnauthorized.bind(this)); - }; - } - this.get = wrap(impl.get); - this.put = wrap(impl.put); - this.delete = wrap(impl.delete); - } - /** - * TODO: document - * @internal - */ - _pendingGPD(methodName) { - return (...args) => { - const methodArguments = Array.prototype.slice.call(args); - return new Promise((resolve, reject) => { - this._pending.push({ - method: methodName, - args: methodArguments, - promise: { - resolve: resolve, - reject: reject - } - }); - }); - }; - } - /** - * TODO: document - * @internal - */ - _processPending() { - this._pending.forEach((pending) => { - try { - this[pending.method](...pending.args).then(pending.promise.resolve, pending.promise.reject); - } - catch (e) { - pending.promise.reject(e); - } - }); - this._pending = []; - } - // - // CHANGE EVENT HANDLING - // - /** - * TODO: document - * @internal - */ - _bindChange(object) { - object.on('change', this._dispatchEvent.bind(this, 'change')); - } - /** - * TODO: document - * @internal - */ - _dispatchEvent(eventName, event) { - Object.keys(this._pathHandlers[eventName]).forEach((path) => { - const pl = path.length; - if (event.path.substr(0, pl) === path) { - this._pathHandlers[eventName][path].forEach((handler) => { - const ev = {}; - for (const key in event) { - ev[key] = event[key]; - } - ev.relativePath = event.path.replace(new RegExp('^' + path), ''); - try { - handler(ev); - } - catch (e) { - console.error("'change' handler failed: ", e, e.stack); - this._emit('error', e); - } - }); - } - }); - } - /** - * This method allows you to quickly instantiate a BaseClient, which you can - * use to directly read and manipulate data in the connected storage account. - * - * Please use this method only for debugging and development, and choose or - * create a [data module](../../../data-modules/) for your app to use. - * - * @param path - The base directory of the BaseClient that will be returned - * (with a leading and a trailing slash) - * - * @returns A client with the specified scope (category/base directory) - * - * @example - * remoteStorage.scope('/pictures/').getListing(''); - * remoteStorage.scope('/public/pictures/').getListing(''); - */ - scope(path) { - if (typeof (path) !== 'string') { - throw 'Argument \'path\' of baseClient.scope must be a string'; - } - if (!this.access.checkPathPermission(path, 'r')) { - console.warn('WARNING: Please use remoteStorage.access.claim() to ask for access permissions first: https://remotestoragejs.readthedocs.io/en/latest/js-api/access.html#claim'); - } - return new baseclient_1.default(this, path); - } - /** - * Get the value of the sync interval when application is in the foreground - * - * @returns A number of milliseconds - * - * @example - * remoteStorage.getSyncInterval(); - * // 10000 - */ - getSyncInterval() { - return config_1.default.syncInterval; - } - /** - * Set the value of the sync interval when application is in the foreground - * - * @param interval - Sync interval in milliseconds (between 2000 and 3600000 [1 hour]) - * - * @example - remoteStorage.setSyncInterval(20000); - */ - setSyncInterval(interval) { - if (!isValidInterval(interval)) { - throw interval + " is not a valid sync interval"; - } - const oldValue = config_1.default.syncInterval; - config_1.default.syncInterval = interval; - this._emit('sync-interval-change', { - oldValue: oldValue, - newValue: interval - }); - } - /** - * Get the value of the sync interval when application is in the background - * - * @returns A number of milliseconds - * - * @example - * remoteStorage.getBackgroundSyncInterval(); - * // 60000 - */ - getBackgroundSyncInterval() { - return config_1.default.backgroundSyncInterval; - } - /** - * Set the value of the sync interval when the application is in the - * background - * - * @param interval - Sync interval in milliseconds (between 2000 and 3600000 [1 hour]) - * - * @example - * remoteStorage.setBackgroundSyncInterval(90000); - */ - setBackgroundSyncInterval(interval) { - if (!isValidInterval(interval)) { - throw interval + " is not a valid sync interval"; - } - const oldValue = config_1.default.backgroundSyncInterval; - config_1.default.backgroundSyncInterval = interval; - this._emit('sync-interval-change', { - oldValue: oldValue, - newValue: interval - }); - } - /** - * Get the value of the current sync interval. Can be background or - * foreground, custom or default. - * - * @returns number of milliseconds - * - * @example - * remoteStorage.getCurrentSyncInterval(); - * // 15000 - */ - getCurrentSyncInterval() { - return config_1.default.isBackground ? config_1.default.backgroundSyncInterval : config_1.default.syncInterval; - } - /** - * Get the value of the current network request timeout - * - * @returns A number of milliseconds - * - * @example - * remoteStorage.getRequestTimeout(); - * // 30000 - */ - getRequestTimeout() { - return config_1.default.requestTimeout; - } - /** - * Set the timeout for network requests. - * - * @param timeout - Timeout in milliseconds - * - * @example - * remoteStorage.setRequestTimeout(30000); - */ - setRequestTimeout(timeout) { - if (typeof timeout !== 'number') { - throw timeout + " is not a valid request timeout"; - } - config_1.default.requestTimeout = timeout; - } - /** - * TODO: document - * @internal - */ - syncCycle() { - if (!this.sync || this.sync.stopped) { - return; - } - this.on('sync-done', () => { - // FIXME Re-enable when modules are all imports - // log('[Sync] Sync done. Setting timer to', this.getCurrentSyncInterval()); - if (this.sync && !this.sync.stopped) { - if (this._syncTimer) { - clearTimeout(this._syncTimer); - this._syncTimer = undefined; - } - this._syncTimer = setTimeout(this.sync.sync.bind(this.sync), this.getCurrentSyncInterval()); - } - }); - this.sync.sync(); - } - /** - * Start synchronization with remote storage, downloading and uploading any - * changes within the cached paths. - * - * Please consider: local changes will attempt sync immediately, and remote - * changes should also be synced timely when using library defaults. So - * this is mostly useful for letting users sync manually, when pressing a - * sync button for example. This might feel safer to them sometimes, esp. - * when shifting between offline and online a lot. - * - * @returns A Promise which resolves when the sync has finished - */ - startSync() { - if (!config_1.default.cache) { - console.warn('Nothing to sync, because caching is disabled.'); - return Promise.resolve(); - } - this.sync.stopped = false; - this.syncStopped = false; - return this.sync.sync(); - } - /** - * Stop the periodic synchronization. - */ - stopSync() { - clearTimeout(this._syncTimer); - this._syncTimer = undefined; - if (this.sync) { - // FIXME Re-enable when modules are all imports - // log('[Sync] Stopping sync'); - this.sync.stopped = true; - } - else { - // The sync class has not been initialized yet, so we make sure it will - // not start the syncing process as soon as it's initialized. - // FIXME Re-enable when modules are all imports - // log('[Sync] Will instantiate sync stopped'); - this.syncStopped = true; - } - } - /** - * Add remoteStorage data module - * - * @param module - A data module object - * - * @example - * - * Usually, you will import your data module from either a package or a local path. - * Let's say you want to use the - * [bookmarks module](https://github.com/raucao/remotestorage-module-bookmarks) - * in order to load data stored from [Webmarks](https://webmarks.5apps.com) for - * example: - * - * ```js - * import Bookmarks from 'remotestorage-module-bookmarks'; - * - * remoteStorage.addModule(Bookmarks); - * ``` - * - * You can also forgo this function entirely and add modules when creating your - * remoteStorage instance: - * - * ```js - * const remoteStorage = new RemoteStorage({ modules: [ Bookmarks ] }); - * ``` - * - * After the module has been added, it can be used like so: - * - * ```js - * remoteStorage.bookmarks.archive.getAll(false) - * .then(bookmarks => console.log(bookmarks)); - * ``` - */ - addModule(module) { - const moduleName = module.name; - const moduleBuilder = module.builder; - Object.defineProperty(this, moduleName, { - configurable: true, - get: function () { - const instance = this._loadModule(moduleName, moduleBuilder); - Object.defineProperty(this, moduleName, { - value: instance - }); - return instance; - } - }); - if (moduleName.indexOf('-') !== -1) { - const camelizedName = moduleName.replace(/\-[a-z]/g, function (s) { - return s[1].toUpperCase(); - }); - Object.defineProperty(this, camelizedName, { - get: function () { - return this[moduleName]; - } - }); - } - } - /** - * Load module - * - * @private - */ - _loadModule(moduleName, moduleBuilder) { - if (moduleBuilder) { - const module = moduleBuilder(new baseclient_1.default(this, '/' + moduleName + '/'), new baseclient_1.default(this, '/public/' + moduleName + '/')); - return module.exports; - } - else { - throw "Unknown module: " + moduleName; - } - } -} -exports.RemoteStorage = RemoteStorage; -/** - * FIXME: Instead of doing this, would be better to only - * export setAuthURL / getAuthURL from RemoteStorage prototype - * - * @ignore - */ -RemoteStorage.Authorize = authorize_1.default; -RemoteStorage.SyncError = sync_error_1.default; -RemoteStorage.Unauthorized = unauthorized_error_1.default; -RemoteStorage.DiscoveryError = discover_1.default.DiscoveryError; -RemoteStorage.util = util; -/** - * @property access - * - * Tracking claimed access scopes. A instance. -*/ -Object.defineProperty(RemoteStorage.prototype, 'access', { - get: function () { - const access = new access_1.default(); - Object.defineProperty(this, 'access', { - value: access - }); - return access; - }, - configurable: true -}); -// TODO Clean up/harmonize how modules are loaded and/or document this architecture properly -// -// At this point the remoteStorage object has not been created yet. -// Only its prototype exists so far, so we define a self-constructing -// property on there: -/** - * Property: caching - * - * Caching settings. A instance. - */ -// FIXME Was in rs_init of Caching but don't want to require RemoteStorage from there. -Object.defineProperty(RemoteStorage.prototype, 'caching', { - configurable: true, - get: function () { - const caching = new caching_1.default(); - Object.defineProperty(this, 'caching', { - value: caching - }); - return caching; - } -}); -(0, util_1.applyMixins)(RemoteStorage, [eventhandling_1.EventHandling]); -exports["default"] = RemoteStorage; - - -/***/ }), - -/***/ "./src/requests.ts": -/*!*************************!*\ - !*** ./src/requests.ts ***! - \*************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -/** - * This file implements an HTTP request with timeout, on top of fetch or XHR. - * The returned value always looks like an XHR. - * It is used by authorize.ts, wireclient.ts, googledrive.ts and dropbox.ts. - * The timeout is set by RemoteStorage#setRequestTimeout(timeout) - */ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.isArrayBufferView = void 0; -exports.retryAfterMs = retryAfterMs; -exports.requestWithTimeout = requestWithTimeout; -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const config_1 = __importDefault(__webpack_require__(/*! ./config */ "./src/config.ts")); -/** - * Extracts a retry interval from header, - * defaulting to three tries and a pause, within sync interval - * */ -function retryAfterMs(xhr) { - const serverMs = parseInt(xhr.getResponseHeader('Retry-After')) * 1000; - if (serverMs >= 1000) { // sanity check - return serverMs; - } - else { // value is NaN if no such header, or malformed - // three tries and a pause, within sync interval, - // with lower & upper bounds - return Math.max(1500, Math.min(60000, Math.round(config_1.default.syncInterval / (2.9 + Math.random() * 0.2)))); - } -} -if (typeof ((__webpack_require__.g || window).ArrayBufferView) === 'function') { - exports.isArrayBufferView = function (object) { - return object && (object instanceof (__webpack_require__.g || window).ArrayBufferView); - }; -} -else { - const arrayBufferViews = [ - Int8Array, Uint8Array, Int16Array, Uint16Array, - Int32Array, Uint32Array, Float32Array, Float64Array - ]; - exports.isArrayBufferView = function (object) { - for (let i = 0; i < 8; i++) { - if (object instanceof arrayBufferViews[i]) { - return true; - } - } - return false; - }; -} -function requestWithTimeout(method, url, options) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof fetch === 'function') { - return _fetchRequestWithTimeout(method, url, options); - } - else if (typeof XMLHttpRequest === 'function') { - return _xhrRequestWithTimeout(method, url, options); - } - else { - return Promise.reject('[Requests] You need to add a polyfill for fetch or XMLHttpRequest'); - } - }); -} -function _fetchRequestWithTimeout(method, url, options) { - return __awaiter(this, void 0, void 0, function* () { - const abortController = typeof AbortController === 'function' ? - new AbortController() : - null; - let timeoutId; - const timeoutPromise = new Promise((_resolve, reject) => { - timeoutId = setTimeout(() => { - if (abortController) { - abortController.abort(); - } - reject('timeout'); - }, config_1.default.requestTimeout); - }); - let syntheticXhr; - const responseHeaders = {}; - const networkPromise = fetch(url, { - method: method, - headers: options.headers, - body: options.body, - signal: abortController ? abortController.signal : undefined - }).then((response) => { - (0, log_1.default)('[requests fetch]', response); - response.headers.forEach((value, headerName) => { - responseHeaders[headerName.toUpperCase()] = value; - }); - syntheticXhr = { - readyState: 4, - status: response.status, - statusText: response.statusText, - response: undefined, - getResponseHeader: (headerName) => { - return responseHeaders[headerName.toUpperCase()] || null; - }, - // responseText: 'foo', - responseType: options.responseType, - responseURL: url, - }; - switch (options.responseType) { - case 'arraybuffer': - return response.arrayBuffer(); - case 'blob': - return response.blob(); - case 'json': - return response.json(); - case undefined: - case '': - case 'text': - return response.text(); - default: // document - throw new Error("responseType 'document' is not currently supported using fetch"); - } - }).then((processedBody) => { - syntheticXhr.response = processedBody; - if (!options.responseType || options.responseType === 'text') { - syntheticXhr.responseText = processedBody; - } - return syntheticXhr; - }).finally(() => { - clearTimeout(timeoutId); - }); - return Promise.race([networkPromise, timeoutPromise]); - }); -} -function _xhrRequestWithTimeout(method, url, options) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - (0, log_1.default)('[requests XHR]', method, url); - let timedOut = false; - const timer = setTimeout(() => { - timedOut = true; - reject('timeout'); - }, config_1.default.requestTimeout); - const xhr = new XMLHttpRequest(); - xhr.open(method, url, true); - if (options.responseType) { - xhr.responseType = options.responseType; - } - if (options.headers) { - for (const key in options.headers) { - xhr.setRequestHeader(key, options.headers[key]); - } - } - xhr.onload = () => { - if (timedOut) { - return; - } - clearTimeout(timer); - resolve(xhr); - }; - xhr.onerror = (error) => { - if (timedOut) { - return; - } - clearTimeout(timer); - reject(error); - }; - let body = options.body; - if (typeof (body) === 'object' && !(0, exports.isArrayBufferView)(body) && body instanceof ArrayBuffer) { - body = new Uint8Array(body); - } - xhr.send(body); - }); - }); -} - - -/***/ }), - -/***/ "./src/revisioncache.ts": -/*!******************************!*\ - !*** ./src/revisioncache.ts ***! - \******************************/ -/***/ (function(module) { - -"use strict"; - -/** - * A cache which can propagate changes up to parent folders and generate new - * revision ids for them. The generated revision id is consistent across - * different sessions. The keys for the cache are case-insensitive. - * - * @param defaultValue {string} the value that is returned for all keys that - * don't exist in the cache - * @class - */ -class RevisionCache { - constructor(defaultValue) { - this._itemsRev = {}; - this._storage = {}; - this._canPropagate = false; - this.defaultValue = defaultValue; - this.activatePropagation(); - } - /** - * Get a value from the cache or defaultValue, if the key is not in the - * cache - */ - get(key) { - key = key.toLowerCase(); - let stored = this._storage[key]; - if (typeof stored === 'undefined') { - stored = this.defaultValue; - this._storage[key] = stored; - } - return stored; - } - /** - * Set a value - */ - set(key, value) { - key = key.toLowerCase(); - if (this._storage[key] === value) { - return value; - } - this._storage[key] = value; - if (!value) { - delete this._itemsRev[key]; - } - this._updateParentFolderItemRev(key, value); - if (this._canPropagate) { - this._propagate(key); - } - return value; - } - /** - * Delete a value - */ - delete(key) { - return this.set(key, null); - } - /** - * Disables automatic update of folder revisions when a key value is updated - */ - deactivatePropagation() { - this._canPropagate = false; - return true; - } - /** - * Enables automatic update of folder revisions when a key value is updated - * and refreshes the folder revision ids for entire tree. - */ - activatePropagation() { - if (this._canPropagate) { - return true; - } - this._generateFolderRev("/"); - this._canPropagate = true; - return true; - } - /** - * Returns a hash code for a string. - */ - _hashCode(str) { - let hash = 0; - if (str.length === 0) { - return hash; - } - for (let i = 0; i < str.length; i++) { - const chr = str.charCodeAt(i); - // eslint-disable-next-line no-bitwise - hash = ((hash << 5) - hash) + chr; - // eslint-disable-next-line no-bitwise - hash |= 0; // Convert to 32bit integer - } - return hash; - } - /** - * Takes an array of strings and returns a hash of the items - */ - _generateHash(items) { - // We sort the items before joining them to ensure correct hash generation - // every time - const files = items.sort().join('|'); - const hash = "" + this._hashCode(files); - return hash; - } - /** - * Update the revision of a key in it's parent folder data - */ - _updateParentFolderItemRev(key, rev) { - if (key !== '/') { - const parentFolder = this._getParentFolder(key); - if (!this._itemsRev[parentFolder]) { - this._itemsRev[parentFolder] = {}; - } - const parentFolderItemsRev = this._itemsRev[parentFolder]; - if (!rev) { - delete parentFolderItemsRev[key]; - } - else { - parentFolderItemsRev[key] = rev; - } - //reset revision until root - this._updateParentFolderItemRev(parentFolder, this.defaultValue); - } - } - _getParentFolder(key) { - return key.substr(0, key.lastIndexOf('/', key.length - 2) + 1); - } - /** - * Propagate the changes to the parent folders and generate new revision ids - * for them - */ - _propagate(key) { - if (key !== '/') { - const parentFolder = this._getParentFolder(key); - const parentFolderItemsRev = this._itemsRev[parentFolder]; - const hashItems = []; - for (const path in parentFolderItemsRev) { - hashItems.push(parentFolderItemsRev[path]); - } - const newRev = this._generateHash(hashItems); - this.set(parentFolder, newRev); - } - } - /** - * Generate revision id for a folder and it's subfolders, by hashing it's - * listing - */ - _generateFolderRev(folder) { - const itemsRev = this._itemsRev[folder]; - let hash = this.defaultValue; - if (itemsRev) { - const hashItems = []; - for (const path in itemsRev) { - const isDir = (path.substr(-1) === '/'); - let hashItem; - if (isDir) { - hashItem = this._generateFolderRev(path); - } - else { - hashItem = itemsRev[path]; - } - hashItems.push(hashItem); - } - if (hashItems.length > 0) { - hash = this._generateHash(hashItems); - } - } - this.set(folder, hash); - return hash; - } -} -module.exports = RevisionCache; - - -/***/ }), - -/***/ "./src/schema-not-found-error.ts": -/*!***************************************!*\ - !*** ./src/schema-not-found-error.ts ***! - \***************************************/ -/***/ (function(module) { - -"use strict"; - -class SchemaNotFound extends Error { - constructor(uri) { - super(); - const error = new Error("Schema not found: " + uri); - error.name = "SchemaNotFound"; - return error; - } -} -module.exports = SchemaNotFound; - - -/***/ }), - -/***/ "./src/solid.ts": -/*!**********************!*\ - !*** ./src/solid.ts ***! - \**********************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const solid_client_authn_browser_1 = __webpack_require__(/*! @inrupt/solid-client-authn-browser */ "./node_modules/@inrupt/solid-client-authn-browser/dist/index.js"); -const solid_client_1 = __webpack_require__(/*! @inrupt/solid-client */ "./node_modules/@inrupt/solid-client/dist/index.js"); -const baseclient_1 = __importDefault(__webpack_require__(/*! ./baseclient */ "./src/baseclient.ts")); -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const remote_1 = __webpack_require__(/*! ./remote */ "./src/remote.ts"); -const solidStorage_1 = __importDefault(__webpack_require__(/*! ./solidStorage */ "./src/solidStorage.ts")); -const blob_1 = __importDefault(__webpack_require__(/*! blob */ "./node_modules/blob/main.js")); -const SETTINGS_KEY = 'remotestorage:solid'; -let hasLocalStorage; -/** - * Overwrite BaseClient's getItemURL with our own implementation - * - * @param {object} rs - RemoteStorage instance - * - * @private - */ -function hookGetItemURL(rs) { - if (rs._origBaseClientGetItemURL) { - return; - } - rs._origBaseClientGetItemURL = baseclient_1.default.prototype.getItemURL; - baseclient_1.default.prototype.getItemURL = function (path) { - if (typeof path !== 'string') { - throw 'Argument \'path\' of baseClient.getItemURL must be a string'; - } - if (this.storage.connected) { - if (path.startsWith('/')) { - path = path.substring(1); - } - return this.selectedPodURL + (0, util_1.cleanPath)(path); - } - else { - return undefined; - } - }; -} -/** - * Restore BaseClient's getItemURL original implementation - * - * @param {object} rs - RemoteStorage instance - * - * @private - */ -function unHookGetItemURL(rs) { - if (!rs._origBaseClientGetItemURL) { - return; - } - baseclient_1.default.prototype.getItemURL = rs._origBaseClientGetItemURL; - delete rs._origBaseClientGetItemURL; -} -/** - * Convert XMLHttpRequestBodyInit to Blob - * - * @param {XMLHttpRequestBodyInit} body - Request body - * @returns {Blob} Blob equivalent of the body - * - * @private - */ -function requestBodyToBlob(body) { - if (typeof (body) === 'object') { - if (body instanceof blob_1.default) { - return body; - } - if (body instanceof DataView) { - return new blob_1.default([body], { type: "application/octet-stream" }); - } - if (body instanceof ArrayBuffer) { - return new blob_1.default([new DataView(body)]); - } - if (ArrayBuffer.isView(body)) { - return new blob_1.default([body], { type: "application/octet-stream" }); - } - if (body instanceof FormData) { - return new blob_1.default([new URLSearchParams([JSON.parse(JSON.stringify(body.entries()))]).toString()], { type: 'application/x-www-form-urlencoded' }); - } - if (body instanceof URLSearchParams) { - return new blob_1.default([body.toString()], { type: 'application/x-www-form-urlencoded' }); - } - } - if (typeof (body) === "string") { - return new blob_1.default([body], { type: 'plain/text' }); - } - return new blob_1.default([JSON.stringify(body)], { type: 'application/json' }); -} -/** - * @class Solid - * - * To use this backend, you need to specify the authURL before calling connect like so: - * - * @example - * solid.setAuthURL('https://login.example.com'); - * solid.connect(); - * - * If connect is successful a list of available pods for the Solid account is retrieved and - * a `pod-not-selected` event is fired. After receiving this event you have to call getPodURLs - * to get the list of available pods and set one of them to be used by calling setPodURL. After - * setting the pod URL the `connected` event is fired. - * - * You can find a list of running solid servers on the solid project website here: - * https://solidproject.org/for-developers#hosted-pod-services -**/ -class Solid extends remote_1.RemoteBase { - constructor(remoteStorage) { - super(remoteStorage); - this.podURLs = null; - this.online = true; - this.addEvents(['connected', 'not-connected', 'pod-not-selected']); - // We use a custom ConfigStore to store the solid session in a rs friendly manner to - // make configuration and disconnect work. - this.configStorage = new solidStorage_1.default(this); - this.session = new solid_client_authn_browser_1.Session({ - secureStorage: new solid_client_authn_browser_1.InMemoryStorage(), // Inrupt prefers InMemoryStorage for tokens. We respect that. - insecureStorage: this.configStorage - }, 'any'); - hasLocalStorage = (0, util_1.localStorageAvailable)(); - if (hasLocalStorage) { - const settings = (0, util_1.getJSONFromLocalStorage)(SETTINGS_KEY); - if (settings) { - this.configure(settings); - } - } - } - /** - * Solid Session storage state changed. - * - * This function is called by the ConfigStore that we provided to Session as an insecure storage. - * - * @param {string} config - The entire Session configuration object serialized into a string - * - * @private - */ - onConfigChanged(config) { - if (config) { - const sessionConfig = JSON.parse(config); - if (typeof sessionConfig.clientSecret !== 'undefined') { - let settings = (0, util_1.getJSONFromLocalStorage)(SETTINGS_KEY); - if (!settings) { - settings = {}; - } - settings.href = this.authURL; - settings.properties = { - sessionProperties: sessionConfig, - podURL: this.selectedPodURL - }; - this.sessionProperties = sessionConfig; - localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings)); - return; - } - } - this.podURLs = null; - localStorage.removeItem(SETTINGS_KEY); - } - /** - * Configure the Solid backend. - * - * @param {Object} settings - * @param {string} [settings.userAddress] - The user's identity prodiver URL - * @param {string} [settings.href] - The authURL - * @param {object} [settings.properties] - All storage for Inrupt session is saved into properties plus the pod URL - * - * @protected - */ - configure(settings) { - // We only update this.userAddress if settings.userAddress is set to a string or to null - if (typeof settings.userAddress !== 'undefined') { - this.userAddress = settings.userAddress; - } - // We only update this.authURL if settings.href is set to a string or to null - if (typeof settings.href !== 'undefined') { - this.authURL = settings.href; - } - // Read session properties and pod URL from the properties if it exists - if (typeof settings.properties !== 'undefined') { - const properties = settings.properties; - if (properties) { - if (typeof properties.sessionProperties !== 'undefined') { - this.sessionProperties = properties.sessionProperties; - } - else { - this.sessionProperties = null; - } - if (typeof properties.podURL !== 'undefined') { - this.selectedPodURL = properties.podURL; - } - else { - this.selectedPodURL = null; - } - } - else { - this.sessionProperties = null; - this.selectedPodURL = null; - } - } - const writeSettingsToCache = function () { - if (hasLocalStorage) { - localStorage.setItem(SETTINGS_KEY, JSON.stringify({ - userAddress: this.userAddress, - href: this.authURL, - properties: { - sessionProperties: this.sessionProperties, - podURL: this.selectedPodURL - } - })); - } - }; - const handleError = function () { - this.connected = false; - this.sessionProperties = null; - this.podURLs = null; - if (hasLocalStorage) { - localStorage.removeItem(SETTINGS_KEY); - } - }; - if (this.sessionProperties) { - this.configStorage.setConfig(JSON.stringify(this.sessionProperties)); - this.connected = this.session.info && this.session.info.isLoggedIn; - writeSettingsToCache.apply(this); - } - else { - handleError.apply(this); - } - } - /** - * Set the auth URL - * - * @param {string} authURL - Auth URL - * - * @public - */ - setAuthURL(authURL) { - this.authURL = authURL; - } - /** - * Get a list of pod URLs for this Solid account. - * - * If the Solid Session is not connected, this function returns null. - * - * @returns Get the list of pod URLs - * - * @public - */ - getPodURLs() { - return this.podURLs; - } - /** - * Set the pod URL to use as the storage. - * - * Pod URL must be one of the URLs provided by the getPodURLs function. This function does - * not validate this constraint. - * - * If the Solid Session is connected and the pod URL is updated to be null, a - * `pod-not-selected` event will be fired. If Session is connected and the pod URL is set, - * a `connected` event will be fired. - * - * @param {string} podURL - URL of the pod to be used as storage - * - * @public - */ - setPodURL(podURL) { - if (this.selectedPodURL === podURL) { - return; - } - this.selectedPodURL = podURL; - if (this.session.info && this.session.info.isLoggedIn) { - if (this.selectedPodURL) { - let settings = (0, util_1.getJSONFromLocalStorage)(SETTINGS_KEY); - if (!settings) { - settings = {}; - } - settings.userAddress = this.session.info.webId; - settings.href = this.authURL; - settings.properties = { - sessionProperties: this.sessionProperties, - podURL: this.selectedPodURL - }; - localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings)); - this.connected = true; - this._emit('connected'); - } - else { - this.connected = false; - this.rs._emit('pod-not-selected'); - } - } - } - /** - * Get the pod URL that is being used as the storage. - * - * @returns {string} The in-use pod URL or null - * - * @public - */ - getPodURL() { - return this.selectedPodURL; - } - /** - * Initiate the authorization flow's OAuth dance. - * - * @public - */ - connect() { - this.rs.setBackend('solid'); - if (!this.authURL) { - this.rs._emit('error', new Error(`No authURL is configured.`)); - return; - } - this.session.login({ - oidcIssuer: this.authURL, - redirectUrl: new URL("/", window.location.href).toString(), - clientName: "Remote Storage" - }); - } - /** - * Get the connected Solid session - * - * @returns {Session} that is being used by this instance or null if Session is not connected - * - * @public - */ - getSession() { - return (this.session.info && this.session.info.isLoggedIn) ? this.session : null; - } - /** - * Convert path to file URL - * - * @param {string} path - Path of the resource - * @returns {string} Full URL of the resource on the pod - * - * @private - */ - getFileURL(path) { - if (path.startsWith('/')) { - path = path.substring(1); - } - if (path.length === 0) { - path = '/'; - } - return this.selectedPodURL + path; - } - /** - * Request a resource (file or directory). - * - * @param {string} path - Path of the resource - * @param {Object} options - Request options - * @returns {Promise} Resolves with an object containing the status code, - * body, content-type and revision - * - * @protected - */ - get(path, options = {}) { - const fileURL = this.getFileURL(path); - if (path.slice(-1) === '/') { - return (0, solid_client_1.getSolidDataset)(fileURL, { fetch: this.session.fetch }).then(containerDataset => { - const URLs = (0, solid_client_1.getContainedResourceUrlAll)(containerDataset); - const listing = URLs.reduce((map, item) => { - const itemName = item.substring(fileURL.length); - const isFolder = itemName.slice(-1) === '/'; - if (isFolder) { - map[itemName] = {}; // We are skipping ETag - } - else { - const fileDataset = (0, solid_client_1.getThing)(containerDataset, item); - map[itemName] = { - 'Content-Length': (0, solid_client_1.getInteger)(fileDataset, 'http://www.w3.org/ns/posix/stat#size'), - 'Last-Modified': (0, solid_client_1.getDatetime)(fileDataset, 'http://purl.org/dc/terms/modified').toUTCString(), // date.toUTCString() - }; - } - return map; - }, {}); - return Promise.resolve({ - statusCode: 200, - body: listing, - contentType: 'application/json; charset=UTF-8', - // revision: ? Skipping ETag - }); - }).catch(error => { - if (error instanceof solid_client_1.FetchError) { - if (error.statusCode === 404) { - return Promise.resolve({ - statusCode: 200, - body: {}, - contentType: 'application/json; charset=UTF-8', - // revision: ? - }); - } - } - return Promise.reject('Failed to get container: ' + error.message); - }); - } - return (0, solid_client_1.getFile)(fileURL, { fetch: this.session.fetch }).then(file => { - return { - statusCode: 200, - body: file, - contentType: (0, solid_client_1.getContentType)(file) - }; - }).catch(error => { - const statusCode = error.statusCode; - if (statusCode === 401 || statusCode === 403 || statusCode === 404) { - return { - statusCode: statusCode - }; - } - return Promise.reject('Failed to get the file: ' + error.message); - }); - } - /** - * Create or update a file. - * - * @param {string} path - File path - * @param body - File content - * @param {string} contentType - File content-type - * @param {Object} options - * @param {string} options.ifNoneMatch - Only create or update the file if the - * current ETag doesn't match this string - * @returns {Promise} Resolves with an object containing the status code, - * content-type and revision - * - * @protected - */ - put(path, body, contentType, options = {}) { - const fileURL = this.getFileURL(path); - const fetch = this.session.fetch; - const overwrite = function () { - const blob = requestBodyToBlob(body); - return (0, solid_client_1.overwriteFile)(fileURL, blob, { - contentType: contentType, - fetch: fetch - }).then(savedFile => { - return { - statusCode: 201 - }; - }).catch(error => { - return Promise.reject("PUT failed with status " + error.statusCode + " (" + error.message + ")"); - }); - }; - return (0, solid_client_1.getFile)(fileURL, { fetch: fetch }).then(file => { - if (options && (options.ifNoneMatch === '*')) { - return { statusCode: 412, revision: 'conflict' }; - } - return overwrite(); - }).catch(error => { - const statusCode = error.statusCode; - if (statusCode === 404) { - return overwrite(); - } - return Promise.reject("PUT failed with status " + statusCode + " (" + error.message + ")"); - }); - } - /** - * Delete a file. - * - * @param {string} path - File path - * @param {Object} options - * @param {string} options.ifMatch - only delete the file if it's ETag - * matches this string - * @returns {Promise} Resolves with an object containing the status code - * - * @protected - */ - delete(path, options = {}) { - const fileURL = this.getFileURL(path); - return (0, solid_client_1.deleteFile)(fileURL, { fetch: this.session.fetch }).then(() => { - return { statusCode: 200 }; - }).catch(error => { - const statusCode = error.statusCode; - if (statusCode === 404) { - return { statusCode: 200 }; - } - return Promise.reject("DELETE failed with status " + statusCode + " (" + error.message + ")"); - }); - } - /** - * Initialize the Solid backend. - * - * @param {Object} remoteStorage - RemoteStorage instance - * - * @protected - */ - static _rs_init(remoteStorage) { - const solid = new Solid(remoteStorage); - remoteStorage.solid = solid; - if (remoteStorage.backend === 'solid') { - remoteStorage._origRemote = remoteStorage.remote; - remoteStorage.remote = remoteStorage.solid; - hookGetItemURL(remoteStorage); - (() => __awaiter(this, void 0, void 0, function* () { - const session = solid.session; - yield session.handleIncomingRedirect(); - if (session.info.isLoggedIn) { - const webId = session.info.webId; - solid.userAddress = webId; - if (solid.selectedPodURL) { - solid._emit('connected'); - } - else { - solid.podURLs = yield (0, solid_client_1.getPodUrlAll)(webId, { fetch: fetch }); - remoteStorage._emit('pod-not-selected'); - } - } - else if (solid.sessionProperties) { - solid.connect(); - } - }))(); - } - } - /** - * Inform about the availability of the Solid backend. - * - * @returns {Boolean} - * - * @protected - */ - static _rs_supported() { - return true; - } - /** - * Remove Solid as a backend. - * - * @param {Object} remoteStorage - RemoteStorage instance - * - * @protected - */ - static _rs_cleanup(remoteStorage) { - remoteStorage.setBackend(undefined); - if (remoteStorage._origRemote) { - remoteStorage.remote = remoteStorage._origRemote; - delete remoteStorage._origRemote; - } - unHookGetItemURL(remoteStorage); - } -} -(0, util_1.applyMixins)(Solid, [eventhandling_1.default]); -module.exports = Solid; - - -/***/ }), - -/***/ "./src/solidStorage.ts": -/*!*****************************!*\ - !*** ./src/solidStorage.ts ***! - \*****************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -class BrowserStorage { - get storage() { - return window.localStorage; - } - get(key) { - return __awaiter(this, void 0, void 0, function* () { - return this.storage.getItem(key) || undefined; - }); - } - set(key, value) { - return __awaiter(this, void 0, void 0, function* () { - this.storage.setItem(key, value); - }); - } - delete(key) { - return __awaiter(this, void 0, void 0, function* () { - this.storage.removeItem(key); - }); - } -} -class ConfigStorage { - constructor(observer) { - this.browserStorage = new BrowserStorage(); - this.observer = observer; - } - isConfigKey(key) { - return key.startsWith('solidClientAuthenticationUser'); - } - setConfig(config) { - this.config = config; - } - get(key) { - return __awaiter(this, void 0, void 0, function* () { - if (this.isConfigKey(key)) { - return this.config; - } - else { - this.browserStorage.get(key); - } - }); - } - set(key, value) { - return __awaiter(this, void 0, void 0, function* () { - if (this.isConfigKey(key)) { - if (this.config) { - const oldConfig = JSON.parse(this.config); - const additionalConfig = JSON.parse(value); - const newConfig = Object.assign(Object.assign({}, oldConfig), additionalConfig); - this.config = JSON.stringify(newConfig); - } - else { - this.config = value; - } - this.observer.onConfigChanged(this.config); - } - else { - this.browserStorage.set(key, value); - } - }); - } - delete(key) { - return __awaiter(this, void 0, void 0, function* () { - if (this.isConfigKey(key)) { - this.config = undefined; - this.observer.onConfigChanged(this.config); - } - else { - this.browserStorage.delete(key); - } - }); - } -} -exports["default"] = ConfigStorage; - - -/***/ }), - -/***/ "./src/sync-error.ts": -/*!***************************!*\ - !*** ./src/sync-error.ts ***! - \***************************/ -/***/ (function(module) { - -"use strict"; - -class SyncError extends Error { - constructor(originalError) { - super(); - this.name = 'SyncError'; - this.message = 'Sync failed: '; - if (typeof originalError === 'string') { - this.message += originalError; - } - else { - this.message += originalError.message; - this.stack = originalError.stack; - this.originalError = originalError; - } - } -} -module.exports = SyncError; - - -/***/ }), - -/***/ "./src/sync.ts": -/*!*********************!*\ - !*** ./src/sync.ts ***! - \*********************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.Sync = void 0; -const config_1 = __importDefault(__webpack_require__(/*! ./config */ "./src/config.ts")); -const env_1 = __importDefault(__webpack_require__(/*! ./env */ "./src/env.ts")); -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const authorize_1 = __importDefault(__webpack_require__(/*! ./authorize */ "./src/authorize.ts")); -const sync_error_1 = __importDefault(__webpack_require__(/*! ./sync-error */ "./src/sync-error.ts")); -const unauthorized_error_1 = __importDefault(__webpack_require__(/*! ./unauthorized-error */ "./src/unauthorized-error.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -let syncCycleCb, syncOnConnect; -function taskFor(action, path, promise) { - return { action, path, promise }; -} -function nodeChanged(node, etag) { - return node.common.revision !== etag && - (!node.remote || node.remote.revision !== etag); -} -function isStaleChild(node) { - return node.remote && node.remote.revision && !node.remote.itemsMap && !node.remote.body; -} -function hasCommonRevision(node) { - return node.common && node.common.revision; -} -function hasNoRemoteChanges(node) { - if (node.remote && node.remote.revision && - node.remote.revision !== node.common.revision) { - return false; - } - return (node.common.body === undefined && node.remote.body === false) || - (node.remote.body === node.common.body && - node.remote.contentType === node.common.contentType); -} -function mergeMutualDeletion(node) { - if (node.remote && node.remote.body === false && - node.local && node.local.body === false) { - delete node.local; - } - return node; -} -function handleVisibility(env, rs) { - function handleChange(isForeground) { - const oldValue = rs.getCurrentSyncInterval(); - config_1.default.isBackground = !isForeground; - const newValue = rs.getCurrentSyncInterval(); - rs._emit('sync-interval-change', { oldValue: oldValue, newValue: newValue }); - } - env.on('background', () => handleChange(false)); - env.on('foreground', () => handleChange(true)); -} -/** - * This class basically does six things: - * - * - retrieve the remote version of relevant documents and folders - * - add all local and remote documents together into one tree - * - push local documents out if they don't exist remotely - * - push local changes out to remote documents (conditionally, to avoid race - * conditions where both have changed) - * - adopt the local version of a document to its remote version if both exist - * and they differ - * - delete the local version of a document if it was deleted remotely - * - if any GET requests were waiting for remote data, resolve them once this - * data comes in. - * - * It does this using requests to documents and folders. Whenever a folder GET - * comes in, it gives information about all the documents it contains (this is - * the `markChildren` function). - **/ -class Sync { - constructor(remoteStorage) { - this._finishedTasks = []; - this.rs = remoteStorage; - this._tasks = {}; - this._running = {}; - this._timeStarted = {}; - this.numThreads = 10; - this.rs.local.onDiff(path => { - this.addTask(path); - this.doTasks(); - }); - this.rs.caching.onActivate((path) => { - this.addTask(path); - this.doTasks(); - }); - this.addEvents(['done', 'req-done']); - } - now() { - return new Date().getTime(); - } - queueGetRequest(path) { - return new Promise((resolve, reject) => { - if (!this.rs.remote.connected) { - reject('cannot fulfill maxAge requirement - remote is not connected'); - } - else if (!this.rs.remote.online) { - reject('cannot fulfill maxAge requirement - remote is not online'); - } - else { - this.addTask(path, function () { - this.rs.local.get(path).then(r => resolve(r)); - }.bind(this)); - this.doTasks(); - } - }); - } - // FIXME force02 sounds like rs spec 02, thus could be removed - corruptServerItemsMap(itemsMap, force02) { - if ((typeof (itemsMap) !== 'object') || (Array.isArray(itemsMap))) { - return true; - } - for (const itemName in itemsMap) { - const item = itemsMap[itemName]; - if (typeof (item) !== 'object') { - return true; - } - if (typeof (item.ETag) !== 'string') { - return true; - } - if ((0, util_1.isFolder)(itemName)) { - if (itemName.substring(0, itemName.length - 1).indexOf('/') !== -1) { - return true; - } - } - else { - if (itemName.indexOf('/') !== -1) { - return true; - } - if (force02) { - if (typeof (item['Content-Type']) !== 'string') { - return true; - } - if (typeof (item['Content-Length']) !== 'number') { - return true; - } - } - } - } - return false; - } - corruptItemsMap(itemsMap) { - if ((typeof (itemsMap) !== 'object') || (Array.isArray(itemsMap))) { - return true; - } - for (const path in itemsMap) { - if (typeof itemsMap[path] !== 'boolean') { - return true; - } - } - return false; - } - corruptRevision(rev) { - return ((typeof (rev) !== 'object') || - (Array.isArray(rev)) || - (rev.revision && typeof (rev.revision) !== 'string') || - (rev.body && typeof (rev.body) !== 'string' && typeof (rev.body) !== 'object') || - (rev.contentType && typeof (rev.contentType) !== 'string') || - (rev.contentLength && typeof (rev.contentLength) !== 'number') || - (rev.timestamp && typeof (rev.timestamp) !== 'number') || - (rev.itemsMap && this.corruptItemsMap(rev.itemsMap))); - } - isCorrupt(node) { - return ((typeof (node) !== 'object') || - (Array.isArray(node)) || - (typeof (node.path) !== 'string') || - (this.corruptRevision(node.common)) || - (node.local && this.corruptRevision(node.local)) || - (node.remote && this.corruptRevision(node.remote)) || - (node.push && this.corruptRevision(node.push))); - } - hasTasks() { - return Object.getOwnPropertyNames(this._tasks).length > 0; - } - collectDiffTasks() { - return __awaiter(this, void 0, void 0, function* () { - let num = 0; - return this.rs.local.forAllNodes((node) => { - if (num > 100) { - return; - } - if (this.isCorrupt(node)) { - (0, log_1.default)('[Sync] WARNING: corrupt node in local cache', node); - if (typeof (node) === 'object' && node.path) { - this.addTask(node.path); - num++; - } - } - else if (this.needsFetch(node) && this.rs.access.checkPathPermission(node.path, 'r')) { - this.addTask(node.path); - num++; - } - else if ((0, util_1.isDocument)(node.path) && this.needsPush(node) && - this.rs.access.checkPathPermission(node.path, 'rw')) { - this.addTask(node.path); - num++; - } - }) - .then(() => num) - .catch(e => { throw e; }); - }); - } - inConflict(node) { - return (node.local && node.remote && - (node.remote.body !== undefined || node.remote.itemsMap)); - } - needsRefresh(node) { - if (node.common) { - if (!node.common.timestamp) { - return true; - } - return (this.now() - node.common.timestamp > config_1.default.syncInterval); - } - return false; - } - needsFetch(node) { - if (this.inConflict(node)) { - return true; - } - if (node.common && - node.common.itemsMap === undefined && - node.common.body === undefined) { - return true; - } - if (node.remote && - node.remote.itemsMap === undefined && - node.remote.body === undefined) { - return true; - } - return false; - } - needsPush(node) { - if (this.inConflict(node)) { - return false; - } - if (node.local && !node.push) { - return true; - } - } - needsRemotePut(node) { - return node.local && node.local.body; - } - needsRemoteDelete(node) { - return node.local && node.local.body === false; - } - getParentPath(path) { - const parts = path.match(/^(.*\/)([^\/]+\/?)$/); - if (parts) { - return parts[1]; - } - else { - throw new Error('Not a valid path: "' + path + '"'); - } - } - deleteChildPathsFromTasks() { - for (const path in this._tasks) { - const paths = (0, util_1.pathsFromRoot)(path); - for (let i = 1; i < paths.length; i++) { - if (this._tasks[paths[i]]) { - // move pending promises to parent task - if (Array.isArray(this._tasks[path]) && this._tasks[path].length) { - Array.prototype.push.apply(this._tasks[paths[i]], this._tasks[path]); - } - delete this._tasks[path]; - } - } - } - } - collectRefreshTasks() { - return __awaiter(this, void 0, void 0, function* () { - return this.rs.local.forAllNodes((node) => { - let parentPath; - if (this.needsRefresh(node)) { - try { - parentPath = this.getParentPath(node.path); - } - catch (e) { - // node.path is already '/', can't take parentPath - } - if (parentPath && this.rs.access.checkPathPermission(parentPath, 'r')) { - this.addTask(parentPath); - } - else if (this.rs.access.checkPathPermission(node.path, 'r')) { - this.addTask(node.path); - } - } - }) - .then(() => this.deleteChildPathsFromTasks()) - .catch((e) => { throw e; }); - }); - } - flush(nodes) { - for (const path in nodes) { - // Strategy is 'FLUSH' and no local changes exist - if (this.rs.caching.checkPath(path) === 'FLUSH' && - nodes[path] && !nodes[path].local) { - (0, log_1.default)('[Sync] Flushing', path); - nodes[path] = undefined; // Cause node to be flushed from cache - } - } - return nodes; - } - doTask(path) { - return this.rs.local.getNodes([path]).then((nodes) => { - const node = nodes[path]; - // First fetch: - if (typeof (node) === 'undefined') { - return taskFor('get', path, this.rs.remote.get(path)); - } - // Fetch known-stale child: - else if (isStaleChild(node)) { - return taskFor('get', path, this.rs.remote.get(path)); - } - // Push PUT: - else if (this.needsRemotePut(node)) { - node.push = (0, util_1.deepClone)(node.local); - node.push.timestamp = this.now(); - return this.rs.local.setNodes(this.flush(nodes)).then(() => { - let options; - if (hasCommonRevision(node)) { - options = { ifMatch: node.common.revision }; - } - else { - // Initial PUT (fail if something is already there) - options = { ifNoneMatch: '*' }; - } - return taskFor('put', path, this.rs.remote.put(path, node.push.body, node.push.contentType, options)); - }); - } - // Push DELETE: - else if (this.needsRemoteDelete(node)) { - node.push = { body: false, timestamp: this.now() }; - return this.rs.local.setNodes(this.flush(nodes)).then(() => { - if (hasCommonRevision(node)) { - return taskFor('delete', path, this.rs.remote.delete(path, { ifMatch: node.common.revision })); - } - else { // Ascertain current common or remote revision first - return taskFor('get', path, this.rs.remote.get(path)); - } - }); - } - // Conditional refresh: - else if (hasCommonRevision(node)) { - return taskFor('get', path, this.rs.remote.get(path, { ifNoneMatch: node.common.revision })); - } - else { - return taskFor('get', path, this.rs.remote.get(path)); - } - }); - } - autoMergeFolder(node) { - if (node.remote.itemsMap) { - node.common = node.remote; - delete node.remote; - if (node.common.itemsMap) { - for (const itemName in node.common.itemsMap) { - if (!node.local.itemsMap[itemName]) { - // Indicates the node is either newly being fetched - // has been deleted locally (whether or not leading to conflict); - // before listing it in local listings, check if a local deletion - // exists. - node.local.itemsMap[itemName] = false; - } - } - if ((0, util_1.equal)(node.local.itemsMap, node.common.itemsMap)) { - delete node.local; - } - } - } - return node; - } - autoMergeDocument(node) { - if (hasNoRemoteChanges(node)) { - node = mergeMutualDeletion(node); - delete node.remote; - } - else if (node.remote.body !== undefined) { - // keep/revert: - (0, log_1.default)('[Sync] Emitting keep/revert'); - this.rs.local._emitChange({ - origin: 'conflict', - path: node.path, - oldValue: node.local.body, - newValue: node.remote.body, - lastCommonValue: node.common.body, - oldContentType: node.local.contentType, - newContentType: node.remote.contentType, - lastCommonContentType: node.common.contentType - }); - if (node.remote.body) { - node.common = node.remote; - } - else { - node.common = {}; - } - delete node.remote; - delete node.local; - } - return node; - } - autoMerge(node) { - if (node.remote) { - if (node.local) { - if ((0, util_1.isFolder)(node.path)) { - return this.autoMergeFolder(node); - } - else { - return this.autoMergeDocument(node); - } - } - else { // no local changes - if ((0, util_1.isFolder)(node.path)) { - if (node.remote.itemsMap !== undefined) { - node.common = node.remote; - delete node.remote; - } - } - else { - if (node.remote.body !== undefined) { - const change = { - origin: 'remote', - path: node.path, - oldValue: (node.common.body === false ? undefined : node.common.body), - newValue: (node.remote.body === false ? undefined : node.remote.body), - oldContentType: node.common.contentType, - newContentType: node.remote.contentType - }; - if (change.oldValue || change.newValue) { - this.rs.local._emitChange(change); - } - if (!node.remote.body) { // no remote, so delete/don't create - return; - } - node.common = node.remote; - delete node.remote; - } - } - } - } - else { - if (node.common.body) { - this.rs.local._emitChange({ - origin: 'remote', - path: node.path, - oldValue: node.common.body, - newValue: undefined, - oldContentType: node.common.contentType, - newContentType: undefined - }); - } - return undefined; - } - return node; - } - updateCommonTimestamp(path, revision) { - return __awaiter(this, void 0, void 0, function* () { - return this.rs.local.getNodes([path]).then((nodes) => { - if (nodes[path] && - nodes[path].common && - nodes[path].common.revision === revision) { - nodes[path].common.timestamp = this.now(); - } - return this.rs.local.setNodes(this.flush(nodes)); - }); - }); - } - markChildren(path, itemsMap, changedNodes, missingChildren) { - return __awaiter(this, void 0, void 0, function* () { - const paths = []; - const meta = {}; - const recurse = {}; - for (const item in itemsMap) { - paths.push(path + item); - meta[path + item] = itemsMap[item]; - } - for (const childName in missingChildren) { - paths.push(path + childName); - } - return this.rs.local.getNodes(paths).then((nodes) => { - let cachingStrategy; - let node; - for (const nodePath in nodes) { - node = nodes[nodePath]; - if (meta[nodePath]) { - if (node && node.common) { - if (nodeChanged(node, meta[nodePath].ETag)) { - changedNodes[nodePath] = (0, util_1.deepClone)(node); - changedNodes[nodePath].remote = { - revision: meta[nodePath].ETag, - timestamp: this.now() - }; - changedNodes[nodePath] = this.autoMerge(changedNodes[nodePath]); - } - } - else { - cachingStrategy = this.rs.caching.checkPath(nodePath); - if (cachingStrategy === 'ALL') { - changedNodes[nodePath] = { - path: nodePath, - common: { - timestamp: this.now() - }, - remote: { - revision: meta[nodePath].ETag, - timestamp: this.now() - } - }; - } - } - if (changedNodes[nodePath] && meta[nodePath]['Content-Type']) { - changedNodes[nodePath].remote.contentType = meta[nodePath]['Content-Type']; - } - if (changedNodes[nodePath] && meta[nodePath]['Content-Length']) { - changedNodes[nodePath].remote.contentLength = meta[nodePath]['Content-Length']; - } - } - else if (missingChildren[nodePath.substring(path.length)] && node && node.common) { - if (node.common.itemsMap) { - for (const commonItem in node.common.itemsMap) { - recurse[nodePath + commonItem] = true; - } - } - if (node.local && node.local.itemsMap) { - for (const localItem in node.local.itemsMap) { - recurse[nodePath + localItem] = true; - } - } - if (node.remote || (0, util_1.isFolder)(nodePath)) { - changedNodes[nodePath] = undefined; - } - else { - changedNodes[nodePath] = this.autoMerge(node); - if (typeof changedNodes[nodePath] === 'undefined') { - const parentPath = this.getParentPath(nodePath); - const parentNode = changedNodes[parentPath]; - const itemName = nodePath.substring(path.length); - if (parentNode && parentNode.local) { - delete parentNode.local.itemsMap[itemName]; - if ((0, util_1.equal)(parentNode.local.itemsMap, parentNode.common.itemsMap)) { - delete parentNode.local; - } - } - } - } - } - } - return this.deleteRemoteTrees(Object.keys(recurse), changedNodes) - .then(changedObjs2 => { - return this.rs.local.setNodes(this.flush(changedObjs2)); - }); - }); - }); - } - deleteRemoteTrees(paths, changedNodes) { - return __awaiter(this, void 0, void 0, function* () { - if (paths.length === 0) { - return Promise.resolve(changedNodes); - } - return this.rs.local.getNodes(paths).then((nodes) => __awaiter(this, void 0, void 0, function* () { - const subPaths = {}; - function collectSubPaths(folder, path) { - if (folder && folder.itemsMap) { - for (const itemName in folder.itemsMap) { - subPaths[path + itemName] = true; - } - } - } - for (const path in nodes) { - const node = nodes[path]; - // TODO Why check for the node here? I don't think this check ever applies - if (!node) { - continue; - } - if ((0, util_1.isFolder)(path)) { - collectSubPaths(node.common, path); - collectSubPaths(node.local, path); - } - else { - if (node.common && typeof (node.common.body) !== undefined) { - changedNodes[path] = (0, util_1.deepClone)(node); - changedNodes[path].remote = { - body: false, - timestamp: this.now() - }; - changedNodes[path] = this.autoMerge(changedNodes[path]); - } - } - } - // Recurse whole tree depth levels at once: - return this.deleteRemoteTrees(Object.keys(subPaths), changedNodes) - .then(changedNodes2 => { - return this.rs.local.setNodes(this.flush(changedNodes2)); - }); - })); - }); - } - completeFetch(path, bodyOrItemsMap, contentType, revision) { - return __awaiter(this, void 0, void 0, function* () { - let paths; - let parentPath; - const pathsFromRootArr = (0, util_1.pathsFromRoot)(path); - if ((0, util_1.isFolder)(path)) { - paths = [path]; - } - else { - parentPath = pathsFromRootArr[1]; - paths = [path, parentPath]; - } - return this.rs.local.getNodes(paths).then((nodes) => { - let itemName; - let node = nodes[path]; - let parentNode; - const missingChildren = {}; - function collectMissingChildren(folder) { - if (folder && folder.itemsMap) { - for (itemName in folder.itemsMap) { - if (!bodyOrItemsMap[itemName]) { - missingChildren[itemName] = true; - } - } - } - } - if (typeof (node) !== 'object' || - node.path !== path || - typeof (node.common) !== 'object') { - node = { path: path, common: {} }; - nodes[path] = node; - } - node.remote = { - revision: revision, - timestamp: this.now() - }; - if ((0, util_1.isFolder)(path)) { - collectMissingChildren(node.common); - collectMissingChildren(node.remote); - node.remote.itemsMap = {}; - for (itemName in bodyOrItemsMap) { - node.remote.itemsMap[itemName] = true; - } - } - else { - node.remote.body = bodyOrItemsMap; - node.remote.contentType = contentType; - parentNode = nodes[parentPath]; - if (parentNode && parentNode.local && parentNode.local.itemsMap) { - itemName = path.substring(parentPath.length); - parentNode.local.itemsMap[itemName] = true; - if ((0, util_1.equal)(parentNode.local.itemsMap, parentNode.common.itemsMap)) { - delete parentNode.local; - } - } - } - nodes[path] = this.autoMerge(node); - return { - toBeSaved: nodes, - missingChildren: missingChildren - }; - }); - }); - } - completePush(path, action, conflict, revision) { - return __awaiter(this, void 0, void 0, function* () { - return this.rs.local.getNodes([path]).then((nodes) => { - const node = nodes[path]; - if (!node.push) { - this.stopped = true; - throw new Error('completePush called but no push version!'); - } - if (conflict) { - (0, log_1.default)('[Sync] We have a conflict'); - if (!node.remote || node.remote.revision !== revision) { - node.remote = { - revision: revision || 'conflict', - timestamp: this.now() - }; - delete node.push; - } - nodes[path] = this.autoMerge(node); - } - else { - node.common = { - revision: revision, - timestamp: this.now() - }; - if (action === 'put') { - node.common.body = node.push.body; - node.common.contentType = node.push.contentType; - if ((0, util_1.equal)(node.local.body, node.push.body) && - node.local.contentType === node.push.contentType) { - delete node.local; - } - delete node.push; - } - else if (action === 'delete') { - if (node.local.body === false) { // No new local changes since push; flush it. - nodes[path] = undefined; - } - else { - delete node.push; - } - } - } - return this.rs.local.setNodes(this.flush(nodes)); - }); - }); - } - dealWithFailure(path) { - return __awaiter(this, void 0, void 0, function* () { - return this.rs.local.getNodes([path]).then((nodes) => { - if (nodes[path]) { - delete nodes[path].push; - return this.rs.local.setNodes(this.flush(nodes)); - } - }); - }); - } - interpretStatus(statusCode) { - const status = { - statusCode: statusCode, - successful: undefined, - conflict: undefined, - unAuth: undefined, - notFound: undefined, - changed: undefined, - networkProblems: undefined - }; - if (typeof statusCode === 'string' && - (statusCode === 'offline' || statusCode === 'timeout')) { - status.successful = false; - status.networkProblems = true; - return status; - } - else if (typeof statusCode === 'number') { - const series = Math.floor(statusCode / 100); - status.successful = (series === 2 || - statusCode === 304 || - statusCode === 412 || - statusCode === 404), - status.conflict = (statusCode === 412); - status.unAuth = ((statusCode === 401 && this.rs.remote.token !== authorize_1.default.IMPLIED_FAKE_TOKEN) || - statusCode === 402 || - statusCode === 403); - status.notFound = (statusCode === 404); - status.changed = (statusCode !== 304); - return status; - } - } - handleGetResponse(path, status, bodyOrItemsMap, contentType, revision) { - return __awaiter(this, void 0, void 0, function* () { - if (status.notFound) { - if ((0, util_1.isFolder)(path)) { - bodyOrItemsMap = {}; - } - else { - bodyOrItemsMap = false; - } - } - if (status.changed) { - return this.completeFetch(path, bodyOrItemsMap, contentType, revision) - .then(dataFromFetch => { - if ((0, util_1.isFolder)(path)) { - if (this.corruptServerItemsMap(bodyOrItemsMap)) { - (0, log_1.default)('[Sync] WARNING: Discarding corrupt folder description from server for ' + path); - return false; - } - else { - return this.markChildren(path, bodyOrItemsMap, dataFromFetch.toBeSaved, dataFromFetch.missingChildren) - .then(() => { return true; }); - } - } - else { - return this.rs.local.setNodes(this.flush(dataFromFetch.toBeSaved)) - .then(() => { return true; }); - } - }); - } - else { - return this.updateCommonTimestamp(path, revision) - .then(() => { return true; }); - } - }); - } - handleResponse(path, action, r) { - const status = this.interpretStatus(r.statusCode); - if (status.successful) { - if (action === 'get') { - return this.handleGetResponse(path, status, r.body, r.contentType, r.revision); - } - else if (action === 'put' || action === 'delete') { - return this.completePush(path, action, status.conflict, r.revision).then(function () { - return true; - }); - } - else { - throw new Error(`cannot handle response for unknown action ${action}`); - } - } - else { - // Unsuccessful - let error; - if (status.unAuth) { - error = new unauthorized_error_1.default(); - } - else if (status.networkProblems) { - error = new sync_error_1.default('Network request failed.'); - } - else { - error = new Error('HTTP response code ' + status.statusCode + ' received.'); - } - return this.dealWithFailure(path).then(() => { - this.rs._emit('error', error); - throw error; - }); - } - } - finishTask(task, queueTask = true) { - if (task.action === undefined) { - delete this._running[task.path]; - return; - } - if (queueTask) { - (0, log_1.default)("[Sync] queue finished task:", task.path); - this._finishedTasks.push(task); - if (this._finishedTasks.length > 1) { - (0, log_1.default)("[Sync] delaying finished task:", task.path); - return; - } - } - (0, log_1.default)("[Sync] run task:", task.path); - return task.promise - .then(res => { - return this.handleResponse(task.path, task.action, res); - }, err => { - (0, log_1.default)('[Sync] wireclient rejects its promise!', task.path, task.action, err); - return this.handleResponse(task.path, task.action, { statusCode: 'offline' }); - }) - .then((completed) => __awaiter(this, void 0, void 0, function* () { - this._finishedTasks.shift(); - delete this._timeStarted[task.path]; - delete this._running[task.path]; - if (completed) { - if (this._tasks[task.path]) { - for (let i = 0; i < this._tasks[task.path].length; i++) { - this._tasks[task.path][i](); - } - delete this._tasks[task.path]; - } - } - this.rs._emit('sync-req-done', { - tasksRemaining: Object.keys(this._tasks).length - }); - if (this._finishedTasks.length > 0) { - this.finishTask(this._finishedTasks[0], false); - return; - } - yield this.collectTasks(false).then(() => { - // See if there are any more tasks that are not refresh tasks - if (!this.hasTasks() || this.stopped) { - (0, log_1.default)('[Sync] Sync is done! Reschedule?', Object.getOwnPropertyNames(this._tasks).length, this.stopped); - if (!this.done) { - this.done = true; - this.rs._emit('sync-done', { completed: true }); - } - } - else { - // Use a 10ms timeout to let the JavaScript runtime catch its breath - // (and hopefully force an IndexedDB auto-commit?), and also to cause - // the threads to get staggered and get a good spread over time: - setTimeout(() => { this.doTasks(); }, 10); - } - }); - }), err => { - (0, log_1.default)('[Sync] Error', err); - this._finishedTasks.shift(); - delete this._timeStarted[task.path]; - delete this._running[task.path]; - this.rs._emit('sync-req-done', { - tasksRemaining: Object.keys(this._tasks).length - }); - if (this._finishedTasks.length > 0) { - this.finishTask(this._finishedTasks[0], false); - return; - } - if (!this.done) { - this.done = true; - this.rs._emit('sync-done', { completed: false }); - } - }); - } - doTasks() { - let numToHave, numAdded = 0, path; - if (this.rs.remote.connected) { - if (this.rs.remote.online) { - numToHave = this.numThreads; - } - else { - numToHave = 1; - } - } - else { - numToHave = 0; - } - const numToAdd = numToHave - Object.getOwnPropertyNames(this._running).length; - if (numToAdd <= 0) { - return true; - } - for (path in this._tasks) { - if (!this._running[path]) { - this._timeStarted[path] = this.now(); - this._running[path] = this.doTask(path); - this._running[path].then(this.finishTask.bind(this)); - numAdded++; - if (numAdded >= numToAdd) { - return true; - } - } - } - return (numAdded >= numToAdd); - } - collectTasks(alsoCheckRefresh) { - return __awaiter(this, void 0, void 0, function* () { - if (this.hasTasks() || this.stopped) { - return Promise.resolve(); - } - return this.collectDiffTasks().then(numDiffs => { - if (numDiffs || alsoCheckRefresh === false) { - return Promise.resolve(); - } - else { - return this.collectRefreshTasks(); - } - }, function (err) { throw err; }); - }); - } - addTask(path, cb) { - if (!this._tasks[path]) { - this._tasks[path] = []; - } - if (typeof (cb) === 'function') { - this._tasks[path].push(cb); - } - } - /** - * Method: sync - **/ - sync() { - this.done = false; - if (!this.doTasks()) { - return this.collectTasks().then(() => { - try { - this.doTasks(); - } - catch (e) { - (0, log_1.default)('[Sync] doTasks error', e); - } - }, function (e) { - (0, log_1.default)('[Sync] Sync error', e); - throw new Error('Local cache unavailable'); - }); - } - else { - return Promise.resolve(); - } - } - static _rs_init(remoteStorage) { - syncCycleCb = function () { - // if (!config.cache) return false - (0, log_1.default)('[Sync] syncCycleCb calling syncCycle'); - const env = new env_1.default(); - if (env.isBrowser()) { - handleVisibility(env, remoteStorage); - } - if (!remoteStorage.sync) { - // Call this now that all other modules are also ready: - remoteStorage.sync = new Sync(remoteStorage); - if (remoteStorage.syncStopped) { - (0, log_1.default)('[Sync] Instantiating sync stopped'); - remoteStorage.sync.stopped = true; - delete remoteStorage.syncStopped; - } - } - (0, log_1.default)('[Sync] syncCycleCb calling syncCycle'); - remoteStorage.syncCycle(); - }; - syncOnConnect = function () { - remoteStorage.removeEventListener('connected', syncOnConnect); - remoteStorage.startSync(); - }; - remoteStorage.on('ready', syncCycleCb); - remoteStorage.on('connected', syncOnConnect); - } - static _rs_cleanup(remoteStorage) { - remoteStorage.stopSync(); - remoteStorage.removeEventListener('ready', syncCycleCb); - remoteStorage.removeEventListener('connected', syncOnConnect); - remoteStorage.sync = undefined; - delete remoteStorage.sync; - } -} -exports.Sync = Sync; -(0, util_1.applyMixins)(Sync, [eventhandling_1.default]); -exports["default"] = Sync; - - -/***/ }), - -/***/ "./src/syncedgetputdelete.ts": -/*!***********************************!*\ - !*** ./src/syncedgetputdelete.ts ***! - \***********************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -function shareFirst(path) { - return (this.backend === 'dropbox' && - !!path.match(/^\/public\/.*[^\/]$/)); -} -function defaultMaxAge(context) { - if ((typeof context.remote === 'object') && - context.remote.connected && context.remote.online) { - return 2 * context.getSyncInterval(); - } - else { - (0, log_1.default)('Not setting default maxAge, because remote is offline or not connected'); - return false; - } -} -const SyncedGetPutDelete = { - get: function (path, maxAge) { - if (!this.local) { - return this.remote.get(path); - } - else { - if (typeof maxAge === 'undefined') { - maxAge = defaultMaxAge(this); - } - else if (typeof maxAge !== 'number' && maxAge !== false) { - return Promise.reject(`Argument 'maxAge' must be 'false' or a number`); - } - return this.local.get(path, maxAge, this.sync.queueGetRequest.bind(this.sync)); - } - }, - put: function (path, body, contentType) { - if (shareFirst.bind(this)(path)) { - return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.put(path, body, contentType)); - } - else if (this.local) { - return this.local.put(path, body, contentType); - } - else { - return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.put(path, body, contentType)); - } - }, - 'delete': function (path) { - if (this.local) { - return this.local.delete(path); - } - else { - return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.delete(path)); - } - }, - _wrapBusyDone: function (result) { - return __awaiter(this, void 0, void 0, function* () { - this._emit('wire-busy'); - return result.then((r) => { - this._emit('wire-done', { success: true }); - return Promise.resolve(r); - }, (err) => { - this._emit('wire-done', { success: false }); - return Promise.reject(err); - }); - }); - } -}; -module.exports = SyncedGetPutDelete; - - -/***/ }), - -/***/ "./src/types.ts": -/*!**********************!*\ - !*** ./src/types.ts ***! - \**********************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.BaseClientTypes = void 0; -/** - * - Manages and validates types of remoteStorage objects, using JSON-LD and - * JSON Schema - * - Adds schema declaration/validation methods to BaseClient instances. - **/ -class BaseClientTypes { - constructor() { - /** - * -> - */ - this.uris = {}; - /** - * Contains schema objects of all types known to the BaseClient instance - * - * -> - */ - this.schemas = {}; - /** - * -> - */ - this.aliases = {}; - } - /** - * Called via public function BaseClient.declareType() - * - * @private - */ - declare(moduleName, alias, uri, schema) { - const fullAlias = moduleName + '/' + alias; - if (schema.extends) { - const parts = schema.extends.split('/'); - const extendedAlias = (parts.length === 1) - ? moduleName + '/' + parts.shift() - : parts.join('/'); - const extendedUri = this.uris[extendedAlias]; - if (!extendedUri) { - throw "Type '" + fullAlias + "' tries to extend unknown schema '" + extendedAlias + "'"; - } - schema.extends = this.schemas[extendedUri]; - } - this.uris[fullAlias] = uri; - this.aliases[uri] = fullAlias; - this.schemas[uri] = schema; - } - resolveAlias(alias) { - return this.uris[alias]; - } - getSchema(uri) { - return this.schemas[uri]; - } - inScope(moduleName) { - const ml = moduleName.length; - const schemas = {}; - for (const alias in this.uris) { - if (alias.substr(0, ml + 1) === moduleName + '/') { - const uri = this.uris[alias]; - schemas[uri] = this.schemas[uri]; - } - } - return schemas; - } -} -exports.BaseClientTypes = BaseClientTypes; -const Types = new BaseClientTypes(); -exports["default"] = Types; - - -/***/ }), - -/***/ "./src/unauthorized-error.ts": -/*!***********************************!*\ - !*** ./src/unauthorized-error.ts ***! - \***********************************/ -/***/ (function(module) { - -"use strict"; - -class UnauthorizedError extends Error { - constructor(message, options = {}) { - super(); - this.name = 'Unauthorized'; - if (typeof message === 'undefined') { - this.message = 'App authorization expired or revoked.'; - } - else { - this.message = message; - } - if (typeof options.code !== 'undefined') { - this.code = options.code; - } - this.stack = (new Error()).stack; - } -} -module.exports = UnauthorizedError; - - -/***/ }), - -/***/ "./src/util.ts": -/*!*********************!*\ - !*** ./src/util.ts ***! - \*********************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - -// Reusable utility functions -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.toBase64 = exports.getTextFromArrayBuffer = exports.shouldBeTreatedAsBinary = exports.getJSONFromLocalStorage = exports.localStorageAvailable = exports.pathsFromRoot = exports.deepClone = exports.equal = exports.bindAll = exports.cleanPath = exports.baseName = exports.isDocument = exports.isFolder = exports.containingFolder = exports.extend = exports.getGlobalContext = exports.globalContext = exports.logError = void 0; -exports.generateCodeVerifier = generateCodeVerifier; -exports.applyMixins = applyMixins; -/** - * Takes an object and its copy as produced by the _deepClone function - * below, and finds and fixes any ArrayBuffers that were cast to `{}` instead - * of being cloned to new ArrayBuffers with the same content. - * - * It recurses into sub-objects, but skips arrays if they occur. - */ -function _fixArrayBuffers(srcObj, dstObj) { - if (typeof (srcObj) !== 'object' || Array.isArray(srcObj) || srcObj === null) { - return; - } - for (const field in srcObj) { - if (typeof (srcObj[field]) === 'object' && srcObj[field] !== null) { - if (srcObj[field].toString() === '[object ArrayBuffer]') { - dstObj[field] = new ArrayBuffer(srcObj[field].byteLength); - const srcArr = new Int8Array(srcObj[field]); - const dstArr = new Int8Array(dstObj[field]); - dstArr.set(srcArr); - } - else { - _fixArrayBuffers(srcObj[field], dstObj[field]); - } - } - } -} -const logError = (error) => { - if (typeof (error) === 'string') { - console.error(error); - } - else { - console.error(error.message, error.stack); - } -}; -exports.logError = logError; -exports.globalContext = (typeof (window) !== 'undefined' ? window : (typeof self === 'object' ? self : __webpack_require__.g)); -const getGlobalContext = () => { - return (typeof (window) !== 'undefined' ? window : (typeof self === 'object' ? self : __webpack_require__.g)); -}; -exports.getGlobalContext = getGlobalContext; -// TODO Remove in favor of modern JS: -// `const mergedObject = { ...obj1, ..obj2 }` -const extend = (...args) => { - const target = args[0]; - const sources = Array.prototype.slice.call(args, 1); - sources.forEach(function (source) { - for (const key in source) { - target[key] = source[key]; - } - }); - return target; -}; -exports.extend = extend; -const containingFolder = (path) => { - if (path === '') { - return '/'; - } - if (!path) { - throw "Path not given!"; - } - return path.replace(/\/+/g, '/') - .replace(/[^\/]+\/?$/, ''); -}; -exports.containingFolder = containingFolder; -const isFolder = (path) => { - return path.slice(-1) === '/'; -}; -exports.isFolder = isFolder; -const isDocument = (path) => { - return !(0, exports.isFolder)(path); -}; -exports.isDocument = isDocument; -const baseName = (path) => { - const parts = path.split('/'); - if ((0, exports.isFolder)(path)) { - return parts[parts.length - 2] + '/'; - } - else { - return parts[parts.length - 1]; - } -}; -exports.baseName = baseName; -const cleanPath = (path) => { - return path.replace(/\/+/g, '/') - .split('/').map(encodeURIComponent).join('/') - .replace(/'/g, '%27'); -}; -exports.cleanPath = cleanPath; -const bindAll = (object) => { - for (const key in this) { - if (typeof (object[key]) === 'function') { - object[key] = object[key].bind(object); - } - } -}; -exports.bindAll = bindAll; -const equal = (a, b, seen = []) => { - let key; - if (typeof (a) !== typeof (b)) { - return false; - } - if (typeof (a) === 'number' || typeof (a) === 'boolean' || typeof (a) === 'string') { - return a === b; - } - if (typeof (a) === 'function') { - return a.toString() === b.toString(); - } - if (a instanceof ArrayBuffer && b instanceof ArrayBuffer) { - // Without the following conversion the browsers wouldn't be able to - // tell the ArrayBuffer instances apart. - a = new Uint8Array(a); - b = new Uint8Array(b); - } - // If this point has been reached, a and b are either arrays or objects. - if (a instanceof Array) { - if (a.length !== b.length) { - return false; - } - for (let i = 0, c = a.length; i < c; i++) { - if (!(0, exports.equal)(a[i], b[i], seen)) { - return false; - } - } - } - else { - // Check that keys from a exist in b - for (key in a) { - if (a.hasOwnProperty(key) && !(key in b)) { - return false; - } - } - // Check that keys from b exist in a, and compare the values - for (key in b) { - if (!b.hasOwnProperty(key)) { - continue; - } - if (!(key in a)) { - return false; - } - let seenArg; - if (typeof (b[key]) === 'object') { - if (seen.indexOf(b[key]) >= 0) { - // Circular reference, don't attempt to compare this object. - // If nothing else returns false, the objects match. - continue; - } - seenArg = seen.slice(); - seenArg.push(b[key]); - } - if (!(0, exports.equal)(a[key], b[key], seenArg)) { - return false; - } - } - } - return true; -}; -exports.equal = equal; -const deepClone = (obj) => { - if (obj === undefined) { - return undefined; - } - else { - const clone = JSON.parse(JSON.stringify(obj)); - _fixArrayBuffers(obj, clone); - return clone; - } -}; -exports.deepClone = deepClone; -const pathsFromRoot = (path) => { - const paths = [path]; - const parts = path.replace(/\/$/, '').split('/'); - while (parts.length > 1) { - parts.pop(); - paths.push(parts.join('/') + '/'); - } - return paths; -}; -exports.pathsFromRoot = pathsFromRoot; -const localStorageAvailable = () => { - const context = (0, exports.getGlobalContext)(); - if (!('localStorage' in context)) { - return false; - } - try { - context.localStorage.setItem('rs-check', '1'); - context.localStorage.removeItem('rs-check'); - return true; - } - catch (error) { - return false; - } -}; -exports.localStorageAvailable = localStorageAvailable; -/** - * Extract and parse JSON data from localStorage. - * - * @param {string} key - localStorage key - * - * @returns {object} parsed object or undefined - */ -const getJSONFromLocalStorage = (key) => { - const context = (0, exports.getGlobalContext)(); - try { - return JSON.parse(context.localStorage.getItem(key)); - } - catch (e) { - // no JSON stored - } -}; -exports.getJSONFromLocalStorage = getJSONFromLocalStorage; -/** - * Decide if data should be treated as binary based on the content (presence of non-printable characters - * or replacement character) and content-type. - * - * @param {string} content - The data - * @param {string} mimeType - The data's content-type - * - * @returns {boolean} - */ -const shouldBeTreatedAsBinary = (content, mimeType) => { - // eslint-disable-next-line no-control-regex - return !!((mimeType && mimeType.match(/charset=binary/)) || /[\x00-\x08\x0E-\x1F\uFFFD]/.test(content)); -}; -exports.shouldBeTreatedAsBinary = shouldBeTreatedAsBinary; -/** - * Read data from an ArrayBuffer and return it as a string - * @param {ArrayBuffer} arrayBuffer - * @param {string} encoding - * @returns {Promise} Resolves with a string containing the data - */ -const getTextFromArrayBuffer = (arrayBuffer, encoding) => { - return new Promise((resolve /*, reject*/) => { - if (typeof Blob === 'undefined' || typeof FileReader === 'undefined') { - const buffer = Buffer.from(arrayBuffer); - resolve(buffer.toString(encoding)); - } - else { - let blob; - const gc = exports.globalContext; - // TODO fix as BlobBuilder is not available in all browsers - // @see https://developer.mozilla.org/en-US/docs/Web/API/BlobBuilder - gc.BlobBuilder = gc.BlobBuilder || gc.WebKitBlobBuilder; - if (typeof gc.BlobBuilder !== 'undefined') { - const bb = new gc.BlobBuilder(); - bb.append(arrayBuffer); - blob = bb.getBlob(); - } - else { - blob = new Blob([arrayBuffer]); - } - const fileReader = new FileReader(); - if (typeof fileReader.addEventListener === 'function') { - fileReader.addEventListener('loadend', function (evt) { - resolve(evt.target.result); - }); - } - else { - fileReader.onloadend = function (evt) { - resolve(evt.target.result); - }; - } - fileReader.readAsText(blob, encoding); - } - }); -}; -exports.getTextFromArrayBuffer = getTextFromArrayBuffer; -/** - * Encode string in base64 - * @param {String} str - * @returns {String} base64-encoded string - */ -const toBase64 = (str) => { - const context = (0, exports.getGlobalContext)(); - if ('btoa' in context) { - return context['btoa'](str); - } - else { - return Buffer.from(str).toString('base64'); - } -}; -exports.toBase64 = toBase64; -/** - * Generates values required for OAuth2 PKCE in a cryptographically secure manner. - * @param {number} [numChar=128] - length of codeVerifier to generate; from 43 to 128 - * - * @typedef {Object} PkceValues - * @property {string} codeVerifier - 43 to 128 chars from the 66-char set - * @property {string} codeChallenge - verifier hashed & base-64 URL encoded - * @property {string} state - a separate random value. Should be used to check redirect_uri. - * @returns PkceValues - */ -function generateCodeVerifier() { - return __awaiter(this, arguments, void 0, function* (numChar = 128) { - const randomBytes = new Uint8Array(numChar); - crypto.getRandomValues(randomBytes); - const charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~'; - const randomChar = Array.from(randomBytes).map(byte => charSet[byte % charSet.length]); - const codeVerifier = randomChar.join(''); - const charsAsBytes = Uint8Array.from(randomChar.map(ch => ch.charCodeAt(0))); - const sha256hash = yield crypto.subtle.digest('SHA-256', charsAsBytes); - const codeChallenge = base64Urlencode(sha256hash); - crypto.getRandomValues(randomBytes); - const stateRandomChar = Array.from(randomBytes).map(byte => charSet[byte % charSet.length]); - const state = stateRandomChar.join(''); - return { codeVerifier, codeChallenge, state }; - }); -} -function base64Urlencode(str) { - return btoa(String.fromCharCode.apply(null, new Uint8Array(str))) - .replace(/\+/g, '-') - .replace(/\//g, '_') - .replace(/=+$/, ''); -} -/* - * Apply mixins to an object - * - * https://www.typescriptlang.org/docs/handbook/mixins.html - * - * @param derivedConstructor Parent object - * @param constructors Mixins to apply methods from - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function applyMixins(derivedCtor, constructors) { - constructors.forEach(baseCtor => { - Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => { - Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name)); - }); - }); -} - - -/***/ }), - -/***/ "./src/wireclient.ts": -/*!***************************!*\ - !*** ./src/wireclient.ts ***! - \***************************/ -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -const authorize_1 = __importDefault(__webpack_require__(/*! ./authorize */ "./src/authorize.ts")); -const eventhandling_1 = __importDefault(__webpack_require__(/*! ./eventhandling */ "./src/eventhandling.ts")); -const unauthorized_error_1 = __importDefault(__webpack_require__(/*! ./unauthorized-error */ "./src/unauthorized-error.ts")); -const log_1 = __importDefault(__webpack_require__(/*! ./log */ "./src/log.ts")); -const util_1 = __webpack_require__(/*! ./util */ "./src/util.ts"); -const requests_1 = __webpack_require__(/*! ./requests */ "./src/requests.ts"); -const remote_1 = __webpack_require__(/*! ./remote */ "./src/remote.ts"); -let hasLocalStorage; -const SETTINGS_KEY = 'remotestorage:wireclient'; -const API_2012 = 1; -const API_00 = 2; -const API_01 = 3; -const API_02 = 4; -const API_HEAD = 5; -const STORAGE_APIS = { - 'draft-dejong-remotestorage-00': API_00, - 'draft-dejong-remotestorage-01': API_01, - 'draft-dejong-remotestorage-02': API_02, - 'https://www.w3.org/community/rww/wiki/read-write-web-00#simple': API_2012 -}; -function readSettings() { - const settings = (0, util_1.getJSONFromLocalStorage)(SETTINGS_KEY) || {}; - const { userAddress, href, storageApi, token, properties } = settings; - return { userAddress, href, storageApi, token, properties }; -} -function determineCharset(mimeType) { - let charset = 'utf-8'; - let charsetMatch; - if (mimeType) { - charsetMatch = mimeType.match(/charset=(.+)$/); - if (charsetMatch) { - charset = charsetMatch[1]; - } - } - return charset; -} -function isFolderDescription(body) { - return ((body['@context'] === 'http://remotestorage.io/spec/folder-description') - && (typeof (body['items']) === 'object')); -} -function isSuccessStatus(status) { - return [201, 204, 304].indexOf(status) >= 0; -} -function isErrorStatus(status) { - return [401, 403, 404, 412].indexOf(status) >= 0; -} -class WireClient extends remote_1.RemoteBase { - constructor(rs) { - super(rs); - this._revisionCache = {}; - hasLocalStorage = (0, util_1.localStorageAvailable)(); - /** - * Event: connected - * Fired when the wireclient connect method realizes that it is in - * possession of a token and href - **/ - this.addEvents(['connected', 'not-connected']); - if (hasLocalStorage) { - const settings = readSettings(); - if (settings) { - setTimeout(() => { - this.configure(settings); - }, 0); - } - } - if (this.connected) { - setTimeout(this._emit.bind(this), 0, 'connected'); - } - } - get storageType() { - if (this.storageApi) { - const spec = this.storageApi.match(/draft-dejong-(remotestorage-\d\d)/); - return spec ? spec[1] : '2012.04'; - } - else { - return undefined; - } - } - _request(method, uri, token, headers, body, getEtag, fakeRevision) { - return __awaiter(this, void 0, void 0, function* () { - if (this.isForbiddenRequestMethod(method, uri)) { - return Promise.reject(`Don't use ${method} on directories!`); - } - let revision; - if (token !== authorize_1.default.IMPLIED_FAKE_TOKEN) { - headers['Authorization'] = 'Bearer ' + token; - } - this.rs._emit('wire-busy', { - method: method, - isFolder: (0, util_1.isFolder)(uri) - }); - return (0, requests_1.requestWithTimeout)(method, uri, { - body: body, - headers: headers, - responseType: 'arraybuffer' - }).then((response) => { - if (!this.online) { - this.online = true; - this.rs._emit('network-online'); - } - this.rs._emit('wire-done', { - method: method, - isFolder: (0, util_1.isFolder)(uri), - success: true - }); - if (isErrorStatus(response.status)) { - (0, log_1.default)('[WireClient] Error response status', response.status); - if (getEtag) { - revision = this.stripQuotes(response.getResponseHeader('ETag')); - } - else { - revision = undefined; - } - if (response.status === 401) { - this.rs._emit('error', new unauthorized_error_1.default()); - } - return Promise.resolve({ statusCode: response.status, revision: revision }); - } - else if (isSuccessStatus(response.status) || - (response.status === 200 && method !== 'GET')) { - revision = this.stripQuotes(response.getResponseHeader('ETag')); - (0, log_1.default)('[WireClient] Successful request', revision); - return Promise.resolve({ statusCode: response.status, revision: revision }); - } - else { - const mimeType = response.getResponseHeader('Content-Type'); - if (getEtag) { - revision = this.stripQuotes(response.getResponseHeader('ETag')); - } - else { - revision = (response.status === 200) ? fakeRevision : undefined; - } - const charset = determineCharset(mimeType); - if ((0, util_1.shouldBeTreatedAsBinary)(response.response, mimeType)) { - (0, log_1.default)('[WireClient] Successful request with unknown or binary mime-type', revision); - return Promise.resolve({ - statusCode: response.status, - body: response.response, - contentType: mimeType, - revision: revision - }); - } - else { - return (0, util_1.getTextFromArrayBuffer)(response.response, charset) - .then((textContent) => { - (0, log_1.default)('[WireClient] Successful request', revision); - return Promise.resolve({ - statusCode: response.status, - body: textContent, - contentType: mimeType, - revision: revision - }); - }); - } - } - }, error => { - if (this.online) { - this.online = false; - this.rs._emit('network-offline'); - } - this.rs._emit('wire-done', { - method: method, - isFolder: (0, util_1.isFolder)(uri), - success: false - }); - return Promise.reject(error); - }); - }); - } - /** - * Sets the userAddress, href, storageApi, token, and properties of a - * remote store. Also sets connected and online to true and emits the - * 'connected' event, if both token and href are present. - * - * Parameters: - * settings - An object that may contain userAddress (string or null), - * href (string or null), storageApi (string or null), token (string - * or null), and/or properties (the JSON-parsed properties object - * from the user's WebFinger record, see section 10 of - * http://tools.ietf.org/html/draft-dejong-remotestorage-03 - * or null). - * Fields that are not included (i.e. `undefined`), stay at - * their current value. To set a field, include that field - * with a `string` value. To reset a field, for instance when - * the user disconnected their storage, or you found that the - * token you have has expired, simply set that field to `null`. - */ - configure(settings) { - if (typeof settings !== 'object') { - throw new Error('WireClient configure settings parameter should be an object'); - } - if (typeof settings.userAddress !== 'undefined') { - this.userAddress = settings.userAddress; - } - if (typeof settings.href !== 'undefined') { - this.href = settings.href; - } - if (typeof settings.storageApi !== 'undefined') { - this.storageApi = settings.storageApi; - } - if (typeof settings.token !== 'undefined') { - this.token = settings.token; - } - if (typeof settings.properties !== 'undefined') { - this.properties = settings.properties; - } - if (typeof this.storageApi === 'string') { - const _storageApi = STORAGE_APIS[this.storageApi] || API_HEAD; - this.supportsRevs = _storageApi >= API_00; - } - if (this.href && this.token) { - this.connected = true; - this.online = true; - this._emit('connected'); - } - else { - this.connected = false; - } - if (hasLocalStorage) { - localStorage[SETTINGS_KEY] = JSON.stringify({ - userAddress: this.userAddress, - href: this.href, - storageApi: this.storageApi, - token: this.token, - properties: this.properties - }); - } - } - get(path, options = {}) { - if (!this.connected) { - return Promise.reject('not connected (path: ' + path + ')'); - } - const headers = {}; - if (this.supportsRevs) { - if (options.ifNoneMatch) { - headers['If-None-Match'] = this.addQuotes(options.ifNoneMatch); - } - } - // commenting it out as this is doing nothing and jshint is complaining -les - // else if (options.ifNoneMatch) { - // let oldRev = this._revisionCache[path]; - // } - return this._request('GET', this.href + (0, util_1.cleanPath)(path), this.token, headers, undefined, this.supportsRevs, this._revisionCache[path]) - .then((r) => { - if (!(0, util_1.isFolder)(path)) { - return Promise.resolve(r); - } - let itemsMap = {}; - if (typeof (r.body) !== 'undefined') { - try { - r.body = JSON.parse(r.body); - } - catch (e) { - return Promise.reject('Folder description at ' + this.href + (0, util_1.cleanPath)(path) + ' is not JSON'); - } - } - if (r.statusCode === 200 && typeof (r.body) === 'object') { - // New folder listing received - if (Object.keys(r.body).length === 0) { - // Empty folder listing of any spec - r.statusCode = 404; - } - else if (isFolderDescription(r.body)) { - // >= 02 spec - for (const item in r.body.items) { - this._revisionCache[path + item] = r.body.items[item].ETag; - } - itemsMap = r.body.items; - } - else { - // < 02 spec - Object.keys(r.body).forEach((key) => { - this._revisionCache[path + key] = r.body[key]; - itemsMap[key] = { 'ETag': r.body[key] }; - }); - } - r.body = itemsMap; - return Promise.resolve(r); - } - else { - return Promise.resolve(r); - } - }); - } - put(path, body, contentType, options = {}) { - if (!this.connected) { - return Promise.reject('not connected (path: ' + path + ')'); - } - if ((!contentType.match(/charset=/)) && (body instanceof ArrayBuffer || (0, requests_1.isArrayBufferView)(body))) { - contentType += '; charset=binary'; - } - const headers = { 'Content-Type': contentType }; - if (this.supportsRevs) { - if (options.ifMatch) { - headers['If-Match'] = this.addQuotes(options.ifMatch); - } - if (options.ifNoneMatch) { - headers['If-None-Match'] = this.addQuotes(options.ifNoneMatch); - } - } - return this._request('PUT', this.href + (0, util_1.cleanPath)(path), this.token, headers, body, this.supportsRevs); - } - delete(path, options = {}) { - if (!this.connected) { - throw new Error('not connected (path: ' + path + ')'); - } - if (!options) { - options = {}; - } - const headers = {}; - if (this.supportsRevs) { - if (options.ifMatch) { - headers['If-Match'] = this.addQuotes(options.ifMatch); - } - } - return this._request('DELETE', this.href + (0, util_1.cleanPath)(path), this.token, headers, undefined, this.supportsRevs); - } - static _rs_init(remoteStorage) { - remoteStorage.remote = new WireClient(remoteStorage); - remoteStorage.remote.online = true; - } - static _rs_supported() { - return typeof fetch === 'function' || typeof XMLHttpRequest === 'function'; - } - static _rs_cleanup() { - if (hasLocalStorage) { - delete localStorage[SETTINGS_KEY]; - } - } -} -(0, util_1.applyMixins)(WireClient, [eventhandling_1.default]); -module.exports = WireClient; - - -/***/ }), - -/***/ "./node_modules/tv4/tv4.js": -/*!*********************************!*\ - !*** ./node_modules/tv4/tv4.js ***! - \*********************************/ -/***/ (function(module, exports) { - -var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* -Author: Geraint Luff and others -Year: 2013 - -This code is released into the "public domain" by its author(s). Anybody may use, alter and distribute the code without restriction. The author makes no guarantees, and takes no liability of any kind for use of this code. - -If you find a bug or make an improvement, it would be courteous to let the author know, but it is not compulsory. -*/ -(function (global, factory) { - if (true) { - // AMD. Register as an anonymous module. - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}(this, function () { - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FObject%2Fkeys -if (!Object.keys) { - Object.keys = (function () { - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), - dontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ], - dontEnumsLength = dontEnums.length; - - return function (obj) { - if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) { - throw new TypeError('Object.keys called on non-object'); - } - - var result = []; - - for (var prop in obj) { - if (hasOwnProperty.call(obj, prop)) { - result.push(prop); - } - } - - if (hasDontEnumBug) { - for (var i=0; i < dontEnumsLength; i++) { - if (hasOwnProperty.call(obj, dontEnums[i])) { - result.push(dontEnums[i]); - } - } - } - return result; - }; - })(); -} -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create -if (!Object.create) { - Object.create = (function(){ - function F(){} - - return function(o){ - if (arguments.length !== 1) { - throw new Error('Object.create implementation only accepts one parameter.'); - } - F.prototype = o; - return new F(); - }; - })(); -} -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FisArray -if(!Array.isArray) { - Array.isArray = function (vArg) { - return Object.prototype.toString.call(vArg) === "[object Array]"; - }; -} -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FindexOf -if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { - if (this === null) { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - - if (len === 0) { - return -1; - } - var n = 0; - if (arguments.length > 1) { - n = Number(arguments[1]); - if (n !== n) { // shortcut for verifying if it's NaN - n = 0; - } else if (n !== 0 && n !== Infinity && n !== -Infinity) { - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - } - if (n >= len) { - return -1; - } - var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); - for (; k < len; k++) { - if (k in t && t[k] === searchElement) { - return k; - } - } - return -1; - }; -} - -// Grungey Object.isFrozen hack -if (!Object.isFrozen) { - Object.isFrozen = function (obj) { - var key = "tv4_test_frozen_key"; - while (obj.hasOwnProperty(key)) { - key += Math.random(); - } - try { - obj[key] = true; - delete obj[key]; - return false; - } catch (e) { - return true; - } - }; -} -// Based on: https://github.com/geraintluff/uri-templates, but with all the de-substitution stuff removed - -var uriTemplateGlobalModifiers = { - "+": true, - "#": true, - ".": true, - "/": true, - ";": true, - "?": true, - "&": true -}; -var uriTemplateSuffices = { - "*": true -}; - -function notReallyPercentEncode(string) { - return encodeURI(string).replace(/%25[0-9][0-9]/g, function (doubleEncoded) { - return "%" + doubleEncoded.substring(3); - }); -} - -function uriTemplateSubstitution(spec) { - var modifier = ""; - if (uriTemplateGlobalModifiers[spec.charAt(0)]) { - modifier = spec.charAt(0); - spec = spec.substring(1); - } - var separator = ""; - var prefix = ""; - var shouldEscape = true; - var showVariables = false; - var trimEmptyString = false; - if (modifier === '+') { - shouldEscape = false; - } else if (modifier === ".") { - prefix = "."; - separator = "."; - } else if (modifier === "/") { - prefix = "/"; - separator = "/"; - } else if (modifier === '#') { - prefix = "#"; - shouldEscape = false; - } else if (modifier === ';') { - prefix = ";"; - separator = ";"; - showVariables = true; - trimEmptyString = true; - } else if (modifier === '?') { - prefix = "?"; - separator = "&"; - showVariables = true; - } else if (modifier === '&') { - prefix = "&"; - separator = "&"; - showVariables = true; - } - - var varNames = []; - var varList = spec.split(","); - var varSpecs = []; - var varSpecMap = {}; - for (var i = 0; i < varList.length; i++) { - var varName = varList[i]; - var truncate = null; - if (varName.indexOf(":") !== -1) { - var parts = varName.split(":"); - varName = parts[0]; - truncate = parseInt(parts[1], 10); - } - var suffices = {}; - while (uriTemplateSuffices[varName.charAt(varName.length - 1)]) { - suffices[varName.charAt(varName.length - 1)] = true; - varName = varName.substring(0, varName.length - 1); - } - var varSpec = { - truncate: truncate, - name: varName, - suffices: suffices - }; - varSpecs.push(varSpec); - varSpecMap[varName] = varSpec; - varNames.push(varName); - } - var subFunction = function (valueFunction) { - var result = ""; - var startIndex = 0; - for (var i = 0; i < varSpecs.length; i++) { - var varSpec = varSpecs[i]; - var value = valueFunction(varSpec.name); - if (value === null || value === undefined || (Array.isArray(value) && value.length === 0) || (typeof value === 'object' && Object.keys(value).length === 0)) { - startIndex++; - continue; - } - if (i === startIndex) { - result += prefix; - } else { - result += (separator || ","); - } - if (Array.isArray(value)) { - if (showVariables) { - result += varSpec.name + "="; - } - for (var j = 0; j < value.length; j++) { - if (j > 0) { - result += varSpec.suffices['*'] ? (separator || ",") : ","; - if (varSpec.suffices['*'] && showVariables) { - result += varSpec.name + "="; - } - } - result += shouldEscape ? encodeURIComponent(value[j]).replace(/!/g, "%21") : notReallyPercentEncode(value[j]); - } - } else if (typeof value === "object") { - if (showVariables && !varSpec.suffices['*']) { - result += varSpec.name + "="; - } - var first = true; - for (var key in value) { - if (!first) { - result += varSpec.suffices['*'] ? (separator || ",") : ","; - } - first = false; - result += shouldEscape ? encodeURIComponent(key).replace(/!/g, "%21") : notReallyPercentEncode(key); - result += varSpec.suffices['*'] ? '=' : ","; - result += shouldEscape ? encodeURIComponent(value[key]).replace(/!/g, "%21") : notReallyPercentEncode(value[key]); - } - } else { - if (showVariables) { - result += varSpec.name; - if (!trimEmptyString || value !== "") { - result += "="; - } - } - if (varSpec.truncate != null) { - value = value.substring(0, varSpec.truncate); - } - result += shouldEscape ? encodeURIComponent(value).replace(/!/g, "%21"): notReallyPercentEncode(value); - } - } - return result; - }; - subFunction.varNames = varNames; - return { - prefix: prefix, - substitution: subFunction - }; -} - -function UriTemplate(template) { - if (!(this instanceof UriTemplate)) { - return new UriTemplate(template); - } - var parts = template.split("{"); - var textParts = [parts.shift()]; - var prefixes = []; - var substitutions = []; - var varNames = []; - while (parts.length > 0) { - var part = parts.shift(); - var spec = part.split("}")[0]; - var remainder = part.substring(spec.length + 1); - var funcs = uriTemplateSubstitution(spec); - substitutions.push(funcs.substitution); - prefixes.push(funcs.prefix); - textParts.push(remainder); - varNames = varNames.concat(funcs.substitution.varNames); - } - this.fill = function (valueFunction) { - var result = textParts[0]; - for (var i = 0; i < substitutions.length; i++) { - var substitution = substitutions[i]; - result += substitution(valueFunction); - result += textParts[i + 1]; - } - return result; - }; - this.varNames = varNames; - this.template = template; -} -UriTemplate.prototype = { - toString: function () { - return this.template; - }, - fillFromObject: function (obj) { - return this.fill(function (varName) { - return obj[varName]; - }); - } -}; -var ValidatorContext = function ValidatorContext(parent, collectMultiple, errorReporter, checkRecursive, trackUnknownProperties) { - this.missing = []; - this.missingMap = {}; - this.formatValidators = parent ? Object.create(parent.formatValidators) : {}; - this.schemas = parent ? Object.create(parent.schemas) : {}; - this.collectMultiple = collectMultiple; - this.errors = []; - this.handleError = collectMultiple ? this.collectError : this.returnError; - if (checkRecursive) { - this.checkRecursive = true; - this.scanned = []; - this.scannedFrozen = []; - this.scannedFrozenSchemas = []; - this.scannedFrozenValidationErrors = []; - this.validatedSchemasKey = 'tv4_validation_id'; - this.validationErrorsKey = 'tv4_validation_errors_id'; - } - if (trackUnknownProperties) { - this.trackUnknownProperties = true; - this.knownPropertyPaths = {}; - this.unknownPropertyPaths = {}; - } - this.errorReporter = errorReporter || defaultErrorReporter('en'); - if (typeof this.errorReporter === 'string') { - throw new Error('debug'); - } - this.definedKeywords = {}; - if (parent) { - for (var key in parent.definedKeywords) { - this.definedKeywords[key] = parent.definedKeywords[key].slice(0); - } - } -}; -ValidatorContext.prototype.defineKeyword = function (keyword, keywordFunction) { - this.definedKeywords[keyword] = this.definedKeywords[keyword] || []; - this.definedKeywords[keyword].push(keywordFunction); -}; -ValidatorContext.prototype.createError = function (code, messageParams, dataPath, schemaPath, subErrors, data, schema) { - var error = new ValidationError(code, messageParams, dataPath, schemaPath, subErrors); - error.message = this.errorReporter(error, data, schema); - return error; -}; -ValidatorContext.prototype.returnError = function (error) { - return error; -}; -ValidatorContext.prototype.collectError = function (error) { - if (error) { - this.errors.push(error); - } - return null; -}; -ValidatorContext.prototype.prefixErrors = function (startIndex, dataPath, schemaPath) { - for (var i = startIndex; i < this.errors.length; i++) { - this.errors[i] = this.errors[i].prefixWith(dataPath, schemaPath); - } - return this; -}; -ValidatorContext.prototype.banUnknownProperties = function (data, schema) { - for (var unknownPath in this.unknownPropertyPaths) { - var error = this.createError(ErrorCodes.UNKNOWN_PROPERTY, {path: unknownPath}, unknownPath, "", null, data, schema); - var result = this.handleError(error); - if (result) { - return result; - } - } - return null; -}; - -ValidatorContext.prototype.addFormat = function (format, validator) { - if (typeof format === 'object') { - for (var key in format) { - this.addFormat(key, format[key]); - } - return this; - } - this.formatValidators[format] = validator; -}; -ValidatorContext.prototype.resolveRefs = function (schema, urlHistory) { - if (schema['$ref'] !== undefined) { - urlHistory = urlHistory || {}; - if (urlHistory[schema['$ref']]) { - return this.createError(ErrorCodes.CIRCULAR_REFERENCE, {urls: Object.keys(urlHistory).join(', ')}, '', '', null, undefined, schema); - } - urlHistory[schema['$ref']] = true; - schema = this.getSchema(schema['$ref'], urlHistory); - } - return schema; -}; -ValidatorContext.prototype.getSchema = function (url, urlHistory) { - var schema; - if (this.schemas[url] !== undefined) { - schema = this.schemas[url]; - return this.resolveRefs(schema, urlHistory); - } - var baseUrl = url; - var fragment = ""; - if (url.indexOf('#') !== -1) { - fragment = url.substring(url.indexOf("#") + 1); - baseUrl = url.substring(0, url.indexOf("#")); - } - if (typeof this.schemas[baseUrl] === 'object') { - schema = this.schemas[baseUrl]; - var pointerPath = decodeURIComponent(fragment); - if (pointerPath === "") { - return this.resolveRefs(schema, urlHistory); - } else if (pointerPath.charAt(0) !== "/") { - return undefined; - } - var parts = pointerPath.split("/").slice(1); - for (var i = 0; i < parts.length; i++) { - var component = parts[i].replace(/~1/g, "/").replace(/~0/g, "~"); - if (schema[component] === undefined) { - schema = undefined; - break; - } - schema = schema[component]; - } - if (schema !== undefined) { - return this.resolveRefs(schema, urlHistory); - } - } - if (this.missing[baseUrl] === undefined) { - this.missing.push(baseUrl); - this.missing[baseUrl] = baseUrl; - this.missingMap[baseUrl] = baseUrl; - } -}; -ValidatorContext.prototype.searchSchemas = function (schema, url) { - if (Array.isArray(schema)) { - for (var i = 0; i < schema.length; i++) { - this.searchSchemas(schema[i], url); - } - } else if (schema && typeof schema === "object") { - if (typeof schema.id === "string") { - if (isTrustedUrl(url, schema.id)) { - if (this.schemas[schema.id] === undefined) { - this.schemas[schema.id] = schema; - } - } - } - for (var key in schema) { - if (key !== "enum") { - if (typeof schema[key] === "object") { - this.searchSchemas(schema[key], url); - } else if (key === "$ref") { - var uri = getDocumentUri(schema[key]); - if (uri && this.schemas[uri] === undefined && this.missingMap[uri] === undefined) { - this.missingMap[uri] = uri; - } - } - } - } - } -}; -ValidatorContext.prototype.addSchema = function (url, schema) { - //overload - if (typeof url !== 'string' || typeof schema === 'undefined') { - if (typeof url === 'object' && typeof url.id === 'string') { - schema = url; - url = schema.id; - } - else { - return; - } - } - if (url === getDocumentUri(url) + "#") { - // Remove empty fragment - url = getDocumentUri(url); - } - this.schemas[url] = schema; - delete this.missingMap[url]; - normSchema(schema, url); - this.searchSchemas(schema, url); -}; - -ValidatorContext.prototype.getSchemaMap = function () { - var map = {}; - for (var key in this.schemas) { - map[key] = this.schemas[key]; - } - return map; -}; - -ValidatorContext.prototype.getSchemaUris = function (filterRegExp) { - var list = []; - for (var key in this.schemas) { - if (!filterRegExp || filterRegExp.test(key)) { - list.push(key); - } - } - return list; -}; - -ValidatorContext.prototype.getMissingUris = function (filterRegExp) { - var list = []; - for (var key in this.missingMap) { - if (!filterRegExp || filterRegExp.test(key)) { - list.push(key); - } - } - return list; -}; - -ValidatorContext.prototype.dropSchemas = function () { - this.schemas = {}; - this.reset(); -}; -ValidatorContext.prototype.reset = function () { - this.missing = []; - this.missingMap = {}; - this.errors = []; -}; - -ValidatorContext.prototype.validateAll = function (data, schema, dataPathParts, schemaPathParts, dataPointerPath) { - var topLevel; - schema = this.resolveRefs(schema); - if (!schema) { - return null; - } else if (schema instanceof ValidationError) { - this.errors.push(schema); - return schema; - } - - var startErrorCount = this.errors.length; - var frozenIndex, scannedFrozenSchemaIndex = null, scannedSchemasIndex = null; - if (this.checkRecursive && data && typeof data === 'object') { - topLevel = !this.scanned.length; - if (data[this.validatedSchemasKey]) { - var schemaIndex = data[this.validatedSchemasKey].indexOf(schema); - if (schemaIndex !== -1) { - this.errors = this.errors.concat(data[this.validationErrorsKey][schemaIndex]); - return null; - } - } - if (Object.isFrozen(data)) { - frozenIndex = this.scannedFrozen.indexOf(data); - if (frozenIndex !== -1) { - var frozenSchemaIndex = this.scannedFrozenSchemas[frozenIndex].indexOf(schema); - if (frozenSchemaIndex !== -1) { - this.errors = this.errors.concat(this.scannedFrozenValidationErrors[frozenIndex][frozenSchemaIndex]); - return null; - } - } - } - this.scanned.push(data); - if (Object.isFrozen(data)) { - if (frozenIndex === -1) { - frozenIndex = this.scannedFrozen.length; - this.scannedFrozen.push(data); - this.scannedFrozenSchemas.push([]); - } - scannedFrozenSchemaIndex = this.scannedFrozenSchemas[frozenIndex].length; - this.scannedFrozenSchemas[frozenIndex][scannedFrozenSchemaIndex] = schema; - this.scannedFrozenValidationErrors[frozenIndex][scannedFrozenSchemaIndex] = []; - } else { - if (!data[this.validatedSchemasKey]) { - try { - Object.defineProperty(data, this.validatedSchemasKey, { - value: [], - configurable: true - }); - Object.defineProperty(data, this.validationErrorsKey, { - value: [], - configurable: true - }); - } catch (e) { - //IE 7/8 workaround - data[this.validatedSchemasKey] = []; - data[this.validationErrorsKey] = []; - } - } - scannedSchemasIndex = data[this.validatedSchemasKey].length; - data[this.validatedSchemasKey][scannedSchemasIndex] = schema; - data[this.validationErrorsKey][scannedSchemasIndex] = []; - } - } - - var errorCount = this.errors.length; - var error = this.validateBasic(data, schema, dataPointerPath) - || this.validateNumeric(data, schema, dataPointerPath) - || this.validateString(data, schema, dataPointerPath) - || this.validateArray(data, schema, dataPointerPath) - || this.validateObject(data, schema, dataPointerPath) - || this.validateCombinations(data, schema, dataPointerPath) - || this.validateHypermedia(data, schema, dataPointerPath) - || this.validateFormat(data, schema, dataPointerPath) - || this.validateDefinedKeywords(data, schema, dataPointerPath) - || null; - - if (topLevel) { - while (this.scanned.length) { - var item = this.scanned.pop(); - delete item[this.validatedSchemasKey]; - } - this.scannedFrozen = []; - this.scannedFrozenSchemas = []; - } - - if (error || errorCount !== this.errors.length) { - while ((dataPathParts && dataPathParts.length) || (schemaPathParts && schemaPathParts.length)) { - var dataPart = (dataPathParts && dataPathParts.length) ? "" + dataPathParts.pop() : null; - var schemaPart = (schemaPathParts && schemaPathParts.length) ? "" + schemaPathParts.pop() : null; - if (error) { - error = error.prefixWith(dataPart, schemaPart); - } - this.prefixErrors(errorCount, dataPart, schemaPart); - } - } - - if (scannedFrozenSchemaIndex !== null) { - this.scannedFrozenValidationErrors[frozenIndex][scannedFrozenSchemaIndex] = this.errors.slice(startErrorCount); - } else if (scannedSchemasIndex !== null) { - data[this.validationErrorsKey][scannedSchemasIndex] = this.errors.slice(startErrorCount); - } - - return this.handleError(error); -}; -ValidatorContext.prototype.validateFormat = function (data, schema) { - if (typeof schema.format !== 'string' || !this.formatValidators[schema.format]) { - return null; - } - var errorMessage = this.formatValidators[schema.format].call(null, data, schema); - if (typeof errorMessage === 'string' || typeof errorMessage === 'number') { - return this.createError(ErrorCodes.FORMAT_CUSTOM, {message: errorMessage}, '', '/format', null, data, schema); - } else if (errorMessage && typeof errorMessage === 'object') { - return this.createError(ErrorCodes.FORMAT_CUSTOM, {message: errorMessage.message || "?"}, errorMessage.dataPath || '', errorMessage.schemaPath || "/format", null, data, schema); - } - return null; -}; -ValidatorContext.prototype.validateDefinedKeywords = function (data, schema, dataPointerPath) { - for (var key in this.definedKeywords) { - if (typeof schema[key] === 'undefined') { - continue; - } - var validationFunctions = this.definedKeywords[key]; - for (var i = 0; i < validationFunctions.length; i++) { - var func = validationFunctions[i]; - var result = func(data, schema[key], schema, dataPointerPath); - if (typeof result === 'string' || typeof result === 'number') { - return this.createError(ErrorCodes.KEYWORD_CUSTOM, {key: key, message: result}, '', '', null, data, schema).prefixWith(null, key); - } else if (result && typeof result === 'object') { - var code = result.code; - if (typeof code === 'string') { - if (!ErrorCodes[code]) { - throw new Error('Undefined error code (use defineError): ' + code); - } - code = ErrorCodes[code]; - } else if (typeof code !== 'number') { - code = ErrorCodes.KEYWORD_CUSTOM; - } - var messageParams = (typeof result.message === 'object') ? result.message : {key: key, message: result.message || "?"}; - var schemaPath = result.schemaPath || ("/" + key.replace(/~/g, '~0').replace(/\//g, '~1')); - return this.createError(code, messageParams, result.dataPath || null, schemaPath, null, data, schema); - } - } - } - return null; -}; - -function recursiveCompare(A, B) { - if (A === B) { - return true; - } - if (A && B && typeof A === "object" && typeof B === "object") { - if (Array.isArray(A) !== Array.isArray(B)) { - return false; - } else if (Array.isArray(A)) { - if (A.length !== B.length) { - return false; - } - for (var i = 0; i < A.length; i++) { - if (!recursiveCompare(A[i], B[i])) { - return false; - } - } - } else { - var key; - for (key in A) { - if (B[key] === undefined && A[key] !== undefined) { - return false; - } - } - for (key in B) { - if (A[key] === undefined && B[key] !== undefined) { - return false; - } - } - for (key in A) { - if (!recursiveCompare(A[key], B[key])) { - return false; - } - } - } - return true; - } - return false; -} - -ValidatorContext.prototype.validateBasic = function validateBasic(data, schema, dataPointerPath) { - var error; - if (error = this.validateType(data, schema, dataPointerPath)) { - return error.prefixWith(null, "type"); - } - if (error = this.validateEnum(data, schema, dataPointerPath)) { - return error.prefixWith(null, "type"); - } - return null; -}; - -ValidatorContext.prototype.validateType = function validateType(data, schema) { - if (schema.type === undefined) { - return null; - } - var dataType = typeof data; - if (data === null) { - dataType = "null"; - } else if (Array.isArray(data)) { - dataType = "array"; - } - var allowedTypes = schema.type; - if (!Array.isArray(allowedTypes)) { - allowedTypes = [allowedTypes]; - } - - for (var i = 0; i < allowedTypes.length; i++) { - var type = allowedTypes[i]; - if (type === dataType || (type === "integer" && dataType === "number" && (data % 1 === 0))) { - return null; - } - } - return this.createError(ErrorCodes.INVALID_TYPE, {type: dataType, expected: allowedTypes.join("/")}, '', '', null, data, schema); -}; - -ValidatorContext.prototype.validateEnum = function validateEnum(data, schema) { - if (schema["enum"] === undefined) { - return null; - } - for (var i = 0; i < schema["enum"].length; i++) { - var enumVal = schema["enum"][i]; - if (recursiveCompare(data, enumVal)) { - return null; - } - } - return this.createError(ErrorCodes.ENUM_MISMATCH, {value: (typeof JSON !== 'undefined') ? JSON.stringify(data) : data}, '', '', null, data, schema); -}; - -ValidatorContext.prototype.validateNumeric = function validateNumeric(data, schema, dataPointerPath) { - return this.validateMultipleOf(data, schema, dataPointerPath) - || this.validateMinMax(data, schema, dataPointerPath) - || this.validateNaN(data, schema, dataPointerPath) - || null; -}; - -var CLOSE_ENOUGH_LOW = Math.pow(2, -51); -var CLOSE_ENOUGH_HIGH = 1 - CLOSE_ENOUGH_LOW; -ValidatorContext.prototype.validateMultipleOf = function validateMultipleOf(data, schema) { - var multipleOf = schema.multipleOf || schema.divisibleBy; - if (multipleOf === undefined) { - return null; - } - if (typeof data === "number") { - var remainder = (data/multipleOf)%1; - if (remainder >= CLOSE_ENOUGH_LOW && remainder < CLOSE_ENOUGH_HIGH) { - return this.createError(ErrorCodes.NUMBER_MULTIPLE_OF, {value: data, multipleOf: multipleOf}, '', '', null, data, schema); - } - } - return null; -}; - -ValidatorContext.prototype.validateMinMax = function validateMinMax(data, schema) { - if (typeof data !== "number") { - return null; - } - if (schema.minimum !== undefined) { - if (data < schema.minimum) { - return this.createError(ErrorCodes.NUMBER_MINIMUM, {value: data, minimum: schema.minimum}, '', '/minimum', null, data, schema); - } - if (schema.exclusiveMinimum && data === schema.minimum) { - return this.createError(ErrorCodes.NUMBER_MINIMUM_EXCLUSIVE, {value: data, minimum: schema.minimum}, '', '/exclusiveMinimum', null, data, schema); - } - } - if (schema.maximum !== undefined) { - if (data > schema.maximum) { - return this.createError(ErrorCodes.NUMBER_MAXIMUM, {value: data, maximum: schema.maximum}, '', '/maximum', null, data, schema); - } - if (schema.exclusiveMaximum && data === schema.maximum) { - return this.createError(ErrorCodes.NUMBER_MAXIMUM_EXCLUSIVE, {value: data, maximum: schema.maximum}, '', '/exclusiveMaximum', null, data, schema); - } - } - return null; -}; - -ValidatorContext.prototype.validateNaN = function validateNaN(data, schema) { - if (typeof data !== "number") { - return null; - } - if (isNaN(data) === true || data === Infinity || data === -Infinity) { - return this.createError(ErrorCodes.NUMBER_NOT_A_NUMBER, {value: data}, '', '/type', null, data, schema); - } - return null; -}; - -ValidatorContext.prototype.validateString = function validateString(data, schema, dataPointerPath) { - return this.validateStringLength(data, schema, dataPointerPath) - || this.validateStringPattern(data, schema, dataPointerPath) - || null; -}; - -ValidatorContext.prototype.validateStringLength = function validateStringLength(data, schema) { - if (typeof data !== "string") { - return null; - } - if (schema.minLength !== undefined) { - if (data.length < schema.minLength) { - return this.createError(ErrorCodes.STRING_LENGTH_SHORT, {length: data.length, minimum: schema.minLength}, '', '/minLength', null, data, schema); - } - } - if (schema.maxLength !== undefined) { - if (data.length > schema.maxLength) { - return this.createError(ErrorCodes.STRING_LENGTH_LONG, {length: data.length, maximum: schema.maxLength}, '', '/maxLength', null, data, schema); - } - } - return null; -}; - -ValidatorContext.prototype.validateStringPattern = function validateStringPattern(data, schema) { - if (typeof data !== "string" || (typeof schema.pattern !== "string" && !(schema.pattern instanceof RegExp))) { - return null; - } - var regexp; - if (schema.pattern instanceof RegExp) { - regexp = schema.pattern; - } - else { - var body, flags = ''; - // Check for regular expression literals - // @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5 - var literal = schema.pattern.match(/^\/(.+)\/([img]*)$/); - if (literal) { - body = literal[1]; - flags = literal[2]; - } - else { - body = schema.pattern; - } - regexp = new RegExp(body, flags); - } - if (!regexp.test(data)) { - return this.createError(ErrorCodes.STRING_PATTERN, {pattern: schema.pattern}, '', '/pattern', null, data, schema); - } - return null; -}; - -ValidatorContext.prototype.validateArray = function validateArray(data, schema, dataPointerPath) { - if (!Array.isArray(data)) { - return null; - } - return this.validateArrayLength(data, schema, dataPointerPath) - || this.validateArrayUniqueItems(data, schema, dataPointerPath) - || this.validateArrayItems(data, schema, dataPointerPath) - || null; -}; - -ValidatorContext.prototype.validateArrayLength = function validateArrayLength(data, schema) { - var error; - if (schema.minItems !== undefined) { - if (data.length < schema.minItems) { - error = this.createError(ErrorCodes.ARRAY_LENGTH_SHORT, {length: data.length, minimum: schema.minItems}, '', '/minItems', null, data, schema); - if (this.handleError(error)) { - return error; - } - } - } - if (schema.maxItems !== undefined) { - if (data.length > schema.maxItems) { - error = this.createError(ErrorCodes.ARRAY_LENGTH_LONG, {length: data.length, maximum: schema.maxItems}, '', '/maxItems', null, data, schema); - if (this.handleError(error)) { - return error; - } - } - } - return null; -}; - -ValidatorContext.prototype.validateArrayUniqueItems = function validateArrayUniqueItems(data, schema) { - if (schema.uniqueItems) { - for (var i = 0; i < data.length; i++) { - for (var j = i + 1; j < data.length; j++) { - if (recursiveCompare(data[i], data[j])) { - var error = this.createError(ErrorCodes.ARRAY_UNIQUE, {match1: i, match2: j}, '', '/uniqueItems', null, data, schema); - if (this.handleError(error)) { - return error; - } - } - } - } - } - return null; -}; - -ValidatorContext.prototype.validateArrayItems = function validateArrayItems(data, schema, dataPointerPath) { - if (schema.items === undefined) { - return null; - } - var error, i; - if (Array.isArray(schema.items)) { - for (i = 0; i < data.length; i++) { - if (i < schema.items.length) { - if (error = this.validateAll(data[i], schema.items[i], [i], ["items", i], dataPointerPath + "/" + i)) { - return error; - } - } else if (schema.additionalItems !== undefined) { - if (typeof schema.additionalItems === "boolean") { - if (!schema.additionalItems) { - error = (this.createError(ErrorCodes.ARRAY_ADDITIONAL_ITEMS, {}, '/' + i, '/additionalItems', null, data, schema)); - if (this.handleError(error)) { - return error; - } - } - } else if (error = this.validateAll(data[i], schema.additionalItems, [i], ["additionalItems"], dataPointerPath + "/" + i)) { - return error; - } - } - } - } else { - for (i = 0; i < data.length; i++) { - if (error = this.validateAll(data[i], schema.items, [i], ["items"], dataPointerPath + "/" + i)) { - return error; - } - } - } - return null; -}; - -ValidatorContext.prototype.validateObject = function validateObject(data, schema, dataPointerPath) { - if (typeof data !== "object" || data === null || Array.isArray(data)) { - return null; - } - return this.validateObjectMinMaxProperties(data, schema, dataPointerPath) - || this.validateObjectRequiredProperties(data, schema, dataPointerPath) - || this.validateObjectProperties(data, schema, dataPointerPath) - || this.validateObjectDependencies(data, schema, dataPointerPath) - || null; -}; - -ValidatorContext.prototype.validateObjectMinMaxProperties = function validateObjectMinMaxProperties(data, schema) { - var keys = Object.keys(data); - var error; - if (schema.minProperties !== undefined) { - if (keys.length < schema.minProperties) { - error = this.createError(ErrorCodes.OBJECT_PROPERTIES_MINIMUM, {propertyCount: keys.length, minimum: schema.minProperties}, '', '/minProperties', null, data, schema); - if (this.handleError(error)) { - return error; - } - } - } - if (schema.maxProperties !== undefined) { - if (keys.length > schema.maxProperties) { - error = this.createError(ErrorCodes.OBJECT_PROPERTIES_MAXIMUM, {propertyCount: keys.length, maximum: schema.maxProperties}, '', '/maxProperties', null, data, schema); - if (this.handleError(error)) { - return error; - } - } - } - return null; -}; - -ValidatorContext.prototype.validateObjectRequiredProperties = function validateObjectRequiredProperties(data, schema) { - if (schema.required !== undefined) { - for (var i = 0; i < schema.required.length; i++) { - var key = schema.required[i]; - if (data[key] === undefined) { - var error = this.createError(ErrorCodes.OBJECT_REQUIRED, {key: key}, '', '/required/' + i, null, data, schema); - if (this.handleError(error)) { - return error; - } - } - } - } - return null; -}; - -ValidatorContext.prototype.validateObjectProperties = function validateObjectProperties(data, schema, dataPointerPath) { - var error; - for (var key in data) { - var keyPointerPath = dataPointerPath + "/" + key.replace(/~/g, '~0').replace(/\//g, '~1'); - var foundMatch = false; - if (schema.properties !== undefined && schema.properties[key] !== undefined) { - foundMatch = true; - if (error = this.validateAll(data[key], schema.properties[key], [key], ["properties", key], keyPointerPath)) { - return error; - } - } - if (schema.patternProperties !== undefined) { - for (var patternKey in schema.patternProperties) { - var regexp = new RegExp(patternKey); - if (regexp.test(key)) { - foundMatch = true; - if (error = this.validateAll(data[key], schema.patternProperties[patternKey], [key], ["patternProperties", patternKey], keyPointerPath)) { - return error; - } - } - } - } - if (!foundMatch) { - if (schema.additionalProperties !== undefined) { - if (this.trackUnknownProperties) { - this.knownPropertyPaths[keyPointerPath] = true; - delete this.unknownPropertyPaths[keyPointerPath]; - } - if (typeof schema.additionalProperties === "boolean") { - if (!schema.additionalProperties) { - error = this.createError(ErrorCodes.OBJECT_ADDITIONAL_PROPERTIES, {key: key}, '', '/additionalProperties', null, data, schema).prefixWith(key, null); - if (this.handleError(error)) { - return error; - } - } - } else { - if (error = this.validateAll(data[key], schema.additionalProperties, [key], ["additionalProperties"], keyPointerPath)) { - return error; - } - } - } else if (this.trackUnknownProperties && !this.knownPropertyPaths[keyPointerPath]) { - this.unknownPropertyPaths[keyPointerPath] = true; - } - } else if (this.trackUnknownProperties) { - this.knownPropertyPaths[keyPointerPath] = true; - delete this.unknownPropertyPaths[keyPointerPath]; - } - } - return null; -}; - -ValidatorContext.prototype.validateObjectDependencies = function validateObjectDependencies(data, schema, dataPointerPath) { - var error; - if (schema.dependencies !== undefined) { - for (var depKey in schema.dependencies) { - if (data[depKey] !== undefined) { - var dep = schema.dependencies[depKey]; - if (typeof dep === "string") { - if (data[dep] === undefined) { - error = this.createError(ErrorCodes.OBJECT_DEPENDENCY_KEY, {key: depKey, missing: dep}, '', '', null, data, schema).prefixWith(null, depKey).prefixWith(null, "dependencies"); - if (this.handleError(error)) { - return error; - } - } - } else if (Array.isArray(dep)) { - for (var i = 0; i < dep.length; i++) { - var requiredKey = dep[i]; - if (data[requiredKey] === undefined) { - error = this.createError(ErrorCodes.OBJECT_DEPENDENCY_KEY, {key: depKey, missing: requiredKey}, '', '/' + i, null, data, schema).prefixWith(null, depKey).prefixWith(null, "dependencies"); - if (this.handleError(error)) { - return error; - } - } - } - } else { - if (error = this.validateAll(data, dep, [], ["dependencies", depKey], dataPointerPath)) { - return error; - } - } - } - } - } - return null; -}; - -ValidatorContext.prototype.validateCombinations = function validateCombinations(data, schema, dataPointerPath) { - return this.validateAllOf(data, schema, dataPointerPath) - || this.validateAnyOf(data, schema, dataPointerPath) - || this.validateOneOf(data, schema, dataPointerPath) - || this.validateNot(data, schema, dataPointerPath) - || null; -}; - -ValidatorContext.prototype.validateAllOf = function validateAllOf(data, schema, dataPointerPath) { - if (schema.allOf === undefined) { - return null; - } - var error; - for (var i = 0; i < schema.allOf.length; i++) { - var subSchema = schema.allOf[i]; - if (error = this.validateAll(data, subSchema, [], ["allOf", i], dataPointerPath)) { - return error; - } - } - return null; -}; - -ValidatorContext.prototype.validateAnyOf = function validateAnyOf(data, schema, dataPointerPath) { - if (schema.anyOf === undefined) { - return null; - } - var errors = []; - var startErrorCount = this.errors.length; - var oldUnknownPropertyPaths, oldKnownPropertyPaths; - if (this.trackUnknownProperties) { - oldUnknownPropertyPaths = this.unknownPropertyPaths; - oldKnownPropertyPaths = this.knownPropertyPaths; - } - var errorAtEnd = true; - for (var i = 0; i < schema.anyOf.length; i++) { - if (this.trackUnknownProperties) { - this.unknownPropertyPaths = {}; - this.knownPropertyPaths = {}; - } - var subSchema = schema.anyOf[i]; - - var errorCount = this.errors.length; - var error = this.validateAll(data, subSchema, [], ["anyOf", i], dataPointerPath); - - if (error === null && errorCount === this.errors.length) { - this.errors = this.errors.slice(0, startErrorCount); - - if (this.trackUnknownProperties) { - for (var knownKey in this.knownPropertyPaths) { - oldKnownPropertyPaths[knownKey] = true; - delete oldUnknownPropertyPaths[knownKey]; - } - for (var unknownKey in this.unknownPropertyPaths) { - if (!oldKnownPropertyPaths[unknownKey]) { - oldUnknownPropertyPaths[unknownKey] = true; - } - } - // We need to continue looping so we catch all the property definitions, but we don't want to return an error - errorAtEnd = false; - continue; - } - - return null; - } - if (error) { - errors.push(error.prefixWith(null, "" + i).prefixWith(null, "anyOf")); - } - } - if (this.trackUnknownProperties) { - this.unknownPropertyPaths = oldUnknownPropertyPaths; - this.knownPropertyPaths = oldKnownPropertyPaths; - } - if (errorAtEnd) { - errors = errors.concat(this.errors.slice(startErrorCount)); - this.errors = this.errors.slice(0, startErrorCount); - return this.createError(ErrorCodes.ANY_OF_MISSING, {}, "", "/anyOf", errors, data, schema); - } -}; - -ValidatorContext.prototype.validateOneOf = function validateOneOf(data, schema, dataPointerPath) { - if (schema.oneOf === undefined) { - return null; - } - var validIndex = null; - var errors = []; - var startErrorCount = this.errors.length; - var oldUnknownPropertyPaths, oldKnownPropertyPaths; - if (this.trackUnknownProperties) { - oldUnknownPropertyPaths = this.unknownPropertyPaths; - oldKnownPropertyPaths = this.knownPropertyPaths; - } - for (var i = 0; i < schema.oneOf.length; i++) { - if (this.trackUnknownProperties) { - this.unknownPropertyPaths = {}; - this.knownPropertyPaths = {}; - } - var subSchema = schema.oneOf[i]; - - var errorCount = this.errors.length; - var error = this.validateAll(data, subSchema, [], ["oneOf", i], dataPointerPath); - - if (error === null && errorCount === this.errors.length) { - if (validIndex === null) { - validIndex = i; - } else { - this.errors = this.errors.slice(0, startErrorCount); - return this.createError(ErrorCodes.ONE_OF_MULTIPLE, {index1: validIndex, index2: i}, "", "/oneOf", null, data, schema); - } - if (this.trackUnknownProperties) { - for (var knownKey in this.knownPropertyPaths) { - oldKnownPropertyPaths[knownKey] = true; - delete oldUnknownPropertyPaths[knownKey]; - } - for (var unknownKey in this.unknownPropertyPaths) { - if (!oldKnownPropertyPaths[unknownKey]) { - oldUnknownPropertyPaths[unknownKey] = true; - } - } - } - } else if (error) { - errors.push(error); - } - } - if (this.trackUnknownProperties) { - this.unknownPropertyPaths = oldUnknownPropertyPaths; - this.knownPropertyPaths = oldKnownPropertyPaths; - } - if (validIndex === null) { - errors = errors.concat(this.errors.slice(startErrorCount)); - this.errors = this.errors.slice(0, startErrorCount); - return this.createError(ErrorCodes.ONE_OF_MISSING, {}, "", "/oneOf", errors, data, schema); - } else { - this.errors = this.errors.slice(0, startErrorCount); - } - return null; -}; - -ValidatorContext.prototype.validateNot = function validateNot(data, schema, dataPointerPath) { - if (schema.not === undefined) { - return null; - } - var oldErrorCount = this.errors.length; - var oldUnknownPropertyPaths, oldKnownPropertyPaths; - if (this.trackUnknownProperties) { - oldUnknownPropertyPaths = this.unknownPropertyPaths; - oldKnownPropertyPaths = this.knownPropertyPaths; - this.unknownPropertyPaths = {}; - this.knownPropertyPaths = {}; - } - var error = this.validateAll(data, schema.not, null, null, dataPointerPath); - var notErrors = this.errors.slice(oldErrorCount); - this.errors = this.errors.slice(0, oldErrorCount); - if (this.trackUnknownProperties) { - this.unknownPropertyPaths = oldUnknownPropertyPaths; - this.knownPropertyPaths = oldKnownPropertyPaths; - } - if (error === null && notErrors.length === 0) { - return this.createError(ErrorCodes.NOT_PASSED, {}, "", "/not", null, data, schema); - } - return null; -}; - -ValidatorContext.prototype.validateHypermedia = function validateCombinations(data, schema, dataPointerPath) { - if (!schema.links) { - return null; - } - var error; - for (var i = 0; i < schema.links.length; i++) { - var ldo = schema.links[i]; - if (ldo.rel === "describedby") { - var template = new UriTemplate(ldo.href); - var allPresent = true; - for (var j = 0; j < template.varNames.length; j++) { - if (!(template.varNames[j] in data)) { - allPresent = false; - break; - } - } - if (allPresent) { - var schemaUrl = template.fillFromObject(data); - var subSchema = {"$ref": schemaUrl}; - if (error = this.validateAll(data, subSchema, [], ["links", i], dataPointerPath)) { - return error; - } - } - } - } -}; - -// parseURI() and resolveUrl() are from https://gist.github.com/1088850 -// - released as public domain by author ("Yaffle") - see comments on gist - -function parseURI(url) { - var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/); - // authority = '//' + user + ':' + pass '@' + hostname + ':' port - return (m ? { - href : m[0] || '', - protocol : m[1] || '', - authority: m[2] || '', - host : m[3] || '', - hostname : m[4] || '', - port : m[5] || '', - pathname : m[6] || '', - search : m[7] || '', - hash : m[8] || '' - } : null); -} - -function resolveUrl(base, href) {// RFC 3986 - - function removeDotSegments(input) { - var output = []; - input.replace(/^(\.\.?(\/|$))+/, '') - .replace(/\/(\.(\/|$))+/g, '/') - .replace(/\/\.\.$/, '/../') - .replace(/\/?[^\/]*/g, function (p) { - if (p === '/..') { - output.pop(); - } else { - output.push(p); - } - }); - return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : ''); - } - - href = parseURI(href || ''); - base = parseURI(base || ''); - - return !href || !base ? null : (href.protocol || base.protocol) + - (href.protocol || href.authority ? href.authority : base.authority) + - removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) + - (href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) + - href.hash; -} - -function getDocumentUri(uri) { - return uri.split('#')[0]; -} -function normSchema(schema, baseUri) { - if (schema && typeof schema === "object") { - if (baseUri === undefined) { - baseUri = schema.id; - } else if (typeof schema.id === "string") { - baseUri = resolveUrl(baseUri, schema.id); - schema.id = baseUri; - } - if (Array.isArray(schema)) { - for (var i = 0; i < schema.length; i++) { - normSchema(schema[i], baseUri); - } - } else { - if (typeof schema['$ref'] === "string") { - schema['$ref'] = resolveUrl(baseUri, schema['$ref']); - } - for (var key in schema) { - if (key !== "enum") { - normSchema(schema[key], baseUri); - } - } - } - } -} - -function defaultErrorReporter(language) { - language = language || 'en'; - - var errorMessages = languages[language]; - - return function (error) { - var messageTemplate = errorMessages[error.code] || ErrorMessagesDefault[error.code]; - if (typeof messageTemplate !== 'string') { - return "Unknown error code " + error.code + ": " + JSON.stringify(error.messageParams); - } - var messageParams = error.params; - // Adapted from Crockford's supplant() - return messageTemplate.replace(/\{([^{}]*)\}/g, function (whole, varName) { - var subValue = messageParams[varName]; - return typeof subValue === 'string' || typeof subValue === 'number' ? subValue : whole; - }); - }; -} - -var ErrorCodes = { - INVALID_TYPE: 0, - ENUM_MISMATCH: 1, - ANY_OF_MISSING: 10, - ONE_OF_MISSING: 11, - ONE_OF_MULTIPLE: 12, - NOT_PASSED: 13, - // Numeric errors - NUMBER_MULTIPLE_OF: 100, - NUMBER_MINIMUM: 101, - NUMBER_MINIMUM_EXCLUSIVE: 102, - NUMBER_MAXIMUM: 103, - NUMBER_MAXIMUM_EXCLUSIVE: 104, - NUMBER_NOT_A_NUMBER: 105, - // String errors - STRING_LENGTH_SHORT: 200, - STRING_LENGTH_LONG: 201, - STRING_PATTERN: 202, - // Object errors - OBJECT_PROPERTIES_MINIMUM: 300, - OBJECT_PROPERTIES_MAXIMUM: 301, - OBJECT_REQUIRED: 302, - OBJECT_ADDITIONAL_PROPERTIES: 303, - OBJECT_DEPENDENCY_KEY: 304, - // Array errors - ARRAY_LENGTH_SHORT: 400, - ARRAY_LENGTH_LONG: 401, - ARRAY_UNIQUE: 402, - ARRAY_ADDITIONAL_ITEMS: 403, - // Custom/user-defined errors - FORMAT_CUSTOM: 500, - KEYWORD_CUSTOM: 501, - // Schema structure - CIRCULAR_REFERENCE: 600, - // Non-standard validation options - UNKNOWN_PROPERTY: 1000 -}; -var ErrorCodeLookup = {}; -for (var key in ErrorCodes) { - ErrorCodeLookup[ErrorCodes[key]] = key; -} -var ErrorMessagesDefault = { - INVALID_TYPE: "Invalid type: {type} (expected {expected})", - ENUM_MISMATCH: "No enum match for: {value}", - ANY_OF_MISSING: "Data does not match any schemas from \"anyOf\"", - ONE_OF_MISSING: "Data does not match any schemas from \"oneOf\"", - ONE_OF_MULTIPLE: "Data is valid against more than one schema from \"oneOf\": indices {index1} and {index2}", - NOT_PASSED: "Data matches schema from \"not\"", - // Numeric errors - NUMBER_MULTIPLE_OF: "Value {value} is not a multiple of {multipleOf}", - NUMBER_MINIMUM: "Value {value} is less than minimum {minimum}", - NUMBER_MINIMUM_EXCLUSIVE: "Value {value} is equal to exclusive minimum {minimum}", - NUMBER_MAXIMUM: "Value {value} is greater than maximum {maximum}", - NUMBER_MAXIMUM_EXCLUSIVE: "Value {value} is equal to exclusive maximum {maximum}", - NUMBER_NOT_A_NUMBER: "Value {value} is not a valid number", - // String errors - STRING_LENGTH_SHORT: "String is too short ({length} chars), minimum {minimum}", - STRING_LENGTH_LONG: "String is too long ({length} chars), maximum {maximum}", - STRING_PATTERN: "String does not match pattern: {pattern}", - // Object errors - OBJECT_PROPERTIES_MINIMUM: "Too few properties defined ({propertyCount}), minimum {minimum}", - OBJECT_PROPERTIES_MAXIMUM: "Too many properties defined ({propertyCount}), maximum {maximum}", - OBJECT_REQUIRED: "Missing required property: {key}", - OBJECT_ADDITIONAL_PROPERTIES: "Additional properties not allowed", - OBJECT_DEPENDENCY_KEY: "Dependency failed - key must exist: {missing} (due to key: {key})", - // Array errors - ARRAY_LENGTH_SHORT: "Array is too short ({length}), minimum {minimum}", - ARRAY_LENGTH_LONG: "Array is too long ({length}), maximum {maximum}", - ARRAY_UNIQUE: "Array items are not unique (indices {match1} and {match2})", - ARRAY_ADDITIONAL_ITEMS: "Additional items not allowed", - // Format errors - FORMAT_CUSTOM: "Format validation failed ({message})", - KEYWORD_CUSTOM: "Keyword failed: {key} ({message})", - // Schema structure - CIRCULAR_REFERENCE: "Circular $refs: {urls}", - // Non-standard validation options - UNKNOWN_PROPERTY: "Unknown property (not in schema)" -}; - -function ValidationError(code, params, dataPath, schemaPath, subErrors) { - Error.call(this); - if (code === undefined) { - throw new Error ("No error code supplied: " + schemaPath); - } - this.message = ''; - this.params = params; - this.code = code; - this.dataPath = dataPath || ""; - this.schemaPath = schemaPath || ""; - this.subErrors = subErrors || null; - - var err = new Error(this.message); - this.stack = err.stack || err.stacktrace; - if (!this.stack) { - try { - throw err; - } - catch(err) { - this.stack = err.stack || err.stacktrace; - } - } -} -ValidationError.prototype = Object.create(Error.prototype); -ValidationError.prototype.constructor = ValidationError; -ValidationError.prototype.name = 'ValidationError'; - -ValidationError.prototype.prefixWith = function (dataPrefix, schemaPrefix) { - if (dataPrefix !== null) { - dataPrefix = dataPrefix.replace(/~/g, "~0").replace(/\//g, "~1"); - this.dataPath = "/" + dataPrefix + this.dataPath; - } - if (schemaPrefix !== null) { - schemaPrefix = schemaPrefix.replace(/~/g, "~0").replace(/\//g, "~1"); - this.schemaPath = "/" + schemaPrefix + this.schemaPath; - } - if (this.subErrors !== null) { - for (var i = 0; i < this.subErrors.length; i++) { - this.subErrors[i].prefixWith(dataPrefix, schemaPrefix); - } - } - return this; -}; - -function isTrustedUrl(baseUrl, testUrl) { - if(testUrl.substring(0, baseUrl.length) === baseUrl){ - var remainder = testUrl.substring(baseUrl.length); - if ((testUrl.length > 0 && testUrl.charAt(baseUrl.length - 1) === "/") - || remainder.charAt(0) === "#" - || remainder.charAt(0) === "?") { - return true; - } - } - return false; -} - -var languages = {}; -function createApi(language) { - var globalContext = new ValidatorContext(); - var currentLanguage; - var customErrorReporter; - var api = { - setErrorReporter: function (reporter) { - if (typeof reporter === 'string') { - return this.language(reporter); - } - customErrorReporter = reporter; - return true; - }, - addFormat: function () { - globalContext.addFormat.apply(globalContext, arguments); - }, - language: function (code) { - if (!code) { - return currentLanguage; - } - if (!languages[code]) { - code = code.split('-')[0]; // fall back to base language - } - if (languages[code]) { - currentLanguage = code; - return code; // so you can tell if fall-back has happened - } - return false; - }, - addLanguage: function (code, messageMap) { - var key; - for (key in ErrorCodes) { - if (messageMap[key] && !messageMap[ErrorCodes[key]]) { - messageMap[ErrorCodes[key]] = messageMap[key]; - } - } - var rootCode = code.split('-')[0]; - if (!languages[rootCode]) { // use for base language if not yet defined - languages[code] = messageMap; - languages[rootCode] = messageMap; - } else { - languages[code] = Object.create(languages[rootCode]); - for (key in messageMap) { - if (typeof languages[rootCode][key] === 'undefined') { - languages[rootCode][key] = messageMap[key]; - } - languages[code][key] = messageMap[key]; - } - } - return this; - }, - freshApi: function (language) { - var result = createApi(); - if (language) { - result.language(language); - } - return result; - }, - validate: function (data, schema, checkRecursive, banUnknownProperties) { - var def = defaultErrorReporter(currentLanguage); - var errorReporter = customErrorReporter ? function (error, data, schema) { - return customErrorReporter(error, data, schema) || def(error, data, schema); - } : def; - var context = new ValidatorContext(globalContext, false, errorReporter, checkRecursive, banUnknownProperties); - if (typeof schema === "string") { - schema = {"$ref": schema}; - } - context.addSchema("", schema); - var error = context.validateAll(data, schema, null, null, ""); - if (!error && banUnknownProperties) { - error = context.banUnknownProperties(data, schema); - } - this.error = error; - this.missing = context.missing; - this.valid = (error === null); - return this.valid; - }, - validateResult: function () { - var result = {toString: function () { - return this.valid ? 'valid' : this.error.message; - }}; - this.validate.apply(result, arguments); - return result; - }, - validateMultiple: function (data, schema, checkRecursive, banUnknownProperties) { - var def = defaultErrorReporter(currentLanguage); - var errorReporter = customErrorReporter ? function (error, data, schema) { - return customErrorReporter(error, data, schema) || def(error, data, schema); - } : def; - var context = new ValidatorContext(globalContext, true, errorReporter, checkRecursive, banUnknownProperties); - if (typeof schema === "string") { - schema = {"$ref": schema}; - } - context.addSchema("", schema); - context.validateAll(data, schema, null, null, ""); - if (banUnknownProperties) { - context.banUnknownProperties(data, schema); - } - var result = {toString: function () { - return this.valid ? 'valid' : this.error.message; - }}; - result.errors = context.errors; - result.missing = context.missing; - result.valid = (result.errors.length === 0); - return result; - }, - addSchema: function () { - return globalContext.addSchema.apply(globalContext, arguments); - }, - getSchema: function () { - return globalContext.getSchema.apply(globalContext, arguments); - }, - getSchemaMap: function () { - return globalContext.getSchemaMap.apply(globalContext, arguments); - }, - getSchemaUris: function () { - return globalContext.getSchemaUris.apply(globalContext, arguments); - }, - getMissingUris: function () { - return globalContext.getMissingUris.apply(globalContext, arguments); - }, - dropSchemas: function () { - globalContext.dropSchemas.apply(globalContext, arguments); - }, - defineKeyword: function () { - globalContext.defineKeyword.apply(globalContext, arguments); - }, - defineError: function (codeName, codeNumber, defaultMessage) { - if (typeof codeName !== 'string' || !/^[A-Z]+(_[A-Z]+)*$/.test(codeName)) { - throw new Error('Code name must be a string in UPPER_CASE_WITH_UNDERSCORES'); - } - if (typeof codeNumber !== 'number' || codeNumber%1 !== 0 || codeNumber < 10000) { - throw new Error('Code number must be an integer > 10000'); - } - if (typeof ErrorCodes[codeName] !== 'undefined') { - throw new Error('Error already defined: ' + codeName + ' as ' + ErrorCodes[codeName]); - } - if (typeof ErrorCodeLookup[codeNumber] !== 'undefined') { - throw new Error('Error code already used: ' + ErrorCodeLookup[codeNumber] + ' as ' + codeNumber); - } - ErrorCodes[codeName] = codeNumber; - ErrorCodeLookup[codeNumber] = codeName; - ErrorMessagesDefault[codeName] = ErrorMessagesDefault[codeNumber] = defaultMessage; - for (var langCode in languages) { - var language = languages[langCode]; - if (language[codeName]) { - language[codeNumber] = language[codeNumber] || language[codeName]; - } - } - }, - reset: function () { - globalContext.reset(); - this.error = null; - this.missing = []; - this.valid = true; - }, - missing: [], - error: null, - valid: true, - normSchema: normSchema, - resolveUrl: resolveUrl, - getDocumentUri: getDocumentUri, - errorCodes: ErrorCodes - }; - api.language(language || 'en'); - return api; -} - -var tv4 = createApi(); -tv4.addLanguage('en-gb', ErrorMessagesDefault); - -//legacy property -tv4.tv4 = tv4; - -return tv4; // used by _header.js to globalise. - -})); - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/index.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -Object.defineProperty(exports, "NIL", ({ - enumerable: true, - get: function get() { - return _nil.default; - } -})); -Object.defineProperty(exports, "parse", ({ - enumerable: true, - get: function get() { - return _parse.default; - } -})); -Object.defineProperty(exports, "stringify", ({ - enumerable: true, - get: function get() { - return _stringify.default; - } -})); -Object.defineProperty(exports, "v1", ({ - enumerable: true, - get: function get() { - return _v.default; - } -})); -Object.defineProperty(exports, "v3", ({ - enumerable: true, - get: function get() { - return _v2.default; - } -})); -Object.defineProperty(exports, "v4", ({ - enumerable: true, - get: function get() { - return _v3.default; - } -})); -Object.defineProperty(exports, "v5", ({ - enumerable: true, - get: function get() { - return _v4.default; - } -})); -Object.defineProperty(exports, "validate", ({ - enumerable: true, - get: function get() { - return _validate.default; - } -})); -Object.defineProperty(exports, "version", ({ - enumerable: true, - get: function get() { - return _version.default; - } -})); - -var _v = _interopRequireDefault(__webpack_require__(/*! ./v1.js */ "./node_modules/uuid/dist/commonjs-browser/v1.js")); - -var _v2 = _interopRequireDefault(__webpack_require__(/*! ./v3.js */ "./node_modules/uuid/dist/commonjs-browser/v3.js")); - -var _v3 = _interopRequireDefault(__webpack_require__(/*! ./v4.js */ "./node_modules/uuid/dist/commonjs-browser/v4.js")); - -var _v4 = _interopRequireDefault(__webpack_require__(/*! ./v5.js */ "./node_modules/uuid/dist/commonjs-browser/v5.js")); - -var _nil = _interopRequireDefault(__webpack_require__(/*! ./nil.js */ "./node_modules/uuid/dist/commonjs-browser/nil.js")); - -var _version = _interopRequireDefault(__webpack_require__(/*! ./version.js */ "./node_modules/uuid/dist/commonjs-browser/version.js")); - -var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js")); - -var _stringify = _interopRequireDefault(__webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js")); - -var _parse = _interopRequireDefault(__webpack_require__(/*! ./parse.js */ "./node_modules/uuid/dist/commonjs-browser/parse.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/md5.js": -/*!********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/md5.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -/* - * Browser-compatible JavaScript MD5 - * - * Modification of JavaScript MD5 - * https://github.com/blueimp/JavaScript-MD5 - * - * Copyright 2011, Sebastian Tschan - * https://blueimp.net - * - * Licensed under the MIT license: - * https://opensource.org/licenses/MIT - * - * Based on - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for more info. - */ -function md5(bytes) { - if (typeof bytes === 'string') { - const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape - - bytes = new Uint8Array(msg.length); - - for (let i = 0; i < msg.length; ++i) { - bytes[i] = msg.charCodeAt(i); - } - } - - return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8)); -} -/* - * Convert an array of little-endian words to an array of bytes - */ - - -function md5ToHexEncodedArray(input) { - const output = []; - const length32 = input.length * 32; - const hexTab = '0123456789abcdef'; - - for (let i = 0; i < length32; i += 8) { - const x = input[i >> 5] >>> i % 32 & 0xff; - const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16); - output.push(hex); - } - - return output; -} -/** - * Calculate output length with padding and bit length - */ - - -function getOutputLength(inputLength8) { - return (inputLength8 + 64 >>> 9 << 4) + 14 + 1; -} -/* - * Calculate the MD5 of an array of little-endian words, and a bit length. - */ - - -function wordsToMd5(x, len) { - /* append padding */ - x[len >> 5] |= 0x80 << len % 32; - x[getOutputLength(len) - 1] = len; - let a = 1732584193; - let b = -271733879; - let c = -1732584194; - let d = 271733878; - - for (let i = 0; i < x.length; i += 16) { - const olda = a; - const oldb = b; - const oldc = c; - const oldd = d; - a = md5ff(a, b, c, d, x[i], 7, -680876936); - d = md5ff(d, a, b, c, x[i + 1], 12, -389564586); - c = md5ff(c, d, a, b, x[i + 2], 17, 606105819); - b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = md5ff(a, b, c, d, x[i + 4], 7, -176418897); - d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = md5ff(b, c, d, a, x[i + 7], 22, -45705983); - a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = md5ff(c, d, a, b, x[i + 10], 17, -42063); - b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = md5ff(d, a, b, c, x[i + 13], 12, -40341101); - c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329); - a = md5gg(a, b, c, d, x[i + 1], 5, -165796510); - d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = md5gg(c, d, a, b, x[i + 11], 14, 643717713); - b = md5gg(b, c, d, a, x[i], 20, -373897302); - a = md5gg(a, b, c, d, x[i + 5], 5, -701558691); - d = md5gg(d, a, b, c, x[i + 10], 9, 38016083); - c = md5gg(c, d, a, b, x[i + 15], 14, -660478335); - b = md5gg(b, c, d, a, x[i + 4], 20, -405537848); - a = md5gg(a, b, c, d, x[i + 9], 5, 568446438); - d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = md5gg(c, d, a, b, x[i + 3], 14, -187363961); - b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = md5gg(d, a, b, c, x[i + 2], 9, -51403784); - c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734); - a = md5hh(a, b, c, d, x[i + 5], 4, -378558); - d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = md5hh(b, c, d, a, x[i + 14], 23, -35309556); - a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = md5hh(c, d, a, b, x[i + 7], 16, -155497632); - b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = md5hh(a, b, c, d, x[i + 13], 4, 681279174); - d = md5hh(d, a, b, c, x[i], 11, -358537222); - c = md5hh(c, d, a, b, x[i + 3], 16, -722521979); - b = md5hh(b, c, d, a, x[i + 6], 23, 76029189); - a = md5hh(a, b, c, d, x[i + 9], 4, -640364487); - d = md5hh(d, a, b, c, x[i + 12], 11, -421815835); - c = md5hh(c, d, a, b, x[i + 15], 16, 530742520); - b = md5hh(b, c, d, a, x[i + 2], 23, -995338651); - a = md5ii(a, b, c, d, x[i], 6, -198630844); - d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = md5ii(b, c, d, a, x[i + 5], 21, -57434055); - a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = md5ii(c, d, a, b, x[i + 10], 15, -1051523); - b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = md5ii(d, a, b, c, x[i + 15], 10, -30611744); - c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = md5ii(a, b, c, d, x[i + 4], 6, -145523070); - d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = md5ii(c, d, a, b, x[i + 2], 15, 718787259); - b = md5ii(b, c, d, a, x[i + 9], 21, -343485551); - a = safeAdd(a, olda); - b = safeAdd(b, oldb); - c = safeAdd(c, oldc); - d = safeAdd(d, oldd); - } - - return [a, b, c, d]; -} -/* - * Convert an array bytes to an array of little-endian words - * Characters >255 have their high-byte silently ignored. - */ - - -function bytesToWords(input) { - if (input.length === 0) { - return []; - } - - const length8 = input.length * 8; - const output = new Uint32Array(getOutputLength(length8)); - - for (let i = 0; i < length8; i += 8) { - output[i >> 5] |= (input[i / 8] & 0xff) << i % 32; - } - - return output; -} -/* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - - -function safeAdd(x, y) { - const lsw = (x & 0xffff) + (y & 0xffff); - const msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return msw << 16 | lsw & 0xffff; -} -/* - * Bitwise rotate a 32-bit number to the left. - */ - - -function bitRotateLeft(num, cnt) { - return num << cnt | num >>> 32 - cnt; -} -/* - * These functions implement the four basic operations the algorithm uses. - */ - - -function md5cmn(q, a, b, x, s, t) { - return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b); -} - -function md5ff(a, b, c, d, x, s, t) { - return md5cmn(b & c | ~b & d, a, b, x, s, t); -} - -function md5gg(a, b, c, d, x, s, t) { - return md5cmn(b & d | c & ~d, a, b, x, s, t); -} - -function md5hh(a, b, c, d, x, s, t) { - return md5cmn(b ^ c ^ d, a, b, x, s, t); -} - -function md5ii(a, b, c, d, x, s, t) { - return md5cmn(c ^ (b | ~d), a, b, x, s, t); -} - -var _default = md5; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/native.js": -/*!***********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/native.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); -var _default = { - randomUUID -}; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/nil.js": -/*!********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/nil.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _default = '00000000-0000-0000-0000-000000000000'; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/parse.js": -/*!**********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/parse.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function parse(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); - } - - let v; - const arr = new Uint8Array(16); // Parse ########-....-....-....-............ - - arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; - arr[1] = v >>> 16 & 0xff; - arr[2] = v >>> 8 & 0xff; - arr[3] = v & 0xff; // Parse ........-####-....-....-............ - - arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; - arr[5] = v & 0xff; // Parse ........-....-####-....-............ - - arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; - arr[7] = v & 0xff; // Parse ........-....-....-####-............ - - arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; - arr[9] = v & 0xff; // Parse ........-....-....-....-############ - // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) - - arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; - arr[11] = v / 0x100000000 & 0xff; - arr[12] = v >>> 24 & 0xff; - arr[13] = v >>> 16 & 0xff; - arr[14] = v >>> 8 & 0xff; - arr[15] = v & 0xff; - return arr; -} - -var _default = parse; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/regex.js": -/*!**********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/regex.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/rng.js": -/*!********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/rng.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = rng; -// Unique ID creation requires a high quality random # generator. In the browser we therefore -// require the crypto API and do not support built-in fallback to lower quality random number -// generators (like Math.random()). -let getRandomValues; -const rnds8 = new Uint8Array(16); - -function rng() { - // lazy load so that environments that need to polyfill have a chance to do so - if (!getRandomValues) { - // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. - getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); - - if (!getRandomValues) { - throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); - } - } - - return getRandomValues(rnds8); -} - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/sha1.js": -/*!*********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/sha1.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack_module, exports) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -// Adapted from Chris Veness' SHA1 code at -// http://www.movable-type.co.uk/scripts/sha1.html -function f(s, x, y, z) { - switch (s) { - case 0: - return x & y ^ ~x & z; - - case 1: - return x ^ y ^ z; - - case 2: - return x & y ^ x & z ^ y & z; - - case 3: - return x ^ y ^ z; - } -} - -function ROTL(x, n) { - return x << n | x >>> 32 - n; -} - -function sha1(bytes) { - const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; - const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; - - if (typeof bytes === 'string') { - const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape - - bytes = []; - - for (let i = 0; i < msg.length; ++i) { - bytes.push(msg.charCodeAt(i)); - } - } else if (!Array.isArray(bytes)) { - // Convert Array-like to Array - bytes = Array.prototype.slice.call(bytes); - } - - bytes.push(0x80); - const l = bytes.length / 4 + 2; - const N = Math.ceil(l / 16); - const M = new Array(N); - - for (let i = 0; i < N; ++i) { - const arr = new Uint32Array(16); - - for (let j = 0; j < 16; ++j) { - arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3]; - } - - M[i] = arr; - } - - M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); - M[N - 1][14] = Math.floor(M[N - 1][14]); - M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; - - for (let i = 0; i < N; ++i) { - const W = new Uint32Array(80); - - for (let t = 0; t < 16; ++t) { - W[t] = M[i][t]; - } - - for (let t = 16; t < 80; ++t) { - W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1); - } - - let a = H[0]; - let b = H[1]; - let c = H[2]; - let d = H[3]; - let e = H[4]; - - for (let t = 0; t < 80; ++t) { - const s = Math.floor(t / 20); - const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0; - e = d; - d = c; - c = ROTL(b, 30) >>> 0; - b = a; - a = T; - } - - H[0] = H[0] + a >>> 0; - H[1] = H[1] + b >>> 0; - H[2] = H[2] + c >>> 0; - H[3] = H[3] + d >>> 0; - H[4] = H[4] + e >>> 0; - } - - return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; -} - -var _default = sha1; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/stringify.js": -/*!**************************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/stringify.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -exports.unsafeStringify = unsafeStringify; - -var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ -const byteToHex = []; - -for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 0x100).toString(16).slice(1)); -} - -function unsafeStringify(arr, offset = 0) { - // Note: Be careful editing this code! It's been tuned for performance - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 - return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; -} - -function stringify(arr, offset = 0) { - const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one - // of the following: - // - One or more input array values don't map to a hex octet (leading to - // "undefined" in the uuid) - // - Invalid input values for the RFC `version` or `variant` fields - - if (!(0, _validate.default)(uuid)) { - throw TypeError('Stringified UUID is invalid'); - } - - return uuid; -} - -var _default = stringify; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/v1.js": -/*!*******************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/v1.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _rng = _interopRequireDefault(__webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/commonjs-browser/rng.js")); - -var _stringify = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html -let _nodeId; - -let _clockseq; // Previous uuid creation time - - -let _lastMSecs = 0; -let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details - -function v1(options, buf, offset) { - let i = buf && offset || 0; - const b = buf || new Array(16); - options = options || {}; - let node = options.node || _nodeId; - let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - - if (node == null || clockseq == null) { - const seedBytes = options.random || (options.rng || _rng.default)(); - - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; - } - - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - - - let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - - let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) - - const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression - - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - - - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } // Per 4.2.1.2 Throw error if too many uuids are requested - - - if (nsecs >= 10000) { - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - - msecs += 12219292800000; // `time_low` - - const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; // `time_mid` - - const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; // `time_high_and_version` - - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - - b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` - - b[i++] = clockseq & 0xff; // `node` - - for (let n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf || (0, _stringify.unsafeStringify)(b); -} - -var _default = v1; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/v3.js": -/*!*******************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/v3.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _v = _interopRequireDefault(__webpack_require__(/*! ./v35.js */ "./node_modules/uuid/dist/commonjs-browser/v35.js")); - -var _md = _interopRequireDefault(__webpack_require__(/*! ./md5.js */ "./node_modules/uuid/dist/commonjs-browser/md5.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const v3 = (0, _v.default)('v3', 0x30, _md.default); -var _default = v3; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/v35.js": -/*!********************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/v35.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports.URL = exports.DNS = void 0; -exports["default"] = v35; - -var _stringify = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js"); - -var _parse = _interopRequireDefault(__webpack_require__(/*! ./parse.js */ "./node_modules/uuid/dist/commonjs-browser/parse.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function stringToBytes(str) { - str = unescape(encodeURIComponent(str)); // UTF8 escape - - const bytes = []; - - for (let i = 0; i < str.length; ++i) { - bytes.push(str.charCodeAt(i)); - } - - return bytes; -} - -const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; -exports.DNS = DNS; -const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; -exports.URL = URL; - -function v35(name, version, hashfunc) { - function generateUUID(value, namespace, buf, offset) { - var _namespace; - - if (typeof value === 'string') { - value = stringToBytes(value); - } - - if (typeof namespace === 'string') { - namespace = (0, _parse.default)(namespace); - } - - if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) { - throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); - } // Compute hash of namespace and value, Per 4.3 - // Future: Use spread syntax when supported on all platforms, e.g. `bytes = - // hashfunc([...namespace, ... value])` - - - let bytes = new Uint8Array(16 + value.length); - bytes.set(namespace); - bytes.set(value, namespace.length); - bytes = hashfunc(bytes); - bytes[6] = bytes[6] & 0x0f | version; - bytes[8] = bytes[8] & 0x3f | 0x80; - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = bytes[i]; - } - - return buf; - } - - return (0, _stringify.unsafeStringify)(bytes); - } // Function#name is not settable on some platforms (#270) - - - try { - generateUUID.name = name; // eslint-disable-next-line no-empty - } catch (err) {} // For CommonJS default export support - - - generateUUID.DNS = DNS; - generateUUID.URL = URL; - return generateUUID; -} - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/v4.js": -/*!*******************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/v4.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _native = _interopRequireDefault(__webpack_require__(/*! ./native.js */ "./node_modules/uuid/dist/commonjs-browser/native.js")); - -var _rng = _interopRequireDefault(__webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/commonjs-browser/rng.js")); - -var _stringify = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/commonjs-browser/stringify.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function v4(options, buf, offset) { - if (_native.default.randomUUID && !buf && !options) { - return _native.default.randomUUID(); - } - - options = options || {}; - - const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - - - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - - return buf; - } - - return (0, _stringify.unsafeStringify)(rnds); -} - -var _default = v4; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/v5.js": -/*!*******************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/v5.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _v = _interopRequireDefault(__webpack_require__(/*! ./v35.js */ "./node_modules/uuid/dist/commonjs-browser/v35.js")); - -var _sha = _interopRequireDefault(__webpack_require__(/*! ./sha1.js */ "./node_modules/uuid/dist/commonjs-browser/sha1.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const v5 = (0, _v.default)('v5', 0x50, _sha.default); -var _default = v5; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/validate.js": -/*!*************************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/validate.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _regex = _interopRequireDefault(__webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/commonjs-browser/regex.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function validate(uuid) { - return typeof uuid === 'string' && _regex.default.test(uuid); -} - -var _default = validate; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/commonjs-browser/version.js": -/*!************************************************************!*\ - !*** ./node_modules/uuid/dist/commonjs-browser/version.js ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; - -var _validate = _interopRequireDefault(__webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/commonjs-browser/validate.js")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function version(uuid) { - if (!(0, _validate.default)(uuid)) { - throw TypeError('Invalid UUID'); - } - - return parseInt(uuid.slice(14, 15), 16); -} - -var _default = version; -exports["default"] = _default; - -/***/ }), - -/***/ "./node_modules/uuid/dist/esm-browser/native.js": -/*!******************************************************!*\ - !*** ./node_modules/uuid/dist/esm-browser/native.js ***! - \******************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto); -/* harmony default export */ __webpack_exports__["default"] = ({ - randomUUID -}); - -/***/ }), - -/***/ "./node_modules/uuid/dist/esm-browser/regex.js": -/*!*****************************************************!*\ - !*** ./node_modules/uuid/dist/esm-browser/regex.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i); - -/***/ }), - -/***/ "./node_modules/uuid/dist/esm-browser/rng.js": -/*!***************************************************!*\ - !*** ./node_modules/uuid/dist/esm-browser/rng.js ***! - \***************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ rng; } -/* harmony export */ }); -// Unique ID creation requires a high quality random # generator. In the browser we therefore -// require the crypto API and do not support built-in fallback to lower quality random number -// generators (like Math.random()). -let getRandomValues; -const rnds8 = new Uint8Array(16); -function rng() { - // lazy load so that environments that need to polyfill have a chance to do so - if (!getRandomValues) { - // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. - getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); - - if (!getRandomValues) { - throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported'); - } - } - - return getRandomValues(rnds8); -} - -/***/ }), - -/***/ "./node_modules/uuid/dist/esm-browser/stringify.js": -/*!*********************************************************!*\ - !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ unsafeStringify: function() { return /* binding */ unsafeStringify; } -/* harmony export */ }); -/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js"); - -/** - * Convert array of 16 byte values to UUID string format of the form: - * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX - */ - -const byteToHex = []; - -for (let i = 0; i < 256; ++i) { - byteToHex.push((i + 0x100).toString(16).slice(1)); -} - -function unsafeStringify(arr, offset = 0) { - // Note: Be careful editing this code! It's been tuned for performance - // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 - return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]; -} - -function stringify(arr, offset = 0) { - const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one - // of the following: - // - One or more input array values don't map to a hex octet (leading to - // "undefined" in the uuid) - // - Invalid input values for the RFC `version` or `variant` fields - - if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) { - throw TypeError('Stringified UUID is invalid'); - } - - return uuid; -} - -/* harmony default export */ __webpack_exports__["default"] = (stringify); - -/***/ }), - -/***/ "./node_modules/uuid/dist/esm-browser/v4.js": -/*!**************************************************!*\ - !*** ./node_modules/uuid/dist/esm-browser/v4.js ***! - \**************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ "./node_modules/uuid/dist/esm-browser/native.js"); -/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/esm-browser/rng.js"); -/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js"); - - - - -function v4(options, buf, offset) { - if (_native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID && !buf && !options) { - return _native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID(); - } - - options = options || {}; - const rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_1__["default"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - - rnds[6] = rnds[6] & 0x0f | 0x40; - rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided - - if (buf) { - offset = offset || 0; - - for (let i = 0; i < 16; ++i) { - buf[offset + i] = rnds[i]; - } - - return buf; - } - - return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds); -} - -/* harmony default export */ __webpack_exports__["default"] = (v4); - -/***/ }), - -/***/ "./node_modules/uuid/dist/esm-browser/validate.js": -/*!********************************************************!*\ - !*** ./node_modules/uuid/dist/esm-browser/validate.js ***! - \********************************************************/ -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/esm-browser/regex.js"); - - -function validate(uuid) { - return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__["default"].test(uuid); -} - -/* harmony default export */ __webpack_exports__["default"] = (validate); - -/***/ }), - -/***/ "./node_modules/webfinger.js/src/webfinger.js": -/*!****************************************************!*\ - !*** ./node_modules/webfinger.js/src/webfinger.js ***! - \****************************************************/ -/***/ (function(module, exports, __webpack_require__) { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* global define */ -/*! - * webfinger.js - * http://github.com/silverbucket/webfinger.js - * - * Developed and Maintained by: - * Nick Jennings - * - * webfinger.js is released under the AGPL (see LICENSE). - * - * You don't have to do anything special to choose one license or the other and you don't - * have to notify anyone which license you are using. - * Please see the corresponding license file for details of these licenses. - * You are free to use, modify and distribute this software, but all copyright - * information must remain. - * - */ - -if (typeof fetch !== 'function' && typeof XMLHttpRequest !== 'function') { - // XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; - XMLHttpRequest = __webpack_require__(/*! xhr2 */ "./node_modules/xhr2/lib/browser.js"); -} - -(function (global) { - - // URI to property name map - var LINK_URI_MAPS = { - 'http://webfist.org/spec/rel': 'webfist', - 'http://webfinger.net/rel/avatar': 'avatar', - 'remotestorage': 'remotestorage', - 'http://tools.ietf.org/id/draft-dejong-remotestorage': 'remotestorage', - 'remoteStorage': 'remotestorage', - 'http://www.packetizer.com/rel/share': 'share', - 'http://webfinger.net/rel/profile-page': 'profile', - 'me': 'profile', - 'vcard': 'vcard', - 'blog': 'blog', - 'http://packetizer.com/rel/blog': 'blog', - 'http://schemas.google.com/g/2010#updates-from': 'updates', - 'https://camlistore.org/rel/server': 'camilstore' - }; - - var LINK_PROPERTIES = { - 'avatar': [], - 'remotestorage': [], - 'blog': [], - 'vcard': [], - 'updates': [], - 'share': [], - 'profile': [], - 'webfist': [], - 'camlistore': [] - }; - - // list of endpoints to try, fallback from beginning to end. - var URIS = ['webfinger', 'host-meta', 'host-meta.json']; - - function generateErrorObject(obj) { - obj.toString = function () { - return this.message; - }; - return obj; - } - - // given a URL ensures it's HTTPS. - // returns false for null string or non-HTTPS URL. - function isSecure(url) { - if (typeof url !== 'string') { - return false; - } - var parts = url.split('://'); - if (parts[0] === 'https') { - return true; - } - return false; - } - - /** - * Function: WebFinger - * - * WebFinger constructor - * - * Returns: - * - * return WebFinger object - */ - function WebFinger(config) { - if (typeof config !== 'object') { - config = {}; - } - - this.config = { - tls_only: (typeof config.tls_only !== 'undefined') ? config.tls_only : true, - webfist_fallback: (typeof config.webfist_fallback !== 'undefined') ? config.webfist_fallback : false, - uri_fallback: (typeof config.uri_fallback !== 'undefined') ? config.uri_fallback : false, - request_timeout: (typeof config.request_timeout !== 'undefined') ? config.request_timeout : 10000 - }; - } - - // make an http request and look for JRD response, fails if request fails - // or response not json. - WebFinger.prototype.__fetchJRD = function (url, errorHandler, successHandler) { - if (typeof fetch === 'function') { - return this.__fetchJRD_fetch(url, errorHandler, successHandler); - } else if (typeof XMLHttpRequest === 'function') { - return this.__fetchJRD_XHR(url, errorHandler, successHandler); - } else { - throw new Error("add a polyfill for fetch or XMLHttpRequest"); - } - }; - WebFinger.prototype.__fetchJRD_fetch = function (url, errorHandler, successHandler) { - var webfinger = this; - var abortController; - if (typeof AbortController === 'function') { - abortController = new AbortController(); - } - var networkPromise = fetch(url, { - headers: {'Accept': 'application/jrd+json, application/json'}, - signal: abortController ? abortController.signal : undefined - }). - then(function (response) { - if (response.ok) { - return response.text(); - } else if (response.status === 404) { - throw generateErrorObject({ - message: 'resource not found', - url: url, - status: response.status - }); - } else { // other HTTP status (redirects are handled transparently) - throw generateErrorObject({ - message: 'error during request', - url: url, - status: response.status - }); - } - }, - function (err) { // connection refused, etc. - throw generateErrorObject({ - message: 'error during request', - url: url, - status: undefined, - err: err - }) - }). - then(function (responseText) { - if (webfinger.__isValidJSON(responseText)) { - return responseText; - } else { - throw generateErrorObject({ - message: 'invalid json', - url: url, - status: undefined - }); - } - }); - - var timeoutPromise = new Promise(function (resolve, reject) { - setTimeout(function () { - reject(generateErrorObject({ - message: 'request timed out', - url: url, - status: undefined - })); - if (abortController) { - abortController.abort(); - } - }, webfinger.config.request_timeout); - }); - - Promise.race([networkPromise, timeoutPromise]). - then(function (responseText) { - successHandler(responseText); - }).catch(function (err) { - errorHandler(err); - }); - }; - WebFinger.prototype.__fetchJRD_XHR = function (url, errorHandler, successHandler) { - var self = this; - var handlerSpent = false; - var xhr = new XMLHttpRequest(); - - function __processState() { - if (handlerSpent){ - return; - }else{ - handlerSpent = true; - } - - if (xhr.status === 200) { - if (self.__isValidJSON(xhr.responseText)) { - return successHandler(xhr.responseText); - } else { - return errorHandler(generateErrorObject({ - message: 'invalid json', - url: url, - status: xhr.status - })); - } - } else if (xhr.status === 404) { - return errorHandler(generateErrorObject({ - message: 'resource not found', - url: url, - status: xhr.status - })); - } else if ((xhr.status >= 301) && (xhr.status <= 302)) { - var location = xhr.getResponseHeader('Location'); - if (isSecure(location)) { - return __makeRequest(location); // follow redirect - } else { - return errorHandler(generateErrorObject({ - message: 'no redirect URL found', - url: url, - status: xhr.status - })); - } - } else { - return errorHandler(generateErrorObject({ - message: 'error during request', - url: url, - status: xhr.status - })); - } - } - - function __makeRequest() { - xhr.onreadystatechange = function () { - if (xhr.readyState === 4) { - __processState(); - } - }; - - xhr.onload = function () { - __processState(); - }; - - xhr.ontimeout = function () { - return errorHandler(generateErrorObject({ - message: 'request timed out', - url: url, - status: xhr.status - })); - }; - - xhr.open('GET', url, true); - xhr.timeout = self.config.request_timeout; - xhr.setRequestHeader('Accept', 'application/jrd+json, application/json'); - xhr.send(); - } - - return __makeRequest(); - }; - - WebFinger.prototype.__isValidJSON = function (str) { - try { - JSON.parse(str); - } catch (e) { - return false; - } - return true; - }; - - WebFinger.prototype.__isLocalhost = function (host) { - var local = /^localhost(\.localdomain)?(\:[0-9]+)?$/; - return local.test(host); - }; - - // processes JRD object as if it's a webfinger response object - // looks for known properties and adds them to profile datat struct. - WebFinger.prototype.__processJRD = function (URL, JRD, errorHandler, successHandler) { - var parsedJRD = JSON.parse(JRD); - if ((typeof parsedJRD !== 'object') || - (typeof parsedJRD.links !== 'object')) { - if (typeof parsedJRD.error !== 'undefined') { - return errorHandler(generateErrorObject({ message: parsedJRD.error, request: URL })); - } else { - return errorHandler(generateErrorObject({ message: 'unknown response from server', request: URL })); - } - } - - var links = parsedJRD.links; - if (!Array.isArray(links)) { - links = []; - } - var result = { // webfinger JRD - object, json, and our own indexing - object: parsedJRD, - json: JRD, - idx: {} - }; - - result.idx.properties = { - 'name': undefined - }; - result.idx.links = JSON.parse(JSON.stringify(LINK_PROPERTIES)); - - // process links - links.map(function (link, i) { - if (LINK_URI_MAPS.hasOwnProperty(link.rel)) { - if (result.idx.links[LINK_URI_MAPS[link.rel]]) { - var entry = {}; - Object.keys(link).map(function (item, n) { - entry[item] = link[item]; - }); - result.idx.links[LINK_URI_MAPS[link.rel]].push(entry); - } - } - }); - - // process properties - var props = JSON.parse(JRD).properties; - for (var key in props) { - if (props.hasOwnProperty(key)) { - if (key === 'http://packetizer.com/ns/name') { - result.idx.properties.name = props[key]; - } - } - } - return successHandler(result); - }; - - WebFinger.prototype.lookup = function (address, cb) { - if (typeof address !== 'string') { - throw new Error('first parameter must be a user address'); - } else if (typeof cb !== 'function') { - throw new Error('second parameter must be a callback'); - } - - var self = this; - var host = ''; - if (address.indexOf('://') > -1) { - // other uri format - host = address.replace(/ /g,'').split('/')[2]; - } else { - // useraddress - host = address.replace(/ /g,'').split('@')[1]; - } - var uri_index = 0; // track which URIS we've tried already - var protocol = 'https'; // we use https by default - - if (self.__isLocalhost(host)) { - protocol = 'http'; - } - - function __buildURL() { - var uri = ''; - if (! address.split('://')[1]) { - // the URI has not been defined, default to acct - uri = 'acct:'; - } - return protocol + '://' + host + '/.well-known/' + - URIS[uri_index] + '?resource=' + uri + address; - } - - // control flow for failures, what to do in various cases, etc. - function __fallbackChecks(err) { - if ((self.config.uri_fallback) && (host !== 'webfist.org') && (uri_index !== URIS.length - 1)) { // we have uris left to try - uri_index = uri_index + 1; - return __call(); - } else if ((!self.config.tls_only) && (protocol === 'https')) { // try normal http - uri_index = 0; - protocol = 'http'; - return __call(); - } else if ((self.config.webfist_fallback) && (host !== 'webfist.org')) { // webfist attempt - uri_index = 0; - protocol = 'http'; - host = 'webfist.org'; - // webfist will - // 1. make a query to the webfist server for the users account - // 2. from the response, get a link to the actual webfinger json data - // (stored somewhere in control of the user) - // 3. make a request to that url and get the json - // 4. process it like a normal webfinger response - var URL = __buildURL(); - self.__fetchJRD(URL, cb, function (data) { // get link to users JRD - self.__processJRD(URL, data, cb, function (result) { - if ((typeof result.idx.links.webfist === 'object') && - (typeof result.idx.links.webfist[0].href === 'string')) { - self.__fetchJRD(result.idx.links.webfist[0].href, cb, function (JRD) { - self.__processJRD(URL, JRD, cb, function (result) { - return cb(null, cb); - }); - }); - } - }); - }); - } else { - return cb(err); - } - } - - function __call() { - // make request - var URL = __buildURL(); - self.__fetchJRD(URL, __fallbackChecks, function (JRD) { - self.__processJRD(URL, JRD, cb, function (result) { cb(null, result); }); - }); - } - - return setTimeout(__call, 0); - }; - - WebFinger.prototype.lookupLink = function (address, rel, cb) { - if (LINK_PROPERTIES.hasOwnProperty(rel)) { - this.lookup(address, function (err, p) { - var links = p.idx.links[rel]; - if (err) { - return cb(err); - } else if (links.length === 0) { - return cb('no links found with rel="' + rel + '"'); - } else { - return cb(null, links[0]); - } - }); - } else { - return cb('unsupported rel ' + rel); - } - }; - - - - // AMD support - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { return WebFinger; }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - // CommonJS and Node.js module support. - } else {} -})(this); - - -/***/ }), - -/***/ "./node_modules/xhr2/lib/browser.js": -/*!******************************************!*\ - !*** ./node_modules/xhr2/lib/browser.js ***! - \******************************************/ -/***/ (function(module) { - -module.exports = XMLHttpRequest; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/index.js": -/*!*************************************************!*\ - !*** ./node_modules/jose/dist/browser/index.js ***! - \*************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CompactEncrypt: function() { return /* reexport safe */ _jwe_compact_encrypt_js__WEBPACK_IMPORTED_MODULE_9__.CompactEncrypt; }, -/* harmony export */ CompactSign: function() { return /* reexport safe */ _jws_compact_sign_js__WEBPACK_IMPORTED_MODULE_11__.CompactSign; }, -/* harmony export */ EmbeddedJWK: function() { return /* reexport safe */ _jwk_embedded_js__WEBPACK_IMPORTED_MODULE_17__.EmbeddedJWK; }, -/* harmony export */ EncryptJWT: function() { return /* reexport safe */ _jwt_encrypt_js__WEBPACK_IMPORTED_MODULE_15__.EncryptJWT; }, -/* harmony export */ FlattenedEncrypt: function() { return /* reexport safe */ _jwe_flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_10__.FlattenedEncrypt; }, -/* harmony export */ FlattenedSign: function() { return /* reexport safe */ _jws_flattened_sign_js__WEBPACK_IMPORTED_MODULE_12__.FlattenedSign; }, -/* harmony export */ GeneralEncrypt: function() { return /* reexport safe */ _jwe_general_encrypt_js__WEBPACK_IMPORTED_MODULE_3__.GeneralEncrypt; }, -/* harmony export */ GeneralSign: function() { return /* reexport safe */ _jws_general_sign_js__WEBPACK_IMPORTED_MODULE_13__.GeneralSign; }, -/* harmony export */ SignJWT: function() { return /* reexport safe */ _jwt_sign_js__WEBPACK_IMPORTED_MODULE_14__.SignJWT; }, -/* harmony export */ UnsecuredJWT: function() { return /* reexport safe */ _jwt_unsecured_js__WEBPACK_IMPORTED_MODULE_20__.UnsecuredJWT; }, -/* harmony export */ base64url: function() { return /* reexport module object */ _util_base64url_js__WEBPACK_IMPORTED_MODULE_28__; }, -/* harmony export */ calculateJwkThumbprint: function() { return /* reexport safe */ _jwk_thumbprint_js__WEBPACK_IMPORTED_MODULE_16__.calculateJwkThumbprint; }, -/* harmony export */ calculateJwkThumbprintUri: function() { return /* reexport safe */ _jwk_thumbprint_js__WEBPACK_IMPORTED_MODULE_16__.calculateJwkThumbprintUri; }, -/* harmony export */ compactDecrypt: function() { return /* reexport safe */ _jwe_compact_decrypt_js__WEBPACK_IMPORTED_MODULE_0__.compactDecrypt; }, -/* harmony export */ compactVerify: function() { return /* reexport safe */ _jws_compact_verify_js__WEBPACK_IMPORTED_MODULE_4__.compactVerify; }, -/* harmony export */ createLocalJWKSet: function() { return /* reexport safe */ _jwks_local_js__WEBPACK_IMPORTED_MODULE_18__.createLocalJWKSet; }, -/* harmony export */ createRemoteJWKSet: function() { return /* reexport safe */ _jwks_remote_js__WEBPACK_IMPORTED_MODULE_19__.createRemoteJWKSet; }, -/* harmony export */ cryptoRuntime: function() { return /* reexport safe */ _util_runtime_js__WEBPACK_IMPORTED_MODULE_29__["default"]; }, -/* harmony export */ decodeJwt: function() { return /* reexport safe */ _util_decode_jwt_js__WEBPACK_IMPORTED_MODULE_24__.decodeJwt; }, -/* harmony export */ decodeProtectedHeader: function() { return /* reexport safe */ _util_decode_protected_header_js__WEBPACK_IMPORTED_MODULE_23__.decodeProtectedHeader; }, -/* harmony export */ errors: function() { return /* reexport module object */ _util_errors_js__WEBPACK_IMPORTED_MODULE_25__; }, -/* harmony export */ exportJWK: function() { return /* reexport safe */ _key_export_js__WEBPACK_IMPORTED_MODULE_21__.exportJWK; }, -/* harmony export */ exportPKCS8: function() { return /* reexport safe */ _key_export_js__WEBPACK_IMPORTED_MODULE_21__.exportPKCS8; }, -/* harmony export */ exportSPKI: function() { return /* reexport safe */ _key_export_js__WEBPACK_IMPORTED_MODULE_21__.exportSPKI; }, -/* harmony export */ flattenedDecrypt: function() { return /* reexport safe */ _jwe_flattened_decrypt_js__WEBPACK_IMPORTED_MODULE_1__.flattenedDecrypt; }, -/* harmony export */ flattenedVerify: function() { return /* reexport safe */ _jws_flattened_verify_js__WEBPACK_IMPORTED_MODULE_5__.flattenedVerify; }, -/* harmony export */ generalDecrypt: function() { return /* reexport safe */ _jwe_general_decrypt_js__WEBPACK_IMPORTED_MODULE_2__.generalDecrypt; }, -/* harmony export */ generalVerify: function() { return /* reexport safe */ _jws_general_verify_js__WEBPACK_IMPORTED_MODULE_6__.generalVerify; }, -/* harmony export */ generateKeyPair: function() { return /* reexport safe */ _key_generate_key_pair_js__WEBPACK_IMPORTED_MODULE_26__.generateKeyPair; }, -/* harmony export */ generateSecret: function() { return /* reexport safe */ _key_generate_secret_js__WEBPACK_IMPORTED_MODULE_27__.generateSecret; }, -/* harmony export */ importJWK: function() { return /* reexport safe */ _key_import_js__WEBPACK_IMPORTED_MODULE_22__.importJWK; }, -/* harmony export */ importPKCS8: function() { return /* reexport safe */ _key_import_js__WEBPACK_IMPORTED_MODULE_22__.importPKCS8; }, -/* harmony export */ importSPKI: function() { return /* reexport safe */ _key_import_js__WEBPACK_IMPORTED_MODULE_22__.importSPKI; }, -/* harmony export */ importX509: function() { return /* reexport safe */ _key_import_js__WEBPACK_IMPORTED_MODULE_22__.importX509; }, -/* harmony export */ jwtDecrypt: function() { return /* reexport safe */ _jwt_decrypt_js__WEBPACK_IMPORTED_MODULE_8__.jwtDecrypt; }, -/* harmony export */ jwtVerify: function() { return /* reexport safe */ _jwt_verify_js__WEBPACK_IMPORTED_MODULE_7__.jwtVerify; } -/* harmony export */ }); -/* harmony import */ var _jwe_compact_decrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jwe/compact/decrypt.js */ "./node_modules/jose/dist/browser/jwe/compact/decrypt.js"); -/* harmony import */ var _jwe_flattened_decrypt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jwe/flattened/decrypt.js */ "./node_modules/jose/dist/browser/jwe/flattened/decrypt.js"); -/* harmony import */ var _jwe_general_decrypt_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jwe/general/decrypt.js */ "./node_modules/jose/dist/browser/jwe/general/decrypt.js"); -/* harmony import */ var _jwe_general_encrypt_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jwe/general/encrypt.js */ "./node_modules/jose/dist/browser/jwe/general/encrypt.js"); -/* harmony import */ var _jws_compact_verify_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./jws/compact/verify.js */ "./node_modules/jose/dist/browser/jws/compact/verify.js"); -/* harmony import */ var _jws_flattened_verify_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./jws/flattened/verify.js */ "./node_modules/jose/dist/browser/jws/flattened/verify.js"); -/* harmony import */ var _jws_general_verify_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./jws/general/verify.js */ "./node_modules/jose/dist/browser/jws/general/verify.js"); -/* harmony import */ var _jwt_verify_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./jwt/verify.js */ "./node_modules/jose/dist/browser/jwt/verify.js"); -/* harmony import */ var _jwt_decrypt_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./jwt/decrypt.js */ "./node_modules/jose/dist/browser/jwt/decrypt.js"); -/* harmony import */ var _jwe_compact_encrypt_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./jwe/compact/encrypt.js */ "./node_modules/jose/dist/browser/jwe/compact/encrypt.js"); -/* harmony import */ var _jwe_flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./jwe/flattened/encrypt.js */ "./node_modules/jose/dist/browser/jwe/flattened/encrypt.js"); -/* harmony import */ var _jws_compact_sign_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./jws/compact/sign.js */ "./node_modules/jose/dist/browser/jws/compact/sign.js"); -/* harmony import */ var _jws_flattened_sign_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./jws/flattened/sign.js */ "./node_modules/jose/dist/browser/jws/flattened/sign.js"); -/* harmony import */ var _jws_general_sign_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./jws/general/sign.js */ "./node_modules/jose/dist/browser/jws/general/sign.js"); -/* harmony import */ var _jwt_sign_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./jwt/sign.js */ "./node_modules/jose/dist/browser/jwt/sign.js"); -/* harmony import */ var _jwt_encrypt_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./jwt/encrypt.js */ "./node_modules/jose/dist/browser/jwt/encrypt.js"); -/* harmony import */ var _jwk_thumbprint_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./jwk/thumbprint.js */ "./node_modules/jose/dist/browser/jwk/thumbprint.js"); -/* harmony import */ var _jwk_embedded_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./jwk/embedded.js */ "./node_modules/jose/dist/browser/jwk/embedded.js"); -/* harmony import */ var _jwks_local_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./jwks/local.js */ "./node_modules/jose/dist/browser/jwks/local.js"); -/* harmony import */ var _jwks_remote_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./jwks/remote.js */ "./node_modules/jose/dist/browser/jwks/remote.js"); -/* harmony import */ var _jwt_unsecured_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./jwt/unsecured.js */ "./node_modules/jose/dist/browser/jwt/unsecured.js"); -/* harmony import */ var _key_export_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./key/export.js */ "./node_modules/jose/dist/browser/key/export.js"); -/* harmony import */ var _key_import_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./key/import.js */ "./node_modules/jose/dist/browser/key/import.js"); -/* harmony import */ var _util_decode_protected_header_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./util/decode_protected_header.js */ "./node_modules/jose/dist/browser/util/decode_protected_header.js"); -/* harmony import */ var _util_decode_jwt_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./util/decode_jwt.js */ "./node_modules/jose/dist/browser/util/decode_jwt.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _key_generate_key_pair_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./key/generate_key_pair.js */ "./node_modules/jose/dist/browser/key/generate_key_pair.js"); -/* harmony import */ var _key_generate_secret_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./key/generate_secret.js */ "./node_modules/jose/dist/browser/key/generate_secret.js"); -/* harmony import */ var _util_base64url_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./util/base64url.js */ "./node_modules/jose/dist/browser/util/base64url.js"); -/* harmony import */ var _util_runtime_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./util/runtime.js */ "./node_modules/jose/dist/browser/util/runtime.js"); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwe/compact/decrypt.js": -/*!***************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwe/compact/decrypt.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ compactDecrypt: function() { return /* binding */ compactDecrypt; } -/* harmony export */ }); -/* harmony import */ var _flattened_decrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/decrypt.js */ "./node_modules/jose/dist/browser/jwe/flattened/decrypt.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); - - - -async function compactDecrypt(jwe, key, options) { - if (jwe instanceof Uint8Array) { - jwe = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_2__.decoder.decode(jwe); - } - if (typeof jwe !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('Compact JWE must be a string or Uint8Array'); - } - const { 0: protectedHeader, 1: encryptedKey, 2: iv, 3: ciphertext, 4: tag, length, } = jwe.split('.'); - if (length !== 5) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('Invalid Compact JWE'); - } - const decrypted = await (0,_flattened_decrypt_js__WEBPACK_IMPORTED_MODULE_0__.flattenedDecrypt)({ - ciphertext, - iv: (iv || undefined), - protected: protectedHeader || undefined, - tag: (tag || undefined), - encrypted_key: encryptedKey || undefined, - }, key, options); - const result = { plaintext: decrypted.plaintext, protectedHeader: decrypted.protectedHeader }; - if (typeof key === 'function') { - return { ...result, key: decrypted.key }; - } - return result; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwe/compact/encrypt.js": -/*!***************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwe/compact/encrypt.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CompactEncrypt: function() { return /* binding */ CompactEncrypt; } -/* harmony export */ }); -/* harmony import */ var _flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/encrypt.js */ "./node_modules/jose/dist/browser/jwe/flattened/encrypt.js"); - -class CompactEncrypt { - constructor(plaintext) { - this._flattened = new _flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_0__.FlattenedEncrypt(plaintext); - } - setContentEncryptionKey(cek) { - this._flattened.setContentEncryptionKey(cek); - return this; - } - setInitializationVector(iv) { - this._flattened.setInitializationVector(iv); - return this; - } - setProtectedHeader(protectedHeader) { - this._flattened.setProtectedHeader(protectedHeader); - return this; - } - setKeyManagementParameters(parameters) { - this._flattened.setKeyManagementParameters(parameters); - return this; - } - async encrypt(key, options) { - const jwe = await this._flattened.encrypt(key, options); - return [jwe.protected, jwe.encrypted_key, jwe.iv, jwe.ciphertext, jwe.tag].join('.'); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwe/flattened/decrypt.js": -/*!*****************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwe/flattened/decrypt.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ flattenedDecrypt: function() { return /* binding */ flattenedDecrypt; } -/* harmony export */ }); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _runtime_decrypt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../runtime/decrypt.js */ "./node_modules/jose/dist/browser/runtime/decrypt.js"); -/* harmony import */ var _runtime_zlib_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../runtime/zlib.js */ "./node_modules/jose/dist/browser/runtime/zlib.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../lib/is_disjoint.js */ "./node_modules/jose/dist/browser/lib/is_disjoint.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); -/* harmony import */ var _lib_decrypt_key_management_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../lib/decrypt_key_management.js */ "./node_modules/jose/dist/browser/lib/decrypt_key_management.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_cek_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../lib/cek.js */ "./node_modules/jose/dist/browser/lib/cek.js"); -/* harmony import */ var _lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../lib/validate_crit.js */ "./node_modules/jose/dist/browser/lib/validate_crit.js"); -/* harmony import */ var _lib_validate_algorithms_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../lib/validate_algorithms.js */ "./node_modules/jose/dist/browser/lib/validate_algorithms.js"); - - - - - - - - - - - -async function flattenedDecrypt(jwe, key, options) { - var _a; - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__["default"])(jwe)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('Flattened JWE must be an object'); - } - if (jwe.protected === undefined && jwe.header === undefined && jwe.unprotected === undefined) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JOSE Header missing'); - } - if (typeof jwe.iv !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Initialization Vector missing or incorrect type'); - } - if (typeof jwe.ciphertext !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Ciphertext missing or incorrect type'); - } - if (typeof jwe.tag !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Authentication Tag missing or incorrect type'); - } - if (jwe.protected !== undefined && typeof jwe.protected !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Protected Header incorrect type'); - } - if (jwe.encrypted_key !== undefined && typeof jwe.encrypted_key !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Encrypted Key incorrect type'); - } - if (jwe.aad !== undefined && typeof jwe.aad !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE AAD incorrect type'); - } - if (jwe.header !== undefined && !(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__["default"])(jwe.header)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Shared Unprotected Header incorrect type'); - } - if (jwe.unprotected !== undefined && !(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__["default"])(jwe.unprotected)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Per-Recipient Unprotected Header incorrect type'); - } - let parsedProt; - if (jwe.protected) { - try { - const protectedHeader = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jwe.protected); - parsedProt = JSON.parse(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.decoder.decode(protectedHeader)); - } - catch (_b) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Protected Header is invalid'); - } - } - if (!(0,_lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_4__["default"])(parsedProt, jwe.header, jwe.unprotected)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint'); - } - const joseHeader = { - ...parsedProt, - ...jwe.header, - ...jwe.unprotected, - }; - (0,_lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_9__["default"])(_util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid, new Map(), options === null || options === void 0 ? void 0 : options.crit, parsedProt, joseHeader); - if (joseHeader.zip !== undefined) { - if (!parsedProt || !parsedProt.zip) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected'); - } - if (joseHeader.zip !== 'DEF') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value'); - } - } - const { alg, enc } = joseHeader; - if (typeof alg !== 'string' || !alg) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('missing JWE Algorithm (alg) in JWE Header'); - } - if (typeof enc !== 'string' || !enc) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('missing JWE Encryption Algorithm (enc) in JWE Header'); - } - const keyManagementAlgorithms = options && (0,_lib_validate_algorithms_js__WEBPACK_IMPORTED_MODULE_10__["default"])('keyManagementAlgorithms', options.keyManagementAlgorithms); - const contentEncryptionAlgorithms = options && - (0,_lib_validate_algorithms_js__WEBPACK_IMPORTED_MODULE_10__["default"])('contentEncryptionAlgorithms', options.contentEncryptionAlgorithms); - if (keyManagementAlgorithms && !keyManagementAlgorithms.has(alg)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed'); - } - if (contentEncryptionAlgorithms && !contentEncryptionAlgorithms.has(enc)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter not allowed'); - } - let encryptedKey; - if (jwe.encrypted_key !== undefined) { - try { - encryptedKey = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jwe.encrypted_key); - } - catch (_c) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('Failed to base64url decode the encrypted_key'); - } - } - let resolvedKey = false; - if (typeof key === 'function') { - key = await key(parsedProt, jwe); - resolvedKey = true; - } - let cek; - try { - cek = await (0,_lib_decrypt_key_management_js__WEBPACK_IMPORTED_MODULE_6__["default"])(alg, key, encryptedKey, joseHeader, options); - } - catch (err) { - if (err instanceof TypeError || err instanceof _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid || err instanceof _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JOSENotSupported) { - throw err; - } - cek = (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_8__["default"])(enc); - } - let iv; - let tag; - try { - iv = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jwe.iv); - } - catch (_d) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('Failed to base64url decode the iv'); - } - try { - tag = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jwe.tag); - } - catch (_e) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('Failed to base64url decode the tag'); - } - const protectedHeader = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.encoder.encode((_a = jwe.protected) !== null && _a !== void 0 ? _a : ''); - let additionalData; - if (jwe.aad !== undefined) { - additionalData = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.concat)(protectedHeader, _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.encoder.encode('.'), _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.encoder.encode(jwe.aad)); - } - else { - additionalData = protectedHeader; - } - let ciphertext; - try { - ciphertext = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jwe.ciphertext); - } - catch (_f) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('Failed to base64url decode the ciphertext'); - } - let plaintext = await (0,_runtime_decrypt_js__WEBPACK_IMPORTED_MODULE_1__["default"])(enc, cek, ciphertext, iv, tag, additionalData); - if (joseHeader.zip === 'DEF') { - plaintext = await ((options === null || options === void 0 ? void 0 : options.inflateRaw) || _runtime_zlib_js__WEBPACK_IMPORTED_MODULE_2__.inflate)(plaintext); - } - const result = { plaintext }; - if (jwe.protected !== undefined) { - result.protectedHeader = parsedProt; - } - if (jwe.aad !== undefined) { - try { - result.additionalAuthenticatedData = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jwe.aad); - } - catch (_g) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWEInvalid('Failed to base64url decode the aad'); - } - } - if (jwe.unprotected !== undefined) { - result.sharedUnprotectedHeader = jwe.unprotected; - } - if (jwe.header !== undefined) { - result.unprotectedHeader = jwe.header; - } - if (resolvedKey) { - return { ...result, key }; - } - return result; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwe/flattened/encrypt.js": -/*!*****************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwe/flattened/encrypt.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ FlattenedEncrypt: function() { return /* binding */ FlattenedEncrypt; }, -/* harmony export */ unprotected: function() { return /* binding */ unprotected; } -/* harmony export */ }); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _runtime_encrypt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../runtime/encrypt.js */ "./node_modules/jose/dist/browser/runtime/encrypt.js"); -/* harmony import */ var _runtime_zlib_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../runtime/zlib.js */ "./node_modules/jose/dist/browser/runtime/zlib.js"); -/* harmony import */ var _lib_iv_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../lib/iv.js */ "./node_modules/jose/dist/browser/lib/iv.js"); -/* harmony import */ var _lib_encrypt_key_management_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../lib/encrypt_key_management.js */ "./node_modules/jose/dist/browser/lib/encrypt_key_management.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../lib/is_disjoint.js */ "./node_modules/jose/dist/browser/lib/is_disjoint.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../lib/validate_crit.js */ "./node_modules/jose/dist/browser/lib/validate_crit.js"); - - - - - - - - - -const unprotected = Symbol(); -class FlattenedEncrypt { - constructor(plaintext) { - if (!(plaintext instanceof Uint8Array)) { - throw new TypeError('plaintext must be an instance of Uint8Array'); - } - this._plaintext = plaintext; - } - setKeyManagementParameters(parameters) { - if (this._keyManagementParameters) { - throw new TypeError('setKeyManagementParameters can only be called once'); - } - this._keyManagementParameters = parameters; - return this; - } - setProtectedHeader(protectedHeader) { - if (this._protectedHeader) { - throw new TypeError('setProtectedHeader can only be called once'); - } - this._protectedHeader = protectedHeader; - return this; - } - setSharedUnprotectedHeader(sharedUnprotectedHeader) { - if (this._sharedUnprotectedHeader) { - throw new TypeError('setSharedUnprotectedHeader can only be called once'); - } - this._sharedUnprotectedHeader = sharedUnprotectedHeader; - return this; - } - setUnprotectedHeader(unprotectedHeader) { - if (this._unprotectedHeader) { - throw new TypeError('setUnprotectedHeader can only be called once'); - } - this._unprotectedHeader = unprotectedHeader; - return this; - } - setAdditionalAuthenticatedData(aad) { - this._aad = aad; - return this; - } - setContentEncryptionKey(cek) { - if (this._cek) { - throw new TypeError('setContentEncryptionKey can only be called once'); - } - this._cek = cek; - return this; - } - setInitializationVector(iv) { - if (this._iv) { - throw new TypeError('setInitializationVector can only be called once'); - } - this._iv = iv; - return this; - } - async encrypt(key, options) { - if (!this._protectedHeader && !this._unprotectedHeader && !this._sharedUnprotectedHeader) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()'); - } - if (!(0,_lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_6__["default"])(this._protectedHeader, this._unprotectedHeader, this._sharedUnprotectedHeader)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint'); - } - const joseHeader = { - ...this._protectedHeader, - ...this._unprotectedHeader, - ...this._sharedUnprotectedHeader, - }; - (0,_lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_8__["default"])(_util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid, new Map(), options === null || options === void 0 ? void 0 : options.crit, this._protectedHeader, joseHeader); - if (joseHeader.zip !== undefined) { - if (!this._protectedHeader || !this._protectedHeader.zip) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected'); - } - if (joseHeader.zip !== 'DEF') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value'); - } - } - const { alg, enc } = joseHeader; - if (typeof alg !== 'string' || !alg) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid'); - } - if (typeof enc !== 'string' || !enc) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid'); - } - let encryptedKey; - if (alg === 'dir') { - if (this._cek) { - throw new TypeError('setContentEncryptionKey cannot be called when using Direct Encryption'); - } - } - else if (alg === 'ECDH-ES') { - if (this._cek) { - throw new TypeError('setContentEncryptionKey cannot be called when using Direct Key Agreement'); - } - } - let cek; - { - let parameters; - ({ cek, encryptedKey, parameters } = await (0,_lib_encrypt_key_management_js__WEBPACK_IMPORTED_MODULE_4__["default"])(alg, enc, key, this._cek, this._keyManagementParameters)); - if (parameters) { - if (options && unprotected in options) { - if (!this._unprotectedHeader) { - this.setUnprotectedHeader(parameters); - } - else { - this._unprotectedHeader = { ...this._unprotectedHeader, ...parameters }; - } - } - else { - if (!this._protectedHeader) { - this.setProtectedHeader(parameters); - } - else { - this._protectedHeader = { ...this._protectedHeader, ...parameters }; - } - } - } - } - this._iv || (this._iv = (0,_lib_iv_js__WEBPACK_IMPORTED_MODULE_3__["default"])(enc)); - let additionalData; - let protectedHeader; - let aadMember; - if (this._protectedHeader) { - protectedHeader = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.encoder.encode((0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(JSON.stringify(this._protectedHeader))); - } - else { - protectedHeader = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.encoder.encode(''); - } - if (this._aad) { - aadMember = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(this._aad); - additionalData = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.concat)(protectedHeader, _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.encoder.encode('.'), _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.encoder.encode(aadMember)); - } - else { - additionalData = protectedHeader; - } - let ciphertext; - let tag; - if (joseHeader.zip === 'DEF') { - const deflated = await ((options === null || options === void 0 ? void 0 : options.deflateRaw) || _runtime_zlib_js__WEBPACK_IMPORTED_MODULE_2__.deflate)(this._plaintext); - ({ ciphertext, tag } = await (0,_runtime_encrypt_js__WEBPACK_IMPORTED_MODULE_1__["default"])(enc, deflated, cek, this._iv, additionalData)); - } - else { - ; - ({ ciphertext, tag } = await (0,_runtime_encrypt_js__WEBPACK_IMPORTED_MODULE_1__["default"])(enc, this._plaintext, cek, this._iv, additionalData)); - } - const jwe = { - ciphertext: (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(ciphertext), - iv: (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(this._iv), - tag: (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(tag), - }; - if (encryptedKey) { - jwe.encrypted_key = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(encryptedKey); - } - if (aadMember) { - jwe.aad = aadMember; - } - if (this._protectedHeader) { - jwe.protected = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_7__.decoder.decode(protectedHeader); - } - if (this._sharedUnprotectedHeader) { - jwe.unprotected = this._sharedUnprotectedHeader; - } - if (this._unprotectedHeader) { - jwe.header = this._unprotectedHeader; - } - return jwe; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwe/general/decrypt.js": -/*!***************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwe/general/decrypt.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ generalDecrypt: function() { return /* binding */ generalDecrypt; } -/* harmony export */ }); -/* harmony import */ var _flattened_decrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/decrypt.js */ "./node_modules/jose/dist/browser/jwe/flattened/decrypt.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); - - - -async function generalDecrypt(jwe, key, options) { - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__["default"])(jwe)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('General JWE must be an object'); - } - if (!Array.isArray(jwe.recipients) || !jwe.recipients.every(_lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__["default"])) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('JWE Recipients missing or incorrect type'); - } - if (!jwe.recipients.length) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('JWE Recipients has no members'); - } - for (const recipient of jwe.recipients) { - try { - return await (0,_flattened_decrypt_js__WEBPACK_IMPORTED_MODULE_0__.flattenedDecrypt)({ - aad: jwe.aad, - ciphertext: jwe.ciphertext, - encrypted_key: recipient.encrypted_key, - header: recipient.header, - iv: jwe.iv, - protected: jwe.protected, - tag: jwe.tag, - unprotected: jwe.unprotected, - }, key, options); - } - catch (_a) { - } - } - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEDecryptionFailed(); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwe/general/encrypt.js": -/*!***************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwe/general/encrypt.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ GeneralEncrypt: function() { return /* binding */ GeneralEncrypt; } -/* harmony export */ }); -/* harmony import */ var _flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/encrypt.js */ "./node_modules/jose/dist/browser/jwe/flattened/encrypt.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_cek_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/cek.js */ "./node_modules/jose/dist/browser/lib/cek.js"); -/* harmony import */ var _lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../lib/is_disjoint.js */ "./node_modules/jose/dist/browser/lib/is_disjoint.js"); -/* harmony import */ var _lib_encrypt_key_management_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../lib/encrypt_key_management.js */ "./node_modules/jose/dist/browser/lib/encrypt_key_management.js"); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../lib/validate_crit.js */ "./node_modules/jose/dist/browser/lib/validate_crit.js"); - - - - - - - -class IndividualRecipient { - constructor(enc, key, options) { - this.parent = enc; - this.key = key; - this.options = options; - } - setUnprotectedHeader(unprotectedHeader) { - if (this.unprotectedHeader) { - throw new TypeError('setUnprotectedHeader can only be called once'); - } - this.unprotectedHeader = unprotectedHeader; - return this; - } - addRecipient(...args) { - return this.parent.addRecipient(...args); - } - encrypt(...args) { - return this.parent.encrypt(...args); - } - done() { - return this.parent; - } -} -class GeneralEncrypt { - constructor(plaintext) { - this._recipients = []; - this._plaintext = plaintext; - } - addRecipient(key, options) { - const recipient = new IndividualRecipient(this, key, { crit: options === null || options === void 0 ? void 0 : options.crit }); - this._recipients.push(recipient); - return recipient; - } - setProtectedHeader(protectedHeader) { - if (this._protectedHeader) { - throw new TypeError('setProtectedHeader can only be called once'); - } - this._protectedHeader = protectedHeader; - return this; - } - setSharedUnprotectedHeader(sharedUnprotectedHeader) { - if (this._unprotectedHeader) { - throw new TypeError('setSharedUnprotectedHeader can only be called once'); - } - this._unprotectedHeader = sharedUnprotectedHeader; - return this; - } - setAdditionalAuthenticatedData(aad) { - this._aad = aad; - return this; - } - async encrypt(options) { - var _a, _b, _c; - if (!this._recipients.length) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('at least one recipient must be added'); - } - options = { deflateRaw: options === null || options === void 0 ? void 0 : options.deflateRaw }; - if (this._recipients.length === 1) { - const [recipient] = this._recipients; - const flattened = await new _flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_0__.FlattenedEncrypt(this._plaintext) - .setAdditionalAuthenticatedData(this._aad) - .setProtectedHeader(this._protectedHeader) - .setSharedUnprotectedHeader(this._unprotectedHeader) - .setUnprotectedHeader(recipient.unprotectedHeader) - .encrypt(recipient.key, { ...recipient.options, ...options }); - let jwe = { - ciphertext: flattened.ciphertext, - iv: flattened.iv, - recipients: [{}], - tag: flattened.tag, - }; - if (flattened.aad) - jwe.aad = flattened.aad; - if (flattened.protected) - jwe.protected = flattened.protected; - if (flattened.unprotected) - jwe.unprotected = flattened.unprotected; - if (flattened.encrypted_key) - jwe.recipients[0].encrypted_key = flattened.encrypted_key; - if (flattened.header) - jwe.recipients[0].header = flattened.header; - return jwe; - } - let enc; - for (let i = 0; i < this._recipients.length; i++) { - const recipient = this._recipients[i]; - if (!(0,_lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_3__["default"])(this._protectedHeader, this._unprotectedHeader, recipient.unprotectedHeader)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint'); - } - const joseHeader = { - ...this._protectedHeader, - ...this._unprotectedHeader, - ...recipient.unprotectedHeader, - }; - const { alg } = joseHeader; - if (typeof alg !== 'string' || !alg) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid'); - } - if (alg === 'dir' || alg === 'ECDH-ES') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient'); - } - if (typeof joseHeader.enc !== 'string' || !joseHeader.enc) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid'); - } - if (!enc) { - enc = joseHeader.enc; - } - else if (enc !== joseHeader.enc) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients'); - } - (0,_lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid, new Map(), recipient.options.crit, this._protectedHeader, joseHeader); - if (joseHeader.zip !== undefined) { - if (!this._protectedHeader || !this._protectedHeader.zip) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected'); - } - } - } - const cek = (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_2__["default"])(enc); - let jwe = { - ciphertext: '', - iv: '', - recipients: [], - tag: '', - }; - for (let i = 0; i < this._recipients.length; i++) { - const recipient = this._recipients[i]; - const target = {}; - jwe.recipients.push(target); - const joseHeader = { - ...this._protectedHeader, - ...this._unprotectedHeader, - ...recipient.unprotectedHeader, - }; - const p2c = joseHeader.alg.startsWith('PBES2') ? 2048 + i : undefined; - if (i === 0) { - const flattened = await new _flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_0__.FlattenedEncrypt(this._plaintext) - .setAdditionalAuthenticatedData(this._aad) - .setContentEncryptionKey(cek) - .setProtectedHeader(this._protectedHeader) - .setSharedUnprotectedHeader(this._unprotectedHeader) - .setUnprotectedHeader(recipient.unprotectedHeader) - .setKeyManagementParameters({ p2c }) - .encrypt(recipient.key, { - ...recipient.options, - ...options, - [_flattened_encrypt_js__WEBPACK_IMPORTED_MODULE_0__.unprotected]: true, - }); - jwe.ciphertext = flattened.ciphertext; - jwe.iv = flattened.iv; - jwe.tag = flattened.tag; - if (flattened.aad) - jwe.aad = flattened.aad; - if (flattened.protected) - jwe.protected = flattened.protected; - if (flattened.unprotected) - jwe.unprotected = flattened.unprotected; - target.encrypted_key = flattened.encrypted_key; - if (flattened.header) - target.header = flattened.header; - continue; - } - const { encryptedKey, parameters } = await (0,_lib_encrypt_key_management_js__WEBPACK_IMPORTED_MODULE_4__["default"])(((_a = recipient.unprotectedHeader) === null || _a === void 0 ? void 0 : _a.alg) || - ((_b = this._protectedHeader) === null || _b === void 0 ? void 0 : _b.alg) || - ((_c = this._unprotectedHeader) === null || _c === void 0 ? void 0 : _c.alg), enc, recipient.key, cek, { p2c }); - target.encrypted_key = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_5__.encode)(encryptedKey); - if (recipient.unprotectedHeader || parameters) - target.header = { ...recipient.unprotectedHeader, ...parameters }; - } - return jwe; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwk/embedded.js": -/*!********************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwk/embedded.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ EmbeddedJWK: function() { return /* binding */ EmbeddedJWK; } -/* harmony export */ }); -/* harmony import */ var _key_import_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../key/import.js */ "./node_modules/jose/dist/browser/key/import.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - - - -async function EmbeddedJWK(protectedHeader, token) { - const joseHeader = { - ...protectedHeader, - ...token === null || token === void 0 ? void 0 : token.header, - }; - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_1__["default"])(joseHeader.jwk)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object'); - } - const key = await (0,_key_import_js__WEBPACK_IMPORTED_MODULE_0__.importJWK)({ ...joseHeader.jwk, ext: true }, joseHeader.alg, true); - if (key instanceof Uint8Array || key.type !== 'public') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key'); - } - return key; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwk/thumbprint.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwk/thumbprint.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ calculateJwkThumbprint: function() { return /* binding */ calculateJwkThumbprint; }, -/* harmony export */ calculateJwkThumbprintUri: function() { return /* binding */ calculateJwkThumbprintUri; } -/* harmony export */ }); -/* harmony import */ var _runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/digest.js */ "./node_modules/jose/dist/browser/runtime/digest.js"); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); - - - - - -const check = (value, description) => { - if (typeof value !== 'string' || !value) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWKInvalid(`${description} missing or invalid`); - } -}; -async function calculateJwkThumbprint(jwk, digestAlgorithm) { - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_4__["default"])(jwk)) { - throw new TypeError('JWK must be an object'); - } - digestAlgorithm !== null && digestAlgorithm !== void 0 ? digestAlgorithm : (digestAlgorithm = 'sha256'); - if (digestAlgorithm !== 'sha256' && - digestAlgorithm !== 'sha384' && - digestAlgorithm !== 'sha512') { - throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"'); - } - let components; - switch (jwk.kty) { - case 'EC': - check(jwk.crv, '"crv" (Curve) Parameter'); - check(jwk.x, '"x" (X Coordinate) Parameter'); - check(jwk.y, '"y" (Y Coordinate) Parameter'); - components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y }; - break; - case 'OKP': - check(jwk.crv, '"crv" (Subtype of Key Pair) Parameter'); - check(jwk.x, '"x" (Public Key) Parameter'); - components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x }; - break; - case 'RSA': - check(jwk.e, '"e" (Exponent) Parameter'); - check(jwk.n, '"n" (Modulus) Parameter'); - components = { e: jwk.e, kty: jwk.kty, n: jwk.n }; - break; - case 'oct': - check(jwk.k, '"k" (Key Value) Parameter'); - components = { k: jwk.k, kty: jwk.kty }; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported'); - } - const data = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__.encoder.encode(JSON.stringify(components)); - return (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_1__.encode)(await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])(digestAlgorithm, data)); -} -async function calculateJwkThumbprintUri(jwk, digestAlgorithm) { - digestAlgorithm !== null && digestAlgorithm !== void 0 ? digestAlgorithm : (digestAlgorithm = 'sha256'); - const thumbprint = await calculateJwkThumbprint(jwk, digestAlgorithm); - return `urn:ietf:params:oauth:jwk-thumbprint:sha-${digestAlgorithm.slice(-3)}:${thumbprint}`; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwks/local.js": -/*!******************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwks/local.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ LocalJWKSet: function() { return /* binding */ LocalJWKSet; }, -/* harmony export */ createLocalJWKSet: function() { return /* binding */ createLocalJWKSet; }, -/* harmony export */ isJWKSLike: function() { return /* binding */ isJWKSLike; } -/* harmony export */ }); -/* harmony import */ var _key_import_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../key/import.js */ "./node_modules/jose/dist/browser/key/import.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); - - - -function getKtyFromAlg(alg) { - switch (typeof alg === 'string' && alg.slice(0, 2)) { - case 'RS': - case 'PS': - return 'RSA'; - case 'ES': - return 'EC'; - case 'Ed': - return 'OKP'; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set'); - } -} -function isJWKSLike(jwks) { - return (jwks && - typeof jwks === 'object' && - Array.isArray(jwks.keys) && - jwks.keys.every(isJWKLike)); -} -function isJWKLike(key) { - return (0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__["default"])(key); -} -function clone(obj) { - if (typeof structuredClone === 'function') { - return structuredClone(obj); - } - return JSON.parse(JSON.stringify(obj)); -} -class LocalJWKSet { - constructor(jwks) { - this._cached = new WeakMap(); - if (!isJWKSLike(jwks)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set malformed'); - } - this._jwks = clone(jwks); - } - async getKey(protectedHeader, token) { - const { alg, kid } = { ...protectedHeader, ...token === null || token === void 0 ? void 0 : token.header }; - const kty = getKtyFromAlg(alg); - const candidates = this._jwks.keys.filter((jwk) => { - let candidate = kty === jwk.kty; - if (candidate && typeof kid === 'string') { - candidate = kid === jwk.kid; - } - if (candidate && typeof jwk.alg === 'string') { - candidate = alg === jwk.alg; - } - if (candidate && typeof jwk.use === 'string') { - candidate = jwk.use === 'sig'; - } - if (candidate && Array.isArray(jwk.key_ops)) { - candidate = jwk.key_ops.includes('verify'); - } - if (candidate && alg === 'EdDSA') { - candidate = jwk.crv === 'Ed25519' || jwk.crv === 'Ed448'; - } - if (candidate) { - switch (alg) { - case 'ES256': - candidate = jwk.crv === 'P-256'; - break; - case 'ES256K': - candidate = jwk.crv === 'secp256k1'; - break; - case 'ES384': - candidate = jwk.crv === 'P-384'; - break; - case 'ES512': - candidate = jwk.crv === 'P-521'; - break; - } - } - return candidate; - }); - const { 0: jwk, length } = candidates; - if (length === 0) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey(); - } - else if (length !== 1) { - const error = new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSMultipleMatchingKeys(); - const { _cached } = this; - error[Symbol.asyncIterator] = async function* () { - for (const jwk of candidates) { - try { - yield await importWithAlgCache(_cached, jwk, alg); - } - catch (_a) { - continue; - } - } - }; - throw error; - } - return importWithAlgCache(this._cached, jwk, alg); - } -} -async function importWithAlgCache(cache, jwk, alg) { - const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk); - if (cached[alg] === undefined) { - const key = await (0,_key_import_js__WEBPACK_IMPORTED_MODULE_0__.importJWK)({ ...jwk, ext: true }, alg); - if (key instanceof Uint8Array || key.type !== 'public') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set members must be public keys'); - } - cached[alg] = key; - } - return cached[alg]; -} -function createLocalJWKSet(jwks) { - const set = new LocalJWKSet(jwks); - return async function (protectedHeader, token) { - return set.getKey(protectedHeader, token); - }; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwks/remote.js": -/*!*******************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwks/remote.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ createRemoteJWKSet: function() { return /* binding */ createRemoteJWKSet; } -/* harmony export */ }); -/* harmony import */ var _runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/fetch_jwks.js */ "./node_modules/jose/dist/browser/runtime/fetch_jwks.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _local_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./local.js */ "./node_modules/jose/dist/browser/jwks/local.js"); - - - -function isCloudflareWorkers() { - return (typeof WebSocketPair !== 'undefined' || - (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') || - (typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel')); -} -class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_2__.LocalJWKSet { - constructor(url, options) { - super({ keys: [] }); - this._jwks = undefined; - if (!(url instanceof URL)) { - throw new TypeError('url must be an instance of URL'); - } - this._url = new URL(url.href); - this._options = { agent: options === null || options === void 0 ? void 0 : options.agent, headers: options === null || options === void 0 ? void 0 : options.headers }; - this._timeoutDuration = - typeof (options === null || options === void 0 ? void 0 : options.timeoutDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.timeoutDuration : 5000; - this._cooldownDuration = - typeof (options === null || options === void 0 ? void 0 : options.cooldownDuration) === 'number' ? options === null || options === void 0 ? void 0 : options.cooldownDuration : 30000; - this._cacheMaxAge = typeof (options === null || options === void 0 ? void 0 : options.cacheMaxAge) === 'number' ? options === null || options === void 0 ? void 0 : options.cacheMaxAge : 600000; - } - coolingDown() { - return typeof this._jwksTimestamp === 'number' - ? Date.now() < this._jwksTimestamp + this._cooldownDuration - : false; - } - fresh() { - return typeof this._jwksTimestamp === 'number' - ? Date.now() < this._jwksTimestamp + this._cacheMaxAge - : false; - } - async getKey(protectedHeader, token) { - if (!this._jwks || !this.fresh()) { - await this.reload(); - } - try { - return await super.getKey(protectedHeader, token); - } - catch (err) { - if (err instanceof _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey) { - if (this.coolingDown() === false) { - await this.reload(); - return super.getKey(protectedHeader, token); - } - } - throw err; - } - } - async reload() { - if (this._pendingFetch && isCloudflareWorkers()) { - this._pendingFetch = undefined; - } - this._pendingFetch || (this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options) - .then((json) => { - if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_2__.isJWKSLike)(json)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set malformed'); - } - this._jwks = { keys: json.keys }; - this._jwksTimestamp = Date.now(); - this._pendingFetch = undefined; - }) - .catch((err) => { - this._pendingFetch = undefined; - throw err; - })); - await this._pendingFetch; - } -} -function createRemoteJWKSet(url, options) { - const set = new RemoteJWKSet(url, options); - return async function (protectedHeader, token) { - return set.getKey(protectedHeader, token); - }; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jws/compact/sign.js": -/*!************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jws/compact/sign.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ CompactSign: function() { return /* binding */ CompactSign; } -/* harmony export */ }); -/* harmony import */ var _flattened_sign_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/sign.js */ "./node_modules/jose/dist/browser/jws/flattened/sign.js"); - -class CompactSign { - constructor(payload) { - this._flattened = new _flattened_sign_js__WEBPACK_IMPORTED_MODULE_0__.FlattenedSign(payload); - } - setProtectedHeader(protectedHeader) { - this._flattened.setProtectedHeader(protectedHeader); - return this; - } - async sign(key, options) { - const jws = await this._flattened.sign(key, options); - if (jws.payload === undefined) { - throw new TypeError('use the flattened module for creating JWS with b64: false'); - } - return `${jws.protected}.${jws.payload}.${jws.signature}`; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jws/compact/verify.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jws/compact/verify.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ compactVerify: function() { return /* binding */ compactVerify; } -/* harmony export */ }); -/* harmony import */ var _flattened_verify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/verify.js */ "./node_modules/jose/dist/browser/jws/flattened/verify.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); - - - -async function compactVerify(jws, key, options) { - if (jws instanceof Uint8Array) { - jws = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_2__.decoder.decode(jws); - } - if (typeof jws !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWSInvalid('Compact JWS must be a string or Uint8Array'); - } - const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.'); - if (length !== 3) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWSInvalid('Invalid Compact JWS'); - } - const verified = await (0,_flattened_verify_js__WEBPACK_IMPORTED_MODULE_0__.flattenedVerify)({ payload, protected: protectedHeader, signature }, key, options); - const result = { payload: verified.payload, protectedHeader: verified.protectedHeader }; - if (typeof key === 'function') { - return { ...result, key: verified.key }; - } - return result; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jws/flattened/sign.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jws/flattened/sign.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ FlattenedSign: function() { return /* binding */ FlattenedSign; } -/* harmony export */ }); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _runtime_sign_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../runtime/sign.js */ "./node_modules/jose/dist/browser/runtime/sign.js"); -/* harmony import */ var _lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/is_disjoint.js */ "./node_modules/jose/dist/browser/lib/is_disjoint.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_check_key_type_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../lib/check_key_type.js */ "./node_modules/jose/dist/browser/lib/check_key_type.js"); -/* harmony import */ var _lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../lib/validate_crit.js */ "./node_modules/jose/dist/browser/lib/validate_crit.js"); - - - - - - - -class FlattenedSign { - constructor(payload) { - if (!(payload instanceof Uint8Array)) { - throw new TypeError('payload must be an instance of Uint8Array'); - } - this._payload = payload; - } - setProtectedHeader(protectedHeader) { - if (this._protectedHeader) { - throw new TypeError('setProtectedHeader can only be called once'); - } - this._protectedHeader = protectedHeader; - return this; - } - setUnprotectedHeader(unprotectedHeader) { - if (this._unprotectedHeader) { - throw new TypeError('setUnprotectedHeader can only be called once'); - } - this._unprotectedHeader = unprotectedHeader; - return this; - } - async sign(key, options) { - if (!this._protectedHeader && !this._unprotectedHeader) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWSInvalid('either setProtectedHeader or setUnprotectedHeader must be called before #sign()'); - } - if (!(0,_lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_2__["default"])(this._protectedHeader, this._unprotectedHeader)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint'); - } - const joseHeader = { - ...this._protectedHeader, - ...this._unprotectedHeader, - }; - const extensions = (0,_lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_6__["default"])(_util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWSInvalid, new Map([['b64', true]]), options === null || options === void 0 ? void 0 : options.crit, this._protectedHeader, joseHeader); - let b64 = true; - if (extensions.has('b64')) { - b64 = this._protectedHeader.b64; - if (typeof b64 !== 'boolean') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean'); - } - } - const { alg } = joseHeader; - if (typeof alg !== 'string' || !alg) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid'); - } - (0,_lib_check_key_type_js__WEBPACK_IMPORTED_MODULE_5__["default"])(alg, key, 'sign'); - let payload = this._payload; - if (b64) { - payload = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__.encoder.encode((0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(payload)); - } - let protectedHeader; - if (this._protectedHeader) { - protectedHeader = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__.encoder.encode((0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(JSON.stringify(this._protectedHeader))); - } - else { - protectedHeader = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__.encoder.encode(''); - } - const data = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__.concat)(protectedHeader, _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__.encoder.encode('.'), payload); - const signature = await (0,_runtime_sign_js__WEBPACK_IMPORTED_MODULE_1__["default"])(alg, key, data); - const jws = { - signature: (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode)(signature), - payload: '', - }; - if (b64) { - jws.payload = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__.decoder.decode(payload); - } - if (this._unprotectedHeader) { - jws.header = this._unprotectedHeader; - } - if (this._protectedHeader) { - jws.protected = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_4__.decoder.decode(protectedHeader); - } - return jws; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jws/flattened/verify.js": -/*!****************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jws/flattened/verify.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ flattenedVerify: function() { return /* binding */ flattenedVerify; } -/* harmony export */ }); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _runtime_verify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../runtime/verify.js */ "./node_modules/jose/dist/browser/runtime/verify.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../lib/is_disjoint.js */ "./node_modules/jose/dist/browser/lib/is_disjoint.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); -/* harmony import */ var _lib_check_key_type_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../lib/check_key_type.js */ "./node_modules/jose/dist/browser/lib/check_key_type.js"); -/* harmony import */ var _lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../lib/validate_crit.js */ "./node_modules/jose/dist/browser/lib/validate_crit.js"); -/* harmony import */ var _lib_validate_algorithms_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../lib/validate_algorithms.js */ "./node_modules/jose/dist/browser/lib/validate_algorithms.js"); - - - - - - - - - -async function flattenedVerify(jws, key, options) { - var _a; - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__["default"])(jws)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('Flattened JWS must be an object'); - } - if (jws.protected === undefined && jws.header === undefined) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members'); - } - if (jws.protected !== undefined && typeof jws.protected !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Protected Header incorrect type'); - } - if (jws.payload === undefined) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Payload missing'); - } - if (typeof jws.signature !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Signature missing or incorrect type'); - } - if (jws.header !== undefined && !(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_5__["default"])(jws.header)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Unprotected Header incorrect type'); - } - let parsedProt = {}; - if (jws.protected) { - try { - const protectedHeader = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jws.protected); - parsedProt = JSON.parse(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__.decoder.decode(protectedHeader)); - } - catch (_b) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Protected Header is invalid'); - } - } - if (!(0,_lib_is_disjoint_js__WEBPACK_IMPORTED_MODULE_4__["default"])(parsedProt, jws.header)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Protected and JWS Unprotected Header Parameter names must be disjoint'); - } - const joseHeader = { - ...parsedProt, - ...jws.header, - }; - const extensions = (0,_lib_validate_crit_js__WEBPACK_IMPORTED_MODULE_7__["default"])(_util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid, new Map([['b64', true]]), options === null || options === void 0 ? void 0 : options.crit, parsedProt, joseHeader); - let b64 = true; - if (extensions.has('b64')) { - b64 = parsedProt.b64; - if (typeof b64 !== 'boolean') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean'); - } - } - const { alg } = joseHeader; - if (typeof alg !== 'string' || !alg) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid'); - } - const algorithms = options && (0,_lib_validate_algorithms_js__WEBPACK_IMPORTED_MODULE_8__["default"])('algorithms', options.algorithms); - if (algorithms && !algorithms.has(alg)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed'); - } - if (b64) { - if (typeof jws.payload !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Payload must be a string'); - } - } - else if (typeof jws.payload !== 'string' && !(jws.payload instanceof Uint8Array)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('JWS Payload must be a string or an Uint8Array instance'); - } - let resolvedKey = false; - if (typeof key === 'function') { - key = await key(parsedProt, jws); - resolvedKey = true; - } - (0,_lib_check_key_type_js__WEBPACK_IMPORTED_MODULE_6__["default"])(alg, key, 'verify'); - const data = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__.concat)(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__.encoder.encode((_a = jws.protected) !== null && _a !== void 0 ? _a : ''), _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__.encoder.encode('.'), typeof jws.payload === 'string' ? _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__.encoder.encode(jws.payload) : jws.payload); - let signature; - try { - signature = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jws.signature); - } - catch (_c) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('Failed to base64url decode the signature'); - } - const verified = await (0,_runtime_verify_js__WEBPACK_IMPORTED_MODULE_1__["default"])(alg, key, signature, data); - if (!verified) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSSignatureVerificationFailed(); - } - let payload; - if (b64) { - try { - payload = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jws.payload); - } - catch (_d) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWSInvalid('Failed to base64url decode the payload'); - } - } - else if (typeof jws.payload === 'string') { - payload = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_3__.encoder.encode(jws.payload); - } - else { - payload = jws.payload; - } - const result = { payload }; - if (jws.protected !== undefined) { - result.protectedHeader = parsedProt; - } - if (jws.header !== undefined) { - result.unprotectedHeader = jws.header; - } - if (resolvedKey) { - return { ...result, key }; - } - return result; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jws/general/sign.js": -/*!************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jws/general/sign.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ GeneralSign: function() { return /* binding */ GeneralSign; } -/* harmony export */ }); -/* harmony import */ var _flattened_sign_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/sign.js */ "./node_modules/jose/dist/browser/jws/flattened/sign.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - - -class IndividualSignature { - constructor(sig, key, options) { - this.parent = sig; - this.key = key; - this.options = options; - } - setProtectedHeader(protectedHeader) { - if (this.protectedHeader) { - throw new TypeError('setProtectedHeader can only be called once'); - } - this.protectedHeader = protectedHeader; - return this; - } - setUnprotectedHeader(unprotectedHeader) { - if (this.unprotectedHeader) { - throw new TypeError('setUnprotectedHeader can only be called once'); - } - this.unprotectedHeader = unprotectedHeader; - return this; - } - addSignature(...args) { - return this.parent.addSignature(...args); - } - sign(...args) { - return this.parent.sign(...args); - } - done() { - return this.parent; - } -} -class GeneralSign { - constructor(payload) { - this._signatures = []; - this._payload = payload; - } - addSignature(key, options) { - const signature = new IndividualSignature(this, key, options); - this._signatures.push(signature); - return signature; - } - async sign() { - if (!this._signatures.length) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWSInvalid('at least one signature must be added'); - } - const jws = { - signatures: [], - payload: '', - }; - for (let i = 0; i < this._signatures.length; i++) { - const signature = this._signatures[i]; - const flattened = new _flattened_sign_js__WEBPACK_IMPORTED_MODULE_0__.FlattenedSign(this._payload); - flattened.setProtectedHeader(signature.protectedHeader); - flattened.setUnprotectedHeader(signature.unprotectedHeader); - const { payload, ...rest } = await flattened.sign(signature.key, signature.options); - if (i === 0) { - jws.payload = payload; - } - else if (jws.payload !== payload) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWSInvalid('inconsistent use of JWS Unencoded Payload (RFC7797)'); - } - jws.signatures.push(rest); - } - return jws; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jws/general/verify.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/jws/general/verify.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ generalVerify: function() { return /* binding */ generalVerify; } -/* harmony export */ }); -/* harmony import */ var _flattened_verify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../flattened/verify.js */ "./node_modules/jose/dist/browser/jws/flattened/verify.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); - - - -async function generalVerify(jws, key, options) { - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__["default"])(jws)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWSInvalid('General JWS must be an object'); - } - if (!Array.isArray(jws.signatures) || !jws.signatures.every(_lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__["default"])) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWSInvalid('JWS Signatures missing or incorrect type'); - } - for (const signature of jws.signatures) { - try { - return await (0,_flattened_verify_js__WEBPACK_IMPORTED_MODULE_0__.flattenedVerify)({ - header: signature.header, - payload: jws.payload, - protected: signature.protected, - signature: signature.signature, - }, key, options); - } - catch (_a) { - } - } - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWSSignatureVerificationFailed(); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwt/decrypt.js": -/*!*******************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwt/decrypt.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ jwtDecrypt: function() { return /* binding */ jwtDecrypt; } -/* harmony export */ }); -/* harmony import */ var _jwe_compact_decrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../jwe/compact/decrypt.js */ "./node_modules/jose/dist/browser/jwe/compact/decrypt.js"); -/* harmony import */ var _lib_jwt_claims_set_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/jwt_claims_set.js */ "./node_modules/jose/dist/browser/lib/jwt_claims_set.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - - - -async function jwtDecrypt(jwt, key, options) { - const decrypted = await (0,_jwe_compact_decrypt_js__WEBPACK_IMPORTED_MODULE_0__.compactDecrypt)(jwt, key, options); - const payload = (0,_lib_jwt_claims_set_js__WEBPACK_IMPORTED_MODULE_1__["default"])(decrypted.protectedHeader, decrypted.plaintext, options); - const { protectedHeader } = decrypted; - if (protectedHeader.iss !== undefined && protectedHeader.iss !== payload.iss) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch', 'iss', 'mismatch'); - } - if (protectedHeader.sub !== undefined && protectedHeader.sub !== payload.sub) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch', 'sub', 'mismatch'); - } - if (protectedHeader.aud !== undefined && - JSON.stringify(protectedHeader.aud) !== JSON.stringify(payload.aud)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch', 'aud', 'mismatch'); - } - const result = { payload, protectedHeader }; - if (typeof key === 'function') { - return { ...result, key: decrypted.key }; - } - return result; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwt/encrypt.js": -/*!*******************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwt/encrypt.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ EncryptJWT: function() { return /* binding */ EncryptJWT; } -/* harmony export */ }); -/* harmony import */ var _jwe_compact_encrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../jwe/compact/encrypt.js */ "./node_modules/jose/dist/browser/jwe/compact/encrypt.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _produce_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./produce.js */ "./node_modules/jose/dist/browser/jwt/produce.js"); - - - -class EncryptJWT extends _produce_js__WEBPACK_IMPORTED_MODULE_2__.ProduceJWT { - setProtectedHeader(protectedHeader) { - if (this._protectedHeader) { - throw new TypeError('setProtectedHeader can only be called once'); - } - this._protectedHeader = protectedHeader; - return this; - } - setKeyManagementParameters(parameters) { - if (this._keyManagementParameters) { - throw new TypeError('setKeyManagementParameters can only be called once'); - } - this._keyManagementParameters = parameters; - return this; - } - setContentEncryptionKey(cek) { - if (this._cek) { - throw new TypeError('setContentEncryptionKey can only be called once'); - } - this._cek = cek; - return this; - } - setInitializationVector(iv) { - if (this._iv) { - throw new TypeError('setInitializationVector can only be called once'); - } - this._iv = iv; - return this; - } - replicateIssuerAsHeader() { - this._replicateIssuerAsHeader = true; - return this; - } - replicateSubjectAsHeader() { - this._replicateSubjectAsHeader = true; - return this; - } - replicateAudienceAsHeader() { - this._replicateAudienceAsHeader = true; - return this; - } - async encrypt(key, options) { - const enc = new _jwe_compact_encrypt_js__WEBPACK_IMPORTED_MODULE_0__.CompactEncrypt(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__.encoder.encode(JSON.stringify(this._payload))); - if (this._replicateIssuerAsHeader) { - this._protectedHeader = { ...this._protectedHeader, iss: this._payload.iss }; - } - if (this._replicateSubjectAsHeader) { - this._protectedHeader = { ...this._protectedHeader, sub: this._payload.sub }; - } - if (this._replicateAudienceAsHeader) { - this._protectedHeader = { ...this._protectedHeader, aud: this._payload.aud }; - } - enc.setProtectedHeader(this._protectedHeader); - if (this._iv) { - enc.setInitializationVector(this._iv); - } - if (this._cek) { - enc.setContentEncryptionKey(this._cek); - } - if (this._keyManagementParameters) { - enc.setKeyManagementParameters(this._keyManagementParameters); - } - return enc.encrypt(key, options); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwt/produce.js": -/*!*******************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwt/produce.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ ProduceJWT: function() { return /* binding */ ProduceJWT; } -/* harmony export */ }); -/* harmony import */ var _lib_epoch_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/epoch.js */ "./node_modules/jose/dist/browser/lib/epoch.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); -/* harmony import */ var _lib_secs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/secs.js */ "./node_modules/jose/dist/browser/lib/secs.js"); - - - -class ProduceJWT { - constructor(payload) { - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_1__["default"])(payload)) { - throw new TypeError('JWT Claims Set MUST be an object'); - } - this._payload = payload; - } - setIssuer(issuer) { - this._payload = { ...this._payload, iss: issuer }; - return this; - } - setSubject(subject) { - this._payload = { ...this._payload, sub: subject }; - return this; - } - setAudience(audience) { - this._payload = { ...this._payload, aud: audience }; - return this; - } - setJti(jwtId) { - this._payload = { ...this._payload, jti: jwtId }; - return this; - } - setNotBefore(input) { - if (typeof input === 'number') { - this._payload = { ...this._payload, nbf: input }; - } - else { - this._payload = { ...this._payload, nbf: (0,_lib_epoch_js__WEBPACK_IMPORTED_MODULE_0__["default"])(new Date()) + (0,_lib_secs_js__WEBPACK_IMPORTED_MODULE_2__["default"])(input) }; - } - return this; - } - setExpirationTime(input) { - if (typeof input === 'number') { - this._payload = { ...this._payload, exp: input }; - } - else { - this._payload = { ...this._payload, exp: (0,_lib_epoch_js__WEBPACK_IMPORTED_MODULE_0__["default"])(new Date()) + (0,_lib_secs_js__WEBPACK_IMPORTED_MODULE_2__["default"])(input) }; - } - return this; - } - setIssuedAt(input) { - if (typeof input === 'undefined') { - this._payload = { ...this._payload, iat: (0,_lib_epoch_js__WEBPACK_IMPORTED_MODULE_0__["default"])(new Date()) }; - } - else { - this._payload = { ...this._payload, iat: input }; - } - return this; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwt/sign.js": -/*!****************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwt/sign.js ***! - \****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ SignJWT: function() { return /* binding */ SignJWT; } -/* harmony export */ }); -/* harmony import */ var _jws_compact_sign_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../jws/compact/sign.js */ "./node_modules/jose/dist/browser/jws/compact/sign.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _produce_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./produce.js */ "./node_modules/jose/dist/browser/jwt/produce.js"); - - - - -class SignJWT extends _produce_js__WEBPACK_IMPORTED_MODULE_3__.ProduceJWT { - setProtectedHeader(protectedHeader) { - this._protectedHeader = protectedHeader; - return this; - } - async sign(key, options) { - var _a; - const sig = new _jws_compact_sign_js__WEBPACK_IMPORTED_MODULE_0__.CompactSign(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_2__.encoder.encode(JSON.stringify(this._payload))); - sig.setProtectedHeader(this._protectedHeader); - if (Array.isArray((_a = this._protectedHeader) === null || _a === void 0 ? void 0 : _a.crit) && - this._protectedHeader.crit.includes('b64') && - this._protectedHeader.b64 === false) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWTInvalid('JWTs MUST NOT use unencoded payload'); - } - return sig.sign(key, options); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwt/unsecured.js": -/*!*********************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwt/unsecured.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ UnsecuredJWT: function() { return /* binding */ UnsecuredJWT; } -/* harmony export */ }); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_jwt_claims_set_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/jwt_claims_set.js */ "./node_modules/jose/dist/browser/lib/jwt_claims_set.js"); -/* harmony import */ var _produce_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./produce.js */ "./node_modules/jose/dist/browser/jwt/produce.js"); - - - - - -class UnsecuredJWT extends _produce_js__WEBPACK_IMPORTED_MODULE_4__.ProduceJWT { - encode() { - const header = _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode(JSON.stringify({ alg: 'none' })); - const payload = _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode(JSON.stringify(this._payload)); - return `${header}.${payload}.`; - } - static decode(jwt, options) { - if (typeof jwt !== 'string') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWTInvalid('Unsecured JWT must be a string'); - } - const { 0: encodedHeader, 1: encodedPayload, 2: signature, length } = jwt.split('.'); - if (length !== 3 || signature !== '') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWTInvalid('Invalid Unsecured JWT'); - } - let header; - try { - header = JSON.parse(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__.decoder.decode(_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode(encodedHeader))); - if (header.alg !== 'none') - throw new Error(); - } - catch (_a) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWTInvalid('Invalid Unsecured JWT'); - } - const payload = (0,_lib_jwt_claims_set_js__WEBPACK_IMPORTED_MODULE_3__["default"])(header, _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode(encodedPayload), options); - return { payload, header }; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/jwt/verify.js": -/*!******************************************************!*\ - !*** ./node_modules/jose/dist/browser/jwt/verify.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ jwtVerify: function() { return /* binding */ jwtVerify; } -/* harmony export */ }); -/* harmony import */ var _jws_compact_verify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../jws/compact/verify.js */ "./node_modules/jose/dist/browser/jws/compact/verify.js"); -/* harmony import */ var _lib_jwt_claims_set_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/jwt_claims_set.js */ "./node_modules/jose/dist/browser/lib/jwt_claims_set.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - - - -async function jwtVerify(jwt, key, options) { - var _a; - const verified = await (0,_jws_compact_verify_js__WEBPACK_IMPORTED_MODULE_0__.compactVerify)(jwt, key, options); - if (((_a = verified.protectedHeader.crit) === null || _a === void 0 ? void 0 : _a.includes('b64')) && verified.protectedHeader.b64 === false) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWTInvalid('JWTs MUST NOT use unencoded payload'); - } - const payload = (0,_lib_jwt_claims_set_js__WEBPACK_IMPORTED_MODULE_1__["default"])(verified.protectedHeader, verified.payload, options); - const result = { payload, protectedHeader: verified.protectedHeader }; - if (typeof key === 'function') { - return { ...result, key: verified.key }; - } - return result; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/key/export.js": -/*!******************************************************!*\ - !*** ./node_modules/jose/dist/browser/key/export.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ exportJWK: function() { return /* binding */ exportJWK; }, -/* harmony export */ exportPKCS8: function() { return /* binding */ exportPKCS8; }, -/* harmony export */ exportSPKI: function() { return /* binding */ exportSPKI; } -/* harmony export */ }); -/* harmony import */ var _runtime_asn1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/asn1.js */ "./node_modules/jose/dist/browser/runtime/asn1.js"); -/* harmony import */ var _runtime_key_to_jwk_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/key_to_jwk.js */ "./node_modules/jose/dist/browser/runtime/key_to_jwk.js"); - - - -async function exportSPKI(key) { - return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_0__.toSPKI)(key); -} -async function exportPKCS8(key) { - return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_0__.toPKCS8)(key); -} -async function exportJWK(key) { - return (0,_runtime_key_to_jwk_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/key/generate_key_pair.js": -/*!*****************************************************************!*\ - !*** ./node_modules/jose/dist/browser/key/generate_key_pair.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ generateKeyPair: function() { return /* binding */ generateKeyPair; } -/* harmony export */ }); -/* harmony import */ var _runtime_generate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/generate.js */ "./node_modules/jose/dist/browser/runtime/generate.js"); - -async function generateKeyPair(alg, options) { - return (0,_runtime_generate_js__WEBPACK_IMPORTED_MODULE_0__.generateKeyPair)(alg, options); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/key/generate_secret.js": -/*!***************************************************************!*\ - !*** ./node_modules/jose/dist/browser/key/generate_secret.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ generateSecret: function() { return /* binding */ generateSecret; } -/* harmony export */ }); -/* harmony import */ var _runtime_generate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/generate.js */ "./node_modules/jose/dist/browser/runtime/generate.js"); - -async function generateSecret(alg, options) { - return (0,_runtime_generate_js__WEBPACK_IMPORTED_MODULE_0__.generateSecret)(alg, options); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/key/import.js": -/*!******************************************************!*\ - !*** ./node_modules/jose/dist/browser/key/import.js ***! - \******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ importJWK: function() { return /* binding */ importJWK; }, -/* harmony export */ importPKCS8: function() { return /* binding */ importPKCS8; }, -/* harmony export */ importSPKI: function() { return /* binding */ importSPKI; }, -/* harmony export */ importX509: function() { return /* binding */ importX509; } -/* harmony export */ }); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/asn1.js */ "./node_modules/jose/dist/browser/runtime/asn1.js"); -/* harmony import */ var _runtime_jwk_to_key_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../runtime/jwk_to_key.js */ "./node_modules/jose/dist/browser/runtime/jwk_to_key.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); - - - - - -async function importSPKI(spki, alg, options) { - if (typeof spki !== 'string' || spki.indexOf('-----BEGIN PUBLIC KEY-----') !== 0) { - throw new TypeError('"spki" must be SPKI formatted string'); - } - return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__.fromSPKI)(spki, alg, options); -} -async function importX509(x509, alg, options) { - if (typeof x509 !== 'string' || x509.indexOf('-----BEGIN CERTIFICATE-----') !== 0) { - throw new TypeError('"x509" must be X.509 formatted string'); - } - return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__.fromX509)(x509, alg, options); -} -async function importPKCS8(pkcs8, alg, options) { - if (typeof pkcs8 !== 'string' || pkcs8.indexOf('-----BEGIN PRIVATE KEY-----') !== 0) { - throw new TypeError('"pkcs8" must be PKCS#8 formatted string'); - } - return (0,_runtime_asn1_js__WEBPACK_IMPORTED_MODULE_1__.fromPKCS8)(pkcs8, alg, options); -} -async function importJWK(jwk, alg, octAsKeyObject) { - var _a; - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_4__["default"])(jwk)) { - throw new TypeError('JWK must be an object'); - } - alg || (alg = jwk.alg); - switch (jwk.kty) { - case 'oct': - if (typeof jwk.k !== 'string' || !jwk.k) { - throw new TypeError('missing "k" (Key Value) Parameter value'); - } - octAsKeyObject !== null && octAsKeyObject !== void 0 ? octAsKeyObject : (octAsKeyObject = jwk.ext !== true); - if (octAsKeyObject) { - return (0,_runtime_jwk_to_key_js__WEBPACK_IMPORTED_MODULE_2__["default"])({ ...jwk, alg, ext: (_a = jwk.ext) !== null && _a !== void 0 ? _a : false }); - } - return (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(jwk.k); - case 'RSA': - if (jwk.oth !== undefined) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported'); - } - case 'EC': - case 'OKP': - return (0,_runtime_jwk_to_key_js__WEBPACK_IMPORTED_MODULE_2__["default"])({ ...jwk, alg }); - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_3__.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value'); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/aesgcmkw.js": -/*!********************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/aesgcmkw.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ unwrap: function() { return /* binding */ unwrap; }, -/* harmony export */ wrap: function() { return /* binding */ wrap; } -/* harmony export */ }); -/* harmony import */ var _runtime_encrypt_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/encrypt.js */ "./node_modules/jose/dist/browser/runtime/encrypt.js"); -/* harmony import */ var _runtime_decrypt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/decrypt.js */ "./node_modules/jose/dist/browser/runtime/decrypt.js"); -/* harmony import */ var _iv_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./iv.js */ "./node_modules/jose/dist/browser/lib/iv.js"); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); - - - - -async function wrap(alg, key, cek, iv) { - const jweAlgorithm = alg.slice(0, 7); - iv || (iv = (0,_iv_js__WEBPACK_IMPORTED_MODULE_2__["default"])(jweAlgorithm)); - const { ciphertext: encryptedKey, tag } = await (0,_runtime_encrypt_js__WEBPACK_IMPORTED_MODULE_0__["default"])(jweAlgorithm, cek, key, iv, new Uint8Array(0)); - return { encryptedKey, iv: (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_3__.encode)(iv), tag: (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_3__.encode)(tag) }; -} -async function unwrap(alg, key, encryptedKey, iv, tag) { - const jweAlgorithm = alg.slice(0, 7); - return (0,_runtime_decrypt_js__WEBPACK_IMPORTED_MODULE_1__["default"])(jweAlgorithm, key, encryptedKey, iv, tag, new Uint8Array(0)); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/buffer_utils.js": -/*!************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/buffer_utils.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ concat: function() { return /* binding */ concat; }, -/* harmony export */ concatKdf: function() { return /* binding */ concatKdf; }, -/* harmony export */ decoder: function() { return /* binding */ decoder; }, -/* harmony export */ encoder: function() { return /* binding */ encoder; }, -/* harmony export */ lengthAndInput: function() { return /* binding */ lengthAndInput; }, -/* harmony export */ p2s: function() { return /* binding */ p2s; }, -/* harmony export */ uint32be: function() { return /* binding */ uint32be; }, -/* harmony export */ uint64be: function() { return /* binding */ uint64be; } -/* harmony export */ }); -/* harmony import */ var _runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/digest.js */ "./node_modules/jose/dist/browser/runtime/digest.js"); - -const encoder = new TextEncoder(); -const decoder = new TextDecoder(); -const MAX_INT32 = 2 ** 32; -function concat(...buffers) { - const size = buffers.reduce((acc, { length }) => acc + length, 0); - const buf = new Uint8Array(size); - let i = 0; - buffers.forEach((buffer) => { - buf.set(buffer, i); - i += buffer.length; - }); - return buf; -} -function p2s(alg, p2sInput) { - return concat(encoder.encode(alg), new Uint8Array([0]), p2sInput); -} -function writeUInt32BE(buf, value, offset) { - if (value < 0 || value >= MAX_INT32) { - throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`); - } - buf.set([value >>> 24, value >>> 16, value >>> 8, value & 0xff], offset); -} -function uint64be(value) { - const high = Math.floor(value / MAX_INT32); - const low = value % MAX_INT32; - const buf = new Uint8Array(8); - writeUInt32BE(buf, high, 0); - writeUInt32BE(buf, low, 4); - return buf; -} -function uint32be(value) { - const buf = new Uint8Array(4); - writeUInt32BE(buf, value); - return buf; -} -function lengthAndInput(input) { - return concat(uint32be(input.length), input); -} -async function concatKdf(secret, bits, value) { - const iterations = Math.ceil((bits >> 3) / 32); - const res = new Uint8Array(iterations * 32); - for (let iter = 0; iter < iterations; iter++) { - const buf = new Uint8Array(4 + secret.length + value.length); - buf.set(uint32be(iter + 1)); - buf.set(secret, 4); - buf.set(value, 4 + secret.length); - res.set(await (0,_runtime_digest_js__WEBPACK_IMPORTED_MODULE_0__["default"])('sha256', buf), iter * 32); - } - return res.slice(0, bits >> 3); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/cek.js": -/*!***************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/cek.js ***! - \***************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ bitLength: function() { return /* binding */ bitLength; } -/* harmony export */ }); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _runtime_random_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/random.js */ "./node_modules/jose/dist/browser/runtime/random.js"); - - -function bitLength(alg) { - switch (alg) { - case 'A128GCM': - return 128; - case 'A192GCM': - return 192; - case 'A256GCM': - case 'A128CBC-HS256': - return 256; - case 'A192CBC-HS384': - return 384; - case 'A256CBC-HS512': - return 512; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`); - } -} -/* harmony default export */ __webpack_exports__["default"] = ((alg) => (0,_runtime_random_js__WEBPACK_IMPORTED_MODULE_1__["default"])(new Uint8Array(bitLength(alg) >> 3))); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/check_iv_length.js": -/*!***************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/check_iv_length.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _iv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iv.js */ "./node_modules/jose/dist/browser/lib/iv.js"); - - -const checkIvLength = (enc, iv) => { - if (iv.length << 3 !== (0,_iv_js__WEBPACK_IMPORTED_MODULE_1__.bitLength)(enc)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWEInvalid('Invalid Initialization Vector length'); - } -}; -/* harmony default export */ __webpack_exports__["default"] = (checkIvLength); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/check_key_type.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/check_key_type.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _invalid_key_input_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - -const symmetricTypeCheck = (alg, key) => { - if (key instanceof Uint8Array) - return; - if (!(0,_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key)) { - throw new TypeError((0,_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_0__.withAlg)(alg, key, ..._runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types, 'Uint8Array')); - } - if (key.type !== 'secret') { - throw new TypeError(`${_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types.join(' or ')} instances for symmetric algorithms must be of type "secret"`); - } -}; -const asymmetricTypeCheck = (alg, key, usage) => { - if (!(0,_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key)) { - throw new TypeError((0,_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_0__.withAlg)(alg, key, ..._runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types)); - } - if (key.type === 'secret') { - throw new TypeError(`${_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types.join(' or ')} instances for asymmetric algorithms must not be of type "secret"`); - } - if (usage === 'sign' && key.type === 'public') { - throw new TypeError(`${_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types.join(' or ')} instances for asymmetric algorithm signing must be of type "private"`); - } - if (usage === 'decrypt' && key.type === 'public') { - throw new TypeError(`${_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types.join(' or ')} instances for asymmetric algorithm decryption must be of type "private"`); - } - if (key.algorithm && usage === 'verify' && key.type === 'private') { - throw new TypeError(`${_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types.join(' or ')} instances for asymmetric algorithm verifying must be of type "public"`); - } - if (key.algorithm && usage === 'encrypt' && key.type === 'private') { - throw new TypeError(`${_runtime_is_key_like_js__WEBPACK_IMPORTED_MODULE_1__.types.join(' or ')} instances for asymmetric algorithm encryption must be of type "public"`); - } -}; -const checkKeyType = (alg, key, usage) => { - const symmetric = alg.startsWith('HS') || - alg === 'dir' || - alg.startsWith('PBES2') || - /^A\d{3}(?:GCM)?KW$/.test(alg); - if (symmetric) { - symmetricTypeCheck(alg, key); - } - else { - asymmetricTypeCheck(alg, key, usage); - } -}; -/* harmony default export */ __webpack_exports__["default"] = (checkKeyType); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/check_p2s.js": -/*!*********************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/check_p2s.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ checkP2s; } -/* harmony export */ }); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - -function checkP2s(p2s) { - if (!(p2s instanceof Uint8Array) || p2s.length < 8) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWEInvalid('PBES2 Salt Input must be 8 or more octets'); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/crypto_key.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/crypto_key.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ checkEncCryptoKey: function() { return /* binding */ checkEncCryptoKey; }, -/* harmony export */ checkSigCryptoKey: function() { return /* binding */ checkSigCryptoKey; } -/* harmony export */ }); -function unusable(name, prop = 'algorithm.name') { - return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`); -} -function isAlgorithm(algorithm, name) { - return algorithm.name === name; -} -function getHashLength(hash) { - return parseInt(hash.name.slice(4), 10); -} -function getNamedCurve(alg) { - switch (alg) { - case 'ES256': - return 'P-256'; - case 'ES384': - return 'P-384'; - case 'ES512': - return 'P-521'; - default: - throw new Error('unreachable'); - } -} -function checkUsage(key, usages) { - if (usages.length && !usages.some((expected) => key.usages.includes(expected))) { - let msg = 'CryptoKey does not support this operation, its usages must include '; - if (usages.length > 2) { - const last = usages.pop(); - msg += `one of ${usages.join(', ')}, or ${last}.`; - } - else if (usages.length === 2) { - msg += `one of ${usages[0]} or ${usages[1]}.`; - } - else { - msg += `${usages[0]}.`; - } - throw new TypeError(msg); - } -} -function checkSigCryptoKey(key, alg, ...usages) { - switch (alg) { - case 'HS256': - case 'HS384': - case 'HS512': { - if (!isAlgorithm(key.algorithm, 'HMAC')) - throw unusable('HMAC'); - const expected = parseInt(alg.slice(2), 10); - const actual = getHashLength(key.algorithm.hash); - if (actual !== expected) - throw unusable(`SHA-${expected}`, 'algorithm.hash'); - break; - } - case 'RS256': - case 'RS384': - case 'RS512': { - if (!isAlgorithm(key.algorithm, 'RSASSA-PKCS1-v1_5')) - throw unusable('RSASSA-PKCS1-v1_5'); - const expected = parseInt(alg.slice(2), 10); - const actual = getHashLength(key.algorithm.hash); - if (actual !== expected) - throw unusable(`SHA-${expected}`, 'algorithm.hash'); - break; - } - case 'PS256': - case 'PS384': - case 'PS512': { - if (!isAlgorithm(key.algorithm, 'RSA-PSS')) - throw unusable('RSA-PSS'); - const expected = parseInt(alg.slice(2), 10); - const actual = getHashLength(key.algorithm.hash); - if (actual !== expected) - throw unusable(`SHA-${expected}`, 'algorithm.hash'); - break; - } - case 'EdDSA': { - if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') { - throw unusable('Ed25519 or Ed448'); - } - break; - } - case 'ES256': - case 'ES384': - case 'ES512': { - if (!isAlgorithm(key.algorithm, 'ECDSA')) - throw unusable('ECDSA'); - const expected = getNamedCurve(alg); - const actual = key.algorithm.namedCurve; - if (actual !== expected) - throw unusable(expected, 'algorithm.namedCurve'); - break; - } - default: - throw new TypeError('CryptoKey does not support this operation'); - } - checkUsage(key, usages); -} -function checkEncCryptoKey(key, alg, ...usages) { - switch (alg) { - case 'A128GCM': - case 'A192GCM': - case 'A256GCM': { - if (!isAlgorithm(key.algorithm, 'AES-GCM')) - throw unusable('AES-GCM'); - const expected = parseInt(alg.slice(1, 4), 10); - const actual = key.algorithm.length; - if (actual !== expected) - throw unusable(expected, 'algorithm.length'); - break; - } - case 'A128KW': - case 'A192KW': - case 'A256KW': { - if (!isAlgorithm(key.algorithm, 'AES-KW')) - throw unusable('AES-KW'); - const expected = parseInt(alg.slice(1, 4), 10); - const actual = key.algorithm.length; - if (actual !== expected) - throw unusable(expected, 'algorithm.length'); - break; - } - case 'ECDH': { - switch (key.algorithm.name) { - case 'ECDH': - case 'X25519': - case 'X448': - break; - default: - throw unusable('ECDH, X25519, or X448'); - } - break; - } - case 'PBES2-HS256+A128KW': - case 'PBES2-HS384+A192KW': - case 'PBES2-HS512+A256KW': - if (!isAlgorithm(key.algorithm, 'PBKDF2')) - throw unusable('PBKDF2'); - break; - case 'RSA-OAEP': - case 'RSA-OAEP-256': - case 'RSA-OAEP-384': - case 'RSA-OAEP-512': { - if (!isAlgorithm(key.algorithm, 'RSA-OAEP')) - throw unusable('RSA-OAEP'); - const expected = parseInt(alg.slice(9), 10) || 1; - const actual = getHashLength(key.algorithm.hash); - if (actual !== expected) - throw unusable(`SHA-${expected}`, 'algorithm.hash'); - break; - } - default: - throw new TypeError('CryptoKey does not support this operation'); - } - checkUsage(key, usages); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/decrypt_key_management.js": -/*!**********************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/decrypt_key_management.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _runtime_aeskw_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/aeskw.js */ "./node_modules/jose/dist/browser/runtime/aeskw.js"); -/* harmony import */ var _runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/ecdhes.js */ "./node_modules/jose/dist/browser/runtime/ecdhes.js"); -/* harmony import */ var _runtime_pbes2kw_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../runtime/pbes2kw.js */ "./node_modules/jose/dist/browser/runtime/pbes2kw.js"); -/* harmony import */ var _runtime_rsaes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../runtime/rsaes.js */ "./node_modules/jose/dist/browser/runtime/rsaes.js"); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _lib_cek_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib/cek.js */ "./node_modules/jose/dist/browser/lib/cek.js"); -/* harmony import */ var _key_import_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../key/import.js */ "./node_modules/jose/dist/browser/key/import.js"); -/* harmony import */ var _check_key_type_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./check_key_type.js */ "./node_modules/jose/dist/browser/lib/check_key_type.js"); -/* harmony import */ var _is_object_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); -/* harmony import */ var _aesgcmkw_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./aesgcmkw.js */ "./node_modules/jose/dist/browser/lib/aesgcmkw.js"); - - - - - - - - - - - -async function decryptKeyManagement(alg, key, encryptedKey, joseHeader, options) { - (0,_check_key_type_js__WEBPACK_IMPORTED_MODULE_8__["default"])(alg, key, 'decrypt'); - switch (alg) { - case 'dir': { - if (encryptedKey !== undefined) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('Encountered unexpected JWE Encrypted Key'); - return key; - } - case 'ECDH-ES': - if (encryptedKey !== undefined) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('Encountered unexpected JWE Encrypted Key'); - case 'ECDH-ES+A128KW': - case 'ECDH-ES+A192KW': - case 'ECDH-ES+A256KW': { - if (!(0,_is_object_js__WEBPACK_IMPORTED_MODULE_9__["default"])(joseHeader.epk)) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`); - if (!_runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__.ecdhAllowed(key)) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('ECDH with the provided key is not allowed or not supported by your javascript runtime'); - const epk = await (0,_key_import_js__WEBPACK_IMPORTED_MODULE_7__.importJWK)(joseHeader.epk, alg); - let partyUInfo; - let partyVInfo; - if (joseHeader.apu !== undefined) { - if (typeof joseHeader.apu !== 'string') - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "apu" (Agreement PartyUInfo) invalid`); - try { - partyUInfo = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__.decode)(joseHeader.apu); - } - catch (_a) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('Failed to base64url decode the apu'); - } - } - if (joseHeader.apv !== undefined) { - if (typeof joseHeader.apv !== 'string') - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "apv" (Agreement PartyVInfo) invalid`); - try { - partyVInfo = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__.decode)(joseHeader.apv); - } - catch (_b) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('Failed to base64url decode the apv'); - } - } - const sharedSecret = await _runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__.deriveKey(epk, key, alg === 'ECDH-ES' ? joseHeader.enc : alg, alg === 'ECDH-ES' ? (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_6__.bitLength)(joseHeader.enc) : parseInt(alg.slice(-5, -2), 10), partyUInfo, partyVInfo); - if (alg === 'ECDH-ES') - return sharedSecret; - if (encryptedKey === undefined) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE Encrypted Key missing'); - return (0,_runtime_aeskw_js__WEBPACK_IMPORTED_MODULE_0__.unwrap)(alg.slice(-6), sharedSecret, encryptedKey); - } - case 'RSA1_5': - case 'RSA-OAEP': - case 'RSA-OAEP-256': - case 'RSA-OAEP-384': - case 'RSA-OAEP-512': { - if (encryptedKey === undefined) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE Encrypted Key missing'); - return (0,_runtime_rsaes_js__WEBPACK_IMPORTED_MODULE_3__.decrypt)(alg, key, encryptedKey); - } - case 'PBES2-HS256+A128KW': - case 'PBES2-HS384+A192KW': - case 'PBES2-HS512+A256KW': { - if (encryptedKey === undefined) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE Encrypted Key missing'); - if (typeof joseHeader.p2c !== 'number') - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`); - const p2cLimit = (options === null || options === void 0 ? void 0 : options.maxPBES2Count) || 10000; - if (joseHeader.p2c > p2cLimit) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`); - if (typeof joseHeader.p2s !== 'string') - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`); - let p2s; - try { - p2s = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__.decode)(joseHeader.p2s); - } - catch (_c) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('Failed to base64url decode the p2s'); - } - return (0,_runtime_pbes2kw_js__WEBPACK_IMPORTED_MODULE_2__.decrypt)(alg, key, encryptedKey, joseHeader.p2c, p2s); - } - case 'A128KW': - case 'A192KW': - case 'A256KW': { - if (encryptedKey === undefined) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE Encrypted Key missing'); - return (0,_runtime_aeskw_js__WEBPACK_IMPORTED_MODULE_0__.unwrap)(alg, key, encryptedKey); - } - case 'A128GCMKW': - case 'A192GCMKW': - case 'A256GCMKW': { - if (encryptedKey === undefined) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('JWE Encrypted Key missing'); - if (typeof joseHeader.iv !== 'string') - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "iv" (Initialization Vector) missing or invalid`); - if (typeof joseHeader.tag !== 'string') - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid(`JOSE Header "tag" (Authentication Tag) missing or invalid`); - let iv; - try { - iv = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__.decode)(joseHeader.iv); - } - catch (_d) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('Failed to base64url decode the iv'); - } - let tag; - try { - tag = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__.decode)(joseHeader.tag); - } - catch (_e) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JWEInvalid('Failed to base64url decode the tag'); - } - return (0,_aesgcmkw_js__WEBPACK_IMPORTED_MODULE_10__.unwrap)(alg, key, encryptedKey, iv, tag); - } - default: { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value'); - } - } -} -/* harmony default export */ __webpack_exports__["default"] = (decryptKeyManagement); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/encrypt_key_management.js": -/*!**********************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/encrypt_key_management.js ***! - \**********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _runtime_aeskw_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/aeskw.js */ "./node_modules/jose/dist/browser/runtime/aeskw.js"); -/* harmony import */ var _runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/ecdhes.js */ "./node_modules/jose/dist/browser/runtime/ecdhes.js"); -/* harmony import */ var _runtime_pbes2kw_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../runtime/pbes2kw.js */ "./node_modules/jose/dist/browser/runtime/pbes2kw.js"); -/* harmony import */ var _runtime_rsaes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../runtime/rsaes.js */ "./node_modules/jose/dist/browser/runtime/rsaes.js"); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _lib_cek_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../lib/cek.js */ "./node_modules/jose/dist/browser/lib/cek.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _key_export_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../key/export.js */ "./node_modules/jose/dist/browser/key/export.js"); -/* harmony import */ var _check_key_type_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./check_key_type.js */ "./node_modules/jose/dist/browser/lib/check_key_type.js"); -/* harmony import */ var _aesgcmkw_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./aesgcmkw.js */ "./node_modules/jose/dist/browser/lib/aesgcmkw.js"); - - - - - - - - - - -async function encryptKeyManagement(alg, enc, key, providedCek, providedParameters = {}) { - let encryptedKey; - let parameters; - let cek; - (0,_check_key_type_js__WEBPACK_IMPORTED_MODULE_8__["default"])(alg, key, 'encrypt'); - switch (alg) { - case 'dir': { - cek = key; - break; - } - case 'ECDH-ES': - case 'ECDH-ES+A128KW': - case 'ECDH-ES+A192KW': - case 'ECDH-ES+A256KW': { - if (!_runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__.ecdhAllowed(key)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_6__.JOSENotSupported('ECDH with the provided key is not allowed or not supported by your javascript runtime'); - } - const { apu, apv } = providedParameters; - let { epk: ephemeralKey } = providedParameters; - ephemeralKey || (ephemeralKey = (await _runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__.generateEpk(key)).privateKey); - const { x, y, crv, kty } = await (0,_key_export_js__WEBPACK_IMPORTED_MODULE_7__.exportJWK)(ephemeralKey); - const sharedSecret = await _runtime_ecdhes_js__WEBPACK_IMPORTED_MODULE_1__.deriveKey(key, ephemeralKey, alg === 'ECDH-ES' ? enc : alg, alg === 'ECDH-ES' ? (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_5__.bitLength)(enc) : parseInt(alg.slice(-5, -2), 10), apu, apv); - parameters = { epk: { x, crv, kty } }; - if (kty === 'EC') - parameters.epk.y = y; - if (apu) - parameters.apu = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__.encode)(apu); - if (apv) - parameters.apv = (0,_runtime_base64url_js__WEBPACK_IMPORTED_MODULE_4__.encode)(apv); - if (alg === 'ECDH-ES') { - cek = sharedSecret; - break; - } - cek = providedCek || (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_5__["default"])(enc); - const kwAlg = alg.slice(-6); - encryptedKey = await (0,_runtime_aeskw_js__WEBPACK_IMPORTED_MODULE_0__.wrap)(kwAlg, sharedSecret, cek); - break; - } - case 'RSA1_5': - case 'RSA-OAEP': - case 'RSA-OAEP-256': - case 'RSA-OAEP-384': - case 'RSA-OAEP-512': { - cek = providedCek || (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_5__["default"])(enc); - encryptedKey = await (0,_runtime_rsaes_js__WEBPACK_IMPORTED_MODULE_3__.encrypt)(alg, key, cek); - break; - } - case 'PBES2-HS256+A128KW': - case 'PBES2-HS384+A192KW': - case 'PBES2-HS512+A256KW': { - cek = providedCek || (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_5__["default"])(enc); - const { p2c, p2s } = providedParameters; - ({ encryptedKey, ...parameters } = await (0,_runtime_pbes2kw_js__WEBPACK_IMPORTED_MODULE_2__.encrypt)(alg, key, cek, p2c, p2s)); - break; - } - case 'A128KW': - case 'A192KW': - case 'A256KW': { - cek = providedCek || (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_5__["default"])(enc); - encryptedKey = await (0,_runtime_aeskw_js__WEBPACK_IMPORTED_MODULE_0__.wrap)(alg, key, cek); - break; - } - case 'A128GCMKW': - case 'A192GCMKW': - case 'A256GCMKW': { - cek = providedCek || (0,_lib_cek_js__WEBPACK_IMPORTED_MODULE_5__["default"])(enc); - const { iv } = providedParameters; - ({ encryptedKey, ...parameters } = await (0,_aesgcmkw_js__WEBPACK_IMPORTED_MODULE_9__.wrap)(alg, key, cek, iv)); - break; - } - default: { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_6__.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value'); - } - } - return { cek, encryptedKey, parameters }; -} -/* harmony default export */ __webpack_exports__["default"] = (encryptKeyManagement); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/epoch.js": -/*!*****************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/epoch.js ***! - \*****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = ((date) => Math.floor(date.getTime() / 1000)); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/format_pem.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/format_pem.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = ((b64, descriptor) => { - const newlined = (b64.match(/.{1,64}/g) || []).join('\n'); - return `-----BEGIN ${descriptor}-----\n${newlined}\n-----END ${descriptor}-----`; -}); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/invalid_key_input.js": -/*!*****************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/invalid_key_input.js ***! - \*****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ withAlg: function() { return /* binding */ withAlg; } -/* harmony export */ }); -function message(msg, actual, ...types) { - if (types.length > 2) { - const last = types.pop(); - msg += `one of type ${types.join(', ')}, or ${last}.`; - } - else if (types.length === 2) { - msg += `one of type ${types[0]} or ${types[1]}.`; - } - else { - msg += `of type ${types[0]}.`; - } - if (actual == null) { - msg += ` Received ${actual}`; - } - else if (typeof actual === 'function' && actual.name) { - msg += ` Received function ${actual.name}`; - } - else if (typeof actual === 'object' && actual != null) { - if (actual.constructor && actual.constructor.name) { - msg += ` Received an instance of ${actual.constructor.name}`; - } - } - return msg; -} -/* harmony default export */ __webpack_exports__["default"] = ((actual, ...types) => { - return message('Key must be ', actual, ...types); -}); -function withAlg(alg, actual, ...types) { - return message(`Key for the ${alg} algorithm must be `, actual, ...types); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/is_disjoint.js": -/*!***********************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/is_disjoint.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -const isDisjoint = (...headers) => { - const sources = headers.filter(Boolean); - if (sources.length === 0 || sources.length === 1) { - return true; - } - let acc; - for (const header of sources) { - const parameters = Object.keys(header); - if (!acc || acc.size === 0) { - acc = new Set(parameters); - continue; - } - for (const parameter of parameters) { - if (acc.has(parameter)) { - return false; - } - acc.add(parameter); - } - } - return true; -}; -/* harmony default export */ __webpack_exports__["default"] = (isDisjoint); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/is_object.js": -/*!*********************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/is_object.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ isObject; } -/* harmony export */ }); -function isObjectLike(value) { - return typeof value === 'object' && value !== null; -} -function isObject(input) { - if (!isObjectLike(input) || Object.prototype.toString.call(input) !== '[object Object]') { - return false; - } - if (Object.getPrototypeOf(input) === null) { - return true; - } - let proto = input; - while (Object.getPrototypeOf(proto) !== null) { - proto = Object.getPrototypeOf(proto); - } - return Object.getPrototypeOf(input) === proto; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/iv.js": -/*!**************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/iv.js ***! - \**************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ bitLength: function() { return /* binding */ bitLength; } -/* harmony export */ }); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _runtime_random_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/random.js */ "./node_modules/jose/dist/browser/runtime/random.js"); - - -function bitLength(alg) { - switch (alg) { - case 'A128GCM': - case 'A128GCMKW': - case 'A192GCM': - case 'A192GCMKW': - case 'A256GCM': - case 'A256GCMKW': - return 96; - case 'A128CBC-HS256': - case 'A192CBC-HS384': - case 'A256CBC-HS512': - return 128; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`); - } -} -/* harmony default export */ __webpack_exports__["default"] = ((alg) => (0,_runtime_random_js__WEBPACK_IMPORTED_MODULE_1__["default"])(new Uint8Array(bitLength(alg) >> 3))); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/jwt_claims_set.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/jwt_claims_set.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _epoch_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./epoch.js */ "./node_modules/jose/dist/browser/lib/epoch.js"); -/* harmony import */ var _secs_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./secs.js */ "./node_modules/jose/dist/browser/lib/secs.js"); -/* harmony import */ var _is_object_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); - - - - - -const normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, ''); -const checkAudiencePresence = (audPayload, audOption) => { - if (typeof audPayload === 'string') { - return audOption.includes(audPayload); - } - if (Array.isArray(audPayload)) { - return audOption.some(Set.prototype.has.bind(new Set(audPayload))); - } - return false; -}; -/* harmony default export */ __webpack_exports__["default"] = ((protectedHeader, encodedPayload, options = {}) => { - const { typ } = options; - if (typ && - (typeof protectedHeader.typ !== 'string' || - normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('unexpected "typ" JWT header value', 'typ', 'check_failed'); - } - let payload; - try { - payload = JSON.parse(_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__.decoder.decode(encodedPayload)); - } - catch (_a) { - } - if (!(0,_is_object_js__WEBPACK_IMPORTED_MODULE_4__["default"])(payload)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTInvalid('JWT Claims Set must be a top-level JSON object'); - } - const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options; - if (maxTokenAge !== undefined) - requiredClaims.push('iat'); - if (audience !== undefined) - requiredClaims.push('aud'); - if (subject !== undefined) - requiredClaims.push('sub'); - if (issuer !== undefined) - requiredClaims.push('iss'); - for (const claim of new Set(requiredClaims.reverse())) { - if (!(claim in payload)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed(`missing required "${claim}" claim`, claim, 'missing'); - } - } - if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('unexpected "iss" claim value', 'iss', 'check_failed'); - } - if (subject && payload.sub !== subject) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('unexpected "sub" claim value', 'sub', 'check_failed'); - } - if (audience && - !checkAudiencePresence(payload.aud, typeof audience === 'string' ? [audience] : audience)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('unexpected "aud" claim value', 'aud', 'check_failed'); - } - let tolerance; - switch (typeof options.clockTolerance) { - case 'string': - tolerance = (0,_secs_js__WEBPACK_IMPORTED_MODULE_3__["default"])(options.clockTolerance); - break; - case 'number': - tolerance = options.clockTolerance; - break; - case 'undefined': - tolerance = 0; - break; - default: - throw new TypeError('Invalid clockTolerance option type'); - } - const { currentDate } = options; - const now = (0,_epoch_js__WEBPACK_IMPORTED_MODULE_2__["default"])(currentDate || new Date()); - if ((payload.iat !== undefined || maxTokenAge) && typeof payload.iat !== 'number') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('"iat" claim must be a number', 'iat', 'invalid'); - } - if (payload.nbf !== undefined) { - if (typeof payload.nbf !== 'number') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('"nbf" claim must be a number', 'nbf', 'invalid'); - } - if (payload.nbf > now + tolerance) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('"nbf" claim timestamp check failed', 'nbf', 'check_failed'); - } - } - if (payload.exp !== undefined) { - if (typeof payload.exp !== 'number') { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('"exp" claim must be a number', 'exp', 'invalid'); - } - if (payload.exp <= now - tolerance) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTExpired('"exp" claim timestamp check failed', 'exp', 'check_failed'); - } - } - if (maxTokenAge) { - const age = now - payload.iat; - const max = typeof maxTokenAge === 'number' ? maxTokenAge : (0,_secs_js__WEBPACK_IMPORTED_MODULE_3__["default"])(maxTokenAge); - if (age - tolerance > max) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTExpired('"iat" claim timestamp check failed (too far in the past)', 'iat', 'check_failed'); - } - if (age < 0 - tolerance) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', 'iat', 'check_failed'); - } - } - return payload; -}); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/secs.js": -/*!****************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/secs.js ***! - \****************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -const minute = 60; -const hour = minute * 60; -const day = hour * 24; -const week = day * 7; -const year = day * 365.25; -const REGEX = /^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i; -/* harmony default export */ __webpack_exports__["default"] = ((str) => { - const matched = REGEX.exec(str); - if (!matched) { - throw new TypeError('Invalid time period format'); - } - const value = parseFloat(matched[1]); - const unit = matched[2].toLowerCase(); - switch (unit) { - case 'sec': - case 'secs': - case 'second': - case 'seconds': - case 's': - return Math.round(value); - case 'minute': - case 'minutes': - case 'min': - case 'mins': - case 'm': - return Math.round(value * minute); - case 'hour': - case 'hours': - case 'hr': - case 'hrs': - case 'h': - return Math.round(value * hour); - case 'day': - case 'days': - case 'd': - return Math.round(value * day); - case 'week': - case 'weeks': - case 'w': - return Math.round(value * week); - default: - return Math.round(value * year); - } -}); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/validate_algorithms.js": -/*!*******************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/validate_algorithms.js ***! - \*******************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -const validateAlgorithms = (option, algorithms) => { - if (algorithms !== undefined && - (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== 'string'))) { - throw new TypeError(`"${option}" option must be an array of strings`); - } - if (!algorithms) { - return undefined; - } - return new Set(algorithms); -}; -/* harmony default export */ __webpack_exports__["default"] = (validateAlgorithms); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/lib/validate_crit.js": -/*!*************************************************************!*\ - !*** ./node_modules/jose/dist/browser/lib/validate_crit.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - -function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) { - if (joseHeader.crit !== undefined && protectedHeader.crit === undefined) { - throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected'); - } - if (!protectedHeader || protectedHeader.crit === undefined) { - return new Set(); - } - if (!Array.isArray(protectedHeader.crit) || - protectedHeader.crit.length === 0 || - protectedHeader.crit.some((input) => typeof input !== 'string' || input.length === 0)) { - throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present'); - } - let recognized; - if (recognizedOption !== undefined) { - recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]); - } - else { - recognized = recognizedDefault; - } - for (const parameter of protectedHeader.crit) { - if (!recognized.has(parameter)) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`); - } - if (joseHeader[parameter] === undefined) { - throw new Err(`Extension Header Parameter "${parameter}" is missing`); - } - else if (recognized.get(parameter) && protectedHeader[parameter] === undefined) { - throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`); - } - } - return new Set(protectedHeader.crit); -} -/* harmony default export */ __webpack_exports__["default"] = (validateCrit); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/aeskw.js": -/*!*********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/aeskw.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ unwrap: function() { return /* binding */ unwrap; }, -/* harmony export */ wrap: function() { return /* binding */ wrap; } -/* harmony export */ }); -/* harmony import */ var _bogus_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bogus.js */ "./node_modules/jose/dist/browser/runtime/bogus.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/crypto_key.js */ "./node_modules/jose/dist/browser/lib/crypto_key.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - - -function checkKeySize(key, alg) { - if (key.algorithm.length !== parseInt(alg.slice(1, 4), 10)) { - throw new TypeError(`Invalid key size for alg: ${alg}`); - } -} -function getCryptoKey(key, alg, usage) { - if ((0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__.isCryptoKey)(key)) { - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__.checkEncCryptoKey)(key, alg, usage); - return key; - } - if (key instanceof Uint8Array) { - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('raw', key, 'AES-KW', true, [usage]); - } - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_4__.types, 'Uint8Array')); -} -const wrap = async (alg, key, cek) => { - const cryptoKey = await getCryptoKey(key, alg, 'wrapKey'); - checkKeySize(cryptoKey, alg); - const cryptoKeyCek = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('raw', cek, ..._bogus_js__WEBPACK_IMPORTED_MODULE_0__["default"]); - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.wrapKey('raw', cryptoKeyCek, cryptoKey, 'AES-KW')); -}; -const unwrap = async (alg, key, encryptedKey) => { - const cryptoKey = await getCryptoKey(key, alg, 'unwrapKey'); - checkKeySize(cryptoKey, alg); - const cryptoKeyCek = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.unwrapKey('raw', encryptedKey, cryptoKey, 'AES-KW', ..._bogus_js__WEBPACK_IMPORTED_MODULE_0__["default"]); - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.exportKey('raw', cryptoKeyCek)); -}; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/asn1.js": -/*!********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/asn1.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ fromPKCS8: function() { return /* binding */ fromPKCS8; }, -/* harmony export */ fromSPKI: function() { return /* binding */ fromSPKI; }, -/* harmony export */ fromX509: function() { return /* binding */ fromX509; }, -/* harmony export */ toPKCS8: function() { return /* binding */ toPKCS8; }, -/* harmony export */ toSPKI: function() { return /* binding */ toSPKI; } -/* harmony export */ }); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/format_pem.js */ "./node_modules/jose/dist/browser/lib/format_pem.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - - - -const genericExport = async (keyType, keyFormat, key) => { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__.isCryptoKey)(key)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_5__.types)); - } - if (!key.extractable) { - throw new TypeError('CryptoKey is not extractable'); - } - if (key.type !== keyType) { - throw new TypeError(`key is not a ${keyType} key`); - } - return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encodeBase64)(new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.exportKey(keyFormat, key))), `${keyType.toUpperCase()} KEY`); -}; -const toSPKI = (key) => { - return genericExport('public', 'spki', key); -}; -const toPKCS8 = (key) => { - return genericExport('private', 'pkcs8', key); -}; -const findOid = (keyData, oid, from = 0) => { - if (from === 0) { - oid.unshift(oid.length); - oid.unshift(0x06); - } - let i = keyData.indexOf(oid[0], from); - if (i === -1) - return false; - const sub = keyData.subarray(i, i + oid.length); - if (sub.length !== oid.length) - return false; - return sub.every((value, index) => value === oid[index]) || findOid(keyData, oid, i + 1); -}; -const getNamedCurve = (keyData) => { - switch (true) { - case findOid(keyData, [0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07]): - return 'P-256'; - case findOid(keyData, [0x2b, 0x81, 0x04, 0x00, 0x22]): - return 'P-384'; - case findOid(keyData, [0x2b, 0x81, 0x04, 0x00, 0x23]): - return 'P-521'; - case findOid(keyData, [0x2b, 0x65, 0x6e]): - return 'X25519'; - case findOid(keyData, [0x2b, 0x65, 0x6f]): - return 'X448'; - case findOid(keyData, [0x2b, 0x65, 0x70]): - return 'Ed25519'; - case findOid(keyData, [0x2b, 0x65, 0x71]): - return 'Ed448'; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported EC Key Curve or OKP Key Sub Type'); - } -}; -const genericImport = async (replace, keyFormat, pem, alg, options) => { - var _a; - let algorithm; - let keyUsages; - const keyData = new Uint8Array(atob(pem.replace(replace, '')) - .split('') - .map((c) => c.charCodeAt(0))); - const isPublic = keyFormat === 'spki'; - switch (alg) { - case 'PS256': - case 'PS384': - case 'PS512': - algorithm = { name: 'RSA-PSS', hash: `SHA-${alg.slice(-3)}` }; - keyUsages = isPublic ? ['verify'] : ['sign']; - break; - case 'RS256': - case 'RS384': - case 'RS512': - algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${alg.slice(-3)}` }; - keyUsages = isPublic ? ['verify'] : ['sign']; - break; - case 'RSA-OAEP': - case 'RSA-OAEP-256': - case 'RSA-OAEP-384': - case 'RSA-OAEP-512': - algorithm = { - name: 'RSA-OAEP', - hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`, - }; - keyUsages = isPublic ? ['encrypt', 'wrapKey'] : ['decrypt', 'unwrapKey']; - break; - case 'ES256': - algorithm = { name: 'ECDSA', namedCurve: 'P-256' }; - keyUsages = isPublic ? ['verify'] : ['sign']; - break; - case 'ES384': - algorithm = { name: 'ECDSA', namedCurve: 'P-384' }; - keyUsages = isPublic ? ['verify'] : ['sign']; - break; - case 'ES512': - algorithm = { name: 'ECDSA', namedCurve: 'P-521' }; - keyUsages = isPublic ? ['verify'] : ['sign']; - break; - case 'ECDH-ES': - case 'ECDH-ES+A128KW': - case 'ECDH-ES+A192KW': - case 'ECDH-ES+A256KW': { - const namedCurve = getNamedCurve(keyData); - algorithm = namedCurve.startsWith('P-') ? { name: 'ECDH', namedCurve } : { name: namedCurve }; - keyUsages = isPublic ? [] : ['deriveBits']; - break; - } - case 'EdDSA': - algorithm = { name: getNamedCurve(keyData) }; - keyUsages = isPublic ? ['verify'] : ['sign']; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value'); - } - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages); -}; -const fromPKCS8 = (pem, alg, options) => { - return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, 'pkcs8', pem, alg, options); -}; -const fromSPKI = (pem, alg, options) => { - return genericImport(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, 'spki', pem, alg, options); -}; -function getElement(seq) { - let result = []; - let next = 0; - while (next < seq.length) { - let nextPart = parseElement(seq.subarray(next)); - result.push(nextPart); - next += nextPart.byteLength; - } - return result; -} -function parseElement(bytes) { - let position = 0; - let tag = bytes[0] & 0x1f; - position++; - if (tag === 0x1f) { - tag = 0; - while (bytes[position] >= 0x80) { - tag = tag * 128 + bytes[position] - 0x80; - position++; - } - tag = tag * 128 + bytes[position] - 0x80; - position++; - } - let length = 0; - if (bytes[position] < 0x80) { - length = bytes[position]; - position++; - } - else if (length === 0x80) { - length = 0; - while (bytes[position + length] !== 0 || bytes[position + length + 1] !== 0) { - if (length > bytes.byteLength) { - throw new TypeError('invalid indefinite form length'); - } - length++; - } - const byteLength = position + length + 2; - return { - byteLength, - contents: bytes.subarray(position, position + length), - raw: bytes.subarray(0, byteLength), - }; - } - else { - let numberOfDigits = bytes[position] & 0x7f; - position++; - length = 0; - for (let i = 0; i < numberOfDigits; i++) { - length = length * 256 + bytes[position]; - position++; - } - } - const byteLength = position + length; - return { - byteLength, - contents: bytes.subarray(position, byteLength), - raw: bytes.subarray(0, byteLength), - }; -} -function spkiFromX509(buf) { - const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents); - return (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw); -} -function getSPKI(x509) { - const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, ''); - const raw = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decodeBase64)(pem); - return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__["default"])(spkiFromX509(raw), 'PUBLIC KEY'); -} -const fromX509 = (pem, alg, options) => { - let spki; - try { - spki = getSPKI(pem); - } - catch (cause) { - throw new TypeError('Failed to parse the X.509 certificate', { cause }); - } - return fromSPKI(spki, alg, options); -}; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/base64url.js": -/*!*************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/base64url.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ decode: function() { return /* binding */ decode; }, -/* harmony export */ decodeBase64: function() { return /* binding */ decodeBase64; }, -/* harmony export */ encode: function() { return /* binding */ encode; }, -/* harmony export */ encodeBase64: function() { return /* binding */ encodeBase64; } -/* harmony export */ }); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); - -const encodeBase64 = (input) => { - let unencoded = input; - if (typeof unencoded === 'string') { - unencoded = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.encoder.encode(unencoded); - } - const CHUNK_SIZE = 0x8000; - const arr = []; - for (let i = 0; i < unencoded.length; i += CHUNK_SIZE) { - arr.push(String.fromCharCode.apply(null, unencoded.subarray(i, i + CHUNK_SIZE))); - } - return btoa(arr.join('')); -}; -const encode = (input) => { - return encodeBase64(input).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_'); -}; -const decodeBase64 = (encoded) => { - const binary = atob(encoded); - const bytes = new Uint8Array(binary.length); - for (let i = 0; i < binary.length; i++) { - bytes[i] = binary.charCodeAt(i); - } - return bytes; -}; -const decode = (input) => { - let encoded = input; - if (encoded instanceof Uint8Array) { - encoded = _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.decoder.decode(encoded); - } - encoded = encoded.replace(/-/g, '+').replace(/_/g, '/').replace(/\s/g, ''); - try { - return decodeBase64(encoded); - } - catch (_a) { - throw new TypeError('The input to be decoded is not correctly encoded.'); - } -}; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/bogus.js": -/*!*********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/bogus.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -const bogusWebCrypto = [ - { hash: 'SHA-256', name: 'HMAC' }, - true, - ['sign'], -]; -/* harmony default export */ __webpack_exports__["default"] = (bogusWebCrypto); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/check_cek_length.js": -/*!********************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/check_cek_length.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - -const checkCekLength = (cek, expected) => { - const actual = cek.byteLength << 3; - if (actual !== expected) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`); - } -}; -/* harmony default export */ __webpack_exports__["default"] = (checkCekLength); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/check_key_length.js": -/*!********************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/check_key_length.js ***! - \********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = ((alg, key) => { - if (alg.startsWith('RS') || alg.startsWith('PS')) { - const { modulusLength } = key.algorithm; - if (typeof modulusLength !== 'number' || modulusLength < 2048) { - throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`); - } - } -}); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/decrypt.js": -/*!***********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/decrypt.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_check_iv_length_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/check_iv_length.js */ "./node_modules/jose/dist/browser/lib/check_iv_length.js"); -/* harmony import */ var _check_cek_length_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./check_cek_length.js */ "./node_modules/jose/dist/browser/runtime/check_cek_length.js"); -/* harmony import */ var _timing_safe_equal_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./timing_safe_equal.js */ "./node_modules/jose/dist/browser/runtime/timing_safe_equal.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib/crypto_key.js */ "./node_modules/jose/dist/browser/lib/crypto_key.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - - - - - - -async function cbcDecrypt(enc, cek, ciphertext, iv, tag, aad) { - if (!(cek instanceof Uint8Array)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_7__["default"])(cek, 'Uint8Array')); - } - const keySize = parseInt(enc.slice(1, 4), 10); - const encKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.importKey('raw', cek.subarray(keySize >> 3), 'AES-CBC', false, ['decrypt']); - const macKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.importKey('raw', cek.subarray(0, keySize >> 3), { - hash: `SHA-${keySize << 1}`, - name: 'HMAC', - }, false, ['sign']); - const macData = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.concat)(aad, iv, ciphertext, (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.uint64be)(aad.length << 3)); - const expectedTag = new Uint8Array((await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.sign('HMAC', macKey, macData)).slice(0, keySize >> 3)); - let macCheckPassed; - try { - macCheckPassed = (0,_timing_safe_equal_js__WEBPACK_IMPORTED_MODULE_3__["default"])(tag, expectedTag); - } - catch (_a) { - } - if (!macCheckPassed) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JWEDecryptionFailed(); - } - let plaintext; - try { - plaintext = new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.decrypt({ iv, name: 'AES-CBC' }, encKey, ciphertext)); - } - catch (_b) { - } - if (!plaintext) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JWEDecryptionFailed(); - } - return plaintext; -} -async function gcmDecrypt(enc, cek, ciphertext, iv, tag, aad) { - let encKey; - if (cek instanceof Uint8Array) { - encKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.importKey('raw', cek, 'AES-GCM', false, ['decrypt']); - } - else { - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_6__.checkEncCryptoKey)(cek, enc, 'decrypt'); - encKey = cek; - } - try { - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.decrypt({ - additionalData: aad, - iv, - name: 'AES-GCM', - tagLength: 128, - }, encKey, (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.concat)(ciphertext, tag))); - } - catch (_a) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JWEDecryptionFailed(); - } -} -const decrypt = async (enc, cek, ciphertext, iv, tag, aad) => { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_5__.isCryptoKey)(cek) && !(cek instanceof Uint8Array)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_7__["default"])(cek, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_8__.types, 'Uint8Array')); - } - (0,_lib_check_iv_length_js__WEBPACK_IMPORTED_MODULE_1__["default"])(enc, iv); - switch (enc) { - case 'A128CBC-HS256': - case 'A192CBC-HS384': - case 'A256CBC-HS512': - if (cek instanceof Uint8Array) - (0,_check_cek_length_js__WEBPACK_IMPORTED_MODULE_2__["default"])(cek, parseInt(enc.slice(-3), 10)); - return cbcDecrypt(enc, cek, ciphertext, iv, tag, aad); - case 'A128GCM': - case 'A192GCM': - case 'A256GCM': - if (cek instanceof Uint8Array) - (0,_check_cek_length_js__WEBPACK_IMPORTED_MODULE_2__["default"])(cek, parseInt(enc.slice(1, 4), 10)); - return gcmDecrypt(enc, cek, ciphertext, iv, tag, aad); - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Unsupported JWE Content Encryption Algorithm'); - } -}; -/* harmony default export */ __webpack_exports__["default"] = (decrypt); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/digest.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/digest.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); - -const digest = async (algorithm, data) => { - const subtleDigest = `SHA-${algorithm.slice(-3)}`; - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.digest(subtleDigest, data)); -}; -/* harmony default export */ __webpack_exports__["default"] = (digest); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/ecdhes.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/ecdhes.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ deriveKey: function() { return /* binding */ deriveKey; }, -/* harmony export */ ecdhAllowed: function() { return /* binding */ ecdhAllowed; }, -/* harmony export */ generateEpk: function() { return /* binding */ generateEpk; } -/* harmony export */ }); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/crypto_key.js */ "./node_modules/jose/dist/browser/lib/crypto_key.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - - -async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(0), apv = new Uint8Array(0)) { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__.isCryptoKey)(publicKey)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__["default"])(publicKey, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_4__.types)); - } - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__.checkEncCryptoKey)(publicKey, 'ECDH'); - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__.isCryptoKey)(privateKey)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__["default"])(privateKey, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_4__.types)); - } - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_2__.checkEncCryptoKey)(privateKey, 'ECDH', 'deriveBits'); - const value = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.concat)((0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.lengthAndInput)(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.encoder.encode(algorithm)), (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.lengthAndInput)(apu), (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.lengthAndInput)(apv), (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.uint32be)(keyLength)); - let length; - if (publicKey.algorithm.name === 'X25519') { - length = 256; - } - else if (publicKey.algorithm.name === 'X448') { - length = 448; - } - else { - length = - Math.ceil(parseInt(publicKey.algorithm.namedCurve.substr(-3), 10) / 8) << 3; - } - const sharedSecret = new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.deriveBits({ - name: publicKey.algorithm.name, - public: publicKey, - }, privateKey, length)); - return (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.concatKdf)(sharedSecret, keyLength, value); -} -async function generateEpk(key) { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__.isCryptoKey)(key)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_4__.types)); - } - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(key.algorithm, true, ['deriveBits']); -} -function ecdhAllowed(key) { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__.isCryptoKey)(key)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_3__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_4__.types)); - } - return (['P-256', 'P-384', 'P-521'].includes(key.algorithm.namedCurve) || - key.algorithm.name === 'X25519' || - key.algorithm.name === 'X448'); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/encrypt.js": -/*!***********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/encrypt.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_check_iv_length_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/check_iv_length.js */ "./node_modules/jose/dist/browser/lib/check_iv_length.js"); -/* harmony import */ var _check_cek_length_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./check_cek_length.js */ "./node_modules/jose/dist/browser/runtime/check_cek_length.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/crypto_key.js */ "./node_modules/jose/dist/browser/lib/crypto_key.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - - - - - -async function cbcEncrypt(enc, plaintext, cek, iv, aad) { - if (!(cek instanceof Uint8Array)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_5__["default"])(cek, 'Uint8Array')); - } - const keySize = parseInt(enc.slice(1, 4), 10); - const encKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__["default"].subtle.importKey('raw', cek.subarray(keySize >> 3), 'AES-CBC', false, ['encrypt']); - const macKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__["default"].subtle.importKey('raw', cek.subarray(0, keySize >> 3), { - hash: `SHA-${keySize << 1}`, - name: 'HMAC', - }, false, ['sign']); - const ciphertext = new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__["default"].subtle.encrypt({ - iv, - name: 'AES-CBC', - }, encKey, plaintext)); - const macData = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.concat)(aad, iv, ciphertext, (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_0__.uint64be)(aad.length << 3)); - const tag = new Uint8Array((await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__["default"].subtle.sign('HMAC', macKey, macData)).slice(0, keySize >> 3)); - return { ciphertext, tag }; -} -async function gcmEncrypt(enc, plaintext, cek, iv, aad) { - let encKey; - if (cek instanceof Uint8Array) { - encKey = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__["default"].subtle.importKey('raw', cek, 'AES-GCM', false, ['encrypt']); - } - else { - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_4__.checkEncCryptoKey)(cek, enc, 'encrypt'); - encKey = cek; - } - const encrypted = new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_3__["default"].subtle.encrypt({ - additionalData: aad, - iv, - name: 'AES-GCM', - tagLength: 128, - }, encKey, plaintext)); - const tag = encrypted.slice(-16); - const ciphertext = encrypted.slice(0, -16); - return { ciphertext, tag }; -} -const encrypt = async (enc, plaintext, cek, iv, aad) => { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_3__.isCryptoKey)(cek) && !(cek instanceof Uint8Array)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_5__["default"])(cek, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_7__.types, 'Uint8Array')); - } - (0,_lib_check_iv_length_js__WEBPACK_IMPORTED_MODULE_1__["default"])(enc, iv); - switch (enc) { - case 'A128CBC-HS256': - case 'A192CBC-HS384': - case 'A256CBC-HS512': - if (cek instanceof Uint8Array) - (0,_check_cek_length_js__WEBPACK_IMPORTED_MODULE_2__["default"])(cek, parseInt(enc.slice(-3), 10)); - return cbcEncrypt(enc, plaintext, cek, iv, aad); - case 'A128GCM': - case 'A192GCM': - case 'A256GCM': - if (cek instanceof Uint8Array) - (0,_check_cek_length_js__WEBPACK_IMPORTED_MODULE_2__["default"])(cek, parseInt(enc.slice(1, 4), 10)); - return gcmEncrypt(enc, plaintext, cek, iv, aad); - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_6__.JOSENotSupported('Unsupported JWE Content Encryption Algorithm'); - } -}; -/* harmony default export */ __webpack_exports__["default"] = (encrypt); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/fetch_jwks.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/fetch_jwks.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - -const fetchJwks = async (url, timeout, options) => { - let controller; - let id; - let timedOut = false; - if (typeof AbortController === 'function') { - controller = new AbortController(); - id = setTimeout(() => { - timedOut = true; - controller.abort(); - }, timeout); - } - const response = await fetch(url.href, { - signal: controller ? controller.signal : undefined, - redirect: 'manual', - headers: options.headers, - }).catch((err) => { - if (timedOut) - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JWKSTimeout(); - throw err; - }); - if (id !== undefined) - clearTimeout(id); - if (response.status !== 200) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response'); - } - try { - return await response.json(); - } - catch (_a) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON'); - } -}; -/* harmony default export */ __webpack_exports__["default"] = (fetchJwks); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/generate.js": -/*!************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/generate.js ***! - \************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ generateKeyPair: function() { return /* binding */ generateKeyPair; }, -/* harmony export */ generateSecret: function() { return /* binding */ generateSecret; } -/* harmony export */ }); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js"); - - - -async function generateSecret(alg, options) { - var _a; - let length; - let algorithm; - let keyUsages; - switch (alg) { - case 'HS256': - case 'HS384': - case 'HS512': - length = parseInt(alg.slice(-3), 10); - algorithm = { name: 'HMAC', hash: `SHA-${length}`, length }; - keyUsages = ['sign', 'verify']; - break; - case 'A128CBC-HS256': - case 'A192CBC-HS384': - case 'A256CBC-HS512': - length = parseInt(alg.slice(-3), 10); - return (0,_random_js__WEBPACK_IMPORTED_MODULE_2__["default"])(new Uint8Array(length >> 3)); - case 'A128KW': - case 'A192KW': - case 'A256KW': - length = parseInt(alg.slice(1, 4), 10); - algorithm = { name: 'AES-KW', length }; - keyUsages = ['wrapKey', 'unwrapKey']; - break; - case 'A128GCMKW': - case 'A192GCMKW': - case 'A256GCMKW': - case 'A128GCM': - case 'A192GCM': - case 'A256GCM': - length = parseInt(alg.slice(1, 4), 10); - algorithm = { name: 'AES-GCM', length }; - keyUsages = ['encrypt', 'decrypt']; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); - } - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.generateKey(algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages); -} -function getModulusLengthOption(options) { - var _a; - const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048; - if (typeof modulusLength !== 'number' || modulusLength < 2048) { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used'); - } - return modulusLength; -} -async function generateKeyPair(alg, options) { - var _a, _b, _c; - let algorithm; - let keyUsages; - switch (alg) { - case 'PS256': - case 'PS384': - case 'PS512': - algorithm = { - name: 'RSA-PSS', - hash: `SHA-${alg.slice(-3)}`, - publicExponent: new Uint8Array([0x01, 0x00, 0x01]), - modulusLength: getModulusLengthOption(options), - }; - keyUsages = ['sign', 'verify']; - break; - case 'RS256': - case 'RS384': - case 'RS512': - algorithm = { - name: 'RSASSA-PKCS1-v1_5', - hash: `SHA-${alg.slice(-3)}`, - publicExponent: new Uint8Array([0x01, 0x00, 0x01]), - modulusLength: getModulusLengthOption(options), - }; - keyUsages = ['sign', 'verify']; - break; - case 'RSA-OAEP': - case 'RSA-OAEP-256': - case 'RSA-OAEP-384': - case 'RSA-OAEP-512': - algorithm = { - name: 'RSA-OAEP', - hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`, - publicExponent: new Uint8Array([0x01, 0x00, 0x01]), - modulusLength: getModulusLengthOption(options), - }; - keyUsages = ['decrypt', 'unwrapKey', 'encrypt', 'wrapKey']; - break; - case 'ES256': - algorithm = { name: 'ECDSA', namedCurve: 'P-256' }; - keyUsages = ['sign', 'verify']; - break; - case 'ES384': - algorithm = { name: 'ECDSA', namedCurve: 'P-384' }; - keyUsages = ['sign', 'verify']; - break; - case 'ES512': - algorithm = { name: 'ECDSA', namedCurve: 'P-521' }; - keyUsages = ['sign', 'verify']; - break; - case 'EdDSA': - keyUsages = ['sign', 'verify']; - const crv = (_a = options === null || options === void 0 ? void 0 : options.crv) !== null && _a !== void 0 ? _a : 'Ed25519'; - switch (crv) { - case 'Ed25519': - case 'Ed448': - algorithm = { name: crv }; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported crv option provided'); - } - break; - case 'ECDH-ES': - case 'ECDH-ES+A128KW': - case 'ECDH-ES+A192KW': - case 'ECDH-ES+A256KW': { - keyUsages = ['deriveKey', 'deriveBits']; - const crv = (_b = options === null || options === void 0 ? void 0 : options.crv) !== null && _b !== void 0 ? _b : 'P-256'; - switch (crv) { - case 'P-256': - case 'P-384': - case 'P-521': { - algorithm = { name: 'ECDH', namedCurve: crv }; - break; - } - case 'X25519': - case 'X448': - algorithm = { name: crv }; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448'); - } - break; - } - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); - } - return (_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages)); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/get_sign_verify_key.js": -/*!***********************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/get_sign_verify_key.js ***! - \***********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ getCryptoKey; } -/* harmony export */ }); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/crypto_key.js */ "./node_modules/jose/dist/browser/lib/crypto_key.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - -function getCryptoKey(alg, key, usage) { - if ((0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__.isCryptoKey)(key)) { - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_1__.checkSigCryptoKey)(key, alg, usage); - return key; - } - if (key instanceof Uint8Array) { - if (!alg.startsWith('HS')) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_2__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_3__.types)); - } - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('raw', key, { hash: `SHA-${alg.slice(-3)}`, name: 'HMAC' }, false, [usage]); - } - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_2__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_3__.types, 'Uint8Array')); -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/is_key_like.js": -/*!***************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/is_key_like.js ***! - \***************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ types: function() { return /* binding */ types; } -/* harmony export */ }); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); - -/* harmony default export */ __webpack_exports__["default"] = ((key) => { - return (0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__.isCryptoKey)(key); -}); -const types = ['CryptoKey']; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/jwk_to_key.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/jwk_to_key.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); -/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); - - - -function subtleMapping(jwk) { - let algorithm; - let keyUsages; - switch (jwk.kty) { - case 'oct': { - switch (jwk.alg) { - case 'HS256': - case 'HS384': - case 'HS512': - algorithm = { name: 'HMAC', hash: `SHA-${jwk.alg.slice(-3)}` }; - keyUsages = ['sign', 'verify']; - break; - case 'A128CBC-HS256': - case 'A192CBC-HS384': - case 'A256CBC-HS512': - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`${jwk.alg} keys cannot be imported as CryptoKey instances`); - case 'A128GCM': - case 'A192GCM': - case 'A256GCM': - case 'A128GCMKW': - case 'A192GCMKW': - case 'A256GCMKW': - algorithm = { name: 'AES-GCM' }; - keyUsages = ['encrypt', 'decrypt']; - break; - case 'A128KW': - case 'A192KW': - case 'A256KW': - algorithm = { name: 'AES-KW' }; - keyUsages = ['wrapKey', 'unwrapKey']; - break; - case 'PBES2-HS256+A128KW': - case 'PBES2-HS384+A192KW': - case 'PBES2-HS512+A256KW': - algorithm = { name: 'PBKDF2' }; - keyUsages = ['deriveBits']; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); - } - break; - } - case 'RSA': { - switch (jwk.alg) { - case 'PS256': - case 'PS384': - case 'PS512': - algorithm = { name: 'RSA-PSS', hash: `SHA-${jwk.alg.slice(-3)}` }; - keyUsages = jwk.d ? ['sign'] : ['verify']; - break; - case 'RS256': - case 'RS384': - case 'RS512': - algorithm = { name: 'RSASSA-PKCS1-v1_5', hash: `SHA-${jwk.alg.slice(-3)}` }; - keyUsages = jwk.d ? ['sign'] : ['verify']; - break; - case 'RSA-OAEP': - case 'RSA-OAEP-256': - case 'RSA-OAEP-384': - case 'RSA-OAEP-512': - algorithm = { - name: 'RSA-OAEP', - hash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`, - }; - keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey']; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); - } - break; - } - case 'EC': { - switch (jwk.alg) { - case 'ES256': - algorithm = { name: 'ECDSA', namedCurve: 'P-256' }; - keyUsages = jwk.d ? ['sign'] : ['verify']; - break; - case 'ES384': - algorithm = { name: 'ECDSA', namedCurve: 'P-384' }; - keyUsages = jwk.d ? ['sign'] : ['verify']; - break; - case 'ES512': - algorithm = { name: 'ECDSA', namedCurve: 'P-521' }; - keyUsages = jwk.d ? ['sign'] : ['verify']; - break; - case 'ECDH-ES': - case 'ECDH-ES+A128KW': - case 'ECDH-ES+A192KW': - case 'ECDH-ES+A256KW': - algorithm = { name: 'ECDH', namedCurve: jwk.crv }; - keyUsages = jwk.d ? ['deriveBits'] : []; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); - } - break; - } - case 'OKP': { - switch (jwk.alg) { - case 'EdDSA': - algorithm = { name: jwk.crv }; - keyUsages = jwk.d ? ['sign'] : ['verify']; - break; - case 'ECDH-ES': - case 'ECDH-ES+A128KW': - case 'ECDH-ES+A192KW': - case 'ECDH-ES+A256KW': - algorithm = { name: jwk.crv }; - keyUsages = jwk.d ? ['deriveBits'] : []; - break; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value'); - } - break; - } - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value'); - } - return { algorithm, keyUsages }; -} -const parse = async (jwk) => { - var _a, _b; - if (!jwk.alg) { - throw new TypeError('"alg" argument is required when "jwk.alg" is not present'); - } - const { algorithm, keyUsages } = subtleMapping(jwk); - const rest = [ - algorithm, - (_a = jwk.ext) !== null && _a !== void 0 ? _a : false, - (_b = jwk.key_ops) !== null && _b !== void 0 ? _b : keyUsages, - ]; - if (algorithm.name === 'PBKDF2') { - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('raw', (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decode)(jwk.k), ...rest); - } - const keyData = { ...jwk }; - delete keyData.alg; - delete keyData.use; - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('jwk', keyData, ...rest); -}; -/* harmony default export */ __webpack_exports__["default"] = (parse); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/key_to_jwk.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/key_to_jwk.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - -const keyToJWK = async (key) => { - if (key instanceof Uint8Array) { - return { - kty: 'oct', - k: (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encode)(key), - }; - } - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__.isCryptoKey)(key)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_3__.types, 'Uint8Array')); - } - if (!key.extractable) { - throw new TypeError('non-extractable CryptoKey cannot be exported as a JWK'); - } - const { ext, key_ops, alg, use, ...jwk } = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.exportKey('jwk', key); - return jwk; -}; -/* harmony default export */ __webpack_exports__["default"] = (keyToJWK); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/pbes2kw.js": -/*!***********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/pbes2kw.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ decrypt: function() { return /* binding */ decrypt; }, -/* harmony export */ encrypt: function() { return /* binding */ encrypt; } -/* harmony export */ }); -/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); -/* harmony import */ var _aeskw_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./aeskw.js */ "./node_modules/jose/dist/browser/runtime/aeskw.js"); -/* harmony import */ var _lib_check_p2s_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/check_p2s.js */ "./node_modules/jose/dist/browser/lib/check_p2s.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib/crypto_key.js */ "./node_modules/jose/dist/browser/lib/crypto_key.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - - - - - - -function getCryptoKey(key, alg) { - if (key instanceof Uint8Array) { - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.importKey('raw', key, 'PBKDF2', false, ['deriveBits']); - } - if ((0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_5__.isCryptoKey)(key)) { - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_6__.checkEncCryptoKey)(key, alg, 'deriveBits', 'deriveKey'); - return key; - } - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_7__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_8__.types, 'Uint8Array')); -} -async function deriveKey(p2s, alg, p2c, key) { - (0,_lib_check_p2s_js__WEBPACK_IMPORTED_MODULE_4__["default"])(p2s); - const salt = (0,_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__.p2s)(alg, p2s); - const keylen = parseInt(alg.slice(13, 16), 10); - const subtleAlg = { - hash: `SHA-${alg.slice(8, 11)}`, - iterations: p2c, - name: 'PBKDF2', - salt, - }; - const wrapAlg = { - length: keylen, - name: 'AES-KW', - }; - const cryptoKey = await getCryptoKey(key, alg); - if (cryptoKey.usages.includes('deriveBits')) { - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.deriveBits(subtleAlg, cryptoKey, keylen)); - } - if (cryptoKey.usages.includes('deriveKey')) { - return _webcrypto_js__WEBPACK_IMPORTED_MODULE_5__["default"].subtle.deriveKey(subtleAlg, cryptoKey, wrapAlg, false, ['wrapKey', 'unwrapKey']); - } - throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"'); -} -const encrypt = async (alg, key, cek, p2c = 2048, p2s = (0,_random_js__WEBPACK_IMPORTED_MODULE_0__["default"])(new Uint8Array(16))) => { - const derived = await deriveKey(p2s, alg, p2c, key); - const encryptedKey = await (0,_aeskw_js__WEBPACK_IMPORTED_MODULE_3__.wrap)(alg.slice(-6), derived, cek); - return { encryptedKey, p2c, p2s: (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encode)(p2s) }; -}; -const decrypt = async (alg, key, encryptedKey, p2c, p2s) => { - const derived = await deriveKey(p2s, alg, p2c, key); - return (0,_aeskw_js__WEBPACK_IMPORTED_MODULE_3__.unwrap)(alg.slice(-6), derived, encryptedKey); -}; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/random.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/random.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); - -/* harmony default export */ __webpack_exports__["default"] = (_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].getRandomValues.bind(_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"])); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/rsaes.js": -/*!*********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/rsaes.js ***! - \*********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ decrypt: function() { return /* binding */ decrypt; }, -/* harmony export */ encrypt: function() { return /* binding */ encrypt; } -/* harmony export */ }); -/* harmony import */ var _subtle_rsaes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subtle_rsaes.js */ "./node_modules/jose/dist/browser/runtime/subtle_rsaes.js"); -/* harmony import */ var _bogus_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bogus.js */ "./node_modules/jose/dist/browser/runtime/bogus.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/crypto_key.js */ "./node_modules/jose/dist/browser/lib/crypto_key.js"); -/* harmony import */ var _check_key_length_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./check_key_length.js */ "./node_modules/jose/dist/browser/runtime/check_key_length.js"); -/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js"); -/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js"); - - - - - - - -const encrypt = async (alg, key, cek) => { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_2__.isCryptoKey)(key)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_5__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_6__.types)); - } - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_3__.checkEncCryptoKey)(key, alg, 'encrypt', 'wrapKey'); - (0,_check_key_length_js__WEBPACK_IMPORTED_MODULE_4__["default"])(alg, key); - if (key.usages.includes('encrypt')) { - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__["default"].subtle.encrypt((0,_subtle_rsaes_js__WEBPACK_IMPORTED_MODULE_0__["default"])(alg), key, cek)); - } - if (key.usages.includes('wrapKey')) { - const cryptoKeyCek = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__["default"].subtle.importKey('raw', cek, ..._bogus_js__WEBPACK_IMPORTED_MODULE_1__["default"]); - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__["default"].subtle.wrapKey('raw', cryptoKeyCek, key, (0,_subtle_rsaes_js__WEBPACK_IMPORTED_MODULE_0__["default"])(alg))); - } - throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation'); -}; -const decrypt = async (alg, key, encryptedKey) => { - if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_2__.isCryptoKey)(key)) { - throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_5__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_6__.types)); - } - (0,_lib_crypto_key_js__WEBPACK_IMPORTED_MODULE_3__.checkEncCryptoKey)(key, alg, 'decrypt', 'unwrapKey'); - (0,_check_key_length_js__WEBPACK_IMPORTED_MODULE_4__["default"])(alg, key); - if (key.usages.includes('decrypt')) { - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__["default"].subtle.decrypt((0,_subtle_rsaes_js__WEBPACK_IMPORTED_MODULE_0__["default"])(alg), key, encryptedKey)); - } - if (key.usages.includes('unwrapKey')) { - const cryptoKeyCek = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__["default"].subtle.unwrapKey('raw', encryptedKey, key, (0,_subtle_rsaes_js__WEBPACK_IMPORTED_MODULE_0__["default"])(alg), ..._bogus_js__WEBPACK_IMPORTED_MODULE_1__["default"]); - return new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_2__["default"].subtle.exportKey('raw', cryptoKeyCek)); - } - throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation'); -}; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/runtime.js": -/*!***********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/runtime.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = ('WebCryptoAPI'); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/sign.js": -/*!********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/sign.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _subtle_dsa_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subtle_dsa.js */ "./node_modules/jose/dist/browser/runtime/subtle_dsa.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _check_key_length_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./check_key_length.js */ "./node_modules/jose/dist/browser/runtime/check_key_length.js"); -/* harmony import */ var _get_sign_verify_key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./get_sign_verify_key.js */ "./node_modules/jose/dist/browser/runtime/get_sign_verify_key.js"); - - - - -const sign = async (alg, key, data) => { - const cryptoKey = await (0,_get_sign_verify_key_js__WEBPACK_IMPORTED_MODULE_3__["default"])(alg, key, 'sign'); - (0,_check_key_length_js__WEBPACK_IMPORTED_MODULE_2__["default"])(alg, cryptoKey); - const signature = await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.sign((0,_subtle_dsa_js__WEBPACK_IMPORTED_MODULE_0__["default"])(alg, cryptoKey.algorithm), cryptoKey, data); - return new Uint8Array(signature); -}; -/* harmony default export */ __webpack_exports__["default"] = (sign); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/subtle_dsa.js": -/*!**************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/subtle_dsa.js ***! - \**************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ subtleDsa; } -/* harmony export */ }); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - -function subtleDsa(alg, algorithm) { - const hash = `SHA-${alg.slice(-3)}`; - switch (alg) { - case 'HS256': - case 'HS384': - case 'HS512': - return { hash, name: 'HMAC' }; - case 'PS256': - case 'PS384': - case 'PS512': - return { hash, name: 'RSA-PSS', saltLength: alg.slice(-3) >> 3 }; - case 'RS256': - case 'RS384': - case 'RS512': - return { hash, name: 'RSASSA-PKCS1-v1_5' }; - case 'ES256': - case 'ES384': - case 'ES512': - return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve }; - case 'EdDSA': - return { name: algorithm.name }; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/subtle_rsaes.js": -/*!****************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/subtle_rsaes.js ***! - \****************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": function() { return /* binding */ subtleRsaEs; } -/* harmony export */ }); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - -function subtleRsaEs(alg) { - switch (alg) { - case 'RSA-OAEP': - case 'RSA-OAEP-256': - case 'RSA-OAEP-384': - case 'RSA-OAEP-512': - return 'RSA-OAEP'; - default: - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/timing_safe_equal.js": -/*!*********************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/timing_safe_equal.js ***! - \*********************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -const timingSafeEqual = (a, b) => { - if (!(a instanceof Uint8Array)) { - throw new TypeError('First argument must be a buffer'); - } - if (!(b instanceof Uint8Array)) { - throw new TypeError('Second argument must be a buffer'); - } - if (a.length !== b.length) { - throw new TypeError('Input buffers must have the same length'); - } - const len = a.length; - let out = 0; - let i = -1; - while (++i < len) { - out |= a[i] ^ b[i]; - } - return out === 0; -}; -/* harmony default export */ __webpack_exports__["default"] = (timingSafeEqual); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/verify.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/verify.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _subtle_dsa_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./subtle_dsa.js */ "./node_modules/jose/dist/browser/runtime/subtle_dsa.js"); -/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js"); -/* harmony import */ var _check_key_length_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./check_key_length.js */ "./node_modules/jose/dist/browser/runtime/check_key_length.js"); -/* harmony import */ var _get_sign_verify_key_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./get_sign_verify_key.js */ "./node_modules/jose/dist/browser/runtime/get_sign_verify_key.js"); - - - - -const verify = async (alg, key, signature, data) => { - const cryptoKey = await (0,_get_sign_verify_key_js__WEBPACK_IMPORTED_MODULE_3__["default"])(alg, key, 'verify'); - (0,_check_key_length_js__WEBPACK_IMPORTED_MODULE_2__["default"])(alg, cryptoKey); - const algorithm = (0,_subtle_dsa_js__WEBPACK_IMPORTED_MODULE_0__["default"])(alg, cryptoKey.algorithm); - try { - return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.verify(algorithm, cryptoKey, signature, data); - } - catch (_a) { - return false; - } -}; -/* harmony default export */ __webpack_exports__["default"] = (verify); - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/webcrypto.js": -/*!*************************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/webcrypto.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ isCryptoKey: function() { return /* binding */ isCryptoKey; } -/* harmony export */ }); -/* harmony default export */ __webpack_exports__["default"] = (crypto); -const isCryptoKey = (key) => key instanceof CryptoKey; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/runtime/zlib.js": -/*!********************************************************!*\ - !*** ./node_modules/jose/dist/browser/runtime/zlib.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ deflate: function() { return /* binding */ deflate; }, -/* harmony export */ inflate: function() { return /* binding */ inflate; } -/* harmony export */ }); -/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - -const inflate = async () => { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `inflateRaw` decrypt option to provide Inflate Raw implementation.'); -}; -const deflate = async () => { - throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `deflateRaw` encrypt option to provide Deflate Raw implementation.'); -}; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/util/base64url.js": -/*!**********************************************************!*\ - !*** ./node_modules/jose/dist/browser/util/base64url.js ***! - \**********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ decode: function() { return /* binding */ decode; }, -/* harmony export */ encode: function() { return /* binding */ encode; } -/* harmony export */ }); -/* harmony import */ var _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js"); - -const encode = _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.encode; -const decode = _runtime_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode; - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/util/decode_jwt.js": -/*!***********************************************************!*\ - !*** ./node_modules/jose/dist/browser/util/decode_jwt.js ***! - \***********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ decodeJwt: function() { return /* binding */ decodeJwt; } -/* harmony export */ }); -/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/util/base64url.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); -/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./errors.js */ "./node_modules/jose/dist/browser/util/errors.js"); - - - - -function decodeJwt(jwt) { - if (typeof jwt !== 'string') - throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.JWTInvalid('JWTs must use Compact JWS serialization, JWT must be a string'); - const { 1: payload, length } = jwt.split('.'); - if (length === 5) - throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.JWTInvalid('Only JWTs using Compact JWS serialization can be decoded'); - if (length !== 3) - throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.JWTInvalid('Invalid JWT'); - if (!payload) - throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.JWTInvalid('JWTs must contain a payload'); - let decoded; - try { - decoded = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(payload); - } - catch (_a) { - throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.JWTInvalid('Failed to base64url decode the payload'); - } - let result; - try { - result = JSON.parse(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__.decoder.decode(decoded)); - } - catch (_b) { - throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.JWTInvalid('Failed to parse the decoded payload as JSON'); - } - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__["default"])(result)) - throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.JWTInvalid('Invalid JWT Claims Set'); - return result; -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/util/decode_protected_header.js": -/*!************************************************************************!*\ - !*** ./node_modules/jose/dist/browser/util/decode_protected_header.js ***! - \************************************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ decodeProtectedHeader: function() { return /* binding */ decodeProtectedHeader; } -/* harmony export */ }); -/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/util/base64url.js"); -/* harmony import */ var _lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/buffer_utils.js */ "./node_modules/jose/dist/browser/lib/buffer_utils.js"); -/* harmony import */ var _lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/is_object.js */ "./node_modules/jose/dist/browser/lib/is_object.js"); - - - -function decodeProtectedHeader(token) { - let protectedB64u; - if (typeof token === 'string') { - const parts = token.split('.'); - if (parts.length === 3 || parts.length === 5) { - ; - [protectedB64u] = parts; - } - } - else if (typeof token === 'object' && token) { - if ('protected' in token) { - protectedB64u = token.protected; - } - else { - throw new TypeError('Token does not contain a Protected Header'); - } - } - try { - if (typeof protectedB64u !== 'string' || !protectedB64u) { - throw new Error(); - } - const result = JSON.parse(_lib_buffer_utils_js__WEBPACK_IMPORTED_MODULE_1__.decoder.decode((0,_base64url_js__WEBPACK_IMPORTED_MODULE_0__.decode)(protectedB64u))); - if (!(0,_lib_is_object_js__WEBPACK_IMPORTED_MODULE_2__["default"])(result)) { - throw new Error(); - } - return result; - } - catch (_a) { - throw new TypeError('Invalid Token or Protected Header formatting'); - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/util/errors.js": -/*!*******************************************************!*\ - !*** ./node_modules/jose/dist/browser/util/errors.js ***! - \*******************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ JOSEAlgNotAllowed: function() { return /* binding */ JOSEAlgNotAllowed; }, -/* harmony export */ JOSEError: function() { return /* binding */ JOSEError; }, -/* harmony export */ JOSENotSupported: function() { return /* binding */ JOSENotSupported; }, -/* harmony export */ JWEDecryptionFailed: function() { return /* binding */ JWEDecryptionFailed; }, -/* harmony export */ JWEInvalid: function() { return /* binding */ JWEInvalid; }, -/* harmony export */ JWKInvalid: function() { return /* binding */ JWKInvalid; }, -/* harmony export */ JWKSInvalid: function() { return /* binding */ JWKSInvalid; }, -/* harmony export */ JWKSMultipleMatchingKeys: function() { return /* binding */ JWKSMultipleMatchingKeys; }, -/* harmony export */ JWKSNoMatchingKey: function() { return /* binding */ JWKSNoMatchingKey; }, -/* harmony export */ JWKSTimeout: function() { return /* binding */ JWKSTimeout; }, -/* harmony export */ JWSInvalid: function() { return /* binding */ JWSInvalid; }, -/* harmony export */ JWSSignatureVerificationFailed: function() { return /* binding */ JWSSignatureVerificationFailed; }, -/* harmony export */ JWTClaimValidationFailed: function() { return /* binding */ JWTClaimValidationFailed; }, -/* harmony export */ JWTExpired: function() { return /* binding */ JWTExpired; }, -/* harmony export */ JWTInvalid: function() { return /* binding */ JWTInvalid; } -/* harmony export */ }); -class JOSEError extends Error { - static get code() { - return 'ERR_JOSE_GENERIC'; - } - constructor(message) { - var _a; - super(message); - this.code = 'ERR_JOSE_GENERIC'; - this.name = this.constructor.name; - (_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor); - } -} -class JWTClaimValidationFailed extends JOSEError { - static get code() { - return 'ERR_JWT_CLAIM_VALIDATION_FAILED'; - } - constructor(message, claim = 'unspecified', reason = 'unspecified') { - super(message); - this.code = 'ERR_JWT_CLAIM_VALIDATION_FAILED'; - this.claim = claim; - this.reason = reason; - } -} -class JWTExpired extends JOSEError { - static get code() { - return 'ERR_JWT_EXPIRED'; - } - constructor(message, claim = 'unspecified', reason = 'unspecified') { - super(message); - this.code = 'ERR_JWT_EXPIRED'; - this.claim = claim; - this.reason = reason; - } -} -class JOSEAlgNotAllowed extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JOSE_ALG_NOT_ALLOWED'; - } - static get code() { - return 'ERR_JOSE_ALG_NOT_ALLOWED'; - } -} -class JOSENotSupported extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JOSE_NOT_SUPPORTED'; - } - static get code() { - return 'ERR_JOSE_NOT_SUPPORTED'; - } -} -class JWEDecryptionFailed extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWE_DECRYPTION_FAILED'; - this.message = 'decryption operation failed'; - } - static get code() { - return 'ERR_JWE_DECRYPTION_FAILED'; - } -} -class JWEInvalid extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWE_INVALID'; - } - static get code() { - return 'ERR_JWE_INVALID'; - } -} -class JWSInvalid extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWS_INVALID'; - } - static get code() { - return 'ERR_JWS_INVALID'; - } -} -class JWTInvalid extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWT_INVALID'; - } - static get code() { - return 'ERR_JWT_INVALID'; - } -} -class JWKInvalid extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWK_INVALID'; - } - static get code() { - return 'ERR_JWK_INVALID'; - } -} -class JWKSInvalid extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWKS_INVALID'; - } - static get code() { - return 'ERR_JWKS_INVALID'; - } -} -class JWKSNoMatchingKey extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWKS_NO_MATCHING_KEY'; - this.message = 'no applicable key found in the JSON Web Key Set'; - } - static get code() { - return 'ERR_JWKS_NO_MATCHING_KEY'; - } -} -class JWKSMultipleMatchingKeys extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWKS_MULTIPLE_MATCHING_KEYS'; - this.message = 'multiple matching keys found in the JSON Web Key Set'; - } - static get code() { - return 'ERR_JWKS_MULTIPLE_MATCHING_KEYS'; - } -} -Symbol.asyncIterator; -class JWKSTimeout extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWKS_TIMEOUT'; - this.message = 'request timed out'; - } - static get code() { - return 'ERR_JWKS_TIMEOUT'; - } -} -class JWSSignatureVerificationFailed extends JOSEError { - constructor() { - super(...arguments); - this.code = 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED'; - this.message = 'signature verification failed'; - } - static get code() { - return 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED'; - } -} - - -/***/ }), - -/***/ "./node_modules/jose/dist/browser/util/runtime.js": -/*!********************************************************!*\ - !*** ./node_modules/jose/dist/browser/util/runtime.js ***! - \********************************************************/ -/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/runtime.js */ "./node_modules/jose/dist/browser/runtime/runtime.js"); - -/* harmony default export */ __webpack_exports__["default"] = (_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__["default"]); - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/global */ -/******/ !function() { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ !function() { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ }(); -/******/ -/************************************************************************/ -/******/ -/******/ // startup -/******/ // Load entry module and return exports -/******/ // This entry module is referenced by other modules so it can't be inlined -/******/ var __webpack_exports__ = __webpack_require__("./src/remotestorage.ts"); -/******/ __webpack_exports__ = __webpack_exports__["default"]; -/******/ -/******/ return __webpack_exports__; -/******/ })() -; -}); -======= /*! For license information please see remotestorage.js.LICENSE.txt */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("RemoteStorage",[],t):"object"==typeof exports?exports.RemoteStorage=t():e.RemoteStorage=t()}(this,(function(){return function(){var e={548:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Access=void 0;class r{static _rs_init(){}constructor(){this.reset()}get scopes(){return Object.keys(this.scopeModeMap).map((e=>({name:e,mode:this.scopeModeMap[e]})))}get scopeParameter(){return this.scopes.map((e=>`${this._scopeNameForParameter(e)}:${e.mode}`)).join(" ")}claim(e,t){if("string"!=typeof e||-1!==e.indexOf("/")||0===e.length)throw new Error("Scope should be a non-empty string without forward slashes");if(!t.match(/^rw?$/))throw new Error("Mode should be either 'r' or 'rw'");this._adjustRootPaths(e),this.scopeModeMap[e]=t}get(e){return this.scopeModeMap[e]}remove(e){const t={};for(const e in this.scopeModeMap)t[e]=this.scopeModeMap[e];this.reset(),delete t[e];for(const e in t)this.claim(e,t[e])}checkPermission(e,t){const r=this.get(e);return r&&("r"===t||"rw"===r)}checkPathPermission(e,t){if(this.checkPermission("*",t))return!0;const r=this._getModuleName(e);return!!this.checkPermission(r,t)}reset(){this.rootPaths=[],this.scopeModeMap={}}_getModuleName(e){if("/"!==e[0])throw new Error("Path should start with a slash");const t=e.replace(/^\/public/,"").match(/^\/([^/]*)\//);return t?t[1]:"*"}_adjustRootPaths(e){"*"in this.scopeModeMap||"*"===e?this.rootPaths=["/"]:e in this.scopeModeMap||(this.rootPaths.push("/"+e+"/"),this.rootPaths.push("/public/"+e+"/"))}_scopeNameForParameter(e){if("*"===e.name&&this.storageType){if("2012.04"===this.storageType)return"";if(this.storageType.match(/remotestorage-0[01]/))return"root"}return e.name}setStorageType(e){this.storageType=e}}t.Access=r,t.default=r},275:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Authorize=void 0;const n=s(r(334)),i=r(746),a=s(r(503)),c=r(368);let l;function u(e){const t=e||h.getLocation().href,r={};for(const[e,o]of new URL(t).searchParams)r[e]=o;const o=t.indexOf("#");if(-1===o)return r;const s=t.substring(o+1);return s.includes("=")?s.split("&").reduce((function(e,t){const r=t.split("=");if("state"===r[0]&&r[1].match(/rsDiscovery/)){let t=decodeURIComponent(r[1]);const o=t.substr(t.indexOf("rsDiscovery=")).split("&")[0].split("=")[1];e.rsDiscovery=JSON.parse(atob(o)),t=t.replace(new RegExp("&?rsDiscovery="+o),""),t.length>0&&(e.state=t)}else e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]);return e}),r):r}class h{static authorize(e,t){if((0,n.default)("[Authorize] authURL = ",t.authURL,"scope = ",t.scope,"redirectUri = ",t.redirectUri,"clientId = ",t.clientId,"response_type =",t.response_type),!t.scope)throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?");if(!(0,i.localStorageAvailable)()&&"remotestorage"===e.backend){t.redirectUri+=t.redirectUri.indexOf("#")>0?"&":"#";const r={userAddress:e.remote.userAddress,href:e.remote.href,storageApi:e.remote.storageApi,properties:e.remote.properties};t.redirectUri+="rsDiscovery="+(0,i.toBase64)(JSON.stringify(r))}const r=function(e){const t=new URL(e.redirectUri);e.state||(e.state=t.hash?t.hash.substring(1):""),e.response_type||(e.response_type="token");const r=new URL(e.authURL);r.searchParams.set("redirect_uri",e.redirectUri.replace(/#.*$/,"")),r.searchParams.set("scope",e.scope),r.searchParams.set("client_id",e.clientId);for(const t of["state","response_type","code_challenge","code_challenge_method","token_access_type"]){const o=e[t];o&&r.searchParams.set(t,o)}return r.href}(t);i.globalContext.cordova?h.openWindow(r,t.redirectUri,"location=yes,clearsessioncache=yes,clearcache=yes").then((t=>{e.remote.configure({token:t.access_token})})):h.setLocation(r)}static refreshAccessToken(e,t,r){return o(this,void 0,void 0,(function*(){var e,o,s;yield t.configure({token:null,tokenType:null});const i=new URLSearchParams({grant_type:"refresh_token",client_id:t.clientId,refresh_token:r}),l=yield(0,c.requestWithTimeout)("POST",t.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:i.toString(),responseType:"json"});if(200!==(null==l?void 0:l.status))throw yield t.configure({refreshToken:null}),new a.default("refresh token rejected:"+JSON.stringify(l.response));{(0,n.default)(`[Authorize] access token good for ${null===(e=null==l?void 0:l.response)||void 0===e?void 0:e.expires_in} seconds`);const r={token:null===(o=null==l?void 0:l.response)||void 0===o?void 0:o.access_token,tokenType:null===(s=null==l?void 0:l.response)||void 0===s?void 0:s.token_type};if(!r.token)throw new Error(`no access_token in "successful" refresh: ${l.response}`);yield t.configure(r)}}))}static setLocation(e){if("string"==typeof e)document.location.href=e;else{if("object"!=typeof e)throw"Invalid location "+e;document.location=e}}static _rs_supported(){return"undefined"!=typeof document}static _rs_cleanup(e){e.removeEventListener("features-loaded",l)}}t.Authorize=h,h.IMPLIED_FAKE_TOKEN=!1,h.getLocation=function(){return document.location},h.openWindow=function(e,t,r){return new Promise(((o,s)=>{const n=open(e,"_blank",r);function i(){s("Authorization was canceled")}n&&!n.closed?(n.addEventListener("loadstart",(function(e){if(0!==e.url.indexOf(t))return;n.removeEventListener("exit",i),n.close();const r=u(e.url);r?o(r):s("Authorization error")})),n.addEventListener("exit",i)):s("Authorization popup was blocked")}))},h._rs_init=function(e){const t=u();let r;t&&(r=h.getLocation(),r.hash=""),l=function(){let s=!1;if(t){if(t.error)throw"access_denied"===t.error?new a.default("Authorization failed: access denied",{code:"access_denied"}):new a.default(`Authorization failed: ${t.error}`);t.rsDiscovery&&e.remote.configure(t.rsDiscovery),t.access_token&&(e.remote.configure({token:t.access_token}),s=!0),t.remotestorage&&(e.connect(t.remotestorage),s=!0),t.state&&(r=h.getLocation(),h.setLocation(r.href.split("#")[0]+"#"+t.state)),t.code&&(function(t){o(this,void 0,void 0,(function*(){var o,s,i,a;const l=sessionStorage.getItem("remotestorage:codeVerifier");if(!l)return void(0,n.default)("[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage");r=h.getLocation();let u=r.origin;"/"!==r.pathname&&(u+=r.pathname);const d=new URLSearchParams({code:t,grant_type:"authorization_code",client_id:e.remote.clientId,redirect_uri:u,code_verifier:l}),f=yield(0,c.requestWithTimeout)("POST",e.remote.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:d.toString(),responseType:"json"});if(200===f.status){(0,n.default)(`[Authorize] access token good for ${null===(o=null==f?void 0:f.response)||void 0===o?void 0:o.expires_in} seconds`);const t={token:null===(s=null==f?void 0:f.response)||void 0===s?void 0:s.access_token,refreshToken:null===(i=null==f?void 0:f.response)||void 0===i?void 0:i.refresh_token,tokenType:null===(a=null==f?void 0:f.response)||void 0===a?void 0:a.token_type};t.token?e.remote.configure(t):e._emit("error",new Error(`no access_token in "successful" response: ${f.response}`)),sessionStorage.removeItem("remotestorage:codeVerifier")}else e._emit("error",new Error(`${f.statusText}: ${f.response}`))}))}(t.code),s=!0),s||e.remote.stopWaitingForToken()}else e.remote.stopWaitingForToken()},e.on("features-loaded",l)},t.default=h},424:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClient=void 0;const n=s(r(439)),i=s(r(613)),a=s(r(491)),c=s(r(93)),l=s(r(28)),u=r(746);class h{constructor(e,t){if(this.schemas={configurable:!0,get(){return h.Types.inScope(this.moduleName)}},"/"!==t[t.length-1])throw"Not a folder: "+t;"/"===t&&(this.makePath=e=>("/"===e[0]?"":"/")+e),this.storage=e,this.base=t,this.moduleName=function(e){const t=e.split("/");return e.length>2?t[1]:"root"}(this.base),this.addEvents(["change"]),this.on=this.on.bind(this),e.onChange(this.base,this._fireChange.bind(this))}scope(e){return new h(this.storage,this.makePath(e))}getListing(e,t){return o(this,void 0,void 0,(function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then((e=>404===e.statusCode?{}:e.body))}))}getAll(e,t){return o(this,void 0,void 0,(function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then((r=>{if(404===r.statusCode)return{};if("object"==typeof r.body){const o=Object.keys(r.body);if(0===o.length)return{};const s=o.map((o=>this.storage.get(this.makePath(e+o),t).then((e=>{if("string"==typeof e.body)try{e.body=JSON.parse(e.body)}catch(e){}"object"==typeof e.body&&(r.body[o]=e.body)}))));return Promise.all(s).then((()=>r.body))}}))}))}getFile(e,t){return o(this,void 0,void 0,(function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getFile must be a string"):this.storage.get(this.makePath(e),t).then((e=>({data:e.body,contentType:e.contentType,revision:e.revision})))}))}storeFile(e,t,r){return o(this,void 0,void 0,(function*(){return"string"!=typeof e?Promise.reject("Argument 'mimeType' of baseClient.storeFile must be a string"):"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.storeFile must be a string"):"string"!=typeof r&&"object"!=typeof r?Promise.reject("Argument 'body' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView"):(this.storage.access.checkPathPermission(this.makePath(t),"rw")||console.warn("WARNING: Editing a document to which only read access ('r') was claimed"),this.storage.put(this.makePath(t),r,e).then((e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode))))}))}getObject(e,t){return o(this,void 0,void 0,(function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getObject must be a string"):this.storage.get(this.makePath(e),t).then((t=>{if("object"==typeof t.body)return t.body;if("string"==typeof t.body)try{return JSON.parse(t.body)}catch(t){throw new Error("Not valid JSON: "+this.makePath(e))}else if(void 0!==t.body&&200===t.statusCode)return Promise.reject("Not an object: "+this.makePath(e))}))}))}storeObject(e,t,r){return o(this,void 0,void 0,(function*(){if("string"!=typeof e)return Promise.reject("Argument 'typeAlias' of baseClient.storeObject must be a string");if("string"!=typeof t)return Promise.reject("Argument 'path' of baseClient.storeObject must be a string");if("object"!=typeof r)return Promise.reject("Argument 'object' of baseClient.storeObject must be an object");this._attachType(r,e);try{const e=this.validate(r);if(!e.valid)return Promise.reject(e)}catch(e){return Promise.reject(e)}return this.storage.put(this.makePath(t),JSON.stringify(r),"application/json; charset=UTF-8").then((e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode)))}))}remove(e){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.remove must be a string"):(this.storage.access.checkPathPermission(this.makePath(e),"rw")||console.warn("WARNING: Removing a document to which only read access ('r') was claimed"),this.storage.delete(this.makePath(e)))}getItemURL(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.getItemURL must be a string";return this.storage.connected?(e=(0,u.cleanPath)(this.makePath(e)),this.storage.remote.href+e):void 0}cache(e,t="ALL"){if("string"!=typeof e)throw"Argument 'path' of baseClient.cache must be a string";if("string"!=typeof t)throw"Argument 'strategy' of baseClient.cache must be a string or undefined";if("FLUSH"!==t&&"SEEN"!==t&&"ALL"!==t)throw'Argument \'strategy\' of baseclient.cache must be one of ["FLUSH", "SEEN", "ALL"]';return this.storage.caching.set(this.makePath(e),t),this}declareType(e,t,r){let o;if(r&&"string"==typeof t)o=t;else if(r||"string"==typeof t){if(!r&&"string"==typeof t)throw new Error("declareType() requires a JSON Schema object to be passed, in order to validate object types/formats")}else r=t,o=this._defaultTypeURI(e);h.Types.declare(this.moduleName,e,o,r)}validate(e){const t=h.Types.getSchema(e["@context"]);if(t)return n.default.validateResult(e,t);throw new a.default(e["@context"])}_defaultTypeURI(e){return"http://remotestorage.io/spec/modules/"+encodeURIComponent(this.moduleName)+"/"+encodeURIComponent(e)}_attachType(e,t){e["@context"]=h.Types.resolveAlias(this.moduleName+"/"+t)||this._defaultTypeURI(t)}makePath(e){return this.base+(e||"")}_fireChange(e){l.default.changeEvents[e.origin]&&(["new","old","lastCommon"].forEach((function(t){if((!e[t+"ContentType"]||/^application\/(.*)json(.*)/.exec(e[t+"ContentType"]))&&"string"==typeof e[t+"Value"])try{e[t+"Value"]=JSON.parse(e[t+"Value"])}catch(e){}})),this._emit("change",e))}static _rs_init(){}}t.BaseClient=h,h.Types=i.default,(0,u.applyMixins)(h,[c.default]),t.default=h},285:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Caching=void 0;const s=r(746),n=o(r(334));class i{constructor(){this.pendingActivations=[],this.reset()}set(e,t){if("string"!=typeof e)throw new Error("path should be a string");if(!(0,s.isFolder)(e))throw new Error("path should be a folder");if(!t.match(/^(FLUSH|SEEN|ALL)$/))throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'");this._rootPaths[e]=t,"ALL"===t&&(this.activateHandler?this.activateHandler(e):this.pendingActivations.push(e))}enable(e){this.set(e,"ALL")}disable(e){this.set(e,"FLUSH")}onActivate(e){(0,n.default)("[Caching] Setting activate handler",e,this.pendingActivations),this.activateHandler=e;for(let t=0;t{const s=l(o[e]);return u(o,t)?r(e):s?{statusCode:200,body:s.body||s.itemsMap,contentType:s.contentType}:{statusCode:404}})):this.getNodes([e]).then((t=>{const r=l(t[e]);if(r){if((0,c.isFolder)(e))for(const e in r.itemsMap)r.itemsMap.hasOwnProperty(e)&&!1===r.itemsMap[e]&&delete r.itemsMap[e];return{statusCode:200,body:r.body||r.itemsMap,contentType:r.contentType}}return{statusCode:404}}))}))}put(e,t,r){return o(this,void 0,void 0,(function*(){const o=(0,c.pathsFromRoot)(e);return this._updateNodes(o,(function(e,o){try{for(let s=0,n=e.length;s0)break}else console.error("Cannot delete non-existing node "+o)}return t}))}flush(e){return this._getAllDescendentPaths(e).then((e=>this.getNodes(e))).then((e=>{for(const t in e){const r=e[t];r&&r.common&&r.local&&this._emitChange({path:r.path,origin:"local",oldValue:!1===r.local.body?void 0:r.local.body,newValue:!1===r.common.body?void 0:r.common.body}),e[t]=void 0}return this.setNodes(e)}))}_emitChange(e){i.default.changeEvents[e.origin]&&this._emit("change",e)}fireInitial(){i.default.changeEvents.local&&this.forAllNodes((e=>{if((0,c.isDocument)(e.path)){const t=l(e);t&&this._emitChange({path:e.path,origin:"local",oldValue:void 0,oldContentType:void 0,newValue:t.body,newContentType:t.contentType})}})).then((()=>{this._emit("local-events-done")}))}onDiff(e){this.diffHandler=e}migrate(e){return"object"!=typeof e||e.common||(e.common={},"string"==typeof e.path?"/"===e.path.substr(-1)&&"object"==typeof e.body&&(e.common.itemsMap=e.body):(e.local||(e.local={}),e.local.body=e.body,e.local.contentType=e.contentType)),e}_updateNodes(e,t){return new Promise(((r,o)=>{this._doUpdateNodes(e,t,{resolve:r,reject:o})}))}_doUpdateNodes(e,t,r){this._updateNodesRunning?this._updateNodesQueued.push({paths:e,cb:t,promise:r}):(this._updateNodesRunning=!0,this.getNodes(e).then((o=>{const s=(0,c.deepClone)(o),n=[];o=t(e,o);for(const e in o){const t=o[e];(0,c.equal)(t,s[e])?delete o[e]:(0,c.isDocument)(e)&&((0,c.equal)(t.local.body,t.local.previousBody)&&t.local.contentType===t.local.previousContentType||n.push({path:e,origin:"window",oldValue:t.local.previousBody,newValue:!1===t.local.body?void 0:t.local.body,oldContentType:t.local.previousContentType,newContentType:t.local.contentType}),delete t.local.previousBody,delete t.local.previousContentType)}this.setNodes(o).then((()=>{this._emitChangeEvents(n),r.resolve({statusCode:200})}))})).then((()=>Promise.resolve()),(e=>{r.reject(e)})).then((()=>{this._updateNodesRunning=!1;const e=this._updateNodesQueued.shift();e&&this._doUpdateNodes(e.paths,e.cb,e.promise)})))}_emitChangeEvents(e){for(let t=0,r=e.length;t{const r=[e],o=l(t[e]),s=Object.keys(o.itemsMap).map((t=>this._getAllDescendentPaths(e+t).then((e=>{for(let t=0,o=e.length;tr))})):Promise.resolve([e])}_getInternals(){return{getLatest:l,makeNode:h,isOutdated:u}}}(0,c.applyMixins)(f,[n.default]),e.exports=f},28:function(e){"use strict";e.exports={cache:!0,changeEvents:{local:!0,window:!1,remote:!0,conflict:!0},cordovaRedirectUri:void 0,logging:!1,modules:[],backgroundSyncInterval:6e4,disableFeatures:[],discoveryTimeout:5e3,isBackground:!1,requestTimeout:3e4,syncInterval:1e4}},373:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const s=o(r(199)),n=o(r(28)),i=o(r(334)),a=r(746);let c;const l="remotestorage:discover";let u={};const h=function(e){return new Promise(((t,r)=>{if(e in u)return t(u[e]);const o=new s.default({tls_only:!1,uri_fallback:!0,request_timeout:n.default.discoveryTimeout});return setTimeout((()=>r(new Error("timed out"))),n.default.discoveryTimeout),o.lookup(e,(function(o,s){if(o)return r(o);if("object"!=typeof s.idx.links.remotestorage||"number"!=typeof s.idx.links.remotestorage.length||s.idx.links.remotestorage.length<=0)return(0,i.default)("[Discover] WebFinger record for "+e+" does not have remotestorage defined in the links section ",JSON.stringify(s.json)),r("WebFinger record for "+e+" does not have remotestorage defined in the links section.");const n=s.idx.links.remotestorage[0],a=n.properties["http://tools.ietf.org/html/rfc6749#section-4.2"]||n.properties["auth-endpoint"],h=n.properties["http://remotestorage.io/spec/version"]||n.type;return u[e]={href:n.href,storageApi:h,authURL:a,properties:n.properties},c&&localStorage.setItem(l,JSON.stringify({cache:u})),t(u[e])}))}))};(h.DiscoveryError=function(e){this.name="DiscoveryError",this.message=e,this.stack=(new Error).stack}).prototype=Object.create(Error.prototype),h.DiscoveryError.prototype.constructor=h.DiscoveryError,h._rs_init=function(){if(c=(0,a.localStorageAvailable)(),c)try{const e=JSON.parse(localStorage[l]);u=e.cache}catch(e){}},h._rs_supported=function(){return Object.prototype.hasOwnProperty.call(a.globalContext,"fetch")||Object.prototype.hasOwnProperty.call(a.globalContext,"XMLHttpRequest")},h._rs_cleanup=function(){c&&delete localStorage[l]},e.exports=h},706:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const n=s(r(93)),i=s(r(424)),a=s(r(941)),c=s(r(982)),l=s(r(503)),u=r(746),h=r(368),d=r(684),f=s(r(275));let p;const m="remotestorage:dropbox",g="https://api.dropboxapi.com/2/files/list_folder",y="https://api.dropboxapi.com/2/files/list_folder/continue",v="/remotestorage";function _(e){return(v+"/"+e).replace(/\/+$/,"").replace(/\/+/g,"/")}const b=/[\u007f-\uffff]/g;function w(e){return JSON.stringify(e).replace(b,(function(e){return"\\u"+("000"+e.charCodeAt(0).toString(16)).slice(-4)}))}function P(e,t){return new RegExp("^"+t.join("\\/")+"(\\/|$)").test(e.error_summary)}function T(e){return e instanceof ArrayBuffer||(0,h.isArrayBufferView)(e)}class E extends d.RemoteBase{constructor(e){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this._initialFetchDone=!1,this.addEvents(["connected","not-connected"]),this.clientId=e.apiKeys.dropbox.appKey,this.TOKEN_URL="https://api.dropboxapi.com/oauth2/token",this._revCache=new a.default("rev"),this._fetchDeltaCursor=null,this._fetchDeltaPromise=null,this._itemRefs={},p=(0,u.localStorageAvailable)(),p){const e=(0,u.getJSONFromLocalStorage)(m);e&&this.configure(e),this._itemRefs=(0,u.getJSONFromLocalStorage)(`${m}:shares`)||{}}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}connect(){return o(this,void 0,void 0,(function*(){try{if(this.rs.setBackend("dropbox"),this.token)A(this.rs);else{const{codeVerifier:e,codeChallenge:t,state:r}=yield(0,u.generateCodeVerifier)();sessionStorage.setItem("remotestorage:codeVerifier",e),sessionStorage.setItem("remotestorage:state",r),this.rs.authorize({authURL:"https://www.dropbox.com/oauth2/authorize",scope:"account_info.read files.content.read files.content.write files.metadata.read files.metadata.write",clientId:this.clientId,response_type:"code",state:r,code_challenge:t,code_challenge_method:"S256",token_access_type:"offline"})}}catch(e){throw this.rs._emit("error",e),this.rs.setBackend(void 0),e}}))}configure(e){return o(this,void 0,void 0,(function*(){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token),void 0!==e.refreshToken&&(this.refreshToken=e.refreshToken),void 0!==e.tokenType&&(this.tokenType=e.tokenType);const t=()=>{p&&localStorage.setItem(m,JSON.stringify({userAddress:this.userAddress,token:this.token,refreshToken:this.refreshToken,tokenType:this.tokenType}))};if(this.refreshToken||this.token)if(this.connected=!0,this.userAddress)this._emit("connected"),t();else try{const e=yield this.info();this.userAddress=e.email,this._emit("connected"),t()}catch(e){this.connected=!1,this.rs._emit("error",new Error("Could not fetch user info.")),t.apply(this)}else(()=>{this.connected=!1,p&&localStorage.removeItem(m),this.rs.setBackend(void 0)})()}))}_getFolder(e){const t=this._revCache,r=r=>{let s;if(200!==r.status&&409!==r.status)return Promise.reject("Unexpected response status: "+r.status);try{s=JSON.parse(r.responseText)}catch(e){return Promise.reject(e)}if(409===r.status)return P(s,["path","not_found"])?Promise.resolve({}):Promise.reject(new Error("API returned an error: "+s.error_summary));const n=s.entries.reduce(((r,o)=>{try{const s="folder"===o[".tag"],n=o.path_display.split("/").slice(-1)[0]+(s?"/":"");if(s)r[n]={ETag:t.get(e+n)};else{const t=new Date(o.server_modified);r[n]={ETag:o.rev,"Content-Length":o.size,"Last-Modified":t.toUTCString()},this._revCache.set(e+n,o.rev)}}catch(t){console.error(`[Dropbox] folder “${e}” has entry ${JSON.stringify(o)}:`,t)}return r}),{});return s.has_more?o(s.cursor).then((function(e){return Object.assign(n,e)})):Promise.resolve(n)},o=e=>{const t={body:{cursor:e}};return this._request("POST",y,t).then(r)};return this._request("POST",g,{body:{path:_(e)}}).then(r).then((function(r){return Promise.resolve({statusCode:200,body:r,contentType:"application/json; charset=UTF-8",revision:t.get(e)})}))}get(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const r=this._revCache.get(e);if(null===r)return Promise.resolve({statusCode:404});if(t&&t.ifNoneMatch){if(!this._initialFetchDone)return this.fetchDelta().then((()=>this.get(e,t)));if(r&&r===t.ifNoneMatch)return Promise.resolve({statusCode:304})}if("/"===e.slice(-1))return this._getFolder(e);const o={headers:{"Dropbox-API-Arg":w({path:_(e)})},responseType:"arraybuffer"};return t&&t.ifNoneMatch&&(o.headers["If-None-Match"]=t.ifNoneMatch),this._request("GET","https://content.dropboxapi.com/2/files/download",o).then((t=>{const r=t.status;let o,s,n,i;return 200!==r&&409!==r?Promise.resolve({statusCode:r}):(o=t.getResponseHeader("Dropbox-API-Result"),(0,u.getTextFromArrayBuffer)(t.response,"UTF-8").then((a=>{s=a,409===r&&(o=s);try{o=JSON.parse(o)}catch(e){return Promise.reject(e)}if(409===r)return P(o,["path","not_found"])?{statusCode:404}:Promise.reject(new Error('API error while downloading file ("'+e+'"): '+o.error_summary));if(n=t.getResponseHeader("Content-Type"),i=o.rev,this._revCache.set(e,i),this._shareIfNeeded(e),(0,u.shouldBeTreatedAsBinary)(a,n))s=t.response;else try{s=JSON.parse(s),n="application/json; charset=UTF-8"}catch(e){}return{statusCode:r,body:s,contentType:n,revision:i}})))}))}put(e,t,r){return o(this,arguments,void 0,(function*(e,t,r,o={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const s=this._revCache.get(e);if(o&&o.ifMatch&&s&&s!==o.ifMatch)return{statusCode:412,revision:s};if(o&&"*"===o.ifNoneMatch&&s&&"rev"!==s)return{statusCode:412,revision:s};if(!r.match(/charset=/)&&T(t)&&(r+="; charset=binary"),t.length>157286400)throw new Error("Cannot upload file larger than 150MB");const n={body:t,contentType:r,path:e};if(o&&(o.ifMatch||"*"===o.ifNoneMatch)){const t=yield this._getMetadata(e);if(o&&"*"===o.ifNoneMatch&&t)return{statusCode:412,revision:t.rev};if(o&&o.ifMatch&&t&&t.rev!==o.ifMatch)return{statusCode:412,revision:t.rev}}const i=yield this._uploadSimple(n);return this._shareIfNeeded(e),i}))}delete(e){return o(this,arguments,void 0,(function*(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const r=this._revCache.get(e);if((null==t?void 0:t.ifMatch)&&r&&t.ifMatch!==r)return{statusCode:412,revision:r};if(null==t?void 0:t.ifMatch){const r=yield this._getMetadata(e);if((null==t?void 0:t.ifMatch)&&r&&r.rev!==t.ifMatch)return{statusCode:412,revision:r.rev}}return this._deleteSimple(e)}))}_shareIfNeeded(e){if(e.match(/^\/public\/.*[^/]$/)&&void 0===this._itemRefs[e])return this.share(e)}share(e){const t={body:{path:_(e)}};return this._request("POST","https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings",t).then((t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status:"+t.status));let r;try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?P(r,["shared_link_already_exists"])?this._getSharedLink(e):Promise.reject(new Error("API error: "+r.error_summary)):Promise.resolve(r.url)})).then((t=>(this._itemRefs[e]=t,p&&localStorage.setItem(m+":shares",JSON.stringify(this._itemRefs)),Promise.resolve(t))),(t=>(t.message='Sharing Dropbox file or folder ("'+e+'") failed: '+t.message,Promise.reject(t))))}info(){return this._request("POST","https://api.dropboxapi.com/2/users/get_current_account",{}).then((function(e){let t;try{const r=JSON.parse(e.responseText);t=null==r?void 0:r.email}catch(t){return Promise.reject(new Error("Could not query current account info: Invalid API response: "+e.responseText))}return Promise.resolve({email:t})}))}_request(e,t,r){return o(this,arguments,void 0,(function*(e,t,r,o=1){if(this.isForbiddenRequestMethod(e,t))throw`Don't use ${e} on directories!`;if(!this.token)throw new l.default("No access token");r.headers||(r.headers={}),r.headers.Authorization="Bearer "+this.token,"object"!=typeof r.body||T(r.body)||(r.body=JSON.stringify(r.body),r.headers["Content-Type"]="application/json; charset=UTF-8"),this.rs._emit("wire-busy",{method:e,isFolder:(0,u.isFolder)(t)});try{const s=yield(0,h.requestWithTimeout)(e,t,r);return this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!0}),401===(null==s?void 0:s.status)&&this.refreshToken?o>=3?(console.error(`Abandoned after ${o} attempts: ${e} ${t}`),s):(this.rs._emit("wire-busy",{method:e,isFolder:(0,u.isFolder)(t)}),yield f.default.refreshAccessToken(this.rs,this,this.refreshToken),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!0}),this._request(e,t,r,o+1)):[503,429].includes(null==s?void 0:s.status)?(this.online&&(this.online=!1,this.rs._emit("network-offline")),o>=3?(console.warn(`Abandoned after ${o} attempts: ${e} ${t}`),s):(yield new Promise((e=>setTimeout(e,(0,h.retryAfterMs)(s)))),this._request(e,t,r,o+1))):s}catch(r){throw this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!1}),r}}))}fetchDelta(...e){if(this._fetchDeltaPromise)return this._fetchDeltaPromise;const t=e=>o(this,void 0,void 0,(function*(){let r,o;"string"==typeof e?(r=y,o={cursor:e}):(r=g,o={path:v,recursive:!0,include_deleted:!0});try{const s=yield this._request("POST",r,{body:o});if(401===s.status)throw new l.default;if(200!==s.status&&409!==s.status)throw new Error("Invalid response status: "+s.status);let n;try{n=JSON.parse(s.responseText)}catch(e){throw new Error("Invalid response body: "+s.responseText)}if(409===s.status){if(!P(n,["path","not_found"]))throw new Error("API returned an error: "+n.error_summary);n={cursor:null,entries:[],has_more:!1}}if(e||this._revCache.deactivatePropagation(),n.entries.forEach((e=>{const t=e.path_display.slice(14);"deleted"===e[".tag"]?(this._revCache.delete(t),this._revCache.delete(t+"/")):"file"===e[".tag"]&&this._revCache.set(t,e.rev)})),this._fetchDeltaCursor=n.cursor,n.has_more)return t(n.cursor);this._revCache.activatePropagation(),this._initialFetchDone=!0}catch(e){if("timeout"===e)return;throw e}}));return this._fetchDeltaPromise=t(this._fetchDeltaCursor).catch((e=>("object"==typeof e&&"message"in e?e.message="Dropbox: fetchDelta: "+e.message:e=`Dropbox: fetchDelta: ${e}`,this.rs._emit("error",e),this._fetchDeltaPromise=null,Promise.reject(e)))).then((()=>(this._fetchDeltaPromise=null,Promise.resolve(e)))),this._fetchDeltaPromise}_getMetadata(e){const t={path:_(e)};return this._request("POST","https://api.dropboxapi.com/2/files/get_metadata",{body:t}).then((e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status:"+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?P(t,["path","not_found"])?Promise.resolve():Promise.reject(new Error("API error: "+t.error_summary)):Promise.resolve(t)})).then(void 0,(t=>(t.message='Could not load metadata for file or folder ("'+e+'"): '+t.message,Promise.reject(t))))}_uploadSimple(e){const t={path:_(e.path),mode:{".tag":"overwrite",update:void 0},mute:!0};return e.ifMatch&&(t.mode={".tag":"update",update:e.ifMatch}),this._request("POST","https://content.dropboxapi.com/2/files/upload",{body:e.body,headers:{"Content-Type":"application/octet-stream","Dropbox-API-Arg":w(t)}}).then((t=>{if(200!==t.status&&409!==t.status)return Promise.resolve({statusCode:t.status});let r;try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid API result: "+t.responseText))}return 409===t.status?P(r,["path","conflict"])?this._getMetadata(e.path).then((function(e){return Promise.resolve({statusCode:412,revision:e.rev})})):(this.rs._emit("error",new Error(r.error_summary)),Promise.resolve({statusCode:t.status})):(this._revCache.set(e.path,r.rev),Promise.resolve({statusCode:t.status,revision:r.rev}))}))}_deleteSimple(e){const t={path:_(e)};return this._request("POST","https://api.dropboxapi.com/2/files/delete",{body:t}).then((e=>{if(200!==e.status&&409!==e.status)return Promise.resolve({statusCode:e.status});let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}if(409===e.status){if(P(t,["path_lookup","not_found"]))return Promise.resolve({statusCode:404});this.rs._emit("error",new Error(t.error_summary))}return Promise.resolve({statusCode:e.status})})).then((t=>(200!==t.statusCode&&404!==t.statusCode||(this._revCache.delete(e),delete this._itemRefs[e]),Promise.resolve(t))),(t=>(t.message='Could not delete Dropbox file or folder ("'+e+'"): '+t.message,Promise.reject(t))))}_getSharedLink(e){return o(this,void 0,void 0,(function*(){const t={body:{path:_(e),direct_only:!0}};return this._request("POST","https://api.dropbox.com/2/sharing/list_shared_links",t).then((e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status: "+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?Promise.reject(new Error("API error: "+(null==t?void 0:t.error_summary)||0)):t.links.length?Promise.resolve(t.links[0].url):Promise.reject(new Error("No links returned"))}),(t=>(t.message='Could not get link to a shared file or folder ("'+e+'"): '+t.message,Promise.reject(t))))}))}static _rs_init(e){p=(0,u.localStorageAvailable)(),e.apiKeys.dropbox&&(e.dropbox=new E(e)),"dropbox"===e.backend&&A(e)}static _rs_supported(){return!0}static _rs_cleanup(e){!function(e){(function(e){e._origRemote&&(e.remote=e._origRemote,delete e._origRemote)})(e),function(e){e._dropboxOrigSync&&(e.sync.sync=e._dropboxOrigSync,delete e._dropboxOrigSync)}(e),function(e){e._origBaseClientGetItemURL&&(i.default.prototype.getItemURL=e._origBaseClientGetItemURL,delete e._origBaseClientGetItemURL)}(e),S(e)}(e),p&&localStorage.removeItem(m),e.setBackend(void 0)}}function k(e,...t){e._dropboxOrigSync||(e._dropboxOrigSync=e.sync.sync.bind(e.sync),e.sync.sync=function(){return this.dropbox.fetchDelta(e,...t).then(e._dropboxOrigSync,(function(t){e._emit("error",new c.default(t)),e._emit("sync-done")}))}.bind(e))}function S(e){e._dropboxOrigSyncCycle&&(e.syncCycle=e._dropboxOrigSyncCycle,delete e._dropboxOrigSyncCycle)}function A(e){!function(e){e._origRemote||(e._origRemote=e.remote,e.remote=e.dropbox)}(e),e.sync?k(e):function(e,...t){e._dropboxOrigSyncCycle||(e._dropboxOrigSyncCycle=e.syncCycle,e.syncCycle=()=>{if(!e.sync)throw new Error("expected sync to be initialized by now");k(e),e._dropboxOrigSyncCycle(e,...t),S(e)})}(e),function(e){e._origBaseClientGetItemURL||(e._origBaseClientGetItemURL=i.default.prototype.getItemURL,i.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Dropbox yet")})}(e)}(0,u.applyMixins)(E,[n.default]),e.exports=E},451:function(e,t,r){"use strict";const o=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(93)),s=r(746);class n{constructor(){this.addEvents(["background","foreground"]),this.mode="undefined"!=typeof window?"browser":"node","browser"===this.mode&&(this.setBrowserPrefixedNames(),document.addEventListener(this.visibilityChangeEvent,this.setVisibility.bind(this),!1),this.setVisibility())}setBrowserPrefixedNames(){"browser"===this.mode&&(void 0!==document.hidden?(this.hiddenProperty="hidden",this.visibilityChangeEvent="visibilitychange"):void 0!==document.mozHidden?(this.hiddenProperty="mozHidden",this.visibilityChangeEvent="mozvisibilitychange"):void 0!==document.msHidden?(this.hiddenProperty="msHidden",this.visibilityChangeEvent="msvisibilitychange"):void 0!==document.webkitHidden&&(this.hiddenProperty="webkitHidden",this.visibilityChangeEvent="webkitvisibilitychange"))}setVisibility(){document[this.hiddenProperty]?this.goBackground():this.goForeground()}isBrowser(){return"browser"===this.mode}isNode(){return"node"===this.mode}goBackground(){this._emit("background")}goForeground(){this._emit("foreground")}static _rs_init(){}static _rs_cleanup(){}}(0,s.applyMixins)(n,[o.default]),e.exports=n},93:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventHandling=void 0;const s=o(r(334));class n{addEvents(e){e.forEach((e=>this._addEvent(e)))}addEventListener(e,t){if("string"!=typeof e)throw new Error("Argument eventName should be a string");if("function"!=typeof t)throw new Error("Argument handler should be a function");(0,s.default)("[EventHandling] Adding event listener",e),this._validateEvent(e),this._handlers[e].push(t)}on(e,t){return this.addEventListener(e,t)}removeEventListener(e,t){this._validateEvent(e);const r=this._handlers[e].length;for(let o=0;o{e.apply(this,t)}))}_validateEvent(e){if(!(e in this._handlers))throw new Error("Unknown event: "+e)}_delegateEvent(e,t){t.on(e,(t=>{this._emit(e,t)}))}_addEvent(e){void 0===this._handlers&&(this._handlers={}),this._handlers[e]=[]}}t.EventHandling=n,t.default=n},545:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const s=o(r(28)),n=o(r(451)),i=o(r(334)),a=r(746),c=o(r(370)),l=o(r(548)),u=o(r(275)),h=o(r(373)),d=o(r(424)),f=o(r(801)),p=o(r(706)),m=o(r(600)),g=o(r(313)),y=o(r(285)),v=o(r(567)),_=o(r(794)),b=o(r(365)),w={features:[],featuresDone:0,readyFired:!1,loadFeatures(){this.features=[],this.featuresDone=0,this.readyFired=!1,this.featureModules={WireClient:m.default,Dropbox:p.default,GoogleDrive:f.default,Access:l.default,Discover:h.default,Authorize:u.default,BaseClient:d.default,Env:n.default},s.default.cache&&(0,a.extend)(this.featureModules,{Caching:y.default,IndexedDB:v.default,LocalStorage:_.default,InMemoryStorage:b.default,Sync:g.default}),s.default.disableFeatures.forEach((e=>{this.featureModules[e]&&delete this.featureModules[e]})),this._allLoaded=!1;for(const e in this.featureModules)this.loadFeature(e)},hasFeature(e){for(let t=this.features.length-1;t>=0;t--)if(this.features[t].name===e)return this.features[t].supported;return!1},loadFeature(e){const t=this.featureModules[e],r=!t._rs_supported||t._rs_supported();(0,i.default)(`[RemoteStorage] [FEATURE ${e}] initializing ...`),"object"==typeof r?r.then((()=>{this.featureSupported(e,!0),this.initFeature(e)}),(()=>{this.featureSupported(e,!1)})):"boolean"==typeof r?(this.featureSupported(e,r),r&&this.initFeature(e)):this.featureSupported(e,!1)},initFeature(e){const t=this.featureModules[e];let r;try{r=t._rs_init(this)}catch(t){return void this.featureFailed(e,t)}"object"==typeof r&&"function"==typeof r.then?r.then((()=>{this.featureInitialized(e)}),(t=>{this.featureFailed(e,t)})):this.featureInitialized(e)},featureFailed(e,t){(0,i.default)(`[RemoteStorage] [FEATURE ${e}] initialization failed (${t})`),this.featureDone()},featureSupported(e,t){(0,i.default)(`[RemoteStorage] [FEATURE ${e}]${t?"":"not "} supported`),t||this.featureDone()},featureInitialized(e){(0,i.default)(`[RemoteStorage] [FEATURE ${e}] initialized`),this.features.push({name:e,init:this.featureModules[e]._rs_init,supported:!0,cleanup:this.featureModules[e]._rs_cleanup}),this.featureDone()},featureDone(){this.featuresDone++,this.featuresDone===Object.keys(this.featureModules).length&&setTimeout(this.featuresLoaded.bind(this),0)},_setCachingModule(){["IndexedDB","LocalStorage","InMemoryStorage"].some((e=>{if(this.features.some((t=>t.name===e)))return this.features.local=this.featureModules[e],!0}))},_fireReady(){try{this.readyFired||(this._emit("ready"),this.readyFired=!0)}catch(e){console.error("'ready' failed: ",e,e.stack),this._emit("error",e)}},featuresLoaded(){(0,i.default)("[RemoteStorage] All features loaded"),this._setCachingModule(),this.local=s.default.cache&&this.features.local&&new this.features.local,this.local&&this.remote?(this._setGPD(c.default,this),this._bindChange(this.local)):this.remote&&this._setGPD(this.remote,this.remote),this.remote&&(this.remote.on("connected",(()=>{this._fireReady(),this._emit("connected")})),this.remote.on("not-connected",(()=>{this._fireReady(),this._emit("not-connected")})),this.remote.connected&&(this._fireReady(),this._emit("connected")),this.hasFeature("Authorize")||this.remote.stopWaitingForToken()),this._collectCleanupFunctions();try{this._allLoaded=!0,this._emit("features-loaded")}catch(e){(0,a.logError)(e),this._emit("error",e)}this._processPending()},_collectCleanupFunctions(){this._cleanups=[];for(let e=0;e=r-this.maxAge?t.v:void 0}set(e,t){this._items[e]={v:t,t:(new Date).getTime()}}}class v extends c.RemoteBase{constructor(e,t){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this.addEvents(["connected","not-connected"]),this.clientId=t,this._fileIdCache=new y(300),d=(0,i.localStorageAvailable)(),d){const e=(0,i.getJSONFromLocalStorage)(u);e&&this.configure(e)}}configure(e){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token);const t=function(){d&&localStorage.setItem(u,JSON.stringify({userAddress:this.userAddress,token:this.token}))},r=function(){this.connected=!1,delete this.token,d&&localStorage.removeItem(u)};this.token?(this.connected=!0,this.userAddress?(this._emit("connected"),t.apply(this)):this.info().then((e=>{this.userAddress=e.user.emailAddress,this._emit("connected"),t.apply(this)})).catch((()=>{r.apply(this),this.rs._emit("error",new Error("Could not fetch user info."))}))):r.apply(this)}connect(){this.rs.setBackend("googledrive"),this.rs.authorize({authURL:"https://accounts.google.com/o/oauth2/auth",scope:"https://www.googleapis.com/auth/drive",clientId:this.clientId})}get(e,t={}){return(0,i.isFolder)(e)?this._getFolder(g(e)):this._getFile(g(e),t)}put(e,t,r,o={}){const s=g(e);function n(e){if(e.status>=200&&e.status<300){const t=JSON.parse(e.responseText),r=this.stripQuotes(t.etag);return Promise.resolve({statusCode:200,contentType:t.mimeType,revision:r})}return 412===e.status?Promise.resolve({statusCode:412,revision:"conflict"}):Promise.reject("PUT failed with status "+e.status+" ("+e.responseText+")")}return this._getFileId(s).then((e=>e?o&&"*"===o.ifNoneMatch?n({status:412}):this._updateFile(e,s,t,r,o).then(n):this._createFile(s,t,r).then(n)))}delete(e,t={}){const r=g(e);return this._getFileId(r).then((e=>e?this._getMeta(e).then((r=>{let o;return"object"==typeof r&&"string"==typeof r.etag&&(o=this.stripQuotes(r.etag)),t&&t.ifMatch&&t.ifMatch!==o?{statusCode:412,revision:o}:this._request("DELETE",l+"/drive/v2/files/"+e,{}).then((e=>200===e.status||204===e.status?{statusCode:200}:Promise.reject("Delete failed: "+e.status+" ("+e.responseText+")")))})):Promise.resolve({statusCode:200})))}info(){const e=l+"/drive/v2/about?fields=user";return this._request("GET",e,{}).then((function(e){try{const t=JSON.parse(e.responseText);return Promise.resolve(t)}catch(e){return Promise.reject(e)}}))}_updateFile(e,t,r,o,s){const n={mimeType:o},i={"Content-Type":"application/json; charset=UTF-8"};return s&&s.ifMatch&&(i["If-Match"]=this.addQuotes(s.ifMatch)),this._request("PUT",l+"/upload/drive/v2/files/"+e+"?uploadType=resumable",{body:JSON.stringify(n),headers:i}).then((e=>412===e.status?e:this._request("PUT",e.getResponseHeader("Location"),{body:o.match(/^application\/json/)?JSON.stringify(r):r})))}_createFile(e,t,r){return this._getParentId(e).then((o=>{const s={title:f(m(e)),mimeType:r,parents:[{kind:"drive#fileLink",id:o}]};return this._request("POST",l+"/upload/drive/v2/files?uploadType=resumable",{body:JSON.stringify(s),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then((e=>this._request("POST",e.getResponseHeader("Location"),{body:r.match(/^application\/json/)?JSON.stringify(t):t})))}))}_getFile(e,t){return this._getFileId(e).then((e=>this._getMeta(e).then((e=>{let r;if("object"==typeof e&&"string"==typeof e.etag&&(r=this.stripQuotes(e.etag)),t&&t.ifNoneMatch&&r===t.ifNoneMatch)return Promise.resolve({statusCode:304});if(!e.downloadUrl){if(!e.exportLinks||!e.exportLinks["text/html"])return Promise.resolve({statusCode:200,body:"",contentType:e.mimeType,revision:r});e.mimeType+=";export=text/html",e.downloadUrl=e.exportLinks["text/html"]}return this._request("GET",e.downloadUrl,{responseType:"arraybuffer"}).then((t=>(0,i.getTextFromArrayBuffer)(t.response,"UTF-8").then((function(o){let s=o;if(e.mimeType.match(/^application\/json/))try{s=JSON.parse(s)}catch(e){}else(0,i.shouldBeTreatedAsBinary)(o,e.mimeType)&&(s=t.response);return{statusCode:200,body:s,contentType:e.mimeType,revision:r}}))))}))))}_getFolder(e){return this._getFileId(e).then((t=>{let r,o,s;if(!t)return Promise.resolve({statusCode:404});const n="'"+t+"' in parents";return this._request("GET",l+"/drive/v2/files?q="+encodeURIComponent(n)+"&fields="+encodeURIComponent("items(downloadUrl,etag,fileSize,id,mimeType,title,labels)")+"&maxResults=1000&trashed=false",{}).then((t=>{var n;if(200!==t.status)return Promise.reject("request failed or something: "+t.status);try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject("non-JSON response from GoogleDrive")}s={};for(const t of r.items)(null===(n=t.labels)||void 0===n?void 0:n.trashed)||(o=this.stripQuotes(t.etag),t.mimeType===h?(this._fileIdCache.set(e+(0,i.cleanPath)(t.title)+"/",t.id),s[t.title+"/"]={ETag:o}):(this._fileIdCache.set(e+(0,i.cleanPath)(t.title),t.id),s[t.title]={ETag:o,"Content-Type":t.mimeType,"Content-Length":t.fileSize}));return Promise.resolve({statusCode:200,body:s,contentType:"application/json; charset=UTF-8",revision:void 0})}))}))}_getParentId(e){const t=p(e);return this._getFileId(t).then((e=>e?Promise.resolve(e):this._createFolder(t)))}_createFolder(e){return this._getParentId(e).then((t=>this._request("POST",l+"/drive/v2/files",{body:JSON.stringify({title:f(m(e)),mimeType:h,parents:[{id:t}]}),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then((e=>{const t=JSON.parse(e.responseText);return Promise.resolve(t.id)}))))}_getFileId(e){let t;return"/"===e?Promise.resolve("root"):(t=this._fileIdCache.get(e))?Promise.resolve(t):this._getFolder(p(e)).then((()=>(t=this._fileIdCache.get(e),t?Promise.resolve(t):"/"===e.substr(-1)?this._createFolder(e).then((()=>this._getFileId(e))):Promise.resolve())))}_getMeta(e){return this._request("GET",l+"/drive/v2/files/"+e,{}).then((function(t){return 200===t.status?Promise.resolve(JSON.parse(t.responseText)):Promise.reject("request (getting metadata for "+e+") failed with status: "+t.status)}))}_request(e,t,r){return this.isForbiddenRequestMethod(e,t)?Promise.reject(`Don't use ${e} on directories!`):(r.headers||(r.headers={}),r.headers.Authorization="Bearer "+this.token,this.rs._emit("wire-busy",{method:e,isFolder:(0,i.isFolder)(t)}),(0,a.requestWithTimeout)(e,t,r).then((r=>r&&401===r.status?void this.connect():(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,i.isFolder)(t),success:!0}),Promise.resolve(r))),(r=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,i.isFolder)(t),success:!1}),Promise.reject(r)))))}static _rs_init(e){const t=e.apiKeys.googledrive;var r;t&&(e.googledrive=new v(e,t.clientId),"googledrive"===e.backend&&(e._origRemote=e.remote,e.remote=e.googledrive,(r=e)._origBaseClientGetItemURL||(r._origBaseClientGetItemURL=s.default.prototype.getItemURL,s.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Google Drive yet")})))}static _rs_supported(){return!0}static _rs_cleanup(e){var t;e.setBackend(void 0),e._origRemote&&(e.remote=e._origRemote,delete e._origRemote),(t=e)._origBaseClientGetItemURL&&(s.default.prototype.getItemURL=t._origBaseClientGetItemURL,delete t._origBaseClientGetItemURL)}}(0,i.applyMixins)(v,[n.default]),e.exports=v},567:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const n=s(r(93)),i=s(r(496)),a=s(r(334)),c=r(746),l="remotestorage";let u;class h extends i.default{constructor(e){super(),this.addEvents(["change","local-events-done"]),this.db=e||u,this.db?(this.getsRunning=0,this.putsRunning=0,this.changesQueued={},this.changesRunning={},this.commitSlownessWarning=null):(0,a.default)("[IndexedDB] Failed to open DB")}getNodes(e){return o(this,void 0,void 0,(function*(){const t=[],r={};for(let o=0,s=e.length;o0?this.getNodesFromDb(t).then((function(e){for(const t in r)e[t]=r[t];return e})):Promise.resolve(r)}))}setNodes(e){return o(this,void 0,void 0,(function*(){for(const t in e)this.changesQueued[t]=e[t]||!1;return this.maybeFlush(),Promise.resolve()}))}maybeFlush(){0===this.putsRunning?this.flushChangesQueued():this.commitSlownessWarning||(this.commitSlownessWarning=r.g.setInterval((function(){console.warn("WARNING: waited more than 10 seconds for previous commit to finish")}),1e4))}flushChangesQueued(){this.commitSlownessWarning&&(clearInterval(this.commitSlownessWarning),this.commitSlownessWarning=null),Object.keys(this.changesQueued).length>0&&(this.changesRunning=this.changesQueued,this.changesQueued={},this.setNodesInDb(this.changesRunning).then(this.flushChangesQueued.bind(this)))}getNodesFromDb(e){return new Promise(((t,r)=>{const o=this.db.transaction(["nodes"],"readonly"),s=o.objectStore("nodes"),n={};this.getsRunning++,e.map((e=>{s.get(e).onsuccess=t=>{n[e]=t.target.result}})),o.oncomplete=()=>{t(n),this.getsRunning--},o.onerror=o.onabort=()=>{r("get transaction error/abort"),this.getsRunning--}}))}setNodesInDb(e){return o(this,void 0,void 0,(function*(){return new Promise(((t,r)=>{const o=this.db.transaction(["nodes"],"readwrite"),s=o.objectStore("nodes"),n=(new Date).getTime();this.putsRunning++,(0,a.default)("[IndexedDB] Starting put",e,this.putsRunning);for(const t in e){const r=e[t];if("object"==typeof r)try{s.put(r)}catch(e){throw(0,a.default)("[IndexedDB] Error while putting",r,e),e}else try{s.delete(t)}catch(e){throw(0,a.default)("[IndexedDB] Error while removing",s,r,e),e}}o.oncomplete=()=>{this.putsRunning--,(0,a.default)("[IndexedDB] Finished put",e,this.putsRunning,(new Date).getTime()-n+"ms"),t()},o.onerror=()=>{this.putsRunning--,r("transaction error")},o.onabort=()=>{r("transaction abort"),this.putsRunning--}}))}))}reset(e){const t=this.db.name;this.db.close(),h.clean(this.db.name,(()=>{h.open(t,((t,r)=>{t?(0,a.default)("[IndexedDB] Error while resetting local storage",t):this.db=r,"function"==typeof e&&e(self)}))}))}forAllNodes(e){return o(this,void 0,void 0,(function*(){return new Promise((t=>{this.db.transaction(["nodes"],"readonly").objectStore("nodes").openCursor().onsuccess=r=>{const o=r.target.result;o?(e(this.migrate(o.value)),o.continue()):t()}}))}))}closeDB(){0===this.putsRunning?this.db.close():setTimeout(this.closeDB.bind(this),100)}static open(e,t){const r=setTimeout((function(){t("timeout trying to open db")}),1e4);try{const o=indexedDB.open(e,2);o.onerror=function(){(0,a.default)("[IndexedDB] Opening DB failed",o),clearTimeout(r),t(o.error)},o.onupgradeneeded=function(e){const t=o.result;(0,a.default)("[IndexedDB] Upgrade: from ",e.oldVersion," to ",e.newVersion),1!==e.oldVersion&&((0,a.default)("[IndexedDB] Creating object store: nodes"),t.createObjectStore("nodes",{keyPath:"path"})),(0,a.default)("[IndexedDB] Creating object store: changes"),t.createObjectStore("changes",{keyPath:"path"})},o.onsuccess=function(){clearTimeout(r);const s=o.result;if(!s.objectStoreNames.contains("nodes")||!s.objectStoreNames.contains("changes"))return(0,a.default)("[IndexedDB] Missing object store. Resetting the database."),void h.clean(e,(function(){h.open(e,t)}));t(null,o.result)}}catch(o){(0,a.default)("[IndexedDB] Failed to open database: "+o),(0,a.default)("[IndexedDB] Resetting database and trying again."),clearTimeout(r),h.clean(e,(function(){h.open(e,t)}))}}static clean(e,t){const r=indexedDB.deleteDatabase(e);r.onsuccess=function(){(0,a.default)("[IndexedDB] Done removing DB"),t()},r.onerror=r.onabort=function(t){console.error('Failed to remove database "'+e+'"',t)}}static _rs_init(e){return new Promise(((t,r)=>{h.open(l,(function(o,s){o?r(o):(u=s,s.onerror=()=>{e._emit("error",o)},t())}))}))}static _rs_supported(){return new Promise(((e,t)=>{const r=(0,c.getGlobalContext)();let o=!1;if("undefined"!=typeof navigator&&navigator.userAgent.match(/Android (2|3|4\.[0-3])/)&&(navigator.userAgent.match(/Chrome|Firefox/)||(o=!0)),"indexedDB"in r&&!o)try{const r=indexedDB.open("rs-check");r.onerror=function(){t()},r.onsuccess=function(){r.result.close(),indexedDB.deleteDatabase("rs-check"),e()}}catch(e){t()}else t()}))}static _rs_cleanup(e){return new Promise((t=>{e.local&&e.local.closeDB(),h.clean(l,t)}))}diffHandler(){}}(0,c.applyMixins)(h,[n.default]),e.exports=h},365:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const s=o(r(93)),n=o(r(496)),i=r(746);class a extends n.default{constructor(){super(),this._storage={},this.addEvents(["change","local-events-done"])}getNodes(e){const t={};for(let r=0,o=e.length;r{(0,i.default)("[LocalStorage] Removing",e),delete localStorage[e]}))}}(0,a.applyMixins)(u,[n.default]),e.exports=u},334:function(e,t,r){"use strict";const o=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(28));e.exports=function(...e){o.default.logging&&console.log(...e)}},684:function(e,t,r){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RemoteBase=void 0;const s=o(r(93)),n=r(746);class i extends s.default{constructor(e){super(),this.rs=e,this.connected=!1}stopWaitingForToken(){this.connected||this._emit("not-connected")}addQuotes(e){return"string"!=typeof e?e:"*"===e?"*":'"'+e+'"'}stripQuotes(e){return"string"!=typeof e?e:e.replace(/^["']|["']$/g,"")}isForbiddenRequestMethod(e,t){return("PUT"===e||"DELETE"===e)&&(0,n.isFolder)(t)}}t.RemoteBase=i},423:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,s)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return s(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RemoteStorage=void 0;const a=i(r(28)),c=i(r(334)),l=r(746),u=i(r(548)),h=i(r(275)),d=i(r(424)),f=i(r(285)),p=r(93),m=i(r(801)),g=i(r(706)),y=i(r(373)),v=i(r(982)),_=i(r(503)),b=i(r(545)),w=n(r(746)),P=(0,l.getGlobalContext)();let T;function E(e){return 403!==e.statusCode&&401!==e.statusCode||this._emit("error",new _.default),Promise.resolve(e)}function k(e){return"number"==typeof e&&e>=2e3&&e<=36e5}var S;!function(e){e.GOOGLE="googledrive",e.DROPBOX="dropbox"}(S||(S={}));class A{constructor(e){if(this._pending=[],this._cleanups=[],this._pathHandlers={change:{}},this.apiKeys={},this._init=b.default.loadFeatures,this.features=b.default.features,this.loadFeature=b.default.loadFeature,this.featureSupported=b.default.featureSupported,this.featureDone=b.default.featureDone,this.featuresDone=b.default.featuresDone,this.featuresLoaded=b.default.featuresLoaded,this.featureInitialized=b.default.featureInitialized,this.featureFailed=b.default.featureFailed,this.hasFeature=b.default.hasFeature,this._setCachingModule=b.default._setCachingModule,this._collectCleanupFunctions=b.default._collectCleanupFunctions,this._fireReady=b.default._fireReady,this.initFeature=b.default.initFeature,"object"==typeof e&&(0,l.extend)(a.default,e),this.addEvents(["ready","authing","connecting","connected","disconnected","not-connected","conflict","error","features-loaded","sync-interval-change","sync-req-done","sync-done","wire-busy","wire-done","network-offline","network-online"]),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")}),T=(0,l.localStorageAvailable)(),T){this.apiKeys=(0,l.getJSONFromLocalStorage)("remotestorage:api-keys")||{};const e=localStorage.getItem("remotestorage:backend");"dropbox"===e||"googledrive"===e?this.setBackend(e):this.setBackend("remotestorage")}const t=this.on;this.on=function(e,r){if(this._allLoaded)switch(e){case"features-loaded":setTimeout(r,0);break;case"ready":this.remote&&setTimeout(r,0);break;case"connected":this.remote&&this.remote.connected&&setTimeout(r,0);break;case"not-connected":this.remote&&!this.remote.connected&&setTimeout(r,0)}return t.call(this,e,r)},this._init(),this.fireInitial=function(){this.local&&setTimeout(this.local.fireInitial.bind(this.local),0)}.bind(this),this.on("ready",this.fireInitial.bind(this)),this.loadModules()}get connected(){return this.remote.connected}loadModules(){a.default.modules.forEach(this.addModule.bind(this))}authorize(e){if(this.access.setStorageType(this.remote.storageApi),void 0===e.scope&&(e.scope=this.access.scopeParameter),P.cordova)e.redirectUri=a.default.cordovaRedirectUri;else{const t=h.default.getLocation();let r=t.origin;"/"!==t.pathname&&(r+=t.pathname),e.redirectUri=r}void 0===e.clientId&&(e.clientId=e.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]),h.default.authorize(this,e)}impliedauth(e,t){e=e||this.remote.storageApi,t=t||String(document.location),(0,c.default)("ImpliedAuth proceeding due to absent authURL; storageApi = "+e+" redirectUri = "+t),this.remote.configure({token:h.default.IMPLIED_FAKE_TOKEN}),document.location.href=t}connect(e,t){if(this.setBackend("remotestorage"),e.indexOf("@")<0&&!e.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/))this._emit("error",new A.DiscoveryError("Not a valid user address or URL."));else{if(e.indexOf("@")<0&&!e.match(/^https?:\/\//)&&(e=`https://${e}`),P.cordova){if("string"!=typeof a.default.cordovaRedirectUri)return void this._emit("error",new A.DiscoveryError("Please supply a custom HTTPS redirect URI for your Cordova app"));if(!P.cordova.InAppBrowser)return void this._emit("error",new A.DiscoveryError("Please include the InAppBrowser Cordova plugin to enable OAuth"))}this.remote.configure({userAddress:e}),this._emit("connecting"),(0,y.default)(e).then((r=>{if(this._emit("authing"),r.userAddress=e,this.remote.configure(r),!this.remote.connected)if(r.authURL)if(void 0===t)this.authorize({authURL:r.authURL});else{if("string"!=typeof t)throw new Error("Supplied bearer token must be a string");(0,c.default)("Skipping authorization sequence and connecting with known token"),this.remote.configure({token:t})}else this.impliedauth()}),(()=>{this._emit("error",new A.DiscoveryError("No storage information found for this user address."))}))}}reconnect(){this.remote.configure({token:null}),"remotestorage"===this.backend?this.connect(this.remote.userAddress):this.remote.connect()}disconnect(){this.remote&&this.remote.configure({userAddress:null,href:null,storageApi:null,token:null,properties:null}),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")});const e=this._cleanups.length;let t=0;const r=()=>{t++,t>=e&&(this._init(),this._emit("disconnected"))};e>0?this._cleanups.forEach((e=>{const t=e(this);"object"==typeof t&&"function"==typeof t.then?t.then(r):r()})):r()}setBackend(e){this.backend=e,T&&(void 0!==e?localStorage.setItem("remotestorage:backend",e):localStorage.removeItem("remotestorage:backend"))}onChange(e,t){this._pathHandlers.change[e]||(this._pathHandlers.change[e]=[]),this._pathHandlers.change[e].push(t)}enableLog(){a.default.logging=!0}disableLog(){a.default.logging=!1}log(...e){c.default.apply(A,e)}setApiKeys(e){const t=[S.GOOGLE,S.DROPBOX];if("object"!=typeof e||!Object.keys(e).every((e=>t.includes(e))))return console.error("setApiKeys() was called with invalid arguments"),!1;Object.keys(e).forEach((t=>{const r=e[t];if(r){switch(t){case S.DROPBOX:this.apiKeys[S.DROPBOX]={appKey:r},void 0!==this.dropbox&&this.dropbox.clientId===r||g.default._rs_init(this);break;case S.GOOGLE:this.apiKeys[S.GOOGLE]={clientId:r},void 0!==this.googledrive&&this.googledrive.clientId===r||m.default._rs_init(this)}return!0}delete this.apiKeys[t]})),T&&localStorage.setItem("remotestorage:api-keys",JSON.stringify(this.apiKeys))}setCordovaRedirectUri(e){if("string"!=typeof e||!e.match(/http(s)?:\/\//))throw new Error("Cordova redirect URI must be a URI string");a.default.cordovaRedirectUri=e}_setGPD(e,t){function r(e){return function(...r){return e.apply(t,r).then(E.bind(this))}}this.get=r(e.get),this.put=r(e.put),this.delete=r(e.delete)}_pendingGPD(e){return(...t)=>{const r=Array.prototype.slice.call(t);return new Promise(((t,o)=>{this._pending.push({method:e,args:r,promise:{resolve:t,reject:o}})}))}}_processPending(){this._pending.forEach((e=>{try{this[e.method](...e.args).then(e.promise.resolve,e.promise.reject)}catch(t){e.promise.reject(t)}})),this._pending=[]}_bindChange(e){e.on("change",this._dispatchEvent.bind(this,"change"))}_dispatchEvent(e,t){Object.keys(this._pathHandlers[e]).forEach((r=>{const o=r.length;t.path.substr(0,o)===r&&this._pathHandlers[e][r].forEach((e=>{const o={};for(const e in t)o[e]=t[e];o.relativePath=t.path.replace(new RegExp("^"+r),"");try{e(o)}catch(e){console.error("'change' handler failed: ",e,e.stack),this._emit("error",e)}}))}))}scope(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.scope must be a string";return this.access.checkPathPermission(e,"r")||console.warn("WARNING: Please use remoteStorage.access.claim() to ask for access permissions first: https://remotestoragejs.readthedocs.io/en/latest/js-api/access.html#claim"),new d.default(this,e)}getSyncInterval(){return a.default.syncInterval}setSyncInterval(e){if(!k(e))throw e+" is not a valid sync interval";const t=a.default.syncInterval;a.default.syncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getBackgroundSyncInterval(){return a.default.backgroundSyncInterval}setBackgroundSyncInterval(e){if(!k(e))throw e+" is not a valid sync interval";const t=a.default.backgroundSyncInterval;a.default.backgroundSyncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getCurrentSyncInterval(){return a.default.isBackground?a.default.backgroundSyncInterval:a.default.syncInterval}getRequestTimeout(){return a.default.requestTimeout}setRequestTimeout(e){if("number"!=typeof e)throw e+" is not a valid request timeout";a.default.requestTimeout=e}syncCycle(){this.sync&&!this.sync.stopped&&(this.on("sync-done",(()=>{this.sync&&!this.sync.stopped&&(this._syncTimer&&(clearTimeout(this._syncTimer),this._syncTimer=void 0),this._syncTimer=setTimeout(this.sync.sync.bind(this.sync),this.getCurrentSyncInterval()))})),this.sync.sync())}startSync(){return a.default.cache?(this.sync.stopped=!1,this.syncStopped=!1,this.sync.sync()):(console.warn("Nothing to sync, because caching is disabled."),Promise.resolve())}stopSync(){clearTimeout(this._syncTimer),this._syncTimer=void 0,this.sync?this.sync.stopped=!0:this.syncStopped=!0}addModule(e){const t=e.name,r=e.builder;if(Object.defineProperty(this,t,{configurable:!0,get:function(){const e=this._loadModule(t,r);return Object.defineProperty(this,t,{value:e}),e}}),-1!==t.indexOf("-")){const e=t.replace(/\-[a-z]/g,(function(e){return e[1].toUpperCase()}));Object.defineProperty(this,e,{get:function(){return this[t]}})}}_loadModule(e,t){if(t)return t(new d.default(this,"/"+e+"/"),new d.default(this,"/public/"+e+"/")).exports;throw"Unknown module: "+e}}t.RemoteStorage=A,A.Authorize=h.default,A.SyncError=v.default,A.Unauthorized=_.default,A.DiscoveryError=y.default.DiscoveryError,A.util=w,Object.defineProperty(A.prototype,"access",{get:function(){const e=new u.default;return Object.defineProperty(this,"access",{value:e}),e},configurable:!0}),Object.defineProperty(A.prototype,"caching",{configurable:!0,get:function(){const e=new f.default;return Object.defineProperty(this,"caching",{value:e}),e}}),(0,l.applyMixins)(A,[p.EventHandling]),t.default=A},368:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayBufferView=void 0,t.retryAfterMs=function(e){const t=1e3*parseInt(e.getResponseHeader("Retry-After"));return t>=1e3?t:Math.max(1500,Math.min(6e4,Math.round(i.default.syncInterval/(2.9+.2*Math.random()))))},t.requestWithTimeout=function(e,r,s){return o(this,void 0,void 0,(function*(){return"function"==typeof fetch?function(e,t,r){return o(this,void 0,void 0,(function*(){const o="function"==typeof AbortController?new AbortController:null;let s;const a=new Promise(((e,t)=>{s=setTimeout((()=>{o&&o.abort(),t("timeout")}),i.default.requestTimeout)}));let c;const l={},u=fetch(t,{method:e,headers:r.headers,body:r.body,signal:o?o.signal:void 0}).then((e=>{switch((0,n.default)("[requests fetch]",e),e.headers.forEach(((e,t)=>{l[t.toUpperCase()]=e})),c={readyState:4,status:e.status,statusText:e.statusText,response:void 0,getResponseHeader:e=>l[e.toUpperCase()]||null,responseType:r.responseType,responseURL:t},r.responseType){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json();case void 0:case"":case"text":return e.text();default:throw new Error("responseType 'document' is not currently supported using fetch")}})).then((e=>(c.response=e,r.responseType&&"text"!==r.responseType||(c.responseText=e),c))).finally((()=>{clearTimeout(s)}));return Promise.race([u,a])}))}(e,r,s):"function"==typeof XMLHttpRequest?function(e,r,s){return o(this,void 0,void 0,(function*(){return new Promise(((o,a)=>{(0,n.default)("[requests XHR]",e,r);let c=!1;const l=setTimeout((()=>{c=!0,a("timeout")}),i.default.requestTimeout),u=new XMLHttpRequest;if(u.open(e,r,!0),s.responseType&&(u.responseType=s.responseType),s.headers)for(const e in s.headers)u.setRequestHeader(e,s.headers[e]);u.onload=()=>{c||(clearTimeout(l),o(u))},u.onerror=e=>{c||(clearTimeout(l),a(e))};let h=s.body;"object"==typeof h&&!(0,t.isArrayBufferView)(h)&&h instanceof ArrayBuffer&&(h=new Uint8Array(h)),u.send(h)}))}))}(e,r,s):Promise.reject("[Requests] You need to add a polyfill for fetch or XMLHttpRequest")}))};const n=s(r(334)),i=s(r(28));if("function"==typeof(r.g||window).ArrayBufferView)t.isArrayBufferView=function(e){return e&&e instanceof(r.g||window).ArrayBufferView};else{const e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];t.isArrayBufferView=function(t){for(let r=0;r<8;r++)if(t instanceof e[r])return!0;return!1}}},941:function(e){"use strict";e.exports=class{constructor(e){this._itemsRev={},this._storage={},this._canPropagate=!1,this.defaultValue=e,this.activatePropagation()}get(e){e=e.toLowerCase();let t=this._storage[e];return void 0===t&&(t=this.defaultValue,this._storage[e]=t),t}set(e,t){return e=e.toLowerCase(),this._storage[e]===t||(this._storage[e]=t,t||delete this._itemsRev[e],this._updateParentFolderItemRev(e,t),this._canPropagate&&this._propagate(e)),t}delete(e){return this.set(e,null)}deactivatePropagation(){return this._canPropagate=!1,!0}activatePropagation(){return this._canPropagate||(this._generateFolderRev("/"),this._canPropagate=!0),!0}_hashCode(e){let t=0;if(0===e.length)return t;for(let r=0;r0&&(r=this._generateHash(e))}return this.set(e,r),r}}},491:function(e){"use strict";class t extends Error{constructor(e){super();const t=new Error("Schema not found: "+e);return t.name="SchemaNotFound",t}}e.exports=t},982:function(e){"use strict";class t extends Error{constructor(e){super(),this.name="SyncError",this.message="Sync failed: ","string"==typeof e?this.message+=e:(this.message+=e.message,this.stack=e.stack,this.originalError=e)}}e.exports=t},313:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Sync=void 0;const n=s(r(28)),i=s(r(451)),a=s(r(93)),c=s(r(334)),l=s(r(275)),u=s(r(982)),h=s(r(503)),d=r(746);let f,p;function m(e,t,r){return{action:e,path:t,promise:r}}function g(e,t){return e.common.revision!==t&&(!e.remote||e.remote.revision!==t)}function y(e){return e.common&&e.common.revision}class v{constructor(e){this._finishedTasks=[],this.rs=e,this._tasks={},this._running={},this._timeStarted={},this.numThreads=10,this.rs.local.onDiff((e=>{this.addTask(e),this.doTasks()})),this.rs.caching.onActivate((e=>{this.addTask(e),this.doTasks()})),this.addEvents(["done","req-done"])}now(){return(new Date).getTime()}queueGetRequest(e){return new Promise(((t,r)=>{this.rs.remote.connected?this.rs.remote.online?(this.addTask(e,function(){this.rs.local.get(e).then((e=>t(e)))}.bind(this)),this.doTasks()):r("cannot fulfill maxAge requirement - remote is not online"):r("cannot fulfill maxAge requirement - remote is not connected")}))}corruptServerItemsMap(e,t){if("object"!=typeof e||Array.isArray(e))return!0;for(const r in e){const o=e[r];if("object"!=typeof o)return!0;if("string"!=typeof o.ETag)return!0;if((0,d.isFolder)(r)){if(-1!==r.substring(0,r.length-1).indexOf("/"))return!0}else{if(-1!==r.indexOf("/"))return!0;if(t){if("string"!=typeof o["Content-Type"])return!0;if("number"!=typeof o["Content-Length"])return!0}}}return!1}corruptItemsMap(e){if("object"!=typeof e||Array.isArray(e))return!0;for(const t in e)if("boolean"!=typeof e[t])return!0;return!1}corruptRevision(e){return"object"!=typeof e||Array.isArray(e)||e.revision&&"string"!=typeof e.revision||e.body&&"string"!=typeof e.body&&"object"!=typeof e.body||e.contentType&&"string"!=typeof e.contentType||e.contentLength&&"number"!=typeof e.contentLength||e.timestamp&&"number"!=typeof e.timestamp||e.itemsMap&&this.corruptItemsMap(e.itemsMap)}isCorrupt(e){return"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.path||this.corruptRevision(e.common)||e.local&&this.corruptRevision(e.local)||e.remote&&this.corruptRevision(e.remote)||e.push&&this.corruptRevision(e.push)}hasTasks(){return Object.getOwnPropertyNames(this._tasks).length>0}collectDiffTasks(){return o(this,void 0,void 0,(function*(){let e=0;return this.rs.local.forAllNodes((t=>{e>100||(this.isCorrupt(t)?((0,c.default)("[Sync] WARNING: corrupt node in local cache",t),"object"==typeof t&&t.path&&(this.addTask(t.path),e++)):(this.needsFetch(t)&&this.rs.access.checkPathPermission(t.path,"r")||(0,d.isDocument)(t.path)&&this.needsPush(t)&&this.rs.access.checkPathPermission(t.path,"rw"))&&(this.addTask(t.path),e++))})).then((()=>e)).catch((e=>{throw e}))}))}inConflict(e){return e.local&&e.remote&&(void 0!==e.remote.body||e.remote.itemsMap)}needsRefresh(e){return!!e.common&&(!e.common.timestamp||this.now()-e.common.timestamp>n.default.syncInterval)}needsFetch(e){return!!this.inConflict(e)||!(!e.common||void 0!==e.common.itemsMap||void 0!==e.common.body)||!(!e.remote||void 0!==e.remote.itemsMap||void 0!==e.remote.body)}needsPush(e){return!this.inConflict(e)&&(!(!e.local||e.push)||void 0)}needsRemotePut(e){return e.local&&e.local.body}needsRemoteDelete(e){return e.local&&!1===e.local.body}getParentPath(e){const t=e.match(/^(.*\/)([^\/]+\/?)$/);if(t)return t[1];throw new Error('Not a valid path: "'+e+'"')}deleteChildPathsFromTasks(){for(const e in this._tasks){const t=(0,d.pathsFromRoot)(e);for(let r=1;r{let t;if(this.needsRefresh(e)){try{t=this.getParentPath(e.path)}catch(e){}t&&this.rs.access.checkPathPermission(t,"r")?this.addTask(t):this.rs.access.checkPathPermission(e.path,"r")&&this.addTask(e.path)}})).then((()=>this.deleteChildPathsFromTasks())).catch((e=>{throw e}))}))}flush(e){for(const t in e)"FLUSH"===this.rs.caching.checkPath(t)&&e[t]&&!e[t].local&&((0,c.default)("[Sync] Flushing",t),e[t]=void 0);return e}doTask(e){return this.rs.local.getNodes([e]).then((t=>{const r=t[e];return void 0===r||function(e){return e.remote&&e.remote.revision&&!e.remote.itemsMap&&!e.remote.body}(r)?m("get",e,this.rs.remote.get(e)):this.needsRemotePut(r)?(r.push=(0,d.deepClone)(r.local),r.push.timestamp=this.now(),this.rs.local.setNodes(this.flush(t)).then((()=>{let t;return t=y(r)?{ifMatch:r.common.revision}:{ifNoneMatch:"*"},m("put",e,this.rs.remote.put(e,r.push.body,r.push.contentType,t))}))):this.needsRemoteDelete(r)?(r.push={body:!1,timestamp:this.now()},this.rs.local.setNodes(this.flush(t)).then((()=>y(r)?m("delete",e,this.rs.remote.delete(e,{ifMatch:r.common.revision})):m("get",e,this.rs.remote.get(e))))):y(r)?m("get",e,this.rs.remote.get(e,{ifNoneMatch:r.common.revision})):m("get",e,this.rs.remote.get(e))}))}autoMergeFolder(e){if(e.remote.itemsMap&&(e.common=e.remote,delete e.remote,e.common.itemsMap)){for(const t in e.common.itemsMap)e.local.itemsMap[t]||(e.local.itemsMap[t]=!1);(0,d.equal)(e.local.itemsMap,e.common.itemsMap)&&delete e.local}return e}autoMergeDocument(e){return function(e){return(!e.remote||!e.remote.revision||e.remote.revision===e.common.revision)&&(void 0===e.common.body&&!1===e.remote.body||e.remote.body===e.common.body&&e.remote.contentType===e.common.contentType)}(e)?delete(e=function(e){return e.remote&&!1===e.remote.body&&e.local&&!1===e.local.body&&delete e.local,e}(e)).remote:void 0!==e.remote.body&&((0,c.default)("[Sync] Emitting keep/revert"),this.rs.local._emitChange({origin:"conflict",path:e.path,oldValue:e.local.body,newValue:e.remote.body,lastCommonValue:e.common.body,oldContentType:e.local.contentType,newContentType:e.remote.contentType,lastCommonContentType:e.common.contentType}),e.remote.body?e.common=e.remote:e.common={},delete e.remote,delete e.local),e}autoMerge(e){if(e.remote){if(e.local)return(0,d.isFolder)(e.path)?this.autoMergeFolder(e):this.autoMergeDocument(e);if((0,d.isFolder)(e.path))void 0!==e.remote.itemsMap&&(e.common=e.remote,delete e.remote);else if(void 0!==e.remote.body){const t={origin:"remote",path:e.path,oldValue:!1===e.common.body?void 0:e.common.body,newValue:!1===e.remote.body?void 0:e.remote.body,oldContentType:e.common.contentType,newContentType:e.remote.contentType};if((t.oldValue||t.newValue)&&this.rs.local._emitChange(t),!e.remote.body)return;e.common=e.remote,delete e.remote}return e}e.common.body&&this.rs.local._emitChange({origin:"remote",path:e.path,oldValue:e.common.body,newValue:void 0,oldContentType:e.common.contentType,newContentType:void 0})}updateCommonTimestamp(e,t){return o(this,void 0,void 0,(function*(){return this.rs.local.getNodes([e]).then((r=>(r[e]&&r[e].common&&r[e].common.revision===t&&(r[e].common.timestamp=this.now()),this.rs.local.setNodes(this.flush(r)))))}))}markChildren(e,t,r,s){return o(this,void 0,void 0,(function*(){const o=[],n={},i={};for(const r in t)o.push(e+r),n[e+r]=t[r];for(const t in s)o.push(e+t);return this.rs.local.getNodes(o).then((t=>{let o,a;for(const c in t)if(a=t[c],n[c])a&&a.common?g(a,n[c].ETag)&&(r[c]=(0,d.deepClone)(a),r[c].remote={revision:n[c].ETag,timestamp:this.now()},r[c]=this.autoMerge(r[c])):(o=this.rs.caching.checkPath(c),"ALL"===o&&(r[c]={path:c,common:{timestamp:this.now()},remote:{revision:n[c].ETag,timestamp:this.now()}})),r[c]&&n[c]["Content-Type"]&&(r[c].remote.contentType=n[c]["Content-Type"]),r[c]&&n[c]["Content-Length"]&&(r[c].remote.contentLength=n[c]["Content-Length"]);else if(s[c.substring(e.length)]&&a&&a.common){if(a.common.itemsMap)for(const e in a.common.itemsMap)i[c+e]=!0;if(a.local&&a.local.itemsMap)for(const e in a.local.itemsMap)i[c+e]=!0;if(a.remote||(0,d.isFolder)(c))r[c]=void 0;else if(r[c]=this.autoMerge(a),void 0===r[c]){const t=this.getParentPath(c),o=r[t],s=c.substring(e.length);o&&o.local&&(delete o.local.itemsMap[s],(0,d.equal)(o.local.itemsMap,o.common.itemsMap)&&delete o.local)}}return this.deleteRemoteTrees(Object.keys(i),r).then((e=>this.rs.local.setNodes(this.flush(e))))}))}))}deleteRemoteTrees(e,t){return o(this,void 0,void 0,(function*(){return 0===e.length?Promise.resolve(t):this.rs.local.getNodes(e).then((e=>o(this,void 0,void 0,(function*(){const r={};function o(e,t){if(e&&e.itemsMap)for(const o in e.itemsMap)r[t+o]=!0}for(const r in e){const s=e[r];s&&((0,d.isFolder)(r)?(o(s.common,r),o(s.local,r)):s.common&&void 0!==typeof s.common.body&&(t[r]=(0,d.deepClone)(s),t[r].remote={body:!1,timestamp:this.now()},t[r]=this.autoMerge(t[r])))}return this.deleteRemoteTrees(Object.keys(r),t).then((e=>this.rs.local.setNodes(this.flush(e))))}))))}))}completeFetch(e,t,r,s){return o(this,void 0,void 0,(function*(){let o,n;const i=(0,d.pathsFromRoot)(e);return(0,d.isFolder)(e)?o=[e]:(n=i[1],o=[e,n]),this.rs.local.getNodes(o).then((o=>{let i,a,c=o[e];const l={};function u(e){if(e&&e.itemsMap)for(i in e.itemsMap)t[i]||(l[i]=!0)}if("object"==typeof c&&c.path===e&&"object"==typeof c.common||(c={path:e,common:{}},o[e]=c),c.remote={revision:s,timestamp:this.now()},(0,d.isFolder)(e))for(i in u(c.common),u(c.remote),c.remote.itemsMap={},t)c.remote.itemsMap[i]=!0;else c.remote.body=t,c.remote.contentType=r,a=o[n],a&&a.local&&a.local.itemsMap&&(i=e.substring(n.length),a.local.itemsMap[i]=!0,(0,d.equal)(a.local.itemsMap,a.common.itemsMap)&&delete a.local);return o[e]=this.autoMerge(c),{toBeSaved:o,missingChildren:l}}))}))}completePush(e,t,r,s){return o(this,void 0,void 0,(function*(){return this.rs.local.getNodes([e]).then((o=>{const n=o[e];if(!n.push)throw this.stopped=!0,new Error("completePush called but no push version!");return r?((0,c.default)("[Sync] We have a conflict"),n.remote&&n.remote.revision===s||(n.remote={revision:s||"conflict",timestamp:this.now()},delete n.push),o[e]=this.autoMerge(n)):(n.common={revision:s,timestamp:this.now()},"put"===t?(n.common.body=n.push.body,n.common.contentType=n.push.contentType,(0,d.equal)(n.local.body,n.push.body)&&n.local.contentType===n.push.contentType&&delete n.local,delete n.push):"delete"===t&&(!1===n.local.body?o[e]=void 0:delete n.push)),this.rs.local.setNodes(this.flush(o))}))}))}dealWithFailure(e){return o(this,void 0,void 0,(function*(){return this.rs.local.getNodes([e]).then((t=>{if(t[e])return delete t[e].push,this.rs.local.setNodes(this.flush(t))}))}))}interpretStatus(e){const t={statusCode:e,successful:void 0,conflict:void 0,unAuth:void 0,notFound:void 0,changed:void 0,networkProblems:void 0};if("string"==typeof e&&("offline"===e||"timeout"===e))return t.successful=!1,t.networkProblems=!0,t;if("number"==typeof e){const r=Math.floor(e/100);return t.successful=2===r||304===e||412===e||404===e,t.conflict=412===e,t.unAuth=401===e&&this.rs.remote.token!==l.default.IMPLIED_FAKE_TOKEN||402===e||403===e,t.notFound=404===e,t.changed=304!==e,t}}handleGetResponse(e,t,r,s,n){return o(this,void 0,void 0,(function*(){return t.notFound&&(r=!!(0,d.isFolder)(e)&&{}),t.changed?this.completeFetch(e,r,s,n).then((t=>(0,d.isFolder)(e)?this.corruptServerItemsMap(r)?((0,c.default)("[Sync] WARNING: Discarding corrupt folder description from server for "+e),!1):this.markChildren(e,r,t.toBeSaved,t.missingChildren).then((()=>!0)):this.rs.local.setNodes(this.flush(t.toBeSaved)).then((()=>!0)))):this.updateCommonTimestamp(e,n).then((()=>!0))}))}handleResponse(e,t,r){const o=this.interpretStatus(r.statusCode);if(o.successful){if("get"===t)return this.handleGetResponse(e,o,r.body,r.contentType,r.revision);if("put"===t||"delete"===t)return this.completePush(e,t,o.conflict,r.revision).then((function(){return!0}));throw new Error(`cannot handle response for unknown action ${t}`)}{let t;return t=o.unAuth?new h.default:o.networkProblems?new u.default("Network request failed."):new Error("HTTP response code "+o.statusCode+" received."),this.dealWithFailure(e).then((()=>{throw this.rs._emit("error",t),t}))}}finishTask(e,t=!0){if(void 0!==e.action){if(!(t&&((0,c.default)("[Sync] queue finished task:",e.path),this._finishedTasks.push(e),this._finishedTasks.length>1)))return(0,c.default)("[Sync] run task:",e.path),e.promise.then((t=>this.handleResponse(e.path,e.action,t)),(t=>((0,c.default)("[Sync] wireclient rejects its promise!",e.path,e.action,t),this.handleResponse(e.path,e.action,{statusCode:"offline"})))).then((t=>o(this,void 0,void 0,(function*(){if(this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.path],t&&this._tasks[e.path]){for(let t=0;t0?this.finishTask(this._finishedTasks[0],!1):yield this.collectTasks(!1).then((()=>{!this.hasTasks()||this.stopped?((0,c.default)("[Sync] Sync is done! Reschedule?",Object.getOwnPropertyNames(this._tasks).length,this.stopped),this.done||(this.done=!0,this.rs._emit("sync-done",{completed:!0}))):setTimeout((()=>{this.doTasks()}),10)}))}))),(t=>{(0,c.default)("[Sync] Error",t),this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.path],this.rs._emit("sync-req-done",{tasksRemaining:Object.keys(this._tasks).length}),this._finishedTasks.length>0?this.finishTask(this._finishedTasks[0],!1):this.done||(this.done=!0,this.rs._emit("sync-done",{completed:!1}))}));(0,c.default)("[Sync] delaying finished task:",e.path)}else delete this._running[e.path]}doTasks(){let e,t,r=0;e=this.rs.remote.connected?this.rs.remote.online?this.numThreads:1:0;const o=e-Object.getOwnPropertyNames(this._running).length;if(o<=0)return!0;for(t in this._tasks)if(!this._running[t]&&(this._timeStarted[t]=this.now(),this._running[t]=this.doTask(t),this._running[t].then(this.finishTask.bind(this)),r++,r>=o))return!0;return r>=o}collectTasks(e){return o(this,void 0,void 0,(function*(){return this.hasTasks()||this.stopped?Promise.resolve():this.collectDiffTasks().then((t=>t||!1===e?Promise.resolve():this.collectRefreshTasks()),(function(e){throw e}))}))}addTask(e,t){this._tasks[e]||(this._tasks[e]=[]),"function"==typeof t&&this._tasks[e].push(t)}sync(){return this.done=!1,this.doTasks()?Promise.resolve():this.collectTasks().then((()=>{try{this.doTasks()}catch(e){(0,c.default)("[Sync] doTasks error",e)}}),(function(e){throw(0,c.default)("[Sync] Sync error",e),new Error("Local cache unavailable")}))}static _rs_init(e){f=function(){(0,c.default)("[Sync] syncCycleCb calling syncCycle");const t=new i.default;t.isBrowser()&&function(e,t){function r(e){const r=t.getCurrentSyncInterval();n.default.isBackground=!e;const o=t.getCurrentSyncInterval();t._emit("sync-interval-change",{oldValue:r,newValue:o})}e.on("background",(()=>r(!1))),e.on("foreground",(()=>r(!0)))}(t,e),e.sync||(e.sync=new v(e),e.syncStopped&&((0,c.default)("[Sync] Instantiating sync stopped"),e.sync.stopped=!0,delete e.syncStopped)),(0,c.default)("[Sync] syncCycleCb calling syncCycle"),e.syncCycle()},p=function(){e.removeEventListener("connected",p),e.startSync()},e.on("ready",f),e.on("connected",p)}static _rs_cleanup(e){e.stopSync(),e.removeEventListener("ready",f),e.removeEventListener("connected",p),e.sync=void 0,delete e.sync}}t.Sync=v,(0,d.applyMixins)(v,[a.default]),t.default=v},370:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};const s=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(334));function n(e){return"dropbox"===this.backend&&!!e.match(/^\/public\/.*[^\/]$/)}const i={get:function(e,t){if(this.local){if(void 0===t)t="object"==typeof(r=this).remote&&r.remote.connected&&r.remote.online?2*r.getSyncInterval():((0,s.default)("Not setting default maxAge, because remote is offline or not connected"),!1);else if("number"!=typeof t&&!1!==t)return Promise.reject("Argument 'maxAge' must be 'false' or a number");return this.local.get(e,t,this.sync.queueGetRequest.bind(this.sync))}return this.remote.get(e);var r},put:function(e,t,r){return n.bind(this)(e)?i._wrapBusyDone.call(this,this.remote.put(e,t,r)):this.local?this.local.put(e,t,r):i._wrapBusyDone.call(this,this.remote.put(e,t,r))},delete:function(e){return this.local?this.local.delete(e):i._wrapBusyDone.call(this,this.remote.delete(e))},_wrapBusyDone:function(e){return o(this,void 0,void 0,(function*(){return this._emit("wire-busy"),e.then((e=>(this._emit("wire-done",{success:!0}),Promise.resolve(e))),(e=>(this._emit("wire-done",{success:!1}),Promise.reject(e))))}))}};e.exports=i},613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClientTypes=void 0;class r{constructor(){this.uris={},this.schemas={},this.aliases={}}declare(e,t,r,o){const s=e+"/"+t;if(o.extends){const t=o.extends.split("/"),r=1===t.length?e+"/"+t.shift():t.join("/"),n=this.uris[r];if(!n)throw"Type '"+s+"' tries to extend unknown schema '"+r+"'";o.extends=this.schemas[n]}this.uris[s]=r,this.aliases[r]=s,this.schemas[r]=o}resolveAlias(e){return this.uris[e]}getSchema(e){return this.schemas[e]}inScope(e){const t=e.length,r={};for(const o in this.uris)if(o.substr(0,t+1)===e+"/"){const e=this.uris[o];r[e]=this.schemas[e]}return r}}t.BaseClientTypes=r;const o=new r;t.default=o},503:function(e){"use strict";class t extends Error{constructor(e,t={}){super(),this.name="Unauthorized",this.message=void 0===e?"App authorization expired or revoked.":e,void 0!==t.code&&(this.code=t.code),this.stack=(new Error).stack}}e.exports=t},746:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))};function s(e,t){if("object"==typeof e&&!Array.isArray(e)&&null!==e)for(const r in e)if("object"==typeof e[r]&&null!==e[r])if("[object ArrayBuffer]"===e[r].toString()){t[r]=new ArrayBuffer(e[r].byteLength);const o=new Int8Array(e[r]);new Int8Array(t[r]).set(o)}else s(e[r],t[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.toBase64=t.getTextFromArrayBuffer=t.shouldBeTreatedAsBinary=t.getJSONFromLocalStorage=t.localStorageAvailable=t.pathsFromRoot=t.deepClone=t.equal=t.bindAll=t.cleanPath=t.baseName=t.isDocument=t.isFolder=t.containingFolder=t.extend=t.getGlobalContext=t.globalContext=t.logError=void 0,t.generateCodeVerifier=function(){return o(this,arguments,void 0,(function*(e=128){const t=new Uint8Array(e);crypto.getRandomValues(t);const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",o=Array.from(t).map((e=>r[e%66])),s=o.join(""),n=Uint8Array.from(o.map((e=>e.charCodeAt(0)))),i=(a=yield crypto.subtle.digest("SHA-256",n),btoa(String.fromCharCode.apply(null,new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""));var a;return crypto.getRandomValues(t),{codeVerifier:s,codeChallenge:i,state:Array.from(t).map((e=>r[e%66])).join("")}}))},t.applyMixins=function(e,t){t.forEach((t=>{Object.getOwnPropertyNames(t.prototype).forEach((r=>{Object.defineProperty(e.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r))}))}))},t.logError=e=>{"string"==typeof e?console.error(e):console.error(e.message,e.stack)},t.globalContext="undefined"!=typeof window?window:"object"==typeof self?self:r.g,t.getGlobalContext=()=>"undefined"!=typeof window?window:"object"==typeof self?self:r.g,t.extend=(...e)=>{const t=e[0];return Array.prototype.slice.call(e,1).forEach((function(e){for(const r in e)t[r]=e[r]})),t},t.containingFolder=e=>{if(""===e)return"/";if(!e)throw"Path not given!";return e.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},t.isFolder=e=>"/"===e.slice(-1),t.isDocument=e=>!(0,t.isFolder)(e),t.baseName=e=>{const r=e.split("/");return(0,t.isFolder)(e)?r[r.length-2]+"/":r[r.length-1]},t.cleanPath=e=>e.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27"),t.bindAll=e=>{for(const t in this)"function"==typeof e[t]&&(e[t]=e[t].bind(e))},t.equal=(e,r,o=[])=>{let s;if(typeof e!=typeof r)return!1;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return e===r;if("function"==typeof e)return e.toString()===r.toString();if(e instanceof ArrayBuffer&&r instanceof ArrayBuffer&&(e=new Uint8Array(e),r=new Uint8Array(r)),e instanceof Array){if(e.length!==r.length)return!1;for(let s=0,n=e.length;s=0)continue;n=o.slice(),n.push(r[s])}if(!(0,t.equal)(e[s],r[s],n))return!1}}return!0},t.deepClone=e=>{if(void 0!==e){const t=JSON.parse(JSON.stringify(e));return s(e,t),t}},t.pathsFromRoot=e=>{const t=[e],r=e.replace(/\/$/,"").split("/");for(;r.length>1;)r.pop(),t.push(r.join("/")+"/");return t},t.localStorageAvailable=()=>{const e=(0,t.getGlobalContext)();if(!("localStorage"in e))return!1;try{return e.localStorage.setItem("rs-check","1"),e.localStorage.removeItem("rs-check"),!0}catch(e){return!1}},t.getJSONFromLocalStorage=e=>{const r=(0,t.getGlobalContext)();try{return JSON.parse(r.localStorage.getItem(e))}catch(e){}},t.shouldBeTreatedAsBinary=(e,t)=>!!(t&&t.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\uFFFD]/.test(e)),t.getTextFromArrayBuffer=(e,r)=>new Promise((o=>{if("undefined"==typeof Blob||"undefined"==typeof FileReader){const t=Buffer.from(e);o(t.toString(r))}else{let s;const n=t.globalContext;if(n.BlobBuilder=n.BlobBuilder||n.WebKitBlobBuilder,void 0!==n.BlobBuilder){const t=new n.BlobBuilder;t.append(e),s=t.getBlob()}else s=new Blob([e]);const i=new FileReader;"function"==typeof i.addEventListener?i.addEventListener("loadend",(function(e){o(e.target.result)})):i.onloadend=function(e){o(e.target.result)},i.readAsText(s,r)}})),t.toBase64=e=>{const r=(0,t.getGlobalContext)();return"btoa"in r?r.btoa(e):Buffer.from(e).toString("base64")}},600:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(s,n){function i(e){try{c(o.next(e))}catch(e){n(e)}}function a(e){try{c(o.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}c((o=o.apply(e,t||[])).next())}))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const n=s(r(275)),i=s(r(93)),a=s(r(503)),c=s(r(334)),l=r(746),u=r(368),h=r(684);let d;const f="remotestorage:wireclient",p={"draft-dejong-remotestorage-00":2,"draft-dejong-remotestorage-01":3,"draft-dejong-remotestorage-02":4,"https://www.w3.org/community/rww/wiki/read-write-web-00#simple":1};class m extends h.RemoteBase{constructor(e){if(super(e),this._revisionCache={},d=(0,l.localStorageAvailable)(),this.addEvents(["connected","not-connected"]),d){const e=function(){const e=(0,l.getJSONFromLocalStorage)(f)||{},{userAddress:t,href:r,storageApi:o,token:s,properties:n}=e;return{userAddress:t,href:r,storageApi:o,token:s,properties:n}}();e&&setTimeout((()=>{this.configure(e)}),0)}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}get storageType(){if(this.storageApi){const e=this.storageApi.match(/draft-dejong-(remotestorage-\d\d)/);return e?e[1]:"2012.04"}}_request(e,t,r,s,i,h,d){return o(this,void 0,void 0,(function*(){if(this.isForbiddenRequestMethod(e,t))return Promise.reject(`Don't use ${e} on directories!`);let o;return r!==n.default.IMPLIED_FAKE_TOKEN&&(s.Authorization="Bearer "+r),this.rs._emit("wire-busy",{method:e,isFolder:(0,l.isFolder)(t)}),(0,u.requestWithTimeout)(e,t,{body:i,headers:s,responseType:"arraybuffer"}).then((r=>{if(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,l.isFolder)(t),success:!0}),s=r.status,[401,403,404,412].indexOf(s)>=0)return(0,c.default)("[WireClient] Error response status",r.status),o=h?this.stripQuotes(r.getResponseHeader("ETag")):void 0,401===r.status&&this.rs._emit("error",new a.default),Promise.resolve({statusCode:r.status,revision:o});if(function(e){return[201,204,304].indexOf(e)>=0}(r.status)||200===r.status&&"GET"!==e)return o=this.stripQuotes(r.getResponseHeader("ETag")),(0,c.default)("[WireClient] Successful request",o),Promise.resolve({statusCode:r.status,revision:o});{const e=r.getResponseHeader("Content-Type");o=h?this.stripQuotes(r.getResponseHeader("ETag")):200===r.status?d:void 0;const t=function(e){let t,r="utf-8";return e&&(t=e.match(/charset=(.+)$/),t&&(r=t[1])),r}(e);return(0,l.shouldBeTreatedAsBinary)(r.response,e)?((0,c.default)("[WireClient] Successful request with unknown or binary mime-type",o),Promise.resolve({statusCode:r.status,body:r.response,contentType:e,revision:o})):(0,l.getTextFromArrayBuffer)(r.response,t).then((t=>((0,c.default)("[WireClient] Successful request",o),Promise.resolve({statusCode:r.status,body:t,contentType:e,revision:o}))))}var s}),(r=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,l.isFolder)(t),success:!1}),Promise.reject(r))))}))}configure(e){if("object"!=typeof e)throw new Error("WireClient configure settings parameter should be an object");if(void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.href&&(this.href=e.href),void 0!==e.storageApi&&(this.storageApi=e.storageApi),void 0!==e.token&&(this.token=e.token),void 0!==e.properties&&(this.properties=e.properties),"string"==typeof this.storageApi){const e=p[this.storageApi]||5;this.supportsRevs=e>=2}this.href&&this.token?(this.connected=!0,this.online=!0,this._emit("connected")):this.connected=!1,d&&(localStorage[f]=JSON.stringify({userAddress:this.userAddress,href:this.href,storageApi:this.storageApi,token:this.token,properties:this.properties}))}get(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const r={};return this.supportsRevs&&t.ifNoneMatch&&(r["If-None-Match"]=this.addQuotes(t.ifNoneMatch)),this._request("GET",this.href+(0,l.cleanPath)(e),this.token,r,void 0,this.supportsRevs,this._revisionCache[e]).then((t=>{if(!(0,l.isFolder)(e))return Promise.resolve(t);let r={};if(void 0!==t.body)try{t.body=JSON.parse(t.body)}catch(t){return Promise.reject("Folder description at "+this.href+(0,l.cleanPath)(e)+" is not JSON")}if(200===t.statusCode&&"object"==typeof t.body){if(0===Object.keys(t.body).length)t.statusCode=404;else if("http://remotestorage.io/spec/folder-description"===(o=t.body)["@context"]&&"object"==typeof o.items){for(const r in t.body.items)this._revisionCache[e+r]=t.body.items[r].ETag;r=t.body.items}else Object.keys(t.body).forEach((o=>{this._revisionCache[e+o]=t.body[o],r[o]={ETag:t.body[o]}}));return t.body=r,Promise.resolve(t)}return Promise.resolve(t);var o}))}put(e,t,r,o={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");!r.match(/charset=/)&&(t instanceof ArrayBuffer||(0,u.isArrayBufferView)(t))&&(r+="; charset=binary");const s={"Content-Type":r};return this.supportsRevs&&(o.ifMatch&&(s["If-Match"]=this.addQuotes(o.ifMatch)),o.ifNoneMatch&&(s["If-None-Match"]=this.addQuotes(o.ifNoneMatch))),this._request("PUT",this.href+(0,l.cleanPath)(e),this.token,s,t,this.supportsRevs)}delete(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");t||(t={});const r={};return this.supportsRevs&&t.ifMatch&&(r["If-Match"]=this.addQuotes(t.ifMatch)),this._request("DELETE",this.href+(0,l.cleanPath)(e),this.token,r,void 0,this.supportsRevs)}static _rs_init(e){e.remote=new m(e),e.remote.online=!0}static _rs_supported(){return"function"==typeof fetch||"function"==typeof XMLHttpRequest}static _rs_cleanup(){d&&delete localStorage[f]}}(0,l.applyMixins)(m,[i.default]),e.exports=m},439:function(e,t){var r,o;r=function(){var e,t,r,o;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),o=(r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(s){if("object"!=typeof s&&"function"!=typeof s||null===s)throw new TypeError("Object.keys called on non-object");var n=[];for(var i in s)e.call(s,i)&&n.push(i);if(t)for(var a=0;a>>0;if(0===r)return-1;var o=0;if(arguments.length>1&&((o=Number(arguments[1]))!=o?o=0:0!==o&&o!==1/0&&o!==-1/0&&(o=(o>0||-1)*Math.floor(Math.abs(o)))),o>=r)return-1;for(var s=o>=0?o:Math.max(r-Math.abs(o),0);s0&&(t+=u.suffices["*"]&&r||",",u.suffices["*"]&&c&&(t+=u.name+"=")),t+=a?encodeURIComponent(h[f]).replace(/!/g,"%21"):i(h[f])}else if("object"==typeof h){c&&!u.suffices["*"]&&(t+=u.name+"=");var p=!0;for(var m in h)p||(t+=u.suffices["*"]&&r||","),p=!1,t+=a?encodeURIComponent(m).replace(/!/g,"%21"):i(m),t+=u.suffices["*"]?"=":",",t+=a?encodeURIComponent(h[m]).replace(/!/g,"%21"):i(h[m])}else c&&(t+=u.name,l&&""===h||(t+="=")),null!=u.truncate&&(h=h.substring(0,u.truncate)),t+=a?encodeURIComponent(h).replace(/!/g,"%21"):i(h)}return t};return b.varNames=u,{prefix:o,substitution:b}}function c(e){if(!(this instanceof c))return new c(e);for(var t=e.split("{"),r=[t.shift()],o=[],s=[],n=[];t.length>0;){var i=t.shift(),l=i.split("}")[0],u=i.substring(l.length+1),h=a(l);s.push(h.substitution),o.push(h.prefix),r.push(u),n=n.concat(h.substitution.varNames)}this.fill=function(e){for(var t=r[0],o=0;o0&&"/"===t.charAt(e.length-1)||"#"===r.charAt(0)||"?"===r.charAt(0))return!0}return!1}(t,e.id)&&void 0===this.schemas[e.id]&&(this.schemas[e.id]=e),e)if("enum"!==o)if("object"==typeof e[o])this.searchSchemas(e[o],t);else if("$ref"===o){var s=m(e[o]);s&&void 0===this.schemas[s]&&void 0===this.missingMap[s]&&(this.missingMap[s]=s)}},l.prototype.addSchema=function(e,t){if("string"!=typeof e||void 0===t){if("object"!=typeof e||"string"!=typeof e.id)return;e=(t=e).id}e===m(e)+"#"&&(e=m(e)),this.schemas[e]=t,delete this.missingMap[e],g(t,e),this.searchSchemas(t,e)},l.prototype.getSchemaMap=function(){var e={};for(var t in this.schemas)e[t]=this.schemas[t];return e},l.prototype.getSchemaUris=function(e){var t=[];for(var r in this.schemas)e&&!e.test(r)||t.push(r);return t},l.prototype.getMissingUris=function(e){var t=[];for(var r in this.missingMap)e&&!e.test(r)||t.push(r);return t},l.prototype.dropSchemas=function(){this.schemas={},this.reset()},l.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},l.prototype.validateAll=function(e,t,r,o,s){var n;if(!(t=this.resolveRefs(t)))return null;if(t instanceof P)return this.errors.push(t),t;var i,a=this.errors.length,c=null,l=null;if(this.checkRecursive&&e&&"object"==typeof e){if(n=!this.scanned.length,e[this.validatedSchemasKey]){var u=e[this.validatedSchemasKey].indexOf(t);if(-1!==u)return this.errors=this.errors.concat(e[this.validationErrorsKey][u]),null}if(Object.isFrozen(e)&&-1!==(i=this.scannedFrozen.indexOf(e))){var h=this.scannedFrozenSchemas[i].indexOf(t);if(-1!==h)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[i][h]),null}if(this.scanned.push(e),Object.isFrozen(e))-1===i&&(i=this.scannedFrozen.length,this.scannedFrozen.push(e),this.scannedFrozenSchemas.push([])),c=this.scannedFrozenSchemas[i].length,this.scannedFrozenSchemas[i][c]=t,this.scannedFrozenValidationErrors[i][c]=[];else{if(!e[this.validatedSchemasKey])try{Object.defineProperty(e,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(e,this.validationErrorsKey,{value:[],configurable:!0})}catch(t){e[this.validatedSchemasKey]=[],e[this.validationErrorsKey]=[]}l=e[this.validatedSchemasKey].length,e[this.validatedSchemasKey][l]=t,e[this.validationErrorsKey][l]=[]}}var d=this.errors.length,f=this.validateBasic(e,t,s)||this.validateNumeric(e,t,s)||this.validateString(e,t,s)||this.validateArray(e,t,s)||this.validateObject(e,t,s)||this.validateCombinations(e,t,s)||this.validateHypermedia(e,t,s)||this.validateFormat(e,t,s)||this.validateDefinedKeywords(e,t,s)||null;if(n){for(;this.scanned.length;)delete this.scanned.pop()[this.validatedSchemasKey];this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(f||d!==this.errors.length)for(;r&&r.length||o&&o.length;){var p=r&&r.length?""+r.pop():null,m=o&&o.length?""+o.pop():null;f&&(f=f.prefixWith(p,m)),this.prefixErrors(d,p,m)}return null!==c?this.scannedFrozenValidationErrors[i][c]=this.errors.slice(a):null!==l&&(e[this.validationErrorsKey][l]=this.errors.slice(a)),this.handleError(f)},l.prototype.validateFormat=function(e,t){if("string"!=typeof t.format||!this.formatValidators[t.format])return null;var r=this.formatValidators[t.format].call(null,e,t);return"string"==typeof r||"number"==typeof r?this.createError(v.FORMAT_CUSTOM,{message:r},"","/format",null,e,t):r&&"object"==typeof r?this.createError(v.FORMAT_CUSTOM,{message:r.message||"?"},r.dataPath||"",r.schemaPath||"/format",null,e,t):null},l.prototype.validateDefinedKeywords=function(e,t,r){for(var o in this.definedKeywords)if(void 0!==t[o])for(var s=this.definedKeywords[o],n=0;n=h&&ot.maximum)return this.createError(v.NUMBER_MAXIMUM,{value:e,maximum:t.maximum},"","/maximum",null,e,t);if(t.exclusiveMaximum&&e===t.maximum)return this.createError(v.NUMBER_MAXIMUM_EXCLUSIVE,{value:e,maximum:t.maximum},"","/exclusiveMaximum",null,e,t)}return null},l.prototype.validateNaN=function(e,t){return"number"!=typeof e?null:!0===isNaN(e)||e===1/0||e===-1/0?this.createError(v.NUMBER_NOT_A_NUMBER,{value:e},"","/type",null,e,t):null},l.prototype.validateString=function(e,t,r){return this.validateStringLength(e,t,r)||this.validateStringPattern(e,t,r)||null},l.prototype.validateStringLength=function(e,t){return"string"!=typeof e?null:void 0!==t.minLength&&e.lengtht.maxLength?this.createError(v.STRING_LENGTH_LONG,{length:e.length,maximum:t.maxLength},"","/maxLength",null,e,t):null},l.prototype.validateStringPattern=function(e,t){if("string"!=typeof e||"string"!=typeof t.pattern&&!(t.pattern instanceof RegExp))return null;var r;if(t.pattern instanceof RegExp)r=t.pattern;else{var o,s="",n=t.pattern.match(/^\/(.+)\/([img]*)$/);n?(o=n[1],s=n[2]):o=t.pattern,r=new RegExp(o,s)}return r.test(e)?null:this.createError(v.STRING_PATTERN,{pattern:t.pattern},"","/pattern",null,e,t)},l.prototype.validateArray=function(e,t,r){return Array.isArray(e)&&(this.validateArrayLength(e,t,r)||this.validateArrayUniqueItems(e,t,r)||this.validateArrayItems(e,t,r))||null},l.prototype.validateArrayLength=function(e,t){var r;return void 0!==t.minItems&&e.lengtht.maxItems&&(r=this.createError(v.ARRAY_LENGTH_LONG,{length:e.length,maximum:t.maxItems},"","/maxItems",null,e,t),this.handleError(r))?r:null},l.prototype.validateArrayUniqueItems=function(e,t){if(t.uniqueItems)for(var r=0;rt.maxProperties&&(r=this.createError(v.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:o.length,maximum:t.maxProperties},"","/maxProperties",null,e,t),this.handleError(r))?r:null},l.prototype.validateObjectRequiredProperties=function(e,t){if(void 0!==t.required)for(var r=0;r 10000");if(void 0!==v[e])throw new Error("Error already defined: "+e+" as "+v[e]);if(void 0!==_[t])throw new Error("Error code already used: "+_[t]+" as "+t);for(var o in v[e]=t,_[t]=e,w[e]=w[t]=r,T){var s=T[o];s[e]&&(s[t]=s[t]||s[e])}},reset:function(){s.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:g,resolveUrl:p,getDocumentUri:m,errorCodes:v};return n.language(t||"en"),n}();return E.addLanguage("en-gb",w),E.tv4=E,E},void 0===(o=r.apply(t,[]))||(e.exports=o)},199:function(e,t,r){var o;"function"!=typeof fetch&&"function"!=typeof XMLHttpRequest&&(XMLHttpRequest=r(317)),function(r){var s={"http://webfist.org/spec/rel":"webfist","http://webfinger.net/rel/avatar":"avatar",remotestorage:"remotestorage","http://tools.ietf.org/id/draft-dejong-remotestorage":"remotestorage",remoteStorage:"remotestorage","http://www.packetizer.com/rel/share":"share","http://webfinger.net/rel/profile-page":"profile",me:"profile",vcard:"vcard",blog:"blog","http://packetizer.com/rel/blog":"blog","http://schemas.google.com/g/2010#updates-from":"updates","https://camlistore.org/rel/server":"camilstore"},n={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],webfist:[],camlistore:[]},i=["webfinger","host-meta","host-meta.json"];function a(e){return e.toString=function(){return this.message},e}function c(e){"object"!=typeof e&&(e={}),this.config={tls_only:void 0===e.tls_only||e.tls_only,webfist_fallback:void 0!==e.webfist_fallback&&e.webfist_fallback,uri_fallback:void 0!==e.uri_fallback&&e.uri_fallback,request_timeout:void 0!==e.request_timeout?e.request_timeout:1e4}}c.prototype.__fetchJRD=function(e,t,r){if("function"==typeof fetch)return this.__fetchJRD_fetch(e,t,r);if("function"==typeof XMLHttpRequest)return this.__fetchJRD_XHR(e,t,r);throw new Error("add a polyfill for fetch or XMLHttpRequest")},c.prototype.__fetchJRD_fetch=function(e,t,r){var o,s=this;"function"==typeof AbortController&&(o=new AbortController);var n=fetch(e,{headers:{Accept:"application/jrd+json, application/json"},signal:o?o.signal:void 0}).then((function(t){if(t.ok)return t.text();throw 404===t.status?a({message:"resource not found",url:e,status:t.status}):a({message:"error during request",url:e,status:t.status})}),(function(t){throw a({message:"error during request",url:e,status:void 0,err:t})})).then((function(t){if(s.__isValidJSON(t))return t;throw a({message:"invalid json",url:e,status:void 0})})),i=new Promise((function(t,r){setTimeout((function(){r(a({message:"request timed out",url:e,status:void 0})),o&&o.abort()}),s.config.request_timeout)}));Promise.race([n,i]).then((function(e){r(e)})).catch((function(e){t(e)}))},c.prototype.__fetchJRD_XHR=function(e,t,r){var o=this,s=!1,n=new XMLHttpRequest;function i(){if(!s)return s=!0,200===n.status?o.__isValidJSON(n.responseText)?r(n.responseText):t(a({message:"invalid json",url:e,status:n.status})):404===n.status?t(a({message:"resource not found",url:e,status:n.status})):n.status>=301&&n.status<=302?function(e){return"string"==typeof e&&"https"===e.split("://")[0]}(n.getResponseHeader("Location"))?c():t(a({message:"no redirect URL found",url:e,status:n.status})):t(a({message:"error during request",url:e,status:n.status}))}function c(){n.onreadystatechange=function(){4===n.readyState&&i()},n.onload=function(){i()},n.ontimeout=function(){return t(a({message:"request timed out",url:e,status:n.status}))},n.open("GET",e,!0),n.timeout=o.config.request_timeout,n.setRequestHeader("Accept","application/jrd+json, application/json"),n.send()}return c()},c.prototype.__isValidJSON=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},c.prototype.__isLocalhost=function(e){return/^localhost(\.localdomain)?(\:[0-9]+)?$/.test(e)},c.prototype.__processJRD=function(e,t,r,o){var i=JSON.parse(t);if("object"!=typeof i||"object"!=typeof i.links)return void 0!==i.error?r(a({message:i.error,request:e})):r(a({message:"unknown response from server",request:e}));var c=i.links;Array.isArray(c)||(c=[]);var l={object:i,json:t,idx:{}};l.idx.properties={name:void 0},l.idx.links=JSON.parse(JSON.stringify(n)),c.map((function(e,t){if(s.hasOwnProperty(e.rel)&&l.idx.links[s[e.rel]]){var r={};Object.keys(e).map((function(t,o){r[t]=e[t]})),l.idx.links[s[e.rel]].push(r)}}));var u=JSON.parse(t).properties;for(var h in u)u.hasOwnProperty(h)&&"http://packetizer.com/ns/name"===h&&(l.idx.properties.name=u[h]);return o(l)},c.prototype.lookup=function(e,t){if("string"!=typeof e)throw new Error("first parameter must be a user address");if("function"!=typeof t)throw new Error("second parameter must be a callback");var r=this,o="";o=e.indexOf("://")>-1?e.replace(/ /g,"").split("/")[2]:e.replace(/ /g,"").split("@")[1];var s=0,n="https";function a(){var t="";return e.split("://")[1]||(t="acct:"),n+"://"+o+"/.well-known/"+i[s]+"?resource="+t+e}function c(e){if(r.config.uri_fallback&&"webfist.org"!==o&&s!==i.length-1)return s+=1,l();if(!r.config.tls_only&&"https"===n)return s=0,n="http",l();if(!r.config.webfist_fallback||"webfist.org"===o)return t(e);s=0,n="http",o="webfist.org";var c=a();r.__fetchJRD(c,t,(function(e){r.__processJRD(c,e,t,(function(e){"object"==typeof e.idx.links.webfist&&"string"==typeof e.idx.links.webfist[0].href&&r.__fetchJRD(e.idx.links.webfist[0].href,t,(function(e){r.__processJRD(c,e,t,(function(e){return t(null,t)}))}))}))}))}function l(){var e=a();r.__fetchJRD(e,c,(function(o){r.__processJRD(e,o,t,(function(e){t(null,e)}))}))}return r.__isLocalhost(o)&&(n="http"),setTimeout(l,0)},c.prototype.lookupLink=function(e,t,r){if(!n.hasOwnProperty(t))return r("unsupported rel "+t);this.lookup(e,(function(e,o){var s=o.idx.links[t];return e?r(e):0===s.length?r('no links found with rel="'+t+'"'):r(null,s[0])}))},void 0===(o=function(){return c}.apply(t,[]))||(e.exports=o)}()},317:function(e){e.exports=XMLHttpRequest}},t={};function r(o){var s=t[o];if(void 0!==s)return s.exports;var n=t[o]={exports:{}};return e[o].call(n.exports,n,n.exports,r),n.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();var o=r(423);return o.default}()})); ->>>>>>> master +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("RemoteStorage",[],t):"object"==typeof exports?exports.RemoteStorage=t():e.RemoteStorage=t()}(this,(function(){return function(){var e={608:function(e,t,r){var{Buffer:n}=r(8287),i={},o=i.LEFT_BRACE=1,s=i.RIGHT_BRACE=2,a=i.LEFT_BRACKET=3,c=i.RIGHT_BRACKET=4,l=i.COLON=5,u=i.COMMA=6,d=i.TRUE=7,h=i.FALSE=8,f=i.NULL=9,p=i.STRING=10,g=i.NUMBER=11,y=i.START=17,m=i.STOP=18,v=i.TRUE1=33,b=i.TRUE2=34,w=i.TRUE3=35,_=i.FALSE1=49,S=i.FALSE2=50,E=i.FALSE3=51,A=i.FALSE4=52,R=i.NULL1=65,I=i.NULL2=66,T=i.NULL3=67,x=i.NUMBER1=81,P=i.NUMBER3=83,C=i.STRING1=97,k=i.STRING2=98,O=i.STRING3=99,F=i.STRING4=100,N=i.STRING5=101,D=i.STRING6=102,L=i.VALUE=113,U=i.KEY=114,j=i.OBJECT=129,M=i.ARRAY=130,B="\\".charCodeAt(0),H="/".charCodeAt(0),W="\b".charCodeAt(0),$="\f".charCodeAt(0),V="\n".charCodeAt(0),K="\r".charCodeAt(0),J="\t".charCodeAt(0),G=65536;function q(e){return n.alloc?n.alloc(e):new n(e)}function z(){this.tState=y,this.value=void 0,this.string=void 0,this.stringBuffer=q(G),this.stringBufferOffset=0,this.unicode=void 0,this.highSurrogate=void 0,this.key=void 0,this.mode=void 0,this.stack=[],this.state=L,this.bytes_remaining=0,this.bytes_in_sequence=0,this.temp_buffs={2:q(2),3:q(3),4:q(4)},this.offset=-1}z.toknam=function(e){for(var t=Object.keys(i),r=0,n=t.length;r=G&&(this.string+=this.stringBuffer.toString("utf8"),this.stringBufferOffset=0),this.stringBuffer[this.stringBufferOffset++]=e},Y.appendStringBuf=function(e,t,r){var n=e.length;"number"==typeof t&&(n="number"==typeof r?r<0?e.length-t+r:r-t:e.length-t),n<0&&(n=0),this.stringBufferOffset+n>G&&(this.string+=this.stringBuffer.toString("utf8",0,this.stringBufferOffset),this.stringBufferOffset=0),e.copy(this.stringBuffer,this.stringBufferOffset,t,r),this.stringBufferOffset+=n},Y.write=function(e){var t;"string"==typeof e&&(e=new n(e));for(var r=0,i=e.length;r=48&&t<64)this.string=String.fromCharCode(t),this.tState=P;else if(32!==t&&9!==t&&10!==t&&13!==t)return this.charError(e,r)}else if(this.tState===C)if(t=e[r],this.bytes_remaining>0){for(var g=0;g=128){if(t<=193||t>244)return this.onError(new Error("Invalid UTF-8 character at position "+r+" in state "+z.toknam(this.tState)));if(t>=194&&t<=223&&(this.bytes_in_sequence=2),t>=224&&t<=239&&(this.bytes_in_sequence=3),t>=240&&t<=244&&(this.bytes_in_sequence=4),this.bytes_in_sequence+r>e.length){for(var m=0;m<=e.length-1-r;m++)this.temp_buffs[this.bytes_in_sequence][m]=e[r+m];this.bytes_remaining=r+this.bytes_in_sequence-e.length,r=e.length-1}else this.appendStringBuf(e,r,r+this.bytes_in_sequence),r=r+this.bytes_in_sequence-1}else if(34===t)this.tState=y,this.string+=this.stringBuffer.toString("utf8",0,this.stringBufferOffset),this.stringBufferOffset=0,this.onToken(p,this.string),this.offset+=n.byteLength(this.string,"utf8")+1,this.string=void 0;else if(92===t)this.tState=k;else{if(!(t>=32))return this.charError(e,r);this.appendStringChar(t)}else if(this.tState===k)if(34===(t=e[r]))this.appendStringChar(t),this.tState=C;else if(92===t)this.appendStringChar(B),this.tState=C;else if(47===t)this.appendStringChar(H),this.tState=C;else if(98===t)this.appendStringChar(W),this.tState=C;else if(102===t)this.appendStringChar($),this.tState=C;else if(110===t)this.appendStringChar(V),this.tState=C;else if(114===t)this.appendStringChar(K),this.tState=C;else if(116===t)this.appendStringChar(J),this.tState=C;else{if(117!==t)return this.charError(e,r);this.unicode="",this.tState=O}else if(this.tState===O||this.tState===F||this.tState===N||this.tState===D){if(!((t=e[r])>=48&&t<64||t>64&&t<=70||t>96&&t<=102))return this.charError(e,r);if(this.unicode+=String.fromCharCode(t),this.tState++===D){var L=parseInt(this.unicode,16);this.unicode=void 0,void 0!==this.highSurrogate&&L>=56320&&L<57344?(this.appendStringBuf(new n(String.fromCharCode(this.highSurrogate,L))),this.highSurrogate=void 0):void 0===this.highSurrogate&&L>=55296&&L<56320?this.highSurrogate=L:(void 0!==this.highSurrogate&&(this.appendStringBuf(new n(String.fromCharCode(this.highSurrogate))),this.highSurrogate=void 0),this.appendStringBuf(new n(String.fromCharCode(L)))),this.tState=C}}else if(this.tState===x||this.tState===P)switch(t=e[r]){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 46:case 101:case 69:case 43:case 45:this.string+=String.fromCharCode(t),this.tState=P;break;default:this.tState=y;var U=this.numberReviver(this.string,e,r);if(U)return U;this.offset+=this.string.length-1,this.string=void 0,r--}else if(this.tState===v){if(114!==e[r])return this.charError(e,r);this.tState=b}else if(this.tState===b){if(117!==e[r])return this.charError(e,r);this.tState=w}else if(this.tState===w){if(101!==e[r])return this.charError(e,r);this.tState=y,this.onToken(d,!0),this.offset+=3}else if(this.tState===_){if(97!==e[r])return this.charError(e,r);this.tState=S}else if(this.tState===S){if(108!==e[r])return this.charError(e,r);this.tState=E}else if(this.tState===E){if(115!==e[r])return this.charError(e,r);this.tState=A}else if(this.tState===A){if(101!==e[r])return this.charError(e,r);this.tState=y,this.onToken(h,!1),this.offset+=4}else if(this.tState===R){if(117!==e[r])return this.charError(e,r);this.tState=I}else if(this.tState===I){if(108!==e[r])return this.charError(e,r);this.tState=T}else if(this.tState===T){if(108!==e[r])return this.charError(e,r);this.tState=y,this.onToken(f,null),this.offset+=3}},Y.onToken=function(e,t){},Y.parseError=function(e,t){this.tState=m,this.onError(new Error("Unexpected "+z.toknam(e)+(t?"("+JSON.stringify(t)+")":"")+" in state "+z.toknam(this.state)))},Y.push=function(){this.stack.push({value:this.value,key:this.key,mode:this.mode})},Y.pop=function(){var e=this.value,t=this.stack.pop();this.value=t.value,this.key=t.key,this.mode=t.mode,this.emit(e),this.mode||(this.state=L)},Y.emit=function(e){this.mode&&(this.state=u),this.onValue(e)},Y.onValue=function(e){},Y.onToken=function(e,t){if(this.state===L)if(e===p||e===g||e===d||e===h||e===f)this.value&&(this.value[this.key]=t),this.emit(t);else if(e===o)this.push(),this.value?this.value=this.value[this.key]={}:this.value={},this.key=void 0,this.state=U,this.mode=j;else if(e===a)this.push(),this.value?this.value=this.value[this.key]=[]:this.value=[],this.key=0,this.mode=M,this.state=L;else if(e===s){if(this.mode!==j)return this.parseError(e,t);this.pop()}else{if(e!==c)return this.parseError(e,t);if(this.mode!==M)return this.parseError(e,t);this.pop()}else if(this.state===U)if(e===p)this.key=t,this.state=l;else{if(e!==s)return this.parseError(e,t);this.pop()}else if(this.state===l){if(e!==l)return this.parseError(e,t);this.state=L}else{if(this.state!==u)return this.parseError(e,t);if(e===u)this.mode===M?(this.key++,this.state=L):this.mode===j&&(this.state=U);else{if(!(e===c&&this.mode===M||e===s&&this.mode===j))return this.parseError(e,t);this.pop()}}},Y.numberReviver=function(e,t,r){var n=Number(e);if(isNaN(n))return this.charError(t,r);e.match(/[0-9]+/)==e&&n.toString()!=e?this.onToken(p,e):this.onToken(g,n)},z.C=i,e.exports=z},2741:function(e,t,r){"use strict";r.r(t),r.d(t,{CordovaIFrameNavigator:function(){return n.CordovaIFrameNavigator},CordovaPopupNavigator:function(){return n.CordovaPopupNavigator},InMemoryWebStorage:function(){return n.InMemoryWebStorage},Log:function(){return n.Log},OidcClient:function(){return n.OidcClient},SessionMonitor:function(){return n.SessionMonitor},User:function(){return n.User},UserManager:function(){return n.UserManager},Version:function(){return n.Version},WebStorageStateStore:function(){return n.WebStorageStateStore},clearOidcPersistentStorage:function(){return N},getBearerToken:function(){return P},getDpopToken:function(){return C},normalizeCallbackUrl:function(){return F},refresh:function(){return O},registerClient:function(){return I}});var n=r(6516);r(7007),globalThis.fetch;const{fetch:i,Response:o,Request:s,Headers:a}=globalThis;var c=r(9380),l=r(8136),u=r(7248),d=r(7307),h=r(5130),f={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let p;const g=new Uint8Array(16);function y(){if(!p&&(p="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!p))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return p(g)}const m=[];for(let e=0;e<256;++e)m.push((e+256).toString(16).slice(1));var v=function(e,t,r){if(f.randomUUID&&!t&&!e)return f.randomUUID();const n=(e=e||{}).random||(e.rng||y)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=n[e];return t}return function(e,t=0){return m[e[t+0]]+m[e[t+1]]+m[e[t+2]]+m[e[t+3]]+"-"+m[e[t+4]]+m[e[t+5]]+"-"+m[e[t+6]]+m[e[t+7]]+"-"+m[e[t+8]]+m[e[t+9]]+"-"+m[e[t+10]]+m[e[t+11]]+m[e[t+12]]+m[e[t+13]]+m[e[t+14]]+m[e[t+15]]}(n)};const b=["ES256","RS256"],w=["openid","offline_access","webid"].join(" ");async function _(e,t,r,n){const o=await async function(e,t){const r=await i.call(globalThis,e);if(200!==r.status)throw new Error(`Could not fetch JWKS for [${t}] at [${e}]: ${r.status} ${r.statusText}`);let n;try{n=(await r.json()).keys[0]}catch(r){throw new Error(`Malformed JWKS for [${t}] at [${e}]: ${r.message}`)}return n}(t,r);let s;try{const{payload:t}=await(0,c.V)(e,await(0,l.Og)(o),{issuer:r,audience:n});s=t}catch(e){throw new Error(`Token verification failed: ${e.stack}`)}if("string"==typeof s.webid)return s.webid;if("string"!=typeof s.sub)throw new Error(`The token ${JSON.stringify(s)} is invalid: it has no 'webid' claim and no 'sub' claim.`);try{return new URL(s.sub),s.sub}catch(e){throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${s.sub}] is invalid as a URL - error [${e}].`)}}Error,Error;class S extends Error{constructor(e){super(`Invalid response from OIDC provider: missing fields ${e}`),this.missingFields=e}}class E extends Error{constructor(e,t,r){super(e),this.error=t,this.errorDescription=r}}function A(e){const t=new URL(e);return new URL(t.pathname,t.origin).toString()}async function R(e,t,r){return new u.P({htu:A(e),htm:t.toUpperCase(),jti:v()}).setProtectedHeader({alg:b[0],jwk:r.publicKey,typ:"dpop+jwt"}).setIssuedAt().sign(r.privateKey,{})}async function I(e,t){var r;if(!t.registrationEndpoint)throw new Error("Dynamic Registration could not be completed because the issuer has no registration endpoint.");if(!Array.isArray(t.idTokenSigningAlgValuesSupported))throw new Error("The OIDC issuer discovery profile is missing the 'id_token_signing_alg_values_supported' value, which is mandatory.");const n=function(e,t){var r;return null!==(r=t.find((t=>e.includes(t))))&&void 0!==r?r:null}(t.idTokenSigningAlgValuesSupported,b),i={client_name:e.clientName,application_type:"web",redirect_uris:[null===(r=e.redirectUrl)||void 0===r?void 0:r.toString()],subject_type:"public",token_endpoint_auth_method:"client_secret_basic",id_token_signed_response_alg:n,grant_types:["authorization_code","refresh_token"]},o=await fetch(t.registrationEndpoint.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(o.ok){const t=await o.json();return function(e,t){if(void 0===e.client_id)throw new Error(`Dynamic client registration failed: no client_id has been found on ${JSON.stringify(e)}`);if(t.redirectUrl&&(void 0===e.redirect_uris||e.redirect_uris[0]!==t.redirectUrl.toString()))throw new Error(`Dynamic client registration failed: the returned redirect URIs ${JSON.stringify(e.redirect_uris)} don't match the provided ${JSON.stringify([t.redirectUrl.toString()])}`)}(t,e),{clientId:t.client_id,clientSecret:t.client_secret,idTokenSignedResponseAlg:t.id_token_signed_response_alg,clientType:"dynamic"}}throw 400===o.status&&function(e,t){var r,n,i,o;if("invalid_redirect_uri"===e.error)throw new Error(`Dynamic client registration failed: the provided redirect uri [${null===(r=t.redirectUrl)||void 0===r?void 0:r.toString()}] is invalid - ${null!==(n=e.error_description)&&void 0!==n?n:""}`);if("invalid_client_metadata"===e.error)throw new Error(`Dynamic client registration failed: the provided client metadata ${JSON.stringify(t)} is invalid - ${null!==(i=e.error_description)&&void 0!==i?i:""}`);throw new Error(`Dynamic client registration failed: ${e.error} - ${null!==(o=e.error_description)&&void 0!==o?o:""}`)}(await o.json(),e),new Error(`Dynamic client registration failed: the server returned ${o.status} ${o.statusText} - ${await o.text()}`)}function T(e){return void 0!==e.error_description&&"string"==typeof e.error_description}function x(e,t){if(void 0!==(r=e).error&&"string"==typeof r.error)throw new E(`Token endpoint returned error [${e.error}]${T(e)?`: ${e.error_description}`:""}${function(e){return void 0!==e.error_uri&&"string"==typeof e.error_uri}(e)?` (see ${e.error_uri})`:""}`,e.error,T(e)?e.error_description:void 0);var r;if(!function(e){return void 0!==e.access_token&&"string"==typeof e.access_token}(e))throw new S(["access_token"]);if(!function(e){return void 0!==e.id_token&&"string"==typeof e.id_token}(e))throw new S(["id_token"]);if(!function(e){return void 0!==e.token_type&&"string"==typeof e.token_type}(e))throw new S(["token_type"]);if(!function(e){return void 0===e.expires_in||"number"==typeof e.expires_in}(e))throw new S(["expires_in"]);if(!t&&"bearer"!==e.token_type.toLowerCase())throw new Error(`Invalid token endpoint response: requested a [Bearer] token, but got a 'token_type' value of [${e.token_type}].`);return e}async function P(e){let t;try{const r=new n.OidcClient({response_mode:"query",loadUserInfo:!1});if(t=await r.processSigninResponse(e),void 0===r.settings.metadata)throw new Error("Cannot retrieve issuer metadata from client information in storage.");if(void 0===r.settings.metadata.jwks_uri)throw new Error("Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined");if(void 0===r.settings.metadata.issuer)throw new Error("Missing some issuer metadata from client information in storage: 'issuer' is undefined");if(void 0===r.settings.client_id)throw new Error("Missing some client information in storage: 'client_id' is undefined");const i=await _(t.id_token,r.settings.metadata.jwks_uri,r.settings.metadata.issuer,r.settings.client_id);return{accessToken:t.access_token,idToken:t.id_token,webId:i,refreshToken:t.refresh_token}}catch(t){throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${e}]: ${t}`)}}async function C(e,t,r){return async function(e,t,r,n){!function(e,t){if(t.grantType&&(!e.grantTypesSupported||!e.grantTypesSupported.includes(t.grantType)))throw new Error(`The issuer [${e.issuer}] does not support the [${t.grantType}] grant`);if(!e.tokenEndpoint)throw new Error(`This issuer [${e.issuer}] does not have a token endpoint`)}(e,r);const o={"content-type":"application/x-www-form-urlencoded"};let s;n&&(s=await async function(){const{privateKey:e,publicKey:t}=await(0,d.T)(b[0]),r={privateKey:e,publicKey:await(0,h.JU)(t)};return[r.publicKey.alg]=b,r}(),o.DPoP=await R(e.tokenEndpoint,"POST",s)),t.clientSecret&&(o.Authorization=`Basic ${btoa(`${t.clientId}:${t.clientSecret}`)}`);const a={grant_type:r.grantType,redirect_uri:r.redirectUrl,code:r.code,code_verifier:r.codeVerifier,client_id:t.clientId},c={method:"POST",headers:o,body:new URLSearchParams(a).toString()},l=await i(e.tokenEndpoint,c),u=x(await l.json(),n),f=await _(u.id_token,e.jwksUri,e.issuer,t.clientId);return{accessToken:u.access_token,idToken:u.id_token,refreshToken:(p=u,void 0!==p.refresh_token&&"string"==typeof p.refresh_token?u.refresh_token:void 0),webId:f,dpopKey:s,expiresIn:u.expires_in};var p}(e,t,r,!0)}const k=e=>{try{return new URL(e),!0}catch(e){return!1}};async function O(e,t,r,n){if(void 0===r.clientId)throw new Error("No client ID available when trying to refresh the access token.");const o={grant_type:"refresh_token",refresh_token:e,scope:w};let s={};void 0!==n&&(s={DPoP:await R(t.tokenEndpoint,"POST",n)});let a={};void 0!==r.clientSecret?a={Authorization:`Basic ${btoa(`${r.clientId}:${r.clientSecret}`)}`}:k(r.clientId)&&(o.client_id=r.clientId);const c=await i(t.tokenEndpoint,{method:"POST",body:new URLSearchParams(o).toString(),headers:{...s,...a,"Content-Type":"application/x-www-form-urlencoded"}});let l;try{l=await c.json()}catch(e){throw new Error(`The token endpoint of issuer ${t.issuer} returned a malformed response.`)}const u=x(l,void 0!==n),d=await _(u.id_token,t.jwksUri,t.issuer,r.clientId);return{accessToken:u.access_token,idToken:u.id_token,refreshToken:"string"==typeof u.refresh_token?u.refresh_token:void 0,webId:d,dpopKey:n,expiresIn:u.expires_in}}function F(e){const t=function(e){const t=new URL(e);return t.searchParams.delete("state"),t.searchParams.delete("code"),t.searchParams.delete("error"),t.searchParams.delete("error_description"),t.searchParams.delete("iss"),t}(e);return t.hash="",e.includes(`${t.origin}/`)?t.href:`${t.origin}${t.href.substring(t.origin.length+1)}`}async function N(){const e=new n.OidcClient({response_mode:"query"});await e.clearStaleState(new n.WebStorageStateStore({}));const t=window.localStorage,r=[];for(let e=0;e<=t.length;e+=1){const n=t.key(e);n&&(n.match(/^oidc\..+$/)||n.match(/^solidClientAuthenticationUser:.+$/))&&r.push(n)}r.forEach((e=>t.removeItem(e)))}},6516:function(e){var t;t=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=22)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r=4){for(var e=arguments.length,t=Array(e),r=0;r=3){for(var e=arguments.length,t=Array(e),r=0;r=2){for(var e=arguments.length,t=Array(e),r=0;r=1){for(var e=arguments.length,t=Array(e),r=0;r1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw i.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=t,this._jsonService=new r(["application/jwk-set+json"])}return e.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},e.prototype.getMetadata=function(){var e=this;return this._settings.metadata?(i.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(i.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(t){i.Log.debug("MetadataService.getMetadata: json received");var r=e._settings.metadataSeed||{};return e._settings.metadata=Object.assign({},r,t),e._settings.metadata}))):(i.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},e.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},e.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},e.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},e.prototype.getTokenEndpoint=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",e)},e.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},e.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},e.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},e.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},e.prototype._getMetadataProperty=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.Log.debug("MetadataService.getMetadataProperty for: "+e),this.getMetadata().then((function(r){if(i.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),void 0===r[e]){if(!0===t)return void i.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+e);throw i.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+e),new Error("Metadata does not contain property "+e)}return r[e]}))},e.prototype.getSigningKeys=function(){var e=this;return this._settings.signingKeys?(i.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(t){return i.Log.debug("MetadataService.getSigningKeys: jwks_uri received",t),e._jsonService.getJson(t).then((function(t){if(i.Log.debug("MetadataService.getSigningKeys: key set received",t),!t.keys)throw i.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return e._settings.signingKeys=t.keys,e._settings.signingKeys}))}))},n(e,[{key:"metadataUrl",get:function(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(s)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=s))),this._metadataUrl}}]),e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UrlUtility=void 0;var n=r(0),i=r(1);t.UrlUtility=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.addQueryParam=function(e,t,r){return e.indexOf("?")<0&&(e+="?"),"?"!==e[e.length-1]&&(e+="&"),e+=encodeURIComponent(t),(e+="=")+encodeURIComponent(r)},e.parseUrlFragment=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.Global;"string"!=typeof e&&(e=r.location.href);var o=e.lastIndexOf(t);o>=0&&(e=e.substr(o+1)),"?"===t&&(o=e.indexOf("#"))>=0&&(e=e.substr(0,o));for(var s,a={},c=/([^&=]+)=([^&]*)/g,l=0;s=c.exec(e);)if(a[decodeURIComponent(s[1])]=decodeURIComponent(s[2].replace(/\+/g," ")),l++>50)return n.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",e),{error:"Response exceeded expected number of parameters"};for(var u in a)return a;return{}},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JoseUtil=void 0;var n=r(26),i=function(e){return e&&e.__esModule?e:{default:e}}(r(33));t.JoseUtil=(0,i.default)({jws:n.jws,KeyUtil:n.KeyUtil,X509:n.X509,crypto:n.crypto,hextob64u:n.hextob64u,b64tohex:n.b64tohex,AllowedSigningAlgs:n.AllowedSigningAlgs})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OidcClientSettings=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=t.authority,i=t.metadataUrl,o=t.metadata,u=t.signingKeys,d=t.metadataSeed,h=t.client_id,f=t.client_secret,p=t.response_type,g=void 0===p?"id_token":p,y=t.scope,m=void 0===y?"openid":y,v=t.redirect_uri,b=t.post_logout_redirect_uri,w=t.client_authentication,_=void 0===w?"client_secret_post":w,S=t.prompt,E=t.display,A=t.max_age,R=t.ui_locales,I=t.acr_values,T=t.resource,x=t.response_mode,P=t.filterProtocolClaims,C=void 0===P||P,k=t.loadUserInfo,O=void 0===k||k,F=t.staleStateAge,N=void 0===F?900:F,D=t.clockSkew,L=void 0===D?300:D,U=t.clockService,j=void 0===U?new s.ClockService:U,M=t.userInfoJwtIssuer,B=void 0===M?"OP":M,H=t.mergeClaims,W=void 0!==H&&H,$=t.stateStore,V=void 0===$?new a.WebStorageStateStore:$,K=t.ResponseValidatorCtor,J=void 0===K?c.ResponseValidator:K,G=t.MetadataServiceCtor,q=void 0===G?l.MetadataService:G,z=t.extraQueryParams,Y=void 0===z?{}:z,Q=t.extraTokenParams,X=void 0===Q?{}:Q;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this._authority=r,this._metadataUrl=i,this._metadata=o,this._metadataSeed=d,this._signingKeys=u,this._client_id=h,this._client_secret=f,this._response_type=g,this._scope=m,this._redirect_uri=v,this._post_logout_redirect_uri=b,this._client_authentication=_,this._prompt=S,this._display=E,this._max_age=A,this._ui_locales=R,this._acr_values=I,this._resource=T,this._response_mode=x,this._filterProtocolClaims=!!C,this._loadUserInfo=!!O,this._staleStateAge=N,this._clockSkew=L,this._clockService=j,this._userInfoJwtIssuer=B,this._mergeClaims=!!W,this._stateStore=V,this._validator=new J(this),this._metadataService=new q(this),this._extraQueryParams="object"===(void 0===Y?"undefined":n(Y))?Y:{},this._extraTokenParams="object"===(void 0===X?"undefined":n(X))?X:{}}return e.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},i(e,[{key:"client_id",get:function(){return this._client_id},set:function(e){if(this._client_id)throw o.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=e}},{key:"client_secret",get:function(){return this._client_secret}},{key:"response_type",get:function(){return this._response_type}},{key:"scope",get:function(){return this._scope}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"post_logout_redirect_uri",get:function(){return this._post_logout_redirect_uri}},{key:"client_authentication",get:function(){return this._client_authentication}},{key:"prompt",get:function(){return this._prompt}},{key:"display",get:function(){return this._display}},{key:"max_age",get:function(){return this._max_age}},{key:"ui_locales",get:function(){return this._ui_locales}},{key:"acr_values",get:function(){return this._acr_values}},{key:"resource",get:function(){return this._resource}},{key:"response_mode",get:function(){return this._response_mode}},{key:"authority",get:function(){return this._authority},set:function(e){if(this._authority)throw o.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=e}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(u)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=u)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(e){this._metadata=e}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(e){this._metadataSeed=e}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(e){this._signingKeys=e}},{key:"filterProtocolClaims",get:function(){return this._filterProtocolClaims}},{key:"loadUserInfo",get:function(){return this._loadUserInfo}},{key:"staleStateAge",get:function(){return this._staleStateAge}},{key:"clockSkew",get:function(){return this._clockSkew}},{key:"userInfoJwtIssuer",get:function(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function(){return this._mergeClaims}},{key:"stateStore",get:function(){return this._stateStore}},{key:"validator",get:function(){return this._validator}},{key:"metadataService",get:function(){return this._metadataService}},{key:"extraQueryParams",get:function(){return this._extraQueryParams},set:function(e){"object"===(void 0===e?"undefined":n(e))?this._extraQueryParams=e:this._extraQueryParams={}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(e){"object"===(void 0===e?"undefined":n(e))?this._extraTokenParams=e:this._extraTokenParams={}}}]),e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebStorageStateStore=void 0;var n=r(0),i=r(1);t.WebStorageStateStore=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.prefix,n=void 0===r?"oidc.":r,o=t.store,s=void 0===o?i.Global.localStorage:o;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this._store=s,this._prefix=n}return e.prototype.set=function(e,t){return n.Log.debug("WebStorageStateStore.set",e),e=this._prefix+e,this._store.setItem(e,t),Promise.resolve()},e.prototype.get=function(e){n.Log.debug("WebStorageStateStore.get",e),e=this._prefix+e;var t=this._store.getItem(e);return Promise.resolve(t)},e.prototype.remove=function(e){n.Log.debug("WebStorageStateStore.remove",e),e=this._prefix+e;var t=this._store.getItem(e);return this._store.removeItem(e),Promise.resolve(t)},e.prototype.getAllKeys=function(){n.Log.debug("WebStorageStateStore.getAllKeys");for(var e=[],t=0;t0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.Global.XMLHttpRequest,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),t&&Array.isArray(t)?this._contentTypes=t.slice():this._contentTypes=[],this._contentTypes.push("application/json"),n&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=r,this._jwtHandler=n}return e.prototype.getJson=function(e,t){var r=this;if(!e)throw n.Log.error("JsonService.getJson: No url passed"),new Error("url");return n.Log.debug("JsonService.getJson, url: ",e),new Promise((function(i,o){var s=new r._XMLHttpRequest;s.open("GET",e);var a=r._contentTypes,c=r._jwtHandler;s.onload=function(){if(n.Log.debug("JsonService.getJson: HTTP response received, status",s.status),200===s.status){var t=s.getResponseHeader("Content-Type");if(t){var r=a.find((function(e){if(t.startsWith(e))return!0}));if("application/jwt"==r)return void c(s).then(i,o);if(r)try{return void i(JSON.parse(s.responseText))}catch(e){return n.Log.error("JsonService.getJson: Error parsing JSON response",e.message),void o(e)}}o(Error("Invalid response Content-Type: "+t+", from URL: "+e))}else o(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){n.Log.error("JsonService.getJson: network error"),o(Error("Network Error"))},t&&(n.Log.debug("JsonService.getJson: token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+t)),s.send()}))},e.prototype.postForm=function(e,t,r){var i=this;if(!e)throw n.Log.error("JsonService.postForm: No url passed"),new Error("url");return n.Log.debug("JsonService.postForm, url: ",e),new Promise((function(o,s){var a=new i._XMLHttpRequest;a.open("POST",e);var c=i._contentTypes;a.onload=function(){if(n.Log.debug("JsonService.postForm: HTTP response received, status",a.status),200!==a.status){if(400===a.status&&(r=a.getResponseHeader("Content-Type"))&&c.find((function(e){if(r.startsWith(e))return!0})))try{var t=JSON.parse(a.responseText);if(t&&t.error)return n.Log.error("JsonService.postForm: Error from server: ",t.error),void s(new Error(t.error))}catch(e){return n.Log.error("JsonService.postForm: Error parsing JSON response",e.message),void s(e)}s(Error(a.statusText+" ("+a.status+")"))}else{var r;if((r=a.getResponseHeader("Content-Type"))&&c.find((function(e){if(r.startsWith(e))return!0})))try{return void o(JSON.parse(a.responseText))}catch(e){return n.Log.error("JsonService.postForm: Error parsing JSON response",e.message),void s(e)}s(Error("Invalid response Content-Type: "+r+", from URL: "+e))}},a.onerror=function(){n.Log.error("JsonService.postForm: network error"),s(Error("Network Error"))};var l="";for(var u in t){var d=t[u];d&&(l.length>0&&(l+="&"),l+=encodeURIComponent(u),l+="=",l+=encodeURIComponent(d))}a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void 0!==r&&a.setRequestHeader("Authorization","Basic "+btoa(r)),a.send(l)}))},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SigninRequest=void 0;var n=r(0),i=r(3),o=r(13);t.SigninRequest=function(){function e(t){var r=t.url,s=t.client_id,a=t.redirect_uri,c=t.response_type,l=t.scope,u=t.authority,d=t.data,h=t.prompt,f=t.display,p=t.max_age,g=t.ui_locales,y=t.id_token_hint,m=t.login_hint,v=t.acr_values,b=t.resource,w=t.response_mode,_=t.request,S=t.request_uri,E=t.extraQueryParams,A=t.request_type,R=t.client_secret,I=t.extraTokenParams,T=t.skipUserInfo;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!r)throw n.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!s)throw n.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!a)throw n.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!c)throw n.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!l)throw n.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!u)throw n.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var x=e.isOidc(c),P=e.isCode(c);w||(w=e.isCode(c)?"query":null),this.state=new o.SigninState({nonce:x,data:d,client_id:s,authority:u,redirect_uri:a,code_verifier:P,request_type:A,response_mode:w,client_secret:R,scope:l,extraTokenParams:I,skipUserInfo:T}),r=i.UrlUtility.addQueryParam(r,"client_id",s),r=i.UrlUtility.addQueryParam(r,"redirect_uri",a),r=i.UrlUtility.addQueryParam(r,"response_type",c),r=i.UrlUtility.addQueryParam(r,"scope",l),r=i.UrlUtility.addQueryParam(r,"state",this.state.id),x&&(r=i.UrlUtility.addQueryParam(r,"nonce",this.state.nonce)),P&&(r=i.UrlUtility.addQueryParam(r,"code_challenge",this.state.code_challenge),r=i.UrlUtility.addQueryParam(r,"code_challenge_method","S256"));var C={prompt:h,display:f,max_age:p,ui_locales:g,id_token_hint:y,login_hint:m,acr_values:v,resource:b,request:_,request_uri:S,response_mode:w};for(var k in C)C[k]&&(r=i.UrlUtility.addQueryParam(r,k,C[k]));for(var O in E)r=i.UrlUtility.addQueryParam(r,O,E[O]);this.url=r}return e.isOidc=function(e){return!!e.split(/\s+/g).filter((function(e){return"id_token"===e}))[0]},e.isOAuth=function(e){return!!e.split(/\s+/g).filter((function(e){return"token"===e}))[0]},e.isCode=function(e){return!!e.split(/\s+/g).filter((function(e){return"code"===e}))[0]},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.State=void 0;var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=t.id,n=t.data,i=t.created,s=t.request_type;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this._id=r||(0,o.default)(),this._data=n,this._created="number"==typeof i&&i>0?i:parseInt(Date.now()/1e3),this._request_type=s}return e.prototype.toStorageString=function(){return i.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},e.fromStorageString=function(t){return i.Log.debug("State.fromStorageString"),new e(JSON.parse(t))},e.clearStaleState=function(t,r){var n=Date.now()/1e3-r;return t.getAllKeys().then((function(r){i.Log.debug("State.clearStaleState: got keys",r);for(var o=[],s=function(s){var a=r[s];c=t.get(a).then((function(r){var o=!1;if(r)try{var s=e.fromStorageString(r);i.Log.debug("State.clearStaleState: got item from key: ",a,s.created),s.created<=n&&(o=!0)}catch(e){i.Log.error("State.clearStaleState: Error parsing state for key",a,e.message),o=!0}else i.Log.debug("State.clearStaleState: no item in storage for key: ",a),o=!0;if(o)return i.Log.debug("State.clearStaleState: removed item for key: ",a),t.remove(a)})),o.push(c)},a=0;a0&&void 0!==arguments[0]?arguments[0]:{};(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),t instanceof o.OidcClientSettings?this._settings=t:this._settings=new o.OidcClientSettings(t)}return e.prototype.createSigninRequest=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.response_type,n=t.scope,o=t.redirect_uri,s=t.data,c=t.state,l=t.prompt,u=t.display,d=t.max_age,h=t.ui_locales,f=t.id_token_hint,p=t.login_hint,g=t.acr_values,y=t.resource,m=t.request,v=t.request_uri,b=t.response_mode,w=t.extraQueryParams,_=t.extraTokenParams,S=t.request_type,E=t.skipUserInfo,A=arguments[1];i.Log.debug("OidcClient.createSigninRequest");var R=this._settings.client_id;r=r||this._settings.response_type,n=n||this._settings.scope,o=o||this._settings.redirect_uri,l=l||this._settings.prompt,u=u||this._settings.display,d=d||this._settings.max_age,h=h||this._settings.ui_locales,g=g||this._settings.acr_values,y=y||this._settings.resource,b=b||this._settings.response_mode,w=w||this._settings.extraQueryParams,_=_||this._settings.extraTokenParams;var I=this._settings.authority;return a.SigninRequest.isCode(r)&&"code"!==r?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then((function(t){i.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",t);var T=new a.SigninRequest({url:t,client_id:R,redirect_uri:o,response_type:r,scope:n,data:s||c,authority:I,prompt:l,display:u,max_age:d,ui_locales:h,id_token_hint:f,login_hint:p,acr_values:g,resource:y,request:m,request_uri:v,extraQueryParams:w,extraTokenParams:_,request_type:S,response_mode:b,client_secret:e._settings.client_secret,skipUserInfo:E}),x=T.state;return(A=A||e._stateStore).set(x.id,x.toStorageString()).then((function(){return T}))}))},e.prototype.readSigninResponseState=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug("OidcClient.readSigninResponseState");var n="query"===this._settings.response_mode||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type)?"?":"#",o=new c.SigninResponse(e,n);return o.state?(t=t||this._stateStore,(r?t.remove.bind(t):t.get.bind(t))(o.state).then((function(e){if(!e)throw i.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:d.SigninState.fromStorageString(e),response:o}}))):(i.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response")))},e.prototype.processSigninResponse=function(e,t){var r=this;return i.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(e,t,!0).then((function(e){var t=e.state,n=e.response;return i.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),r._validator.validateSigninResponse(t,n)}))},e.prototype.createSignoutRequest=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.id_token_hint,n=t.data,o=t.state,s=t.post_logout_redirect_uri,a=t.extraQueryParams,c=t.request_type,u=arguments[1];return i.Log.debug("OidcClient.createSignoutRequest"),s=s||this._settings.post_logout_redirect_uri,a=a||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(t){if(!t)throw i.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");i.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",t);var d=new l.SignoutRequest({url:t,id_token_hint:r,post_logout_redirect_uri:s,data:n||o,extraQueryParams:a,request_type:c}),h=d.state;return h&&(i.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(u=u||e._stateStore).set(h.id,h.toStorageString())),d}))},e.prototype.readSignoutResponseState=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug("OidcClient.readSignoutResponseState");var n=new u.SignoutResponse(e);if(!n.state)return i.Log.debug("OidcClient.readSignoutResponseState: No state in response"),n.error?(i.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",n.error),Promise.reject(new s.ErrorResponse(n))):Promise.resolve({state:void 0,response:n});var o=n.state;return t=t||this._stateStore,(r?t.remove.bind(t):t.get.bind(t))(o).then((function(e){if(!e)throw i.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:h.State.fromStorageString(e),response:n}}))},e.prototype.processSignoutResponse=function(e,t){var r=this;return i.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(e,t,!0).then((function(e){var t=e.state,n=e.response;return t?(i.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),r._validator.validateSignoutResponse(t,n)):(i.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),n)}))},e.prototype.clearStaleState=function(e){return i.Log.debug("OidcClient.clearStaleState"),e=e||this._stateStore,h.State.clearStaleState(e,this.settings.staleStateAge)},n(e,[{key:"_stateStore",get:function(){return this.settings.stateStore}},{key:"_validator",get:function(){return this.settings.validator}},{key:"_metadataService",get:function(){return this.settings.metadataService}},{key:"settings",get:function(){return this._settings}},{key:"metadataService",get:function(){return this._metadataService}}]),e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClient=void 0;var n=r(7),i=r(2),o=r(0);t.TokenClient=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw o.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=t,this._jsonService=new r,this._metadataService=new s(this._settings)}return e.prototype.exchangeCode=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).grant_type=t.grant_type||"authorization_code",t.client_id=t.client_id||this._settings.client_id,t.client_secret=t.client_secret||this._settings.client_secret,t.redirect_uri=t.redirect_uri||this._settings.redirect_uri;var r=void 0,n=t._client_authentication||this._settings._client_authentication;return delete t._client_authentication,t.code?t.redirect_uri?t.code_verifier?t.client_id?t.client_secret||"client_secret_basic"!=n?("client_secret_basic"==n&&(r=t.client_id+":"+t.client_secret,delete t.client_id,delete t.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(n){return o.Log.debug("TokenClient.exchangeCode: Received token endpoint"),e._jsonService.postForm(n,t,r).then((function(e){return o.Log.debug("TokenClient.exchangeCode: response received"),e}))}))):(o.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(o.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(o.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(o.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},e.prototype.exchangeRefreshToken=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).grant_type=t.grant_type||"refresh_token",t.client_id=t.client_id||this._settings.client_id,t.client_secret=t.client_secret||this._settings.client_secret;var r=void 0,n=t._client_authentication||this._settings._client_authentication;return delete t._client_authentication,t.refresh_token?t.client_id?("client_secret_basic"==n&&(r=t.client_id+":"+t.client_secret,delete t.client_id,delete t.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(n){return o.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),e._jsonService.postForm(n,t,r).then((function(e){return o.Log.debug("TokenClient.exchangeRefreshToken: response received"),e}))}))):(o.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorResponse=void 0;var n=r(0);t.ErrorResponse=function(e){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=r.error,o=r.error_description,s=r.error_uri,a=r.state,c=r.session_state;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!i)throw n.Log.error("No error passed to ErrorResponse"),new Error("error");var l=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,o||i));return l.name="ErrorResponse",l.error=i,l.error_description=o,l.error_uri=s,l.state=a,l.session_state=c,l}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(Error)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SigninState=void 0;var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=r.nonce,i=r.authority,o=r.client_id,c=r.redirect_uri,l=r.code_verifier,u=r.response_mode,d=r.client_secret,h=r.scope,f=r.extraTokenParams,p=r.skipUserInfo;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var g=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,arguments[0]));if(!0===n?g._nonce=(0,a.default)():n&&(g._nonce=n),!0===l?g._code_verifier=(0,a.default)()+(0,a.default)()+(0,a.default)():l&&(g._code_verifier=l),g.code_verifier){var y=s.JoseUtil.hashString(g.code_verifier,"SHA256");g._code_challenge=s.JoseUtil.hexToBase64Url(y)}return g._redirect_uri=c,g._authority=i,g._client_id=o,g._response_mode=u,g._client_secret=d,g._scope=h,g._extraTokenParams=f,g._skipUserInfo=p,g}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.toStorageString=function(){return i.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},t.fromStorageString=function(e){return i.Log.debug("SigninState.fromStorageString"),new t(JSON.parse(e))},n(t,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"code_verifier",get:function(){return this._code_verifier}},{key:"code_challenge",get:function(){return this._code_challenge}},{key:"response_mode",get:function(){return this._response_mode}},{key:"client_secret",get:function(){return this._client_secret}},{key:"scope",get:function(){return this._scope}},{key:"extraTokenParams",get:function(){return this._extraTokenParams}},{key:"skipUserInfo",get:function(){return this._skipUserInfo}}]),t}(o.State)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return("undefined"!=n&&null!==n&&void 0!==n.getRandomValues?i:o)().replace(/-/g,"")};var n="undefined"!=typeof window?window.crypto||window.msCrypto:null;function i(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(e^n.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)}))}function o(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(e^16*Math.random()>>e/4).toString(16)}))}e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.User=void 0;var n=function(){function e(e,t){for(var r=0;r0){var r=parseInt(Date.now()/1e3);this.expires_at=r+t}}},{key:"expired",get:function(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AccessTokenEvents=void 0;var n=r(0),i=r(46);t.AccessTokenEvents=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.accessTokenExpiringNotificationTime,n=void 0===r?60:r,o=t.accessTokenExpiringTimer,s=void 0===o?new i.Timer("Access token expiring"):o,a=t.accessTokenExpiredTimer,c=void 0===a?new i.Timer("Access token expired"):a;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this._accessTokenExpiringNotificationTime=n,this._accessTokenExpiring=s,this._accessTokenExpired=c}return e.prototype.load=function(e){if(e.access_token&&void 0!==e.expires_in){var t=e.expires_in;if(n.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",t),t>0){var r=t-this._accessTokenExpiringNotificationTime;r<=0&&(r=1),n.Log.debug("AccessTokenEvents.load: registering expiring timer in:",r),this._accessTokenExpiring.init(r)}else n.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var i=t+1;n.Log.debug("AccessTokenEvents.load: registering expired timer in:",i),this._accessTokenExpired.init(i)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},e.prototype.unload=function(){n.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},e.prototype.addAccessTokenExpiring=function(e){this._accessTokenExpiring.addHandler(e)},e.prototype.removeAccessTokenExpiring=function(e){this._accessTokenExpiring.removeHandler(e)},e.prototype.addAccessTokenExpired=function(e){this._accessTokenExpired.addHandler(e)},e.prototype.removeAccessTokenExpired=function(e){this._accessTokenExpired.removeHandler(e)},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Event=void 0;var n=r(0);t.Event=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._callbacks=[]}return e.prototype.addHandler=function(e){this._callbacks.push(e)},e.prototype.removeHandler=function(e){var t=this._callbacks.findIndex((function(t){return t===e}));t>=0&&this._callbacks.splice(t,1)},e.prototype.raise=function(){n.Log.debug("Event: Raising event: "+this._name);for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw i.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=t,this._CheckSessionIFrameCtor=n,this._timer=a,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(e){e?r._start(e):r._settings.monitorAnonymousSession&&r._userManager.querySessionStatus().then((function(e){var t={session_state:e.session_state};e.sub&&e.sid&&(t.profile={sub:e.sub,sid:e.sid}),r._start(t)})).catch((function(e){i.Log.error("SessionMonitor ctor: error from querySessionStatus:",e.message)}))})).catch((function(e){i.Log.error("SessionMonitor ctor: error from getUser:",e.message)})))}return e.prototype._start=function(e){var t=this,r=e.session_state;r&&(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,i.Log.debug("SessionMonitor._start: session_state:",r,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,i.Log.debug("SessionMonitor._start: session_state:",r,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(r):this._metadataService.getCheckSessionIframe().then((function(e){if(e){i.Log.debug("SessionMonitor._start: Initializing check session iframe");var n=t._client_id,o=t._checkSessionInterval,s=t._stopCheckSessionOnError;t._checkSessionIFrame=new t._CheckSessionIFrameCtor(t._callback.bind(t),n,e,o,s),t._checkSessionIFrame.load().then((function(){t._checkSessionIFrame.start(r)}))}else i.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(e){i.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",e.message)})))},e.prototype._stop=function(){var e=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(i.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var t=this._timer.setInterval((function(){e._timer.clearInterval(t),e._userManager.querySessionStatus().then((function(t){var r={session_state:t.session_state};t.sub&&t.sid&&(r.profile={sub:t.sub,sid:t.sid}),e._start(r)})).catch((function(e){i.Log.error("SessionMonitor: error from querySessionStatus:",e.message)}))}),1e3)},e.prototype._callback=function(){var e=this;this._userManager.querySessionStatus().then((function(t){var r=!0;t?t.sub===e._sub?(r=!1,e._checkSessionIFrame.start(t.session_state),t.sid===e._sid?i.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",t.session_state):(i.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",t.session_state),e._userManager.events._raiseUserSessionChanged())):i.Log.debug("SessionMonitor._callback: Different subject signed into OP:",t.sub):i.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),r&&(e._sub?(i.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),e._userManager.events._raiseUserSignedOut()):(i.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),e._userManager.events._raiseUserSignedIn()))})).catch((function(t){e._sub&&(i.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",t.message),e._userManager.events._raiseUserSignedOut())}))},n(e,[{key:"_settings",get:function(){return this._userManager.settings}},{key:"_metadataService",get:function(){return this._userManager.metadataService}},{key:"_client_id",get:function(){return this._settings.client_id}},{key:"_checkSessionInterval",get:function(){return this._settings.checkSessionInterval}},{key:"_stopCheckSessionOnError",get:function(){return this._settings.stopCheckSessionOnError}}]),e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CheckSessionIFrame=void 0;var n=r(0);t.CheckSessionIFrame=function(){function e(t,r,n,i){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this._callback=t,this._client_id=r,this._url=n,this._interval=i||2e3,this._stopOnError=o;var s=n.indexOf("/",n.indexOf("//")+2);this._frame_origin=n.substr(0,s),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=n}return e.prototype.load=function(){var e=this;return new Promise((function(t){e._frame.onload=function(){t()},window.document.body.appendChild(e._frame),e._boundMessageEvent=e._message.bind(e),window.addEventListener("message",e._boundMessageEvent,!1)}))},e.prototype._message=function(e){e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&("error"===e.data?(n.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===e.data?(n.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):n.Log.debug("CheckSessionIFrame: "+e.data+" message from check session op iframe"))},e.prototype.start=function(e){var t=this;if(this._session_state!==e){n.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=e;var r=function(){t._frame.contentWindow.postMessage(t._client_id+" "+t._session_state,t._frame_origin)};r(),this._timer=window.setInterval(r,this._interval)}},e.prototype.stop=function(){this._session_state=null,this._timer&&(n.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenRevocationClient=void 0;var n=r(0),i=r(2),o=r(1);t.TokenRevocationClient=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw n.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=t,this._XMLHttpRequestCtor=r,this._metadataService=new s(this._settings)}return e.prototype.revoke=function(e,t){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"access_token";if(!e)throw n.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if("access_token"!==i&&"refresh_token"!=i)throw n.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then((function(o){if(o){n.Log.debug("TokenRevocationClient.revoke: Revoking "+i);var s=r._settings.client_id,a=r._settings.client_secret;return r._revoke(o,s,a,e,i)}if(t)throw n.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},e.prototype._revoke=function(e,t,r,i,o){var s=this;return new Promise((function(a,c){var l=new s._XMLHttpRequestCtor;l.open("POST",e),l.onload=function(){n.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",l.status),200===l.status?a():c(Error(l.statusText+" ("+l.status+")"))},l.onerror=function(){n.Log.debug("TokenRevocationClient.revoke: Network Error."),c("Network Error")};var u="client_id="+encodeURIComponent(t);r&&(u+="&client_secret="+encodeURIComponent(r)),u+="&token_type_hint="+encodeURIComponent(o),u+="&token="+encodeURIComponent(i),l.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),l.send(u)}))},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CordovaPopupWindow=void 0;var n=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.JoseUtil,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:a.TokenClient;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw i.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=t,this._metadataService=new r(this._settings),this._userInfoService=new n(this._settings),this._joseUtil=c,this._tokenClient=new u(this._settings)}return e.prototype.validateSigninResponse=function(e,t){var r=this;return i.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(e,t).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: state processed"),r._validateTokens(e,t).then((function(t){return i.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),r._processClaims(e,t).then((function(e){return i.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),e}))}))}))},e.prototype.validateSignoutResponse=function(e,t){return e.id!==t.state?(i.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(i.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),t.state=e.data,t.error?(i.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",t.error),Promise.reject(new c.ErrorResponse(t))):Promise.resolve(t))},e.prototype._processSigninParams=function(e,t){if(e.id!==t.state)return i.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!e.client_id)return i.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!e.authority)return i.Log.error("ResponseValidator._processSigninParams: No authority on state"),Promise.reject(new Error("No authority on state"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==e.authority)return i.Log.error("ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state"),Promise.reject(new Error("authority mismatch on settings vs. signin state"))}else this._settings.authority=e.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==e.client_id)return i.Log.error("ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state"),Promise.reject(new Error("client_id mismatch on settings vs. signin state"))}else this._settings.client_id=e.client_id;return i.Log.debug("ResponseValidator._processSigninParams: state validated"),t.state=e.data,t.error?(i.Log.warn("ResponseValidator._processSigninParams: Response was error",t.error),Promise.reject(new c.ErrorResponse(t))):e.nonce&&!t.id_token?(i.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!e.nonce&&t.id_token?(i.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):e.code_verifier&&!t.code?(i.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!e.code_verifier&&t.code?(i.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(t.scope||(t.scope=e.scope),Promise.resolve(t))},e.prototype._processClaims=function(e,t){var r=this;if(t.isOpenIdConnect){if(i.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),t.profile=this._filterProtocolClaims(t.profile),!0!==e.skipUserInfo&&this._settings.loadUserInfo&&t.access_token)return i.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(t.access_token).then((function(e){return i.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),e.sub!==t.profile.sub?(i.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(t.profile=r._mergeClaims(t.profile,e),i.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",t.profile),t)}));i.Log.debug("ResponseValidator._processClaims: not loading user info")}else i.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(t)},e.prototype._mergeClaims=function(e,t){var r=Object.assign({},e);for(var i in t){var o=t[i];Array.isArray(o)||(o=[o]);for(var s=0;s1)return i.Log.error("ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));o=r[0]}return Promise.resolve(o)}))},e.prototype._getSigningKeyForJwtWithSingleRetry=function(e){var t=this;return this._getSigningKeyForJwt(e).then((function(r){return r?Promise.resolve(r):(t._metadataService.resetSigningKeys(),t._getSigningKeyForJwt(e))}))},e.prototype._validateIdToken=function(e,t){var r=this;if(!e.nonce)return i.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var n=this._joseUtil.parseJwt(t.id_token);return n&&n.header&&n.payload?e.nonce!==n.payload.nonce?(i.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then((function(o){return i.Log.debug("ResponseValidator._validateIdToken: Received issuer"),r._getSigningKeyForJwtWithSingleRetry(n).then((function(s){if(!s)return i.Log.error("ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var a=e.client_id,c=r._settings.clockSkew;return i.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",c),r._joseUtil.validateJwt(t.id_token,s,o,a,c).then((function(){return i.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),n.payload.sub?(t.profile=n.payload,t):(i.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))})):(i.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",n),Promise.reject(new Error("Failed to parse id_token")))},e.prototype._filterByAlg=function(e,t){var r=null;if(t.startsWith("RS"))r="RSA";else if(t.startsWith("PS"))r="PS";else{if(!t.startsWith("ES"))return i.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",t),[];r="EC"}return i.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",r),e=e.filter((function(e){return e.kty===r})),i.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",r,e.length),e},e.prototype._validateAccessToken=function(e){if(!e.profile)return i.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!e.profile.at_hash)return i.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!e.id_token)return i.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var t=this._joseUtil.parseJwt(e.id_token);if(!t||!t.header)return i.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",t),Promise.reject(new Error("Failed to parse id_token"));var r=t.header.alg;if(!r||5!==r.length)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",r),Promise.reject(new Error("Unsupported alg: "+r));var n=r.substr(2,3);if(!n)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",r,n),Promise.reject(new Error("Unsupported alg: "+r));if(256!==(n=parseInt(n))&&384!==n&&512!==n)return i.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",r,n),Promise.reject(new Error("Unsupported alg: "+r));var o="sha"+n,s=this._joseUtil.hashString(e.access_token,o);if(!s)return i.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",o),Promise.reject(new Error("Failed to validate at_hash"));var a=s.substr(0,s.length/2),c=this._joseUtil.hexToBase64Url(a);return c!==e.profile.at_hash?(i.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",c,e.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(i.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(e))},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserInfoService=void 0;var n=r(7),i=r(2),o=r(0),s=r(4);t.UserInfoService=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!t)throw o.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=t,this._jsonService=new r(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new a(this._settings),this._joseUtil=c}return e.prototype.getClaims=function(e){var t=this;return e?this._metadataService.getUserInfoEndpoint().then((function(r){return o.Log.debug("UserInfoService.getClaims: received userinfo url",r),t._jsonService.getJson(r,e).then((function(e){return o.Log.debug("UserInfoService.getClaims: claims received",e),e}))})):(o.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},e.prototype._getClaimsFromJwt=function e(t){var r=this;try{var n=this._joseUtil.parseJwt(t.responseText);if(!n||!n.header||!n.payload)return o.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",n),Promise.reject(new Error("Failed to parse id_token"));var i=n.header.kid,s=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":s=this._metadataService.getIssuer();break;case"ANY":s=Promise.resolve(n.payload.iss);break;default:s=Promise.resolve(this._settings.userInfoJwtIssuer)}return s.then((function(e){return o.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+e),r._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));o.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var a=void 0;if(i)a=s.filter((function(e){return e.kid===i}))[0];else{if((s=r._filterByAlg(s,n.header.alg)).length>1)return o.Log.error("UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));a=s[0]}if(!a)return o.Log.error("UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var c=r._settings.client_id,l=r._settings.clockSkew;return o.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",l),r._joseUtil.validateJwt(t.responseText,a,e,c,l,void 0,!0).then((function(){return o.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),n.payload}))}))}))}catch(e){return o.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",e.message),void reject(e)}},e.prototype._filterByAlg=function(e,t){var r=null;if(t.startsWith("RS"))r="RSA";else if(t.startsWith("PS"))r="PS";else{if(!t.startsWith("ES"))return o.Log.debug("UserInfoService._filterByAlg: alg not supported: ",t),[];r="EC"}return o.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",r),e=e.filter((function(e){return e.kty===r})),o.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",r,e.length),e},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AllowedSigningAlgs=t.b64tohex=t.hextob64u=t.crypto=t.X509=t.KeyUtil=t.jws=void 0;var n=r(27);t.jws=n.jws,t.KeyUtil=n.KEYUTIL,t.X509=n.X509,t.crypto=n.crypto,t.hextob64u=n.hextob64u,t.b64tohex=n.b64tohex,t.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(e,t,r){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r,n,i,o,s,a,c,l,u,d,h,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p={userAgent:!1},g={},y=y||(r=Math,i=(n={}).lib={},o=i.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var r=new e;return t&&r.mixIn(t),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=s<<24-(n+o)%4*8}else for(o=0;o>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=r.ceil(t/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new s.init(r,t/2)}},l=a.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new s.init(r,t)}},u=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(l.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return l.parse(unescape(encodeURIComponent(e)))}},d=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=u.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,n=t.words,i=t.sigBytes,o=this.blockSize,a=i/(4*o),c=(a=e?r.ceil(a):r.max((0|a)-this._minBufferSize,0))*o,l=r.min(4*c,i);if(c){for(var u=0;u>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s>>6*(3-s)&63));if(t=n.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var r=e.length,n=this._map;(i=n.charAt(64))&&-1!=(i=e.indexOf(i))&&(r=i);for(var i=[],o=0,s=0;s>>6-s%4*2;i[o>>>2]|=(a|c)<<24-o%4*8,o++}return t.create(i,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){for(var t=y,r=(i=t.lib).WordArray,n=i.Hasher,i=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},c=2,l=0;64>l;){var u;e:{u=c;for(var d=e.sqrt(u),h=2;h<=d;h++)if(!(u%h)){u=!1;break e}u=!0}u&&(8>l&&(o[l]=a(e.pow(c,.5))),s[l]=a(e.pow(c,1/3)),l++),c++}var f=[];i=i.SHA256=n.extend({_doReset:function(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],c=r[4],l=r[5],u=r[6],d=r[7],h=0;64>h;h++){if(16>h)f[h]=0|e[t+h];else{var p=f[h-15],g=f[h-2];f[h]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+f[h-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+f[h-16]}p=d+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&l^~c&u)+s[h]+f[h],g=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&o^i&o),d=u,u=l,l=c,c=a+p|0,a=o,o=i,i=n,n=p+g|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0,r[5]=r[5]+l|0,r[6]=r[6]+u|0,r[7]=r[7]+d|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}}),t.SHA256=n._createHelper(i),t.HmacSHA256=n._createHmacHelper(i)}(Math),function(){function e(){return n.create.apply(n,arguments)}for(var t=y,r=t.lib.Hasher,n=(o=t.x64).Word,i=o.WordArray,o=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],a=[],c=0;80>c;c++)a[c]=e();o=o.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=(d=this._hash.words)[0],n=d[1],i=d[2],o=d[3],c=d[4],l=d[5],u=d[6],d=d[7],h=r.high,f=r.low,p=n.high,g=n.low,y=i.high,m=i.low,v=o.high,b=o.low,w=c.high,_=c.low,S=l.high,E=l.low,A=u.high,R=u.low,I=d.high,T=d.low,x=h,P=f,C=p,k=g,O=y,F=m,N=v,D=b,L=w,U=_,j=S,M=E,B=A,H=R,W=I,$=T,V=0;80>V;V++){var K=a[V];if(16>V)var J=K.high=0|e[t+2*V],G=K.low=0|e[t+2*V+1];else{J=((G=(J=a[V-15]).high)>>>1|(q=J.low)<<31)^(G>>>8|q<<24)^G>>>7;var q=(q>>>1|G<<31)^(q>>>8|G<<24)^(q>>>7|G<<25),z=((G=(z=a[V-2]).high)>>>19|(Y=z.low)<<13)^(G<<3|Y>>>29)^G>>>6,Y=(Y>>>19|G<<13)^(Y<<3|G>>>29)^(Y>>>6|G<<26),Q=(G=a[V-7]).high,X=(Z=a[V-16]).high,Z=Z.low;J=(J=(J=J+Q+((G=q+G.low)>>>0>>0?1:0))+z+((G+=Y)>>>0>>0?1:0))+X+((G+=Z)>>>0>>0?1:0),K.high=J,K.low=G}Q=L&j^~L&B,Z=U&M^~U&H,K=x&C^x&O^C&O;var ee=P&k^P&F^k&F,te=(q=(x>>>28|P<<4)^(x<<30|P>>>2)^(x<<25|P>>>7),z=(P>>>28|x<<4)^(P<<30|x>>>2)^(P<<25|x>>>7),(Y=s[V]).high),re=Y.low;X=W+((L>>>14|U<<18)^(L>>>18|U<<14)^(L<<23|U>>>9))+((Y=$+((U>>>14|L<<18)^(U>>>18|L<<14)^(U<<23|L>>>9)))>>>0<$>>>0?1:0),W=B,$=H,B=j,H=M,j=L,M=U,L=N+(X=(X=(X=X+Q+((Y+=Z)>>>0>>0?1:0))+te+((Y+=re)>>>0>>0?1:0))+J+((Y+=G)>>>0>>0?1:0))+((U=D+Y|0)>>>0>>0?1:0)|0,N=O,D=F,O=C,F=k,C=x,k=P,x=X+(K=q+K+((G=z+ee)>>>0>>0?1:0))+((P=Y+G|0)>>>0>>0?1:0)|0}f=r.low=f+P,r.high=h+x+(f>>>0

>>0?1:0),g=n.low=g+k,n.high=p+C+(g>>>0>>0?1:0),m=i.low=m+F,i.high=y+O+(m>>>0>>0?1:0),b=o.low=b+D,o.high=v+N+(b>>>0>>0?1:0),_=c.low=_+U,c.high=w+L+(_>>>0>>0?1:0),E=l.low=E+M,l.high=S+j+(E>>>0>>0?1:0),R=u.low=R+H,u.high=A+B+(R>>>0>>0?1:0),T=d.low=T+$,d.high=I+W+(T>>>0<$>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=r._createHelper(o),t.HmacSHA512=r._createHmacHelper(o)}(),function(){var e=y,t=(i=e.x64).Word,r=i.WordArray,n=(i=e.algo).SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=n._createHelper(i),e.HmacSHA384=n._createHmacHelper(i)}();var m,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function b(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=v.charAt(r>>6)+v.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=v.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=v.charAt(r>>2)+v.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function w(e){var t,r,n,i="",o=0;for(t=0;t>2),r=3&n,o=1):1==o?(i+=T(r<<2|n>>4),r=15&n,o=2):2==o?(i+=T(r),i+=T(n>>2),r=3&n,o=3):(i+=T(r<<2|n>>4),i+=T(15&n),o=0));return 1==o&&(i+=T(r<<2)),i}function _(e){var t,r=w(e),n=new Array;for(t=0;2*t>15;--o>=0;){var c=32767&this[e],l=this[e++]>>15,u=a*c+l*s;i=((c=s*c+((32767&u)<<15)+r[n]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),r[n++]=1073741823&c}return i},m=30):"Netscape"!=p.appName?(S.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},m=26):(S.prototype.am=function(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this[e],l=this[e++]>>14,u=a*c+l*s;i=((c=s*c+((16383&u)<<14)+r[n]+i)>>28)+(u>>14)+a*l,r[n++]=268435455&c}return i},m=28),S.prototype.DB=m,S.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function k(e){this.m=e}function O(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),!(255&e)&&(e>>=8,t+=8),!(15&e)&&(e>>=4,t+=4),!(3&e)&&(e>>=2,t+=2),!(1&e)&&++t,t}function j(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function M(){}function B(e){return e}function H(e){this.r2=E(),this.q3=E(),S.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}k.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},k.prototype.revert=function(e){return e},k.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},k.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},k.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},O.prototype.convert=function(e){var t=E();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(S.ZERO)>0&&this.m.subTo(t,t),t},O.prototype.revert=function(e){var t=E();return e.copyTo(t),this.reduce(t),t},O.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},O.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},O.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},S.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},S.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},S.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,o=0;--n>=0;){var s=8==r?255&e[n]:x(e,n);s<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&!!(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t},S.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},S.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t[r+s+1]=this[r]>>i|a,a=(this[r]&o)<=0;--r)t[r]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},S.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(t[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()},S.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},S.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(c,o),i.lShiftTo(c,r)):(n.copyTo(o),i.copyTo(r));var l=o.t,u=o[l-1];if(0!=u){var d=u*(1<1?o[l-2]>>this.F2:0),h=this.FV/d,f=(1<=0&&(r[r.t++]=1,r.subTo(m,r)),S.ONE.dlShiftTo(l,m),m.subTo(o,o);o.t=0;){var v=r[--g]==u?this.DM:Math.floor(r[g]*h+(r[g-1]+p)*f);if((r[g]+=o.am(0,v,r,y,0,l))0&&r.rShiftTo(c,r),s<0&&S.ZERO.subTo(r,r)}}},S.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},S.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},S.prototype.exp=function(e,t){if(e>4294967295||e<1)return S.ONE;var r=E(),n=E(),i=t.convert(this),o=C(e)-1;for(i.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var s=r;r=n,n=s}return t.revert(r)},S.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=T(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=T(r));return i?o:"0"},S.prototype.negate=function(){var e=E();return S.ZERO.subTo(this,e),e},S.prototype.abs=function(){return this.s<0?this.negate():this},S.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},S.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+C(this[this.t-1]^this.s&this.DM)},S.prototype.mod=function(e){var t=E();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(S.ZERO)>0&&e.subTo(t,t),t},S.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new k(t):new O(t),this.exp(e,r)},S.ZERO=P(0),S.ONE=P(1),M.prototype.convert=B,M.prototype.revert=B,M.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},M.prototype.sqrTo=function(e,t){e.squareTo(t)},H.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=E();return e.copyTo(t),this.reduce(t),t},H.prototype.revert=function(e){return e},H.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},H.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},H.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var W,$,V,K=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],J=(1<<26)/K[K.length-1];function G(){this.i=0,this.j=0,this.S=new Array}function q(){!function(e){$[V++]^=255&e,$[V++]^=e>>8&255,$[V++]^=e>>16&255,$[V++]^=e>>24&255,V>=256&&(V-=256)}((new Date).getTime())}if(S.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},S.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=P(r),i=E(),o=E(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(e).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(e)+s},S.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,o=0,s=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(s,0)),i&&S.ZERO.subTo(this,this)},S.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(S.ONE.shiftLeft(e-1),N,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(S.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()},S.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},S.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},S.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i=0;)r[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r},S.prototype.millerRabin=function(e){var t=this.subtract(S.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);(e=e+1>>1)>K.length&&(e=K.length);for(var i=E(),o=0;o>24},S.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},S.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},S.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),!!(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},S.prototype.equals=function(e){return 0==this.compareTo(e)},S.prototype.min=function(e){return this.compareTo(e)<0?this:e},S.prototype.max=function(e){return this.compareTo(e)>0?this:e},S.prototype.and=function(e){var t=E();return this.bitwiseTo(e,F,t),t},S.prototype.or=function(e){var t=E();return this.bitwiseTo(e,N,t),t},S.prototype.xor=function(e){var t=E();return this.bitwiseTo(e,D,t),t},S.prototype.andNot=function(e){var t=E();return this.bitwiseTo(e,L,t),t},S.prototype.not=function(){for(var e=E(),t=0;t=this.t?0!=this.s:!!(this[t]&1<1){var u=E();for(n.sqrTo(s[1],u);a<=l;)s[a]=E(),n.mulTo(u,s[a-2],s[a]),a+=2}var d,h,f=e.t-1,p=!0,g=E();for(i=C(e[f])-1;f>=0;){for(i>=c?d=e[f]>>i-c&l:(d=(e[f]&(1<0&&(d|=e[f-1]>>this.DB+i-c)),a=r;!(1&d);)d>>=1,--a;if((i-=a)<0&&(i+=this.DB,--f),p)s[d].copyTo(o),p=!1;else{for(;a>1;)n.sqrTo(o,g),n.sqrTo(g,o),a-=2;a>0?n.sqrTo(o,g):(h=o,o=g,g=h),n.mulTo(g,s[d],o)}for(;f>=0&&!(e[f]&1<=0?(r.subTo(n,r),t&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),t&&s.subTo(i,s),a.subTo(o,a))}return 0!=n.compareTo(S.ONE)?S.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},S.prototype.pow=function(e){return this.exp(e,new M)},S.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},S.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=K[K.length-1]){for(t=0;t>>8,$[V++]=255&z;V=0,q()}function Z(){if(null==W){for(q(),(W=new G).init($),V=0;V<$.length;++V)$[V]=0;V=0}return W.next()}function ee(){}function te(e,t){return new S(e,t)}function re(e,t,r){for(var n="",i=0;n.length>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function ne(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function ie(e,t){this.x=t,this.q=e}function oe(e,t,r,n){this.curve=e,this.x=t,this.y=r,this.z=null==n?S.ONE:n,this.zinv=null}function se(e,t,r){this.q=e,this.a=this.fromBigInteger(t),this.b=this.fromBigInteger(r),this.infinity=new oe(this,null,null)}ee.prototype.nextBytes=function(e){var t;for(t=0;t0&&t.length>0))throw"Invalid RSA public key";this.n=te(e,16),this.e=parseInt(t,16)}},ne.prototype.encrypt=function(e){var t=function(e,t){if(t=0&&t>0;){var i=e.charCodeAt(n--);i<128?r[--t]=i:i>127&&i<2048?(r[--t]=63&i|128,r[--t]=i>>6|192):(r[--t]=63&i|128,r[--t]=i>>6&63|128,r[--t]=i>>12|224)}r[--t]=0;for(var o=new ee,s=new Array;t>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--t]=s[0]}return r[--t]=2,r[--t]=0,new S(r)}(e,this.n.bitLength()+7>>3);if(null==t)return null;var r=this.doPublic(t);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n},ne.prototype.encryptOAEP=function(e,t,r){var n=function(e,t,r,n){var i=ce.crypto.MessageDigest,o=ce.crypto.Util,s=null;if(r||(r="sha1"),"string"==typeof r&&(s=i.getCanonicalAlgName(r),n=i.getHashLength(s),r=function(e){return Se(o.hashHex(Ee(e),s))}),e.length+2*n+2>t)throw"Message too long for RSA";var a,c="";for(a=0;a>3,t,r);if(null==n)return null;var i=this.doPublic(n);if(null==i)return null;var o=i.toString(16);return 1&o.length?"0"+o:o},ne.prototype.type="RSA",ie.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.x.equals(e.x)},ie.prototype.toBigInteger=function(){return this.x},ie.prototype.negate=function(){return new ie(this.q,this.x.negate().mod(this.q))},ie.prototype.add=function(e){return new ie(this.q,this.x.add(e.toBigInteger()).mod(this.q))},ie.prototype.subtract=function(e){return new ie(this.q,this.x.subtract(e.toBigInteger()).mod(this.q))},ie.prototype.multiply=function(e){return new ie(this.q,this.x.multiply(e.toBigInteger()).mod(this.q))},ie.prototype.square=function(){return new ie(this.q,this.x.square().mod(this.q))},ie.prototype.divide=function(e){return new ie(this.q,this.x.multiply(e.toBigInteger().modInverse(this.q)).mod(this.q))},oe.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},oe.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},oe.prototype.equals=function(e){return e==this||(this.isInfinity()?e.isInfinity():e.isInfinity()?this.isInfinity():!!e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(S.ZERO)&&e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q).equals(S.ZERO))},oe.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(S.ZERO)&&!this.y.toBigInteger().equals(S.ZERO)},oe.prototype.negate=function(){return new oe(this.curve,this.x,this.y.negate(),this.z)},oe.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(e.z)).mod(this.curve.q),r=e.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(e.z)).mod(this.curve.q);if(S.ZERO.equals(r))return S.ZERO.equals(t)?this.twice():this.curve.getInfinity();var n=new S("3"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(e.x.toBigInteger(),e.y.toBigInteger(),r.square()),a=s.multiply(r),c=i.multiply(s),l=t.square().multiply(this.z),u=l.subtract(c.shiftLeft(1)).multiply(e.z).subtract(a).multiply(r).mod(this.curve.q),d=c.multiply(n).multiply(t).subtract(o.multiply(a)).subtract(l.multiply(t)).multiply(e.z).add(t.multiply(a)).mod(this.curve.q),h=a.multiply(this.z).multiply(e.z).mod(this.curve.q);return new oe(this.curve,this.curve.fromBigInteger(u),this.curve.fromBigInteger(d),h)},oe.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=new S("3"),t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=t.square().multiply(e);S.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(t.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),c=s.multiply(e).multiply(t).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),l=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new oe(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(c),l)},oe.prototype.multiply=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,r=e,n=r.multiply(new S("3")),i=this.negate(),o=this,s=this.curve.q.subtract(e),a=s.multiply(new S("3")),c=new oe(this.curve,this.x,this.y),l=c.negate();for(t=n.bitLength()-2;t>0;--t){o=o.twice();var u=n.testBit(t);u!=r.testBit(t)&&(o=o.add(u?this:i))}for(t=a.bitLength()-2;t>0;--t){c=c.twice();var d=a.testBit(t);d!=s.testBit(t)&&(c=c.add(d?c:l))}return o},oe.prototype.multiplyTwo=function(e,t,r){var n;n=e.bitLength()>r.bitLength()?e.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(t);n>=0;)i=i.twice(),e.testBit(n)?i=r.testBit(n)?i.add(o):i.add(this):r.testBit(n)&&(i=i.add(t)),--n;return i},se.prototype.getQ=function(){return this.q},se.prototype.getA=function(){return this.a},se.prototype.getB=function(){return this.b},se.prototype.equals=function(e){return e==this||this.q.equals(e.q)&&this.a.equals(e.a)&&this.b.equals(e.b)},se.prototype.getInfinity=function(){return this.infinity},se.prototype.fromBigInteger=function(e){return new ie(this.q,e)},se.prototype.decodePointHex=function(e){switch(parseInt(e.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:default:return null;case 4:case 6:case 7:var t=(e.length-2)/2,r=e.substr(2,t),n=e.substr(t+2,t);return new oe(this,this.fromBigInteger(new S(r,16)),this.fromBigInteger(new S(n,16)))}},ie.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},oe.prototype.getEncoded=function(e){var t=function(e,t){var r=e.toByteArrayUnsigned();if(tr.length;)r.unshift(0);return r},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=t(r,32);return e?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(n,32))),i},oe.decodeFrom=function(e,t){t[0];var r=t.length-1,n=t.slice(1,1+r/2),i=t.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var o=new S(n),s=new S(i);return new oe(e,e.fromBigInteger(o),e.fromBigInteger(s))},oe.decodeFromHex=function(e,t){t.substr(0,2);var r=t.length-2,n=t.substr(2,r/2),i=t.substr(2+r/2,r/2),o=new S(n,16),s=new S(i,16);return new oe(e,e.fromBigInteger(o),e.fromBigInteger(s))},oe.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),r=e.y.subtract(this.y).divide(t),n=r.square().subtract(this.x).subtract(e.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new oe(this.curve,n,i)},oe.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=this.curve.fromBigInteger(S.valueOf(2)),t=this.curve.fromBigInteger(S.valueOf(3)),r=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),n=r.square().subtract(this.x.multiply(e)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new oe(this.curve,n,i)},oe.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,r=e,n=r.multiply(new S("3")),i=this.negate(),o=this;for(t=n.bitLength()-2;t>0;--t){o=o.twice();var s=n.testBit(t);s!=r.testBit(t)&&(o=o.add2D(s?this:i))}return o},oe.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),o=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(r.multiply(e)).add(n).mod(i);return o.equals(s)},oe.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},oe.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(t.compareTo(S.ONE)<0||t.compareTo(e.subtract(S.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(S.ONE)<0||r.compareTo(e.subtract(S.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var ae=function(){var e=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function n(e,t,n){return t?r[t]:String.fromCharCode(parseInt(n,16))}var i=new String(""),o=Object.hasOwnProperty;return function(r,s){var a,c,l=r.match(e),u=l[0],d=!1;"{"===u?a={}:"["===u?a=[]:(a=[],d=!0);for(var h=[a],p=1-d,g=l.length;p=0;)delete n[i[l]]}return s.call(t,r,n)}({"":a},"")),a}}();void 0!==ce&&ce||(t.KJUR=ce={}),void 0!==ce.asn1&&ce.asn1||(ce.asn1={}),ce.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var r=t.substr(1).length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+r).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},ce.asn1.DERAbstractString=function(e){ce.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=we(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},He(ce.asn1.DERAbstractString,ce.asn1.ASN1Object),ce.asn1.DERAbstractTime=function(e){ce.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,r){var n=this.zeroPadding,i=this.localDateToUTC(e),o=String(i.getFullYear());"utc"==t&&(o=o.substr(2,2));var s=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var c=n(String(a),3);s=s+"."+(c=c.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=ge(e)},this.setByDateValue=function(e,t,r,n,i,o){var s=new Date(Date.UTC(e,t-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},He(ce.asn1.DERAbstractTime,ce.asn1.ASN1Object),ce.asn1.DERAbstractStructured=function(e){ce.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},He(ce.asn1.DERAbstractStructured,ce.asn1.ASN1Object),ce.asn1.DERBoolean=function(e){ce.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},He(ce.asn1.DERBoolean,ce.asn1.ASN1Object),ce.asn1.DERInteger=function(e){ce.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=ce.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},He(ce.asn1.DERInteger,ce.asn1.ASN1Object),ce.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=ce.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}ce.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7i.length&&(i=n[r]);return(e=e.replace(i,"::")).slice(1,-1)}function De(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?Ne(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function Le(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),r=parseInt(e.substr(2),16);if(0==t&r<128)return String.fromCharCode(r);if(t<8){var n=128|63&r;return _e((192|(7&t)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&t)<<2|(192&r)>>6;var i=128|63&r;return _e((224|(240&t)>>4).toString(16)+n.toString(16)+i.toString(16))})).join("")}function Ue(e){for(var t=encodeURIComponent(e),r="",n=0;n"7"?"00"+e:e}de.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var r=parseInt(e.substr(t+3,1));return 0==r?-1:0=n)break}return s},de.getNthChildIdx=function(e,t,r){return de.getChildIdx(e,t)[r]},de.getIdxbyList=function(e,t,r,n){var i,o,s=de;return 0==r.length?void 0!==n&&e.substr(t,2)!==n?-1:t:(i=r.shift())>=(o=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,o[i],r,n)},de.getIdxbyListEx=function(e,t,r,n){var i,o,s=de;if(0==r.length)return void 0!==n&&e.substr(t,2)!==n?-1:t;i=r.shift(),o=s.getChildIdx(e,t);for(var a=0,c=0;c=e.length?null:i.getTLV(e,o)},de.getTLVbyListEx=function(e,t,r,n){var i=de,o=i.getIdxbyListEx(e,t,r,n);return-1==o?null:i.getTLV(e,o)},de.getVbyList=function(e,t,r,n,i){var o,s,a=de;return-1==(o=a.getIdxbyList(e,t,r,n))||o>=e.length?null:(s=a.getV(e,o),!0===i&&(s=s.substr(2)),s)},de.getVbyListEx=function(e,t,r,n,i){var o,s,a=de;return-1==(o=a.getIdxbyListEx(e,t,r,n))?null:(s=a.getV(e,o),"03"==e.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},de.getInt=function(e,t,r){null==r&&(r=-1);try{var n=e.substr(t,2);if("02"!=n&&"03"!=n)return r;var i=de.getV(e,t);return"02"==n?parseInt(i,16):function(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var r=parseInt(t,16),n=e.substr(2),i=parseInt(n,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-r),parseInt(i,2)}catch(e){return-1}}(i)}catch(e){return r}},de.getOID=function(e,t,r){null==r&&(r=null);try{return"06"!=e.substr(t,2)?r:function(e){if(!je(e))return null;try{var t=[],r=e.substr(0,2),n=parseInt(r,16);t[0]=new String(Math.floor(n/40)),t[1]=new String(n%40);for(var i=e.substr(2),o=[],s=0;s0&&(l=l+"."+a.join(".")),l}catch(e){return null}}(de.getV(e,t))}catch(e){return r}},de.getOIDName=function(e,t,r){null==r&&(r=null);try{var n=de.getOID(e,t,r);if(n==r)return r;var i=ce.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(e){return r}},de.getString=function(e,t,r){null==r&&(r=null);try{return Se(de.getV(e,t))}catch(e){return r}},de.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},r=[],n=e.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=e.substr(2),s=[],a=0;a0&&(u=u+"."+c.join(".")),u},de.dump=function(e,t,r,n){var i=de,o=i.getV,s=i.dump,a=i.getChildIdx,c=e;e instanceof ce.asn1.ASN1Object&&(c=e.getEncodedHex());var l=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n="");var u,d=t.ommit_long_octet;if("01"==(u=c.substr(r,2)))return"00"==(h=o(c,r))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==u)return n+"INTEGER "+l(h=o(c,r),d)+"\n";if("03"==u){var h=o(c,r);return i.isASN1HEX(h.substr(2))?(_=n+"BITSTRING, encapsulates\n")+s(h.substr(2),t,0,n+" "):n+"BITSTRING "+l(h,d)+"\n"}if("04"==u)return h=o(c,r),i.isASN1HEX(h)?(_=n+"OCTETSTRING, encapsulates\n")+s(h,t,0,n+" "):n+"OCTETSTRING "+l(h,d)+"\n";if("05"==u)return n+"NULL\n";if("06"==u){var f=o(c,r),p=ce.asn1.ASN1Util.oidHexToInt(f),g=ce.asn1.x509.OID.oid2name(p),y=p.replace(/\./g," ");return""!=g?n+"ObjectIdentifier "+g+" ("+y+")\n":n+"ObjectIdentifier ("+y+")\n"}if("0a"==u)return n+"ENUMERATED "+parseInt(o(c,r))+"\n";if("0c"==u)return n+"UTF8String '"+_e(o(c,r))+"'\n";if("13"==u)return n+"PrintableString '"+_e(o(c,r))+"'\n";if("14"==u)return n+"TeletexString '"+_e(o(c,r))+"'\n";if("16"==u)return n+"IA5String '"+_e(o(c,r))+"'\n";if("17"==u)return n+"UTCTime "+_e(o(c,r))+"\n";if("18"==u)return n+"GeneralizedTime "+_e(o(c,r))+"\n";if("1a"==u)return n+"VisualString '"+_e(o(c,r))+"'\n";if("1e"==u)return n+"BMPString '"+Le(o(c,r))+"'\n";if("30"==u){if("3000"==c.substr(r,4))return n+"SEQUENCE {}\n";_=n+"SEQUENCE\n";var m=t;if((2==(w=a(c,r)).length||3==w.length)&&"06"==c.substr(w[0],2)&&"04"==c.substr(w[w.length-1],2)){g=i.oidname(o(c,w[0]));var v=JSON.parse(JSON.stringify(t));v.x509ExtName=g,m=v}for(var b=0;b31)&&128==(192&r)&&(31&r)==n}catch(e){return!1}},de.isASN1HEX=function(e){var t=de;if(e.length%2==1)return!1;var r=t.getVblen(e,0),n=e.substr(0,2),i=t.getL(e,0);return e.length-n.length-i.length==2*r},de.checkStrictDER=function(e,t,r,n,i){var o=de;if(void 0===r){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!ce.lang.String.isHex(e))throw new Error("not hex string");r=e.length,i=(n=e.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(e,t).length>2*i)throw new Error("L of TLV too long: idx="+t);var s=o.getVblen(e,t);if(s>n)throw new Error("value of L too long than hex: idx="+t);var a=o.getTLV(e,t),c=a.length-2-o.getL(e,t).length;if(c!==2*s)throw new Error("V string length and L's value not the same:"+c+"/"+2*s);if(0===t&&e.length!=a.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+a.length);var l=e.substr(t,2);if("02"===l){var u=o.getVidx(e,t);if("00"==e.substr(u,2)&&e.charCodeAt(u+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(l,16)){for(var d=o.getVblen(e,t),h=0,f=o.getChildIdx(e,t),p=0;p=t?e:new Array(t-e.length+1).join(r)+e};function He(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==ce&&ce||(t.KJUR=ce={}),void 0!==ce.crypto&&ce.crypto||(ce.crypto={}),ce.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:y.algo.MD5,sha1:y.algo.SHA1,sha224:y.algo.SHA224,sha256:y.algo.SHA256,sha384:y.algo.SHA384,sha512:y.algo.SHA512,ripemd160:y.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,r){var n=this.getDigestInfoHex(e,t),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+t;for(var o="00"+n,s="",a=i-4-o.length,c=0;c=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(o)>=0)return!1;var a=n.modInverse(o),c=e.multiply(a).mod(o),l=t.multiply(a).mod(o);return s.multiply(c).add(i.multiply(l)).getX().toBigInteger().mod(o).equals(t)},this.serializeSig=function(e,t){var r=e.toByteArraySigned(),n=t.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(e){var t;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(2!=e[t=2])throw new Error("First element in signature must be a DERInteger");var n=e.slice(t+2,t+2+e[t+1]);if(2!=e[t+=2+e[t+1]])throw new Error("Second element in signature must be a DERInteger");var i=e.slice(t+2,t+2+e[t+1]);return t+=2+e[t+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var t=e[0]-27;if(t<0||t>7)throw"Invalid signature type";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(e.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(e.slice(33,65)).mod(n),i:t}},this.readPKCS5PrvKeyHex=function(e){if(!1===l(e))throw new Error("not ASN.1 hex string");var t,r,n;try{t=c(e,0,["[0]",0],"06"),r=c(e,0,[1],"04");try{n=c(e,0,["[1]",0],"03")}catch(e){}}catch(e){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(t),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(e){if(!1===l(e))throw new t("not ASN.1 hex string");var r,n,i;try{c(e,0,[1,0],"06"),r=c(e,0,[1,1],"06"),n=c(e,0,[2,0,1],"04");try{i=c(e,0,[2,0,"[1]",0],"03")}catch(e){}}catch(e){throw new t("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(r),void 0===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(e){if(!1===l(e))throw new t("not ASN.1 hex string");var r,n;try{c(e,0,[0,0],"06"),r=c(e,0,[0,1],"06"),n=c(e,0,[1],"03")}catch(e){throw new t("malformed PKCS#8 ECC public key")}if(this.curveName=s(r),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(e,r){if(!1===l(e))throw new t("not ASN.1 hex string");var n,i;try{n=c(e,0,[0,5,0,1],"06"),i=c(e,0,[0,5,1],"03")}catch(e){throw new t("malformed X.509 certificate ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},ce.crypto.ECDSA.parseSigHex=function(e){var t=ce.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new S(t.r,16),s:new S(t.s,16)}},ce.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=de,r=t.getChildIdx,n=t.getV;if(t.checkStrictDER(e,0),"30"!=e.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=r(e,0);if(2!=i.length)throw new Error("signature shall have two elements");var o=i[0],s=i[1];if("02"!=e.substr(o,2))throw new Error("1st item not ASN.1 integer");if("02"!=e.substr(s,2))throw new Error("2nd item not ASN.1 integer");return{r:n(e,o),s:n(e,s)}},ce.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=ce.crypto.ECDSA.parseSigHexInHexRS(e),r=t.r,n=t.s;if("00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),"00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw"unknown ECDSA sig r length error";if(n.length%32!=0)throw"unknown ECDSA sig s length error";return r+n},ce.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var t=e.substr(0,e.length/2),r=e.substr(e.length/2);return ce.crypto.ECDSA.hexRSSigToASN1Sig(t,r)},ce.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var r=new S(e,16),n=new S(t,16);return ce.crypto.ECDSA.biRSSigToASN1Sig(r,n)},ce.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var r=ce.asn1,n=new r.DERInteger({bigint:e}),i=new r.DERInteger({bigint:t});return new r.DERSequence({array:[n,i]}).getEncodedHex()},ce.crypto.ECDSA.getName=function(e){return"2b8104001f"===e?"secp192k1":"2a8648ce3d030107"===e?"secp256r1":"2b8104000a"===e?"secp256k1":"2b81040021"===e?"secp224r1":"2b81040022"===e?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)?"secp256r1":-1!=="|secp256k1|".indexOf(e)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(e)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(e)?"secp384r1":null},void 0!==ce&&ce||(t.KJUR=ce={}),void 0!==ce.crypto&&ce.crypto||(ce.crypto={}),ce.crypto.ECParameterDB=new function(){var e={},t={};function r(e){return new S(e,16)}this.getByName=function(r){var n=r;if(void 0!==t[n]&&(n=t[r]),void 0!==e[n])return e[n];throw"unregistered EC curve name: "+n},this.regist=function(n,i,o,s,a,c,l,u,d,h,f,p){e[n]={};var g=r(o),y=r(s),m=r(a),v=r(c),b=r(l),w=new se(g,y,m),_=w.decodePointHex("04"+u+d);e[n].name=n,e[n].keylen=i,e[n].curve=w,e[n].G=_,e[n].n=v,e[n].h=b,e[n].oid=f,e[n].info=p;for(var S=0;S=2*a)break}var d={};return d.keyhex=c.substr(0,2*i[e].keylen),d.ivhex=c.substr(2*i[e].keylen,2*i[e].ivlen),d},a=function(e,t,r,n){var o=y.enc.Base64.parse(e),s=y.enc.Hex.stringify(o);return(0,i[t].proc)(s,r,n)};return{version:"1.0.0",parsePKCS5PEM:function(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,r){return s(e,t,r)},decryptKeyB64:function(e,t,r,n){return a(e,t,r,n)},getDecryptedKeyHex:function(e,t){var r=o(e),n=(r.type,r.cipher),i=r.ivsalt,c=r.data,l=s(n,t,i).keyhex;return a(c,n,l,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,r,n,o){var a="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===i[n])throw new Error("KEYUTIL unsupported algorithm: "+n);void 0!==o&&null!=o||(o=function(e){var t=y.lib.WordArray.random(e);return y.enc.Hex.stringify(t)}(i[n].ivlen).toUpperCase());var c=function(e,t,r,n){return(0,i[t].eproc)(e,r,n)}(t,n,s(n,r,o).keyhex,o);return a="-----BEGIN "+e+" PRIVATE KEY-----\r\n",a+="Proc-Type: 4,ENCRYPTED\r\n",a+="DEK-Info: "+n+","+o+"\r\n",a+="\r\n",(a+=c.replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=de,r=t.getChildIdx,n=t.getV,i={},o=r(e,0);if(2!=o.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+o.length);i.ciphertext=n(e,o[1]);var s=r(e,o[0]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+s.length);if("2a864886f70d01050d"!=n(e,s[0]))throw new Error("this only supports pkcs5PBES2");var a=r(e,s[1]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+a.length);var c=r(e,a[1]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+c.length);if("2a864886f70d0307"!=n(e,c[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(e,c[1]);var l=r(e,a[0]);if(2!=l.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length);if("2a864886f70d01050c"!=n(e,l[0]))throw new Error("this only supports pkcs5PBKDF2");var u=r(e,l[1]);if(u.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+u.length);i.pbkdf2Salt=n(e,u[0]);var d=n(e,u[1]);try{i.pbkdf2Iter=parseInt(d,16)}catch(e){throw new Error("malformed format pbkdf2Iter: "+d)}return i},getPBKDF2KeyHexFromParam:function(e,t){var r=y.enc.Hex.parse(e.pbkdf2Salt),n=e.pbkdf2Iter,i=y.PBKDF2(t,r,{keySize:6,iterations:n});return y.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var r=xe(e,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=We.getPBKDF2KeyHexFromParam(n,t),o={};o.ciphertext=y.enc.Hex.parse(n.ciphertext);var s=y.enc.Hex.parse(i),a=y.enc.Hex.parse(n.encryptionSchemeIV),c=y.TripleDES.decrypt(o,s,{iv:a});return y.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function(e,t){var r=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(e){var t=de,r=t.getChildIdx,n=t.getV,i={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=r(e,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=r(e,o[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=n(e,s[0]),"06"==e.substr(s[1],2)&&(i.algparam=n(e,s[1])),"04"!=e.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=t.getVidx(e,o[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=xe(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,r=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==r.algoid)t=new ne;else if("2a8648ce380401"==r.algoid)t=new ce.crypto.DSA;else{if("2a8648ce3d0201"!=r.algoid)throw new Error("unsupported private key algorithm");t=new ce.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,r=de.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===r)t=new ne;else if("2a8648ce380401"===r)t=new ce.crypto.DSA;else{if("2a8648ce3d0201"!==r)throw new Error("unsupported PKCS#8 public key hex");t=new ce.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=de,r=t.getChildIdx,n=t.getV,i={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var o=r(e,0);if(2!=o.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(o[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=n(e,o[0]),"02"!=e.substr(o[1],2))throw new Error("malformed RSA key(code:004)");return i.e=n(e,o[1]),i},parsePublicPKCS8Hex:function(e){var t=de,r=t.getChildIdx,n=t.getV,i={algparam:null},o=r(e,0);if(2!=o.length)throw new Error("outer DERSequence shall have 2 elements: "+o.length);var s=o[0];if("30"!=e.substr(s,2))throw new Error("malformed PKCS8 public key(code:001)");var a=r(e,s);if(2!=a.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(a[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=n(e,a[0]),"06"==e.substr(a[1],2)?i.algparam=n(e,a[1]):"30"==e.substr(a[1],2)&&(i.algparam={},i.algparam.p=t.getVbyList(e,a[1],[0],"02"),i.algparam.q=t.getVbyList(e,a[1],[1],"02"),i.algparam.g=t.getVbyList(e,a[1],[2],"02")),"03"!=e.substr(o[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=n(e,o[1]).substr(2),i}}}();function $e(e,t){for(var r="",n=t/4-e.length,i=0;i>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function Ke(e){for(var t in ce.crypto.Util.DIGESTINFOHEAD){var r=ce.crypto.Util.DIGESTINFOHEAD[t],n=r.length;if(e.substring(0,n)==r)return[t,e.substring(n)]}return[]}function Je(e){var t,r=de,n=r.getChildIdx,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getVbyListEx,c=r.getTLVbyList,l=r.getTLVbyListEx,u=r.getIdxbyList,d=r.getIdxbyListEx,h=r.getVidx,f=r.getInt,p=r.oidname,g=r.hextooidstr,y=xe;try{t=ce.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=c(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=c(e,0,[0]),r=f(t,0);if(r<0||21){var a=o(e,s[1]),c=this.getGeneralName(a);null!=c.uri&&(i.uri=c.uri)}if(s.length>2){var l=o(e,s[2]);"0101ff"==l&&(i.reqauth=!0),"010100"==l&&(i.reqauth=!1)}return i},this.getX500NameRule=function(e){for(var t=null,r=[],n=0;n0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&-1!=d(this.hex,0,[0,"[3]"])&&(e=l(this.hex,0,[0,"[3]",0],"30"));for(var t=[],r=n(e,0),i=0;i2&&"04"===y.substr(g[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(P=new a).readPKCS5PrvKeyHex(y)}return P}if("pkcs8prv"===r)return d.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===r)return d._getKeyFromPublicPKCS8Hex(e);if("x509pub"===r)return Je.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Je.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var v=xe(e,"PUBLIC KEY");return d._getKeyFromPublicPKCS8Hex(v)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=u(e,"RSA PRIVATE KEY");return d.getKey(b,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var w=o(n=u(e,"DSA PRIVATE KEY"),0,[1],"02"),_=o(n,0,[2],"02"),E=o(n,0,[3],"02"),A=o(n,0,[4],"02"),R=o(n,0,[5],"02");return(P=new c).setPrivate(new S(w,16),new S(_,16),new S(E,16),new S(A,16),new S(R,16)),P}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED"))return b=u(e,"EC PRIVATE KEY"),d.getKey(b,null,"pkcs5prv");if(-1!=e.indexOf("-END PRIVATE KEY-"))return d.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var I=d.getDecryptedKeyHex(e,t),T=new ne;return T.readPKCS5PrvKeyHex(I),T}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var x,P=o(n=d.getDecryptedKeyHex(e,t),0,[1],"04"),C=o(n,0,[2,0],"06"),k=o(n,0,[3,0],"03").substr(2);if(void 0===ce.crypto.OID.oidhex2name[C])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+C);return(x=new a({curve:ce.crypto.OID.oidhex2name[C]})).setPublicKeyHex(k),x.setPrivateKeyHex(P),x.isPublic=!1,x}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED"))return w=o(n=d.getDecryptedKeyHex(e,t),0,[1],"02"),_=o(n,0,[2],"02"),E=o(n,0,[3],"02"),A=o(n,0,[4],"02"),R=o(n,0,[5],"02"),(P=new c).setPrivate(new S(w,16),new S(_,16),new S(E,16),new S(A,16),new S(R,16)),P;if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return d.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},We.generateKeypair=function(e,t){if("RSA"==e){var r=t;(s=new ne).generate(r,"10001"),s.isPrivate=!0,s.isPublic=!0;var n=new ne,i=s.n.toString(16),o=s.e.toString(16);return n.setPublic(i,o),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}if("EC"==e){var s,a,c=t,l=new ce.crypto.ECDSA({curve:c}).generateKeyPairHex();return(s=new ce.crypto.ECDSA({curve:c})).setPublicKeyHex(l.ecpubhex),s.setPrivateKeyHex(l.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(n=new ce.crypto.ECDSA({curve:c})).setPublicKeyHex(l.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}throw new Error("unknown algorithm: "+e)},We.getPEM=function(e,t,r,n,i,o){var s=ce,a=s.asn1,c=a.DERObjectIdentifier,l=a.DERInteger,u=a.ASN1Util.newObject,d=a.x509.SubjectPublicKeyInfo,h=s.crypto,f=h.DSA,p=h.ECDSA,g=ne;function m(e){return u({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function v(e){return u({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function b(e){return u({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==g&&e instanceof g||void 0!==f&&e instanceof f||void 0!==p&&e instanceof p)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return Te(E=new d(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==g&&e instanceof g&&(void 0===r||null==r)&&1==e.isPrivate)return Te(E=m(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==p&&e instanceof p&&(void 0===r||null==r)&&1==e.isPrivate){var w=new c({name:e.curveName}).getEncodedHex(),_=v(e).getEncodedHex(),S="";return(S+=Te(w,"EC PARAMETERS"))+Te(_,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==f&&e instanceof f&&(void 0===r||null==r)&&1==e.isPrivate)return Te(E=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==g&&e instanceof g&&void 0!==r&&null!=r&&1==e.isPrivate){var E=m(e).getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,r,n,o)}if("PKCS5PRV"==t&&void 0!==p&&e instanceof p&&void 0!==r&&null!=r&&1==e.isPrivate)return E=v(e).getEncodedHex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,r,n,o);if("PKCS5PRV"==t&&void 0!==f&&e instanceof f&&void 0!==r&&null!=r&&1==e.isPrivate)return E=b(e).getEncodedHex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,r,n,o);var A=function(e,t){var r=R(e,t);return new u({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:r.pbkdf2Salt}},{int:r.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:r.encryptionSchemeIV}}]}]}]},{octstr:{hex:r.ciphertext}}]}).getEncodedHex()},R=function(e,t){var r=y.lib.WordArray.random(8),n=y.lib.WordArray.random(8),i=y.PBKDF2(t,r,{keySize:6,iterations:100}),o=y.enc.Hex.parse(e),s=y.TripleDES.encrypt(o,i,{iv:n})+"",a={};return a.ciphertext=s,a.pbkdf2Salt=y.enc.Hex.stringify(r),a.pbkdf2Iter=100,a.encryptionSchemeAlg="DES-EDE3-CBC",a.encryptionSchemeIV=y.enc.Hex.stringify(n),a};if("PKCS8PRV"==t&&null!=g&&e instanceof g&&1==e.isPrivate){var I=m(e).getEncodedHex();return E=u({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===r||null==r?Te(E,"PRIVATE KEY"):Te(_=A(E,r),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==p&&e instanceof p&&1==e.isPrivate)return I=new u({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=u({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===r||null==r?Te(E,"PRIVATE KEY"):Te(_=A(E,r),"ENCRYPTED PRIVATE KEY");if("PKCS8PRV"==t&&void 0!==f&&e instanceof f&&1==e.isPrivate)return I=new l({bigint:e.x}).getEncodedHex(),E=u({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:I}}]}).getEncodedHex(),void 0===r||null==r?Te(E,"PRIVATE KEY"):Te(_=A(E,r),"ENCRYPTED PRIVATE KEY");throw new Error("unsupported object nor format")},We.getKeyFromCSRPEM=function(e){var t=xe(e,"CERTIFICATE REQUEST");return We.getKeyFromCSRHex(t)},We.getKeyFromCSRHex=function(e){var t=We.parseCSRHex(e);return We.getKey(t.p8pubkeyhex,null,"pkcs8pub")},We.parseCSRHex=function(e){var t=de,r=t.getChildIdx,n=t.getTLV,i={},o=e;if("30"!=o.substr(0,2))throw new Error("malformed CSR(code:001)");var s=r(o,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if("30"!=o.substr(s[0],2))throw new Error("malformed CSR(code:003)");var a=r(o,s[0]);if(a.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(o,a[2]),i},We.getKeyID=function(e){var t=We,r=de;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var n=xe(t.getPEM(e)),i=r.getIdxbyList(n,0,[1]),o=r.getV(n,i).substring(2);return ce.crypto.Util.hashHex(o,"sha1")},We.getJWKFromKey=function(e){var t={};if(e instanceof ne&&e.isPrivate)return t.kty="RSA",t.n=ve(e.n.toString(16)),t.e=ve(e.e.toString(16)),t.d=ve(e.d.toString(16)),t.p=ve(e.p.toString(16)),t.q=ve(e.q.toString(16)),t.dp=ve(e.dmp1.toString(16)),t.dq=ve(e.dmq1.toString(16)),t.qi=ve(e.coeff.toString(16)),t;if(e instanceof ne&&e.isPublic)return t.kty="RSA",t.n=ve(e.n.toString(16)),t.e=ve(e.e.toString(16)),t;if(e instanceof ce.crypto.ECDSA&&e.isPrivate){if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw new Error("unsupported curve name for JWT: "+n);var r=e.getPublicKeyXYHex();return t.kty="EC",t.crv=n,t.x=ve(r.x),t.y=ve(r.y),t.d=ve(e.prvKeyHex),t}if(e instanceof ce.crypto.ECDSA&&e.isPublic){var n;if("P-256"!==(n=e.getShortNISTPCurveName())&&"P-384"!==n)throw new Error("unsupported curve name for JWT: "+n);return r=e.getPublicKeyXYHex(),t.kty="EC",t.crv=n,t.x=ve(r.x),t.y=ve(r.y),t}throw new Error("not supported key object")},ne.getPosArrayOfChildrenFromHex=function(e){return de.getChildIdx(e,0)},ne.getHexValueArrayOfChildrenFromHex=function(e){var t,r=de.getV,n=r(e,(t=ne.getPosArrayOfChildrenFromHex(e))[0]),i=r(e,t[1]),o=r(e,t[2]),s=r(e,t[3]),a=r(e,t[4]),c=r(e,t[5]),l=r(e,t[6]),u=r(e,t[7]),d=r(e,t[8]);return(t=new Array).push(n,i,o,s,a,c,l,u,d),t},ne.prototype.readPrivateKeyFromPEMString=function(e){var t=xe(e),r=ne.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},ne.prototype.readPKCS5PrvKeyHex=function(e){var t=ne.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},ne.prototype.readPKCS8PrvKeyHex=function(e){var t,r,n,i,o,s,a,c,l=de,u=l.getVbyListEx;if(!1===l.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=u(e,0,[2,0,1],"02"),r=u(e,0,[2,0,2],"02"),n=u(e,0,[2,0,3],"02"),i=u(e,0,[2,0,4],"02"),o=u(e,0,[2,0,5],"02"),s=u(e,0,[2,0,6],"02"),a=u(e,0,[2,0,7],"02"),c=u(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,r,n,i,o,s,a,c)},ne.prototype.readPKCS5PubKeyHex=function(e){var t=de,r=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var n=t.getChildIdx(e,0);if(2!==n.length||"02"!==e.substr(n[0],2)||"02"!==e.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(e,n[0]),o=r(e,n[1]);this.setPublic(i,o)},ne.prototype.readPKCS8PubKeyHex=function(e){var t=de;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(r)},ne.prototype.readCertPubKeyHex=function(e,t){var r,n;(r=new Je).readCertHex(e),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},new RegExp("[^0-9a-f]","gi"),ne.prototype.sign=function(e,t){var r=function(e){return ce.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(r,t)},ne.prototype.signWithMessageHash=function(e,t){var r=te(ce.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return $e(this.doPrivate(r).toString(16),this.n.bitLength())},ne.prototype.signPSS=function(e,t,r){var n=function(e){return ce.crypto.Util.hashHex(e,t)}(Ee(e));return void 0===r&&(r=-1),this.signWithMessageHashPSS(n,t,r)},ne.prototype.signWithMessageHashPSS=function(e,t,r){var n,i=Se(e),o=i.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),c=function(e){return ce.crypto.Util.hashHex(e,t)};if(-1===r||void 0===r)r=o;else if(-2===r)r=a-o-2;else if(r<-2)throw new Error("invalid salt length");if(a0&&(l=new Array(r),(new ee).nextBytes(l),l=String.fromCharCode.apply(String,l));var u=Se(c(Ee("\0\0\0\0\0\0\0\0"+i+l))),d=[];for(n=0;n>8*a-s&255;for(p[0]&=~g,n=0;nn)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var o=Ke(i.replace(/^1f+00/,""));if(0==o.length)return!1;var s=o[0];return o[1]==function(e){return ce.crypto.Util.hashString(e,s)}(e)},ne.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=te(t,16);if(r.bitLength()>this.n.bitLength())return 0;var n=Ke(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==e)},ne.prototype.verifyPSS=function(e,t,r,n){var i=function(e){return ce.crypto.Util.hashHex(e,r)}(Ee(e));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(i,t,r,n)},ne.prototype.verifyWithMessageHashPSS=function(e,t,r,n){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new S(t,16),s=function(e){return ce.crypto.Util.hashHex(e,r)},a=Se(e),c=a.length,l=this.n.bitLength()-1,u=Math.ceil(l/8);if(-1===n||void 0===n)n=c;else if(-2===n)n=u-c-2;else if(n<-2)throw new Error("invalid salt length");if(u>8*u-l&255;if(h.charCodeAt(0)&p)throw new Error("bits beyond keysize not zero");var g=Ve(f,h.length,s),y=[];for(i=0;i0&&-1==(":"+r.join(":")+":").indexOf(":"+m+":"))throw"algorithm '"+m+"' not accepted in the list";if("none"!=m&&null===t)throw"key shall be specified to verify.";if("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&(t=We.getKey(t)),!("RS"!=h&&"PS"!=h||t instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==h&&!(t instanceof c))throw"key shall be a ECDSA obj for ES* algs";var v=null;if(void 0===o.jwsalg2sigalg[y.alg])throw"unsupported alg name: "+m;if("none"==(v=o.jwsalg2sigalg[m]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===t)throw"hexadecimal key shall be specified for HMAC";var b=new l({alg:v,pass:t});return b.updateString(p),g==b.doFinal()}if(-1!=v.indexOf("withECDSA")){var w,_=null;try{_=c.concatSigToASN1Sig(g)}catch(e){return!1}return(w=new u({alg:v})).init(t),w.updateString(p),w.verify(_)}return(w=new u({alg:v})).init(t),w.updateString(p),w.verify(g)},ce.jws.JWS.parse=function(e){var t,r,n,i=e.split("."),o={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return t=i[0],r=i[1],3==i.length&&(n=i[2]),o.headerObj=ce.jws.JWS.readSafeJSONString(ue(t)),o.payloadObj=ce.jws.JWS.readSafeJSONString(ue(r)),o.headerPP=JSON.stringify(o.headerObj,null," "),null==o.payloadObj?o.payloadPP=ue(r):o.payloadPP=JSON.stringify(o.payloadObj,null," "),void 0!==n&&(o.sigHex=be(n)),o},ce.jws.JWS.verifyJWT=function(e,t,r){var n=ce.jws,i=n.JWS,o=i.readSafeJSONString,s=i.inArray,a=i.includedArray,c=e.split("."),l=c[0],u=c[1],d=(be(c[2]),o(ue(l))),h=o(ue(u));if(void 0===d.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!s(d.alg,r.alg))return!1;if(void 0!==h.iss&&"object"===f(r.iss)&&!s(h.iss,r.iss))return!1;if(void 0!==h.sub&&"object"===f(r.sub)&&!s(h.sub,r.sub))return!1;if(void 0!==h.aud&&"object"===f(r.aud))if("string"==typeof h.aud){if(!s(h.aud,r.aud))return!1}else if("object"==f(h.aud)&&!a(h.aud,r.aud))return!1;var p=n.IntDate.getNow();return void 0!==r.verifyAt&&"number"==typeof r.verifyAt&&(p=r.verifyAt),void 0!==r.gracePeriod&&"number"==typeof r.gracePeriod||(r.gracePeriod=0),!(void 0!==h.exp&&"number"==typeof h.exp&&h.exp+r.gracePeriodt.length&&(r=t.length);for(var n=0;n=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function p(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(n)return H(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var u=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){for(var d=!0,h=0;hi&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function R(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+d<=r)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&l)<<6|63&o)>127&&(u=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&l)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=d}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);for(var r="",n=0;n0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},c.prototype.compare=function(e,t,r,n,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r),d=0;di)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function x(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function D(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,r,n,o){return o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||O(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||F(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):D(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);F(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s|0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):D(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):D(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function $(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(29))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],a=n[1],l=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),u=0,d=a>0?s-4:s;for(r=0;r>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[u++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=16383,a=0,c=r-i;ac?c:a+s));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,s=[],a=t;a>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,u=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=l}return(f?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,l=8*o-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;e[r+f]=255&s,f+=p,s/=256,l-=8);e[r+f-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e.jws,r=e.KeyUtil,i=e.X509,o=e.crypto,s=e.hextob64u,a=e.b64tohex,c=e.AllowedSigningAlgs;return function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return e.parseJwt=function e(r){n.Log.debug("JoseUtil.parseJwt");try{var i=t.JWS.parse(r);return{header:i.headerObj,payload:i.payloadObj}}catch(e){n.Log.error(e)}},e.validateJwt=function(t,o,s,c,l,u,d){n.Log.debug("JoseUtil.validateJwt");try{if("RSA"===o.kty)if(o.e&&o.n)o=r.getKey(o);else{if(!o.x5c||!o.x5c.length)return n.Log.error("JoseUtil.validateJwt: RSA key missing key material",o),Promise.reject(new Error("RSA key missing key material"));var h=a(o.x5c[0]);o=i.getPublicKeyFromCertHex(h)}else{if("EC"!==o.kty)return n.Log.error("JoseUtil.validateJwt: Unsupported key type",o&&o.kty),Promise.reject(new Error(o.kty));if(!(o.crv&&o.x&&o.y))return n.Log.error("JoseUtil.validateJwt: EC key missing key material",o),Promise.reject(new Error("EC key missing key material"));o=r.getKey(o)}return e._validateJwt(t,o,s,c,l,u,d)}catch(e){return n.Log.error(e&&e.message||e),Promise.reject("JWT validation failed")}},e.validateJwtAttributes=function(t,r,i,o,s,a){o||(o=0),s||(s=parseInt(Date.now()/1e3));var c=e.parseJwt(t).payload;if(!c.iss)return n.Log.error("JoseUtil._validateJwt: issuer was not provided"),Promise.reject(new Error("issuer was not provided"));if(c.iss!==r)return n.Log.error("JoseUtil._validateJwt: Invalid issuer in token",c.iss),Promise.reject(new Error("Invalid issuer in token: "+c.iss));if(!c.aud)return n.Log.error("JoseUtil._validateJwt: aud was not provided"),Promise.reject(new Error("aud was not provided"));if(!(c.aud===i||Array.isArray(c.aud)&&c.aud.indexOf(i)>=0))return n.Log.error("JoseUtil._validateJwt: Invalid audience in token",c.aud),Promise.reject(new Error("Invalid audience in token: "+c.aud));if(c.azp&&c.azp!==i)return n.Log.error("JoseUtil._validateJwt: Invalid azp in token",c.azp),Promise.reject(new Error("Invalid azp in token: "+c.azp));if(!a){var l=s+o,u=s-o;if(!c.iat)return n.Log.error("JoseUtil._validateJwt: iat was not provided"),Promise.reject(new Error("iat was not provided"));if(l1&&void 0!==arguments[1]?arguments[1]:"#";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=i.UrlUtility.parseUrlFragment(t,r);this.error=n.error,this.error_description=n.error_description,this.error_uri=n.error_uri,this.code=n.code,this.state=n.state,this.id_token=n.id_token,this.session_state=n.session_state,this.access_token=n.access_token,this.token_type=n.token_type,this.scope=n.scope,this.profile=void 0,this.expires_in=n.expires_in}return n(e,[{key:"expires_in",get:function(){if(this.expires_at){var e=parseInt(Date.now()/1e3);return this.expires_at-e}},set:function(e){var t=parseInt(e);if("number"==typeof t&&t>0){var r=parseInt(Date.now()/1e3);this.expires_at=r+t}}},{key:"expired",get:function(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf("openid")>=0||!!this.id_token}}]),e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SignoutRequest=void 0;var n=r(0),i=r(3),o=r(9);t.SignoutRequest=function e(t){var r=t.url,s=t.id_token_hint,a=t.post_logout_redirect_uri,c=t.data,l=t.extraQueryParams,u=t.request_type;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),!r)throw n.Log.error("SignoutRequest.ctor: No url passed"),new Error("url");for(var d in s&&(r=i.UrlUtility.addQueryParam(r,"id_token_hint",s)),a&&(r=i.UrlUtility.addQueryParam(r,"post_logout_redirect_uri",a),c&&(this.state=new o.State({data:c,request_type:u}),r=i.UrlUtility.addQueryParam(r,"state",this.state.id))),l)r=i.UrlUtility.addQueryParam(r,d,l[d]);this.url=r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SignoutResponse=void 0;var n=r(3);t.SignoutResponse=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var r=n.UrlUtility.parseUrlFragment(t,"?");this.error=r.error,this.error_description=r.error_description,this.error_uri=r.error_uri,this.state=r.state}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryWebStorage=void 0;var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h.TokenRevocationClient,d=arguments.length>4&&void 0!==arguments[4]?arguments[4]:f.TokenClient,g=arguments.length>5&&void 0!==arguments[5]?arguments[5]:p.JoseUtil;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),r instanceof s.UserManagerSettings||(r=new s.UserManagerSettings(r));var y=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,r));return y._events=new c.UserManagerEvents(r),y._silentRenewService=new n(y),y.settings.automaticSilentRenew&&(i.Log.debug("UserManager.ctor: automaticSilentRenew is configured, setting up silent renew"),y.startSilentRenew()),y.settings.monitorSession&&(i.Log.debug("UserManager.ctor: monitorSession is configured, setting up session monitor"),y._sessionMonitor=new o(y)),y._tokenRevocationClient=new a(y._settings),y._tokenClient=new d(y._settings),y._joseUtil=g,y}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.getUser=function(){var e=this;return this._loadUser().then((function(t){return t?(i.Log.info("UserManager.getUser: user loaded"),e._events.load(t,!1),t):(i.Log.info("UserManager.getUser: user not found in storage"),null)}))},t.prototype.removeUser=function(){var e=this;return this.storeUser(null).then((function(){i.Log.info("UserManager.removeUser: user removed from storage"),e._events.unload()}))},t.prototype.signinRedirect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="si:r";var t={useReplaceToNavigate:e.useReplaceToNavigate};return this._signinStart(e,this._redirectNavigator,t).then((function(){i.Log.info("UserManager.signinRedirect: successful")}))},t.prototype.signinRedirectCallback=function(e){return this._signinEnd(e||this._redirectNavigator.url).then((function(e){return e.profile&&e.profile.sub?i.Log.info("UserManager.signinRedirectCallback: successful, signed in sub: ",e.profile.sub):i.Log.info("UserManager.signinRedirectCallback: no sub"),e}))},t.prototype.signinPopup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="si:p";var t=e.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return t?(e.redirect_uri=t,e.display="popup",this._signin(e,this._popupNavigator,{startUrl:t,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(e){return e&&(e.profile&&e.profile.sub?i.Log.info("UserManager.signinPopup: signinPopup successful, signed in sub: ",e.profile.sub):i.Log.info("UserManager.signinPopup: no sub")),e}))):(i.Log.error("UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured"),Promise.reject(new Error("No popup_redirect_uri or redirect_uri configured")))},t.prototype.signinPopupCallback=function(e){return this._signinCallback(e,this._popupNavigator).then((function(e){return e&&(e.profile&&e.profile.sub?i.Log.info("UserManager.signinPopupCallback: successful, signed in sub: ",e.profile.sub):i.Log.info("UserManager.signinPopupCallback: no sub")),e})).catch((function(e){i.Log.error(e.message)}))},t.prototype.signinSilent=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=Object.assign({},t),this._loadUser().then((function(r){return r&&r.refresh_token?(t.refresh_token=r.refresh_token,e._useRefreshToken(t)):(t.request_type="si:s",t.id_token_hint=t.id_token_hint||e.settings.includeIdTokenInSilentRenew&&r&&r.id_token,r&&e._settings.validateSubOnSilentRenew&&(i.Log.debug("UserManager.signinSilent, subject prior to silent renew: ",r.profile.sub),t.current_sub=r.profile.sub),e._signinSilentIframe(t))}))},t.prototype._useRefreshToken=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(t).then((function(t){return t?t.access_token?e._loadUser().then((function(r){if(r){var n=Promise.resolve();return t.id_token&&(n=e._validateIdTokenFromTokenRefreshToken(r.profile,t.id_token)),n.then((function(){return i.Log.debug("UserManager._useRefreshToken: refresh token response success"),r.id_token=t.id_token||r.id_token,r.access_token=t.access_token,r.refresh_token=t.refresh_token||r.refresh_token,r.expires_in=t.expires_in,e.storeUser(r).then((function(){return e._events.load(r),r}))}))}return null})):(i.Log.error("UserManager._useRefreshToken: No access token returned from token endpoint"),Promise.reject("No access token returned from token endpoint")):(i.Log.error("UserManager._useRefreshToken: No response returned from token endpoint"),Promise.reject("No response returned from token endpoint"))}))},t.prototype._validateIdTokenFromTokenRefreshToken=function(e,t){var r=this;return this._metadataService.getIssuer().then((function(n){return r.settings.getEpochTime().then((function(o){return r._joseUtil.validateJwtAttributes(t,n,r._settings.client_id,r._settings.clockSkew,o).then((function(t){return t?t.sub!==e.sub?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub"),Promise.reject(new Error("sub in id_token does not match current sub"))):t.auth_time&&t.auth_time!==e.auth_time?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time"),Promise.reject(new Error("auth_time in id_token does not match original auth_time"))):t.azp&&t.azp!==e.azp?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp"),Promise.reject(new Error("azp in id_token does not match original azp"))):!t.azp&&e.azp?(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token"),Promise.reject(new Error("azp not in id_token, but present in original id_token"))):void 0:(i.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token"),Promise.reject(new Error("Failed to validate id_token")))}))}))}))},t.prototype._signinSilentIframe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return t?(e.redirect_uri=t,e.prompt=e.prompt||"none",this._signin(e,this._iframeNavigator,{startUrl:t,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(e){return e&&(e.profile&&e.profile.sub?i.Log.info("UserManager.signinSilent: successful, signed in sub: ",e.profile.sub):i.Log.info("UserManager.signinSilent: no sub")),e}))):(i.Log.error("UserManager.signinSilent: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},t.prototype.signinSilentCallback=function(e){return this._signinCallback(e,this._iframeNavigator).then((function(e){return e&&(e.profile&&e.profile.sub?i.Log.info("UserManager.signinSilentCallback: successful, signed in sub: ",e.profile.sub):i.Log.info("UserManager.signinSilentCallback: no sub")),e}))},t.prototype.signinCallback=function(e){var t=this;return this.readSigninResponseState(e).then((function(r){var n=r.state;return r.response,"si:r"===n.request_type?t.signinRedirectCallback(e):"si:p"===n.request_type?t.signinPopupCallback(e):"si:s"===n.request_type?t.signinSilentCallback(e):Promise.reject(new Error("invalid response_type in state"))}))},t.prototype.signoutCallback=function(e,t){var r=this;return this.readSignoutResponseState(e).then((function(n){var i=n.state,o=n.response;return i?"so:r"===i.request_type?r.signoutRedirectCallback(e):"so:p"===i.request_type?r.signoutPopupCallback(e,t):Promise.reject(new Error("invalid response_type in state")):o}))},t.prototype.querySessionStatus=function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="si:s";var r=t.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return r?(t.redirect_uri=r,t.prompt="none",t.response_type=t.response_type||this.settings.query_status_response_type,t.scope=t.scope||"openid",t.skipUserInfo=!0,this._signinStart(t,this._iframeNavigator,{startUrl:r,silentRequestTimeout:t.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return e.processSigninResponse(t.url).then((function(e){if(i.Log.debug("UserManager.querySessionStatus: got signin response"),e.session_state&&e.profile.sub)return i.Log.info("UserManager.querySessionStatus: querySessionStatus success for sub: ",e.profile.sub),{session_state:e.session_state,sub:e.profile.sub,sid:e.profile.sid};i.Log.info("querySessionStatus successful, user not authenticated")})).catch((function(t){if(t.session_state&&e.settings.monitorAnonymousSession&&("login_required"==t.message||"consent_required"==t.message||"interaction_required"==t.message||"account_selection_required"==t.message))return i.Log.info("UserManager.querySessionStatus: querySessionStatus success for anonymous user"),{session_state:t.session_state};throw t}))}))):(i.Log.error("UserManager.querySessionStatus: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},t.prototype._signin=function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(e,t,n).then((function(t){return r._signinEnd(t.url,e)}))},t.prototype._signinStart=function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.prepare(n).then((function(t){return i.Log.debug("UserManager._signinStart: got navigator window handle"),r.createSigninRequest(e).then((function(e){return i.Log.debug("UserManager._signinStart: got signin request"),n.url=e.url,n.id=e.state.id,t.navigate(n)})).catch((function(e){throw t.close&&(i.Log.debug("UserManager._signinStart: Error after preparing navigator, closing navigator window"),t.close()),e}))}))},t.prototype._signinEnd=function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.processSigninResponse(e).then((function(e){i.Log.debug("UserManager._signinEnd: got signin response");var n=new a.User(e);if(r.current_sub){if(r.current_sub!==n.profile.sub)return i.Log.debug("UserManager._signinEnd: current user does not match user returned from signin. sub from signin: ",n.profile.sub),Promise.reject(new Error("login_required"));i.Log.debug("UserManager._signinEnd: current user matches user returned from signin")}return t.storeUser(n).then((function(){return i.Log.debug("UserManager._signinEnd: user stored"),t._events.load(n),n}))}))},t.prototype._signinCallback=function(e,t){i.Log.debug("UserManager._signinCallback");var r="query"===this._settings.response_mode||!this._settings.response_mode&&d.SigninRequest.isCode(this._settings.response_type)?"?":"#";return t.callback(e,void 0,r)},t.prototype.signoutRedirect=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="so:r";var t=e.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;t&&(e.post_logout_redirect_uri=t);var r={useReplaceToNavigate:e.useReplaceToNavigate};return this._signoutStart(e,this._redirectNavigator,r).then((function(){i.Log.info("UserManager.signoutRedirect: successful")}))},t.prototype.signoutRedirectCallback=function(e){return this._signoutEnd(e||this._redirectNavigator.url).then((function(e){return i.Log.info("UserManager.signoutRedirectCallback: successful"),e}))},t.prototype.signoutPopup=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="so:p";var t=e.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return e.post_logout_redirect_uri=t,e.display="popup",e.post_logout_redirect_uri&&(e.state=e.state||{}),this._signout(e,this._popupNavigator,{startUrl:t,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){i.Log.info("UserManager.signoutPopup: successful")}))},t.prototype.signoutPopupCallback=function(e,t){return void 0===t&&"boolean"==typeof e&&(t=e,e=null),this._popupNavigator.callback(e,t,"?").then((function(){i.Log.info("UserManager.signoutPopupCallback: successful")}))},t.prototype._signout=function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(e,t,n).then((function(e){return r._signoutEnd(e.url)}))},t.prototype._signoutStart=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return arguments[1].prepare(r).then((function(n){return i.Log.debug("UserManager._signoutStart: got navigator window handle"),t._loadUser().then((function(o){return i.Log.debug("UserManager._signoutStart: loaded current user from storage"),(t._settings.revokeAccessTokenOnSignout?t._revokeInternal(o):Promise.resolve()).then((function(){var s=e.id_token_hint||o&&o.id_token;return s&&(i.Log.debug("UserManager._signoutStart: Setting id_token into signout request"),e.id_token_hint=s),t.removeUser().then((function(){return i.Log.debug("UserManager._signoutStart: user removed, creating signout request"),t.createSignoutRequest(e).then((function(e){return i.Log.debug("UserManager._signoutStart: got signout request"),r.url=e.url,e.state&&(r.id=e.state.id),n.navigate(r)}))}))}))})).catch((function(e){throw n.close&&(i.Log.debug("UserManager._signoutStart: Error after preparing navigator, closing navigator window"),n.close()),e}))}))},t.prototype._signoutEnd=function(e){return this.processSignoutResponse(e).then((function(e){return i.Log.debug("UserManager._signoutEnd: got signout response"),e}))},t.prototype.revokeAccessToken=function(){var e=this;return this._loadUser().then((function(t){return e._revokeInternal(t,!0).then((function(r){if(r)return i.Log.debug("UserManager.revokeAccessToken: removing token properties from user and re-storing"),t.access_token=null,t.refresh_token=null,t.expires_at=null,t.token_type=null,e.storeUser(t).then((function(){i.Log.debug("UserManager.revokeAccessToken: user stored"),e._events.load(t)}))}))})).then((function(){i.Log.info("UserManager.revokeAccessToken: access token revoked successfully")}))},t.prototype._revokeInternal=function(e,t){var r=this;if(e){var n=e.access_token,o=e.refresh_token;return this._revokeAccessTokenInternal(n,t).then((function(e){return r._revokeRefreshTokenInternal(o,t).then((function(t){return e||t||i.Log.debug("UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format"),e||t}))}))}return Promise.resolve(!1)},t.prototype._revokeAccessTokenInternal=function(e,t){return!e||e.indexOf(".")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(e,t).then((function(){return!0}))},t.prototype._revokeRefreshTokenInternal=function(e,t){return e?this._tokenRevocationClient.revoke(e,t,"refresh_token").then((function(){return!0})):Promise.resolve(!1)},t.prototype.startSilentRenew=function(){this._silentRenewService.start()},t.prototype.stopSilentRenew=function(){this._silentRenewService.stop()},t.prototype._loadUser=function(){return this._userStore.get(this._userStoreKey).then((function(e){return e?(i.Log.debug("UserManager._loadUser: user storageString loaded"),a.User.fromStorageString(e)):(i.Log.debug("UserManager._loadUser: no user storageString"),null)}))},t.prototype.storeUser=function(e){if(e){i.Log.debug("UserManager.storeUser: storing user");var t=e.toStorageString();return this._userStore.set(this._userStoreKey,t)}return i.Log.debug("storeUser.storeUser: removing user"),this._userStore.remove(this._userStoreKey)},n(t,[{key:"_redirectNavigator",get:function(){return this.settings.redirectNavigator}},{key:"_popupNavigator",get:function(){return this.settings.popupNavigator}},{key:"_iframeNavigator",get:function(){return this.settings.iframeNavigator}},{key:"_userStore",get:function(){return this.settings.userStore}},{key:"events",get:function(){return this._events}},{key:"_userStoreKey",get:function(){return"user:"+this.settings.authority+":"+this.settings.client_id}}]),t}(o.OidcClient)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserManagerSettings=void 0;var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=r.popup_redirect_uri,i=r.popup_post_logout_redirect_uri,d=r.popupWindowFeatures,h=r.popupWindowTarget,f=r.silent_redirect_uri,p=r.silentRequestTimeout,g=r.automaticSilentRenew,y=void 0!==g&&g,m=r.validateSubOnSilentRenew,v=void 0!==m&&m,b=r.includeIdTokenInSilentRenew,w=void 0===b||b,_=r.monitorSession,S=void 0===_||_,E=r.monitorAnonymousSession,A=void 0!==E&&E,R=r.checkSessionInterval,I=void 0===R?2e3:R,T=r.stopCheckSessionOnError,x=void 0===T||T,P=r.query_status_response_type,C=r.revokeAccessTokenOnSignout,k=void 0!==C&&C,O=r.accessTokenExpiringNotificationTime,F=void 0===O?60:O,N=r.redirectNavigator,D=void 0===N?new o.RedirectNavigator:N,L=r.popupNavigator,U=void 0===L?new s.PopupNavigator:L,j=r.iframeNavigator,M=void 0===j?new a.IFrameNavigator:j,B=r.userStore,H=void 0===B?new c.WebStorageStateStore({store:l.Global.sessionStorage}):B;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var W=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,arguments[0]));return W._popup_redirect_uri=n,W._popup_post_logout_redirect_uri=i,W._popupWindowFeatures=d,W._popupWindowTarget=h,W._silent_redirect_uri=f,W._silentRequestTimeout=p,W._automaticSilentRenew=y,W._validateSubOnSilentRenew=v,W._includeIdTokenInSilentRenew=w,W._accessTokenExpiringNotificationTime=F,W._monitorSession=S,W._monitorAnonymousSession=A,W._checkSessionInterval=I,W._stopCheckSessionOnError=x,P?W._query_status_response_type=P:arguments[0]&&arguments[0].response_type?W._query_status_response_type=u.SigninRequest.isOidc(arguments[0].response_type)?"id_token":"code":W._query_status_response_type="id_token",W._revokeAccessTokenOnSignout=k,W._redirectNavigator=D,W._popupNavigator=U,W._iframeNavigator=M,W._userStore=H,W}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"popup_redirect_uri",get:function(){return this._popup_redirect_uri}},{key:"popup_post_logout_redirect_uri",get:function(){return this._popup_post_logout_redirect_uri}},{key:"popupWindowFeatures",get:function(){return this._popupWindowFeatures}},{key:"popupWindowTarget",get:function(){return this._popupWindowTarget}},{key:"silent_redirect_uri",get:function(){return this._silent_redirect_uri}},{key:"silentRequestTimeout",get:function(){return this._silentRequestTimeout}},{key:"automaticSilentRenew",get:function(){return this._automaticSilentRenew}},{key:"validateSubOnSilentRenew",get:function(){return this._validateSubOnSilentRenew}},{key:"includeIdTokenInSilentRenew",get:function(){return this._includeIdTokenInSilentRenew}},{key:"accessTokenExpiringNotificationTime",get:function(){return this._accessTokenExpiringNotificationTime}},{key:"monitorSession",get:function(){return this._monitorSession}},{key:"monitorAnonymousSession",get:function(){return this._monitorAnonymousSession}},{key:"checkSessionInterval",get:function(){return this._checkSessionInterval}},{key:"stopCheckSessionOnError",get:function(){return this._stopCheckSessionOnError}},{key:"query_status_response_type",get:function(){return this._query_status_response_type}},{key:"revokeAccessTokenOnSignout",get:function(){return this._revokeAccessTokenOnSignout}},{key:"redirectNavigator",get:function(){return this._redirectNavigator}},{key:"popupNavigator",get:function(){return this._popupNavigator}},{key:"iframeNavigator",get:function(){return this._iframeNavigator}},{key:"userStore",get:function(){return this._userStore}}]),t}(i.OidcClientSettings)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RedirectNavigator=void 0;var n=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1])||arguments[1];n.Log.debug("UserManagerEvents.load"),e.prototype.load.call(this,t),r&&this._userLoaded.raise(t)},t.prototype.unload=function(){n.Log.debug("UserManagerEvents.unload"),e.prototype.unload.call(this),this._userUnloaded.raise()},t.prototype.addUserLoaded=function(e){this._userLoaded.addHandler(e)},t.prototype.removeUserLoaded=function(e){this._userLoaded.removeHandler(e)},t.prototype.addUserUnloaded=function(e){this._userUnloaded.addHandler(e)},t.prototype.removeUserUnloaded=function(e){this._userUnloaded.removeHandler(e)},t.prototype.addSilentRenewError=function(e){this._silentRenewError.addHandler(e)},t.prototype.removeSilentRenewError=function(e){this._silentRenewError.removeHandler(e)},t.prototype._raiseSilentRenewError=function(e){n.Log.debug("UserManagerEvents._raiseSilentRenewError",e.message),this._silentRenewError.raise(e)},t.prototype.addUserSignedIn=function(e){this._userSignedIn.addHandler(e)},t.prototype.removeUserSignedIn=function(e){this._userSignedIn.removeHandler(e)},t.prototype._raiseUserSignedIn=function(){n.Log.debug("UserManagerEvents._raiseUserSignedIn"),this._userSignedIn.raise()},t.prototype.addUserSignedOut=function(e){this._userSignedOut.addHandler(e)},t.prototype.removeUserSignedOut=function(e){this._userSignedOut.removeHandler(e)},t.prototype._raiseUserSignedOut=function(){n.Log.debug("UserManagerEvents._raiseUserSignedOut"),this._userSignedOut.raise()},t.prototype.addUserSessionChanged=function(e){this._userSessionChanged.addHandler(e)},t.prototype.removeUserSessionChanged=function(e){this._userSessionChanged.removeHandler(e)},t.prototype._raiseUserSessionChanged=function(){n.Log.debug("UserManagerEvents._raiseUserSessionChanged"),this._userSessionChanged.raise()},t}(i.AccessTokenEvents)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Timer=void 0;var n=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,e.call(this,r));return s._timer=n,s._nowFunc=i||function(){return Date.now()/1e3},s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t.prototype.init=function(e){e<=0&&(e=1),e=parseInt(e);var t=this.now+e;if(this.expiration===t&&this._timerHandle)i.Log.debug("Timer.init timer "+this._name+" skipping initialization since already initialized for expiration:",this.expiration);else{this.cancel(),i.Log.debug("Timer.init timer "+this._name+" for duration:",e),this._expiration=t;var r=5;e{var r,i;await this.sessionInfoManager.clear(e.sessionId);const o=null!==(r=e.redirectUrl)&&void 0!==r?r:s.normalizeCallbackUrl(window.location.href);if(!n.isValidRedirectUrl(o))throw new Error(`${o} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);await this.loginHandler.handle({...e,redirectUrl:o,clientName:null!==(i=e.clientName)&&void 0!==i?i:e.clientId,eventEmitter:t})},this.validateCurrentSession=async e=>{const t=await this.sessionInfoManager.get(e);return void 0===t||void 0===t.clientAppId||void 0===t.issuer?null:t},this.handleIncomingRedirect=async(e,t)=>{try{const r=await this.redirectHandler.handle(e,t);return this.fetch=r.fetch.bind(window),this.boundLogout=r.getLogoutUrl,await this.cleanUrlAfterRedirect(e),{isLoggedIn:r.isLoggedIn,webId:r.webId,sessionId:r.sessionId,expirationDate:r.expirationDate}}catch(r){return await this.cleanUrlAfterRedirect(e),void t.emit(n.EVENTS.ERROR,"redirect",r)}}}async cleanUrlAfterRedirect(e){const t=n.removeOpenIdParams(e).href;for(window.history.replaceState(null,"",t);window.location.href!==t;)await new Promise((e=>{setTimeout((()=>e()),1)}))}}function u(e){return"string"==typeof e.oidcIssuer}function d(e){return"string"==typeof e.redirectUrl}class h{constructor(e,t,r,n){this.storageUtility=e,this.oidcHandler=t,this.issuerConfigFetcher=r,this.clientRegistrar=n,this.storageUtility=e,this.oidcHandler=t,this.issuerConfigFetcher=r,this.clientRegistrar=n}async canHandle(e){return u(e)&&d(e)}async handle(e){if(!u(e))throw new n.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(e)}`);if(!d(e))throw new n.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(e)}`);const t=await this.issuerConfigFetcher.fetchConfig(e.oidcIssuer),r=await n.handleRegistration(e,t,this.storageUtility,this.clientRegistrar),i={issuer:t.issuer,dpop:"dpop"===e.tokenType.toLowerCase(),...e,issuerConfiguration:t,client:r};return this.oidcHandler.handle(i)}}class f extends n.AuthorizationCodeWithPkceOidcHandlerBase{async handle(e){var t;const r={authority:e.issuer.toString(),client_id:e.client.clientId,client_secret:e.client.clientSecret,redirect_uri:e.redirectUrl.toString(),post_logout_redirect_uri:e.redirectUrl.toString(),response_type:"code",scope:n.DEFAULT_SCOPES,filterProtocolClaims:!0,loadUserInfo:!1,code_verifier:!0,prompt:null!==(t=e.prompt)&&void 0!==t?t:"consent"},i=new s.OidcClient(r);try{const t=await i.createSigninRequest();return await this.handleRedirect({oidcLoginOptions:e,state:t.state._id,codeVerifier:t.state._code_verifier,targetUrl:t.url.toString()})}catch(e){console.error(e)}}}const p={issuer:{toKey:"issuer",convertToUrl:!0},authorization_endpoint:{toKey:"authorizationEndpoint",convertToUrl:!0},token_endpoint:{toKey:"tokenEndpoint",convertToUrl:!0},userinfo_endpoint:{toKey:"userinfoEndpoint",convertToUrl:!0},jwks_uri:{toKey:"jwksUri",convertToUrl:!0},registration_endpoint:{toKey:"registrationEndpoint",convertToUrl:!0},end_session_endpoint:{toKey:"endSessionEndpoint",convertToUrl:!0},scopes_supported:{toKey:"scopesSupported"},response_types_supported:{toKey:"responseTypesSupported"},response_modes_supported:{toKey:"responseModesSupported"},grant_types_supported:{toKey:"grantTypesSupported"},acr_values_supported:{toKey:"acrValuesSupported"},subject_types_supported:{toKey:"subjectTypesSupported"},id_token_signing_alg_values_supported:{toKey:"idTokenSigningAlgValuesSupported"},id_token_encryption_alg_values_supported:{toKey:"idTokenEncryptionAlgValuesSupported"},id_token_encryption_enc_values_supported:{toKey:"idTokenEncryptionEncValuesSupported"},userinfo_signing_alg_values_supported:{toKey:"userinfoSigningAlgValuesSupported"},userinfo_encryption_alg_values_supported:{toKey:"userinfoEncryptionAlgValuesSupported"},userinfo_encryption_enc_values_supported:{toKey:"userinfoEncryptionEncValuesSupported"},request_object_signing_alg_values_supported:{toKey:"requestObjectSigningAlgValuesSupported"},request_object_encryption_alg_values_supported:{toKey:"requestObjectEncryptionAlgValuesSupported"},request_object_encryption_enc_values_supported:{toKey:"requestObjectEncryptionEncValuesSupported"},token_endpoint_auth_methods_supported:{toKey:"tokenEndpointAuthMethodsSupported"},token_endpoint_auth_signing_alg_values_supported:{toKey:"tokenEndpointAuthSigningAlgValuesSupported"},display_values_supported:{toKey:"displayValuesSupported"},claim_types_supported:{toKey:"claimTypesSupported"},claims_supported:{toKey:"claimsSupported"},service_documentation:{toKey:"serviceDocumentation"},claims_locales_supported:{toKey:"claimsLocalesSupported"},ui_locales_supported:{toKey:"uiLocalesSupported"},claims_parameter_supported:{toKey:"claimsParameterSupported"},request_parameter_supported:{toKey:"requestParameterSupported"},request_uri_parameter_supported:{toKey:"requestUriParameterSupported"},require_request_uri_registration:{toKey:"requireRequestUriRegistration"},op_policy_uri:{toKey:"opPolicyUri",convertToUrl:!0},op_tos_uri:{toKey:"opTosUri",convertToUrl:!0}};class g{constructor(e){this.storageUtility=e,this.storageUtility=e}static getLocalStorageKey(e){return`issuerConfig:${e}`}async fetchConfig(e){let t;const r=new URL(".well-known/openid-configuration",e.endsWith("/")?e:`${e}/`).href,i=await a.fetch.call(globalThis,r);try{t=function(e){const t={};return Object.keys(e).forEach((r=>{p[r]&&(t[p[r].toKey]=e[r])})),Array.isArray(t.scopesSupported)||(t.scopesSupported=["openid"]),t}(await i.json())}catch(t){throw new n.ConfigurationError(`[${e.toString()}] has an invalid configuration: ${t.message}`)}return await this.storageUtility.set(g.getLocalStorageKey(e),JSON.stringify(t)),t}}class y extends n.SessionInfoManagerBase{async get(e){const[t,r,i,o,s,a,c,l]=await Promise.all([this.storageUtility.getForUser(e,"isLoggedIn",{secure:!0}),this.storageUtility.getForUser(e,"webId",{secure:!0}),this.storageUtility.getForUser(e,"clientId",{secure:!1}),this.storageUtility.getForUser(e,"clientSecret",{secure:!1}),this.storageUtility.getForUser(e,"redirectUrl",{secure:!1}),this.storageUtility.getForUser(e,"refreshToken",{secure:!0}),this.storageUtility.getForUser(e,"issuer",{secure:!1}),this.storageUtility.getForUser(e,"tokenType",{secure:!1})]);if("string"!=typeof s||n.isValidRedirectUrl(s)){if(void 0!==l&&!n.isSupportedTokenType(l))throw new Error(`Tokens of type [${l}] are not supported.`);if(void 0!==i||void 0!==t||void 0!==r||void 0!==a)return{sessionId:e,webId:r,isLoggedIn:"true"===t,redirectUrl:s,refreshToken:a,issuer:c,clientAppId:i,clientAppSecret:o,tokenType:null!=l?l:"DPoP"}}else await Promise.all([this.storageUtility.deleteAllUserData(e,{secure:!1}),this.storageUtility.deleteAllUserData(e,{secure:!0})])}async clear(e){return async function(e,t){await n.clear(e,t),await s.clearOidcPersistentStorage()}(e,this.storageUtility)}}class m{async canHandle(e){try{return new URL(e),!0}catch(t){throw new Error(`[${e}] is not a valid URL, and cannot be used as a redirect URL: ${t}`)}}async handle(e){return n.getUnauthenticatedSession()}}const v=(...e)=>a.fetch.call(globalThis,...e);class b{constructor(e,t,r,n,i){this.storageUtility=e,this.sessionInfoManager=t,this.issuerConfigFetcher=r,this.clientRegistrar=n,this.tokerRefresher=i,this.storageUtility=e,this.sessionInfoManager=t,this.issuerConfigFetcher=r,this.clientRegistrar=n,this.tokerRefresher=i}async canHandle(e){try{const t=new URL(e);return null!==t.searchParams.get("code")&&null!==t.searchParams.get("state")}catch(t){throw new Error(`[${e}] is not a valid URL, and cannot be used as a redirect URL: ${t}`)}}async handle(e,t){if(!await this.canHandle(e))throw new Error(`AuthCodeRedirectHandler cannot handle [${e}]: it is missing one of [code, state].`);const r=new URL(e),i=r.searchParams.get("state"),o=await this.storageUtility.getForUser(i,"sessionId",{errorIfNull:!0}),{issuerConfig:a,codeVerifier:c,redirectUrl:l,dpop:u}=await n.loadOidcContextFromStorage(o,this.storageUtility,this.issuerConfigFetcher),d=r.searchParams.get("iss");if("string"==typeof d&&d!==a.issuer)throw new Error(`The value of the iss parameter (${d}) does not match the issuer identifier of the authorization server (${a.issuer}). See [rfc9207](https://www.rfc-editor.org/rfc/rfc9207.html#section-2.3-3.1.1)`);if(void 0===c)throw new Error(`The code verifier for session ${o} is missing from storage.`);if(void 0===l)throw new Error(`The redirect URL for session ${o} is missing from storage.`);const h=await this.clientRegistrar.getClient({sessionId:o},a);let f;const p=Date.now();let g;u?(f=await s.getDpopToken(a,h,{grantType:"authorization_code",code:r.searchParams.get("code"),codeVerifier:c,redirectUrl:l}),window.localStorage.removeItem(`oidc.${i}`)):f=await s.getBearerToken(r.toString()),void 0!==f.refreshToken&&(g={sessionId:o,refreshToken:f.refreshToken,tokenRefresher:this.tokerRefresher});const y=await n.buildAuthenticatedFetch(v,f.accessToken,{dpopKey:f.dpopKey,refreshOptions:g,eventEmitter:t,expiresIn:f.expiresIn});await this.storageUtility.setForUser(o,{webId:f.webId,isLoggedIn:"true"},{secure:!0});const m=await this.sessionInfoManager.get(o);if(!m)throw new Error(`Could not retrieve session: [${o}].`);return Object.assign(m,{fetch:y,getLogoutUrl:n.maybeBuildRpInitiatedLogout({idTokenHint:f.idToken,endSessionEndpoint:a.endSessionEndpoint}),expirationDate:"number"==typeof f.expiresIn?p+1e3*f.expiresIn:void 0})}}class w extends n.AggregateHandler{constructor(e){super(e)}}class _{get storage(){return window.localStorage}async get(e){return this.storage.getItem(e)||void 0}async set(e,t){this.storage.setItem(e,t)}async delete(e){this.storage.removeItem(e)}}class S{redirect(e,t){t&&t.handleRedirect?t.handleRedirect(e):t&&t.redirectByReplacingState?window.history.replaceState({},"",e):window.location.href=e}}class E{constructor(e){this.storageUtility=e,this.storageUtility=e}async getClient(e,t){const[r,n]=await Promise.all([this.storageUtility.getForUser(e.sessionId,"clientId",{secure:!1}),this.storageUtility.getForUser(e.sessionId,"clientSecret",{secure:!1})]);if(r)return{clientId:r,clientSecret:n,clientType:"dynamic"};try{const r=await s.registerClient(e,t),n={clientId:r.clientId};return r.clientSecret&&(n.clientSecret=r.clientSecret),r.idTokenSignedResponseAlg&&(n.idTokenSignedResponseAlg=r.idTokenSignedResponseAlg),await this.storageUtility.setForUser(e.sessionId,n,{secure:!1}),r}catch(e){throw new Error(`Client registration failed: [${e}]`)}}}class A{async canHandle(e){try{return new URL(e).searchParams.has("error")}catch(t){throw new Error(`[${e}] is not a valid URL, and cannot be used as a redirect URL: ${t}`)}}async handle(e,t){if(void 0!==t){const r=new URL(e),i=r.searchParams.get("error"),o=r.searchParams.get("error_description");t.emit(n.EVENTS.ERROR,i,o)}return n.getUnauthenticatedSession()}}class R{constructor(e,t,r){this.storageUtility=e,this.issuerConfigFetcher=t,this.clientRegistrar=r,this.storageUtility=e,this.issuerConfigFetcher=t,this.clientRegistrar=r}async refresh(e,t,r,i){const o=await n.loadOidcContextFromStorage(e,this.storageUtility,this.issuerConfigFetcher),a=await this.clientRegistrar.getClient({sessionId:e},o.issuerConfig);if(void 0===t)throw new Error(`Session [${e}] has no refresh token to allow it to refresh its access token.`);if(o.dpop&&void 0===r)throw new Error(`For session [${e}], the key bound to the DPoP access token must be provided to refresh said access token.`);const c=await s.refresh(t,o.issuerConfig,a,r);return void 0!==c.refreshToken&&(null==i||i.emit(n.EVENTS.NEW_REFRESH_TOKEN,c.refreshToken),await this.storageUtility.setForUser(e,{refreshToken:c.refreshToken})),c}}function I(e){const t=new n.InMemoryStorage,r=e.secureStorage||t,i=e.insecureStorage||new _,o=new c(r,i),s=new g(o),a=new E(o),u=new y(o),d=new R(o,s,a),p=new S,v=new h(o,new f(o,p),s,a),I=new w([new A,new b(o,u,s,a,d),new m]);return new l(v,I,new n.IWaterfallLogoutHandler(u,p),u,s)}const T=`${n.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`,x=`${n.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`;class P extends o{constructor(e={},t=void 0){super(),this.tokenRequestInProgress=!1,this.login=async e=>{var t;return await this.clientAuthentication.login({sessionId:this.info.sessionId,...e,tokenType:null!==(t=e.tokenType)&&void 0!==t?t:"DPoP"},this.events),new Promise((()=>{}))},this.fetch=(e,t)=>this.clientAuthentication.fetch(e,t),this.internalLogout=async(e,t)=>{window.localStorage.removeItem(T),await this.clientAuthentication.logout(this.info.sessionId,t),this.info.isLoggedIn=!1,e&&this.events.emit(n.EVENTS.LOGOUT)},this.logout=async e=>this.internalLogout(!0,e),this.handleIncomingRedirect=async(e={})=>{var t;if(this.info.isLoggedIn)return this.info;if(this.tokenRequestInProgress)return;const r="string"==typeof e?{url:e}:e,i=null!==(t=r.url)&&void 0!==t?t:window.location.href;this.tokenRequestInProgress=!0;const o=await this.clientAuthentication.handleIncomingRedirect(i,this.events);if(function(e){return!!(null==e?void 0:e.isLoggedIn)}(o)){this.setSessionInfo(o);const e=window.localStorage.getItem(x);null===e?this.events.emit(n.EVENTS.LOGIN):(window.localStorage.removeItem(x),this.events.emit(n.EVENTS.SESSION_RESTORED,e))}else if(!0===r.restorePreviousSession){const e=window.localStorage.getItem(T);if(null!==e){const t=await async function(e,t,r){var n;const i=await t.validateCurrentSession(e);return null!==i&&(window.localStorage.setItem(x,window.location.href),await t.login({sessionId:e,prompt:"none",oidcIssuer:i.issuer,redirectUrl:i.redirectUrl,clientId:i.clientAppId,clientSecret:i.clientAppSecret,tokenType:null!==(n=i.tokenType)&&void 0!==n?n:"DPoP"},r.events),!0)}(e,this.clientAuthentication,this);if(t)return new Promise((()=>{}))}}return this.tokenRequestInProgress=!1,o},this.events=new Proxy(this,n.buildProxyHandler(P.prototype,"events only implements ISessionEventListener")),e.clientAuthentication?this.clientAuthentication=e.clientAuthentication:e.secureStorage&&e.insecureStorage?this.clientAuthentication=I({secureStorage:e.secureStorage,insecureStorage:e.insecureStorage}):this.clientAuthentication=I({}),e.sessionInfo?this.info={sessionId:e.sessionInfo.sessionId,isLoggedIn:!1,webId:e.sessionInfo.webId}:this.info={sessionId:null!=t?t:i.v4(),isLoggedIn:!1},this.events.on(n.EVENTS.LOGIN,(()=>window.localStorage.setItem(T,this.info.sessionId))),this.events.on(n.EVENTS.SESSION_EXPIRED,(()=>this.internalLogout(!1))),this.events.on(n.EVENTS.ERROR,(()=>this.internalLogout(!1)))}onLogin(e){this.events.on(n.EVENTS.LOGIN,e)}onLogout(e){this.events.on(n.EVENTS.LOGOUT,e)}onError(e){this.events.on(n.EVENTS.ERROR,e)}onSessionRestore(e){this.events.on(n.EVENTS.SESSION_RESTORED,e)}onSessionExpiration(e){this.events.on(n.EVENTS.SESSION_EXPIRED,e)}setSessionInfo(e){this.info.isLoggedIn=e.isLoggedIn,this.info.webId=e.webId,this.info.sessionId=e.sessionId,this.info.expirationDate=e.expirationDate,this.events.on(n.EVENTS.SESSION_EXTENDED,(e=>{this.info.expirationDate=Date.now()+1e3*e}))}}let C;function k(){return void 0===C&&(C=new P),C}Object.defineProperty(t,"ConfigurationError",{enumerable:!0,get:function(){return n.ConfigurationError}}),Object.defineProperty(t,"EVENTS",{enumerable:!0,get:function(){return n.EVENTS}}),Object.defineProperty(t,"InMemoryStorage",{enumerable:!0,get:function(){return n.InMemoryStorage}}),Object.defineProperty(t,"NotImplementedError",{enumerable:!0,get:function(){return n.NotImplementedError}}),t.Session=P,t.events=()=>k().events,t.fetch=(...e)=>k().fetch(...e),t.getClientAuthenticationWithDependencies=I,t.getDefaultSession=k,t.handleIncomingRedirect=(...e)=>k().handleIncomingRedirect(...e),t.login=(...e)=>k().login(...e),t.logout=(...e)=>k().logout(...e),t.onLogin=(...e)=>k().onLogin(...e),t.onLogout=(...e)=>k().onLogout(...e),t.onSessionRestore=(...e)=>k().onSessionRestore(...e)},4667:function(e,t,r){"use strict";var n=r(7007),i=r(5914),o=r(6438),s=r(2831);const a=["ES256","RS256"],c={ERROR:"error",LOGIN:"login",LOGOUT:"logout",NEW_REFRESH_TOKEN:"newRefreshToken",SESSION_EXPIRED:"sessionExpired",SESSION_EXTENDED:"sessionExtended",SESSION_RESTORED:"sessionRestore",TIMEOUT_SET:"timeoutSet"},l=["openid","offline_access","webid"].join(" ");async function u(e,t){const r=await i.fetch.call(globalThis,e);if(200!==r.status)throw new Error(`Could not fetch JWKS for [${t}] at [${e}]: ${r.status} ${r.statusText}`);let n;try{n=(await r.json()).keys[0]}catch(r){throw new Error(`Malformed JWKS for [${t}] at [${e}]: ${r.message}`)}return n}class d{constructor(e){this.sessionInfoManager=e,this.sessionInfoManager=e}async canHandle(){return!0}async handle(e){await this.sessionInfoManager.clear(e)}}class h{constructor(e){this.redirector=e,this.redirector=e}async canHandle(e,t){return"idp"===(null==t?void 0:t.logoutType)}async handle(e,t){if("idp"!==(null==t?void 0:t.logoutType))throw new Error("Attempting to call idp logout handler to perform app logout");if(void 0===t.toLogoutUrl)throw new Error("Cannot perform IDP logout. Did you log in using the OIDC authentication flow?");this.redirector.redirect(t.toLogoutUrl(t),{handleRedirect:t.handleRedirect})}}async function f(e,t){await Promise.all([t.deleteAllUserData(e,{secure:!1}),t.deleteAllUserData(e,{secure:!0})])}function p({endSessionEndpoint:e,idTokenHint:t,postLogoutRedirectUri:r,state:n}){const i=new URL(e);return void 0!==t&&i.searchParams.append("id_token_hint",t),void 0!==r&&(i.searchParams.append("post_logout_redirect_uri",r),void 0!==n&&i.searchParams.append("state",n)),i.toString()}function g(e){try{return new URL(e),!0}catch(e){return!1}}const y=(e,t)=>i.fetch.call(globalThis,e,t);class m{constructor(e,t){this.secureStorage=e,this.insecureStorage=t,this.secureStorage=e,this.insecureStorage=t}getKey(e){return`solidClientAuthenticationUser:${e}`}async getUserData(e,t){const r=await(t?this.secureStorage:this.insecureStorage).get(this.getKey(e));if(void 0===r)return{};try{return JSON.parse(r)}catch(n){throw new Error(`Data for user [${e}] in [${t?"secure":"unsecure"}] storage is corrupted - expected valid JSON, but got: ${r}`)}}async setUserData(e,t,r){await(r?this.secureStorage:this.insecureStorage).set(this.getKey(e),JSON.stringify(t))}async get(e,t){const r=await((null==t?void 0:t.secure)?this.secureStorage:this.insecureStorage).get(e);if(void 0===r&&(null==t?void 0:t.errorIfNull))throw new Error(`[${e}] is not stored`);return r}async set(e,t,r){return((null==r?void 0:r.secure)?this.secureStorage:this.insecureStorage).set(e,t)}async delete(e,t){return((null==t?void 0:t.secure)?this.secureStorage:this.insecureStorage).delete(e)}async getForUser(e,t,r){const n=await this.getUserData(e,null==r?void 0:r.secure);let i;if(n&&n[t]||(i=void 0),i=n[t],void 0===i&&(null==r?void 0:r.errorIfNull))throw new Error(`Field [${t}] for user [${e}] is not stored`);return i||void 0}async setForUser(e,t,r){let n;try{n=await this.getUserData(e,null==r?void 0:r.secure)}catch(e){n={}}await this.setUserData(e,{...n,...t},null==r?void 0:r.secure)}async deleteForUser(e,t,r){const n=await this.getUserData(e,null==r?void 0:r.secure);delete n[t],await this.setUserData(e,n,null==r?void 0:r.secure)}async deleteAllUserData(e,t){await((null==t?void 0:t.secure)?this.secureStorage:this.insecureStorage).delete(this.getKey(e))}}class v extends Error{constructor(e){super(e)}}class b extends Error{constructor(e){super(`[${e}] is not implemented`)}}class w extends Error{constructor(e){super(`Invalid response from OIDC provider: missing fields ${e}`),this.missingFields=e}}class _ extends Error{constructor(e,t,r){super(e),this.error=t,this.errorDescription=r}}function S(e){const t=new URL(e);return new URL(t.pathname,t.origin).toString()}async function E(e,t,r){return new o.SignJWT({htu:S(e),htm:t.toUpperCase(),jti:s.v4()}).setProtectedHeader({alg:a[0],jwk:r.publicKey,typ:"dpop+jwt"}).setIssuedAt().sign(r.privateKey,{})}async function A(e,t,r,n,o){return e(r,await async function(e,t,r,n){if(void 0!==r)return async function(e,t,r,n){var o;const s=new i.Headers(null==n?void 0:n.headers);return s.set("Authorization",`DPoP ${t}`),s.set("DPoP",await E(e,null!==(o=null==n?void 0:n.method)&&void 0!==o?o:"get",r)),{...n,headers:s}}(e,t,r,n);const o=new i.Headers(null==n?void 0:n.headers);return o.set("Authorization",`Bearer ${t}`),{...n,headers:o}}(r.toString(),t,o,n))}const R=e=>void 0!==e?e-5>0?e-5:e:600,I="getResponse",T={get:async(e,t)=>I,set:async(e,t)=>{},delete:async e=>{},getForUser:async(e,t,r)=>I,setForUser:async(e,t,r)=>{},deleteForUser:async(e,t,r)=>{},deleteAllUserData:async(e,t)=>{}},x=e=>{const t=e;return{get:async e=>{if(void 0!==t[e])return"string"==typeof t[e]?t[e]:JSON.stringify(t[e])},set:async(e,r)=>{t[e]=r},delete:async e=>{delete t[e]}}};t.AggregateHandler=class{constructor(e){this.handleables=e,this.handleables=e}async getProperHandler(e){const t=await Promise.all(this.handleables.map((t=>t.canHandle(...e))));for(let e=0;e{try{return JSON.stringify(e)}catch(t){return e.toString()}})).join(", ")}`)}},t.AuthorizationCodeWithPkceOidcHandlerBase=class{constructor(e,t){this.storageUtility=e,this.redirector=t,this.storageUtility=e,this.redirector=t}async canHandle(e){return!!(e.issuerConfiguration.grantTypesSupported&&e.issuerConfiguration.grantTypesSupported.indexOf("authorization_code")>-1)}async handleRedirect({oidcLoginOptions:e,state:t,codeVerifier:r,targetUrl:n}){await Promise.all([this.storageUtility.setForUser(t,{sessionId:e.sessionId}),this.storageUtility.setForUser(e.sessionId,{codeVerifier:r,issuer:e.issuer.toString(),redirectUrl:e.redirectUrl,dpop:e.dpop?"true":"false"})]),this.redirector.redirect(n,{handleRedirect:e.handleRedirect})}},t.ClientAuthentication=class{constructor(e,t,r,n,i){this.loginHandler=e,this.redirectHandler=t,this.logoutHandler=r,this.sessionInfoManager=n,this.issuerConfigFetcher=i,this.fetch=y,this.logout=async(e,t)=>{await this.logoutHandler.handle(e,"idp"===(null==t?void 0:t.logoutType)?{...t,toLogoutUrl:this.boundLogout}:t),this.fetch=y,delete this.boundLogout},this.getSessionInfo=async e=>this.sessionInfoManager.get(e),this.getAllSessionInfo=async()=>this.sessionInfoManager.getAll(),this.loginHandler=e,this.redirectHandler=t,this.logoutHandler=r,this.sessionInfoManager=n,this.issuerConfigFetcher=i}},t.ConfigurationError=v,t.DEFAULT_SCOPES=l,t.EVENTS=c,t.GeneralLogoutHandler=d,t.IRpLogoutHandler=h,t.IWaterfallLogoutHandler=class{constructor(e,t){this.handlers=[new d(e),new h(t)]}async canHandle(){return!0}async handle(e,t){for(const r of this.handlers)await r.canHandle(e,t)&&await r.handle(e,t)}},t.InMemoryStorage=class{constructor(){this.map={}}async get(e){return this.map[e]||void 0}async set(e,t){this.map[e]=t}async delete(e){delete this.map[e]}},t.InvalidResponseError=w,t.NotImplementedError=b,t.OidcProviderError=_,t.PREFERRED_SIGNING_ALG=a,t.REFRESH_BEFORE_EXPIRATION_SECONDS=5,t.SOLID_CLIENT_AUTHN_KEY_PREFIX="solidClientAuthn:",t.SessionInfoManagerBase=class{constructor(e){this.storageUtility=e,this.storageUtility=e}update(e,t){throw new Error("Not Implemented")}get(e){throw new Error("Not implemented")}async getAll(){throw new Error("Not implemented")}async clear(e){return f(e,this.storageUtility)}async register(e){throw new Error("Not implemented")}async getRegisteredSessionIdAll(){throw new Error("Not implemented")}async clearAll(){throw new Error("Not implemented")}},t.StorageUtility=m,t.StorageUtilityGetResponse=I,t.StorageUtilityMock=T,t.USER_SESSION_PREFIX="solidClientAuthenticationUser",t.buildAuthenticatedFetch=async function(e,t,r){var n;let i,o=t;const s=null==r?void 0:r.refreshOptions;if(void 0!==s){const e=async()=>{var t,n,a,l;try{const{accessToken:n,refreshToken:a,expiresIn:l}=await async function(e,t,r){var n;const i=await e.tokenRefresher.refresh(e.sessionId,e.refreshToken,t);return null==r||r.emit(c.SESSION_EXTENDED,null!==(n=i.expiresIn)&&void 0!==n?n:600),"string"==typeof i.refreshToken&&(null==r||r.emit(c.NEW_REFRESH_TOKEN,i.refreshToken)),{accessToken:i.accessToken,refreshToken:i.refreshToken,expiresIn:i.expiresIn}}(s,r.dpopKey,r.eventEmitter);o=n,void 0!==a&&(s.refreshToken=a),clearTimeout(i),i=setTimeout(e,1e3*R(l)),null===(t=r.eventEmitter)||void 0===t||t.emit(c.TIMEOUT_SET,i)}catch(e){e instanceof _&&(null===(n=null==r?void 0:r.eventEmitter)||void 0===n||n.emit(c.ERROR,e.error,e.errorDescription),null===(a=null==r?void 0:r.eventEmitter)||void 0===a||a.emit(c.SESSION_EXPIRED)),e instanceof w&&e.missingFields.includes("access_token")&&(null===(l=null==r?void 0:r.eventEmitter)||void 0===l||l.emit(c.SESSION_EXPIRED))}};i=setTimeout(e,1e3*R(r.expiresIn)),null===(n=r.eventEmitter)||void 0===n||n.emit(c.TIMEOUT_SET,i)}else if(void 0!==r&&void 0!==r.eventEmitter){const e=setTimeout((()=>{r.eventEmitter.emit(c.SESSION_EXPIRED)}),1e3*R(r.expiresIn));r.eventEmitter.emit(c.TIMEOUT_SET,e)}return async(t,n)=>{let i=await A(e,o,t,n,null==r?void 0:r.dpopKey);const s=!i.ok&&(a=i.status,![401,403].includes(a));var a;return i.ok||s||i.url!==t&&void 0!==(null==r?void 0:r.dpopKey)&&(i=await A(e,o,i.url,n,r.dpopKey)),i}},t.buildProxyHandler=(e,t)=>({get(r,i,o){if(!Object.getOwnPropertyNames(n.EventEmitter).includes(i)&&Object.getOwnPropertyNames(e).includes(i))throw new Error(`${t}: [${i}] is not supported`);return Reflect.get(r,i,o)}}),t.clear=f,t.createDpopHeader=E,t.determineSigningAlg=function(e,t){var r;return null!==(r=t.find((t=>e.includes(t))))&&void 0!==r?r:null},t.fetchJwks=u,t.generateDpopKeyPair=async function(){const{privateKey:e,publicKey:t}=await o.generateKeyPair(a[0]),r={privateKey:e,publicKey:await o.exportJWK(t)};return[r.publicKey.alg]=a,r},t.getEndSessionUrl=p,t.getSessionIdFromOauthState=async function(e,t){return e.getForUser(t,"sessionId")},t.getUnauthenticatedSession=function(){return{isLoggedIn:!1,sessionId:s.v4(),fetch:(...e)=>i.fetch.call(globalThis,...e)}},t.getWebidFromTokenPayload=async function(e,t,r,n){const i=await u(t,r);let s;try{const{payload:t}=await o.jwtVerify(e,await o.importJWK(i),{issuer:r,audience:n});s=t}catch(e){throw new Error(`Token verification failed: ${e.stack}`)}if("string"==typeof s.webid)return s.webid;if("string"!=typeof s.sub)throw new Error(`The token ${JSON.stringify(s)} is invalid: it has no 'webid' claim and no 'sub' claim.`);try{return new URL(s.sub),s.sub}catch(e){throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${s.sub}] is invalid as a URL - error [${e}].`)}},t.handleRegistration=async function(e,t,r,n){const i=function(e,t){return void 0===e.clientId||g(e.clientId)?t.scopesSupported.includes("webid")&&void 0!==e.clientId&&g(e.clientId)?"solid-oidc":"dynamic":"static"}(e,t);return"dynamic"===i?n.getClient({sessionId:e.sessionId,clientName:e.clientName,redirectUrl:e.redirectUrl},t):(await r.setForUser(e.sessionId,{clientId:e.clientId}),e.clientSecret&&await r.setForUser(e.sessionId,{clientSecret:e.clientSecret}),e.clientName&&await r.setForUser(e.sessionId,{clientName:e.clientName}),{clientId:e.clientId,clientSecret:e.clientSecret,clientName:e.clientName,clientType:i})},t.isSupportedTokenType=function(e){return"string"==typeof e&&["DPoP","Bearer"].includes(e)},t.isValidRedirectUrl=function(e){try{const t=new URL(e),r=!t.searchParams.has("code")&&!t.searchParams.has("state"),n=""===t.hash;return r&&n}catch(e){return!1}},t.loadOidcContextFromStorage=async function(e,t,r){try{const[n,i,o,s]=await Promise.all([t.getForUser(e,"issuer",{errorIfNull:!0}),t.getForUser(e,"codeVerifier"),t.getForUser(e,"redirectUrl"),t.getForUser(e,"dpop",{errorIfNull:!0})]);return await t.deleteForUser(e,"codeVerifier"),{codeVerifier:i,redirectUrl:o,issuerConfig:await r.fetchConfig(n),dpop:"true"===s}}catch(t){throw new Error(`Failed to retrieve OIDC context from storage associated with session [${e}]: ${t}`)}},t.maybeBuildRpInitiatedLogout=function({endSessionEndpoint:e,idTokenHint:t}){if(void 0!==e)return function({state:r,postLogoutUrl:n}){return p({endSessionEndpoint:e,idTokenHint:t,state:r,postLogoutRedirectUri:n})}},t.mockStorage=x,t.mockStorageUtility=(e,t=!1)=>t?new m(x(e),x({})):new m(x({}),x(e)),t.removeOpenIdParams=function(e){const t=new URL(e);return t.searchParams.delete("state"),t.searchParams.delete("code"),t.searchParams.delete("error"),t.searchParams.delete("error_description"),t.searchParams.delete("iss"),t},t.saveSessionInfoToStorage=async function(e,t,r,n,i,s,a){void 0!==i&&await e.setForUser(t,{refreshToken:i},{secure:s}),void 0!==r&&await e.setForUser(t,{webId:r},{secure:s}),void 0!==n&&await e.setForUser(t,{isLoggedIn:n},{secure:s}),void 0!==a&&await e.setForUser(t,{publicKey:JSON.stringify(a.publicKey),privateKey:JSON.stringify(await o.exportJWK(a.privateKey))},{secure:s})}},4848:function(e,t,r){"use strict";var n=r(8690),i=r(2395),o=r(5914),s=r(2384),a=r(8518),c=r(4727),l=r(6565),u=r(2831);function d(e){return"object"==typeof e&&"object"==typeof e.internal_resourceInfo}function h(e){const t=e;return"object"==typeof t&&"object"==typeof t.internal_resourceInfo&&"object"==typeof t.internal_resourceInfo.linkedResources}function f(e){const t=e;return"object"==typeof t.internal_changeLog&&Array.isArray(t.internal_changeLog.additions)&&Array.isArray(t.internal_changeLog.deletions)}class p extends Error{}function g(e){return"string"==typeof e?e:e.value}const y=o.fetch.bind(globalThis);function m(e){var t,r,n,i,o;const a=null!==(r=null===(t=e.headers.get("Content-Type"))||void 0===t?void 0:t.split(";"))&&void 0!==r?r:[],c=a.length>0&&["text/turtle","application/ld+json"].includes(a[0]),l={sourceIri:e.url,isRawData:!c,contentLocation:null!==(n=e.headers.get("Content-Location"))&&void 0!==n?n:void 0,contentType:null!==(i=e.headers.get("Content-Type"))&&void 0!==i?i:void 0,linkedResources:{},location:null!==(o=e.headers.get("Location"))&&void 0!==o?o:void 0},u=e.headers.get("Link");if(u){const e=s.parse(u),t=e.get("rel","acl");1===t.length&&(l.aclUrl=new URL(t[0].uri,l.sourceIri).href),l.linkedResources=e.refs.reduce(((e,t)=>{var r,n;return null!==(r=e[n=t.rel])&&void 0!==r||(e[n]=[]),e[t.rel].push(new URL(t.uri,l.sourceIri).href),e}),l.linkedResources)}const d=e.headers.get("WAC-Allow");return d&&(l.permissions=function(e){function t(e){const t=e.split(" ");return t.includes("write")?{read:t.includes("read"),append:!0,write:!0,control:t.includes("control")}:{read:t.includes("read"),append:t.includes("append"),write:!1,control:t.includes("control")}}function r(e,t){const r=e.split(",").map((e=>e.split("="))).filter((e=>2===e.length&&e[0].trim()===t));if(1!==r.length)return"";const n=r[0][1].trim();return'"'!==n.charAt(0)||'"'!==n.charAt(n.length-1)?"":n.substring(1,n.length-1)}return{user:t(r(e,"user")),public:t(r(e,"public"))}}(d)),l}function v(e){let t;return t="function"==typeof e.slice?Object.assign(e.slice(),{...e}):{...e},t}function b(e){return!e.ok}const w="http://www.w3.org/ns/auth/acl#Authorization",_="http://www.w3.org/ns/auth/acl#accessTo",S="http://www.w3.org/ns/auth/acl#agent",E="http://www.w3.org/ns/auth/acl#agentGroup",A="http://www.w3.org/ns/auth/acl#agentClass",R="http://www.w3.org/ns/auth/acl#default",I="http://www.w3.org/ns/auth/acl#defaultForNew",T="http://www.w3.org/ns/auth/acl#mode",x="http://www.w3.org/ns/auth/acl#origin",P="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",C="http://www.w3.org/ns/ldp#BasicContainer",k="http://www.w3.org/ns/ldp#Resource",O="http://www.w3.org/ns/ldp#contains",F="http://xmlns.com/foaf/0.1/Agent",N={AccessControlResource:"http://www.w3.org/ns/solid/acp#AccessControlResource",Policy:"http://www.w3.org/ns/solid/acp#Policy",AccessControl:"http://www.w3.org/ns/solid/acp#AccessControl",Read:"http://www.w3.org/ns/solid/acp#Read",Append:"http://www.w3.org/ns/solid/acp#Append",Write:"http://www.w3.org/ns/solid/acp#Write",Rule:"http://www.w3.org/ns/solid/acp#Rule",Matcher:"http://www.w3.org/ns/solid/acp#Matcher",accessControl:"http://www.w3.org/ns/solid/acp#accessControl",memberAccessControl:"http://www.w3.org/ns/solid/acp#memberAccessControl",apply:"http://www.w3.org/ns/solid/acp#apply",applyMembers:"http://www.w3.org/ns/solid/acp#applyMembers",allow:"http://www.w3.org/ns/solid/acp#allow",deny:"http://www.w3.org/ns/solid/acp#deny",allOf:"http://www.w3.org/ns/solid/acp#allOf",anyOf:"http://www.w3.org/ns/solid/acp#anyOf",noneOf:"http://www.w3.org/ns/solid/acp#noneOf",access:"http://www.w3.org/ns/solid/acp#access",accessMembers:"http://www.w3.org/ns/solid/acp#accessMembers",agent:"http://www.w3.org/ns/solid/acp#agent",group:"http://www.w3.org/ns/solid/acp#group",client:"http://www.w3.org/ns/solid/acp#client",PublicAgent:"http://www.w3.org/ns/solid/acp#PublicAgent",AuthenticatedAgent:"http://www.w3.org/ns/solid/acp#AuthenticatedAgent",CreatorAgent:"http://www.w3.org/ns/solid/acp#CreatorAgent"},D="http://www.w3.org/ns/solid/terms#PublicOidcClient",L="https://w3id.org/security#publicKey",U="http://www.w3.org/ns/pim/space#storage",j={fetch:y};async function M(e,t={...j,ignoreAuthenticationErrors:!1}){var r;const n={...j,...t};return B(await n.fetch(e,{method:"HEAD"}),{ignoreAuthenticationErrors:null!==(r=t.ignoreAuthenticationErrors)&&void 0!==r&&r})}function B(e,t={ignoreAuthenticationErrors:!1}){if(b(e)&&(!function(e){return 401===e.status||403===e.status}(e)||!t.ignoreAuthenticationErrors))throw new G(`Fetching the metadata of the Resource at [${e.url}] failed: [${e.status}] [${e.statusText}].`,e);return{internal_resourceInfo:m(e)}}function H(e){return(d(e)?$(e):g(e)).endsWith("/")}function W(e){var t;return null!==(t=e.internal_resourceInfo.contentType)&&void 0!==t?t:null}function $(e){return d(e)?e.internal_resourceInfo.sourceIri:null}const V=$;function K(e){var t;if(!h(e))return null;const r=null!==(t=J(e)["http://www.w3.org/ns/solid/terms#podOwner"])&&void 0!==t?t:[];return 1===r.length?r[0]:null}function J(e){return e.internal_resourceInfo.linkedResources}class G extends p{get statusCode(){return this.response.status}get statusText(){return this.response.statusText}constructor(e,t){super(e),this.response=t}}const q=()=>{const e=[],t=[],r=[];return{onQuad:t=>{e.push(t)},onError:e=>{r.push(e)},onComplete:e=>{t.push(e)},parse:async(o,s)=>new Promise((a=>{const c=new n.JsonLdParser({baseIRI:$(s),documentLoader:new i.FetchDocumentLoader(y)});let l=!1;function u(){l||(l=!0,t.forEach((e=>e())),a())}c.on("end",u),c.on("error",(e=>{r.forEach((t=>t(e))),u()})),e.forEach((e=>c.on("data",e))),c.write(o),c.end()}))}};l.dataset;const z="https://inrupt.com/.well-known/sdk-local-node/",{freeze:Y}=Object;function Q(e){return e.substring(0,46)===z}function X(e){return e.substring(46)}function Z(e){return"string"==typeof e&&"_:"===e.substring(0,2)}function ee(e){return e.substring(2)}function te(e){return`_:${e.value}`}const re="http://www.w3.org/2001/XMLSchema#boolean",ne="http://www.w3.org/2001/XMLSchema#dateTime",ie="http://www.w3.org/2001/XMLSchema#date",oe="http://www.w3.org/2001/XMLSchema#time",se="http://www.w3.org/2001/XMLSchema#decimal",ae="http://www.w3.org/2001/XMLSchema#integer",ce="http://www.w3.org/2001/XMLSchema#string",le="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString";function ue(e){return"true"===e||"1"===e||"false"!==e&&"0"!==e&&null}function de(e){if(!/\d\d:\d\d:\d\d(\.\d+)?(Z|(\+|-)\d\d:\d\d)?/.test(e))return null;const[t,r]=pe(e),[n,i,o]=t.split(":");let s=Number.parseInt(n,10),a=Number.parseInt(i,10);const[c,l]=o.split("."),u=Number.parseInt(c,10),d=l?Number.parseInt(l,10):void 0;a>=60&&(s+=1,a-=60);const h={hour:s,minute:a,second:u};if("number"==typeof d&&(h.millisecond=d),"string"==typeof r){const[e,t]=ge(r);if("number"!=typeof e||e>24||"number"!=typeof t||t>59)return null;h.timezoneHourOffset=e,h.timezoneMinuteOffset=t}return h}function he(e){if(!/-?\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(Z|(\+|-)\d\d:\d\d)?/.test(e))return null;const[t,r]=e.split("T"),[n,i]="-"===t.charAt(0)?[-1,t.substring(1)]:[1,t],[o,s,a]=i.split("-"),c=Number.parseInt(o,10)*n,l=Number.parseInt(s,10)-1,u=Number.parseInt(a,10),[d,h]=pe(r),[f,p]="string"==typeof h?ge(h):[0,0],[g,y,m]=d.split(":"),v=Number.parseInt(g,10)+f,b=Number.parseInt(y,10)+p,[w,_]=m.split("."),S=Number.parseInt(w,10),E=_?Number.parseInt(_,10):0,A=new Date(Date.UTC(c,l,u,v,b,S,E));return c>=0&&c<100&&A.setUTCFullYear(A.getUTCFullYear()-1900),A}function fe(e){if(!/-?\d{4,}-\d\d-\d\d(Z|(\+|-)\d\d:\d\d)?/.test(e))return null;const t=e,[r,n]="-"===t.charAt(0)?[-1,t.substring(1)]:[1,t],[i,o,s]=n.split("-"),a=s.length>2?s.substring(0,2):s,c=Number.parseInt(i,10)*r,l=Number.parseInt(o,10)-1,u=Number.parseInt(a,10),d=new Date(Date.UTC(c,l,u,12));return c>=0&&c<100&&d.setUTCFullYear(d.getUTCFullYear()-1900),d}function pe(e){if(e.endsWith("Z"))return[e.substring(0,e.length-1),"Z"];const t=e.split("+"),r=e.split("-");return 1===t.length&&1===r.length?[t[0],void 0]:t.length>r.length?[t[0],`+${t[1]}`]:[r[0],`-${r[1]}`]}function ge(e){if("Z"===e)return[0,0];const t="+"===e.charAt(0)?1:-1,[r,n]=e.substring(1).split(":");return[Number.parseInt(r,10)*t,Number.parseInt(n,10)*t]}function ye(e){const t=Number.parseFloat(e);return Number.isNaN(t)?null:t}function me(e){const t=Number.parseInt(e,10);return Number.isNaN(t)?null:t}function ve(e){return e.toLowerCase()}function be(e){return we(e)&&"NamedNode"===e.termType}function we(e){return null!==e&&"object"==typeof e&&"string"==typeof e.termType&&"string"==typeof e.value&&"function"==typeof e.equals}function _e(e){return be(e)&&Q(e.value)}function Se(e){const t=g(e);if("function"!=typeof URL)return!0;try{return new URL(t),!0}catch(e){return!1}}function Ee(e,t){return Re.namedNode(Ae(X(e.value),t))}function Ae(e,t){if("function"!=typeof URL)throw new Error("The URL interface is not available, so an IRI cannot be determined.");const r=new URL(t);return r.hash=e,r.href}const Re=c;function Ie(e,t,r={}){var n;if(!["NamedNode","DefaultGraph"].includes(t.graph.termType))throw new Error(`Cannot parse Quads with nodes of type [${t.graph.termType}] as their Graph node.`);const i="DefaultGraph"===t.graph.termType?"default":t.graph.value,o=null!==(n=e.graphs[i])&&void 0!==n?n:{};return Y({...e,graphs:Y({...e.graphs,[i]:Te(o,t,r)})})}function Te(e,t,r){var n;if(!["NamedNode","BlankNode"].includes(t.subject.termType))throw new Error(`Cannot parse Quads with nodes of type [${t.subject.termType}] as their Subject node.`);const i="BlankNode"===t.subject.termType?`_:${t.subject.value}`:t.subject.value,o=null!==(n=e[i])&&void 0!==n?n:{type:"Subject",url:i,predicates:{}};return Y({...e,[i]:xe(o,t,r)})}function xe(e,t,r){return Y({...e,predicates:Pe(e.predicates,t,r)})}function Pe(e,t,r){var n;if(!["NamedNode"].includes(t.predicate.termType))throw new Error(`Cannot parse Quads with nodes of type [${t.predicate.termType}] as their Predicate node.`);const i=t.predicate.value,o=null!==(n=e[i])&&void 0!==n?n:{};return Y({...e,[i]:Ce(o,t,r)})}function Ce(e,t,r){var n,i,o,s,a,c,l,u;if("NamedNode"===t.object.termType){const r=Y([...null!==(n=e.namedNodes)&&void 0!==n?n:[],t.object.value]);return Y({...e,namedNodes:r})}if("Literal"===t.object.termType){if(t.object.datatype.value===le){const r=t.object.language.toLowerCase(),n=Y([...null!==(o=null===(i=e.langStrings)||void 0===i?void 0:i[r])&&void 0!==o?o:[],t.object.value]),a=Y({...null!==(s=e.langStrings)&&void 0!==s?s:{},[r]:n});return Y({...e,langStrings:a})}const r=Y([...null!==(c=null===(a=e.literals)||void 0===a?void 0:a[t.object.datatype.value])&&void 0!==c?c:[],t.object.value]),n=Y({...null!==(l=e.literals)&&void 0!==l?l:{},[t.object.datatype.value]:r});return Y({...e,literals:n})}if("BlankNode"===t.object.termType){const n=ke(t.object,r),i=Y([...null!==(u=e.blankNodes)&&void 0!==u?u:[],n]);return Y({...e,blankNodes:i})}throw new Error(`Objects of type [${t.object.termType}] are not supported.`)}function ke(e,t){var r,n;if(void 0===(null!==(r=t.chainBlankNodes)&&void 0!==r?r:[]).find((t=>t.equals(e))))return te(e);const i=(null!==(n=t.otherQuads)&&void 0!==n?n:[]).filter((t=>t.subject.equals(e))),o=i.filter((e=>!Le(e.object))).reduce(((e,r)=>{var n;if(!["NamedNode"].includes(r.predicate.termType))throw new Error(`Cannot parse Quads with nodes of type [${r.predicate.termType}] as their Predicate node.`);const i=null!==(n=e[r.predicate.value])&&void 0!==n?n:{};return Y({...e,[r.predicate.value]:Ce(i,r,t)})}),{});return i.filter((e=>Le(e.object))).reduce(((e,r)=>{var n,i;if(!["NamedNode"].includes(r.predicate.termType))throw new Error(`Cannot parse Quads with nodes of type [${r.predicate.termType}] as their Predicate node.`);const o=null!==(n=e[r.predicate.value])&&void 0!==n?n:{},s=null!==(i=o.blankNodes)&&void 0!==i?i:[];return Y({...e,[r.predicate.value]:{...o,blankNodes:[...s,ke(r.object,t)]}})}),o)}function Oe(e){const t=e.map((e=>e.subject)).filter(Le),r=e.map((e=>e.object)).filter(Le),n=[];return r.forEach((t=>{n.push(...De(t,e))})),t.concat(r).filter((t=>{if(n.some((e=>e.equals(t))))return!1;const r=e.filter((e=>e.object.equals(t))).map((e=>e.subject));return r.length>0&&(i=r).every((e=>i.every((t=>e.equals(t)))));var i}))}function Fe(e,t={}){var r;const n=[],i=null!==(r=t.dataFactory)&&void 0!==r?r:c;return Object.keys(e.graphs).forEach((r=>{const o=e.graphs[r],s="default"===r?i.defaultGraph():i.namedNode(r);Object.keys(o).forEach((e=>{const{predicates:r}=o[e],a=Z(e)?i.blankNode(ee(e)):i.namedNode(e);n.push(...Ne(r,a,s,t))}))})),n}function Ne(e,t,r,n={}){var i;const o=[],s=null!==(i=n.dataFactory)&&void 0!==i?i:c;return Object.keys(e).forEach((n=>{var i,a,c,l;const u=s.namedNode(n),d=null!==(i=e[n].langStrings)&&void 0!==i?i:{},h=null!==(a=e[n].namedNodes)&&void 0!==a?a:[],f=null!==(c=e[n].literals)&&void 0!==c?c:{},p=null!==(l=e[n].blankNodes)&&void 0!==l?l:[];Object.keys(f).forEach((e=>{const n=s.namedNode(e);f[e].forEach((e=>{const i=s.literal(e,n);o.push(s.quad(t,u,i,r))}))})),Object.keys(d).forEach((e=>{d[e].forEach((n=>{const i=s.literal(n,e);o.push(s.quad(t,u,i,r))}))})),h.forEach((e=>{const n=s.namedNode(e);o.push(s.quad(t,u,n,r))})),p.forEach((e=>{if(Z(e)){const n=s.blankNode(ee(e));o.push(s.quad(t,u,n,r))}else{const n=s.blankNode(),i=s.quad(t,u,n,r),a=Ne(e,n,r);o.push(i),o.push(...a)}}))})),o}function De(e,t,r=[]){if(void 0!==r.find((t=>t.equals(e))))return r;const n=t.filter((t=>t.subject.equals(e)&&Le(t.object))).map((e=>e.object));if(0===n.length)return[];const i=[...r,e],o=n.map((e=>De(e,t,i))),s=[];for(const e of o)s.push(...e);return s}function Le(e){return"BlankNode"===e.termType}const Ue=()=>{const e=[],t=[],r=[];return{onQuad:t=>{e.push(t)},onError:e=>{r.push(e)},onComplete:e=>{t.push(e)},parse:async(n,i)=>{(await async function(e){return new a.Parser({format:"text/turtle",baseIRI:e})}($(i))).parse(n,((n,i)=>{n?r.forEach((e=>e(n))):i?e.forEach((e=>e(i))):t.forEach((e=>e()))}))}}};async function je(e,t){const r=new a.Writer({format:"text/turtle",prefixes:null==t?void 0:t.prefixes}),n=e.map((e=>Re.quad(e.subject,e.predicate,e.object,void 0)));r.addQuads(n);const i=new Promise(((e,t)=>{r.end(((r,n)=>{r?t(r):e(n)}))}));return await i}const Me={acl:"http://www.w3.org/ns/auth/acl#",acp:"http://www.w3.org/ns/solid/acp#",cc:"http://creativecommons.org/ns#",cert:"http://www.w3.org/ns/auth/cert#",csvw:"http://www.w3.org/ns/csvw#",current:"#",dc:"http://purl.org/dc/terms/",dcam:"http://purl.org/dc/dcam/",dcat:"http://www.w3.org/ns/dcat#",dctype:"http://purl.org/dc/dcmitype/",foaf:"http://xmlns.com/foaf/0.1/",ldp:"http://www.w3.org/ns/ldp#",owl:"http://www.w3.org/2002/07/owl#",posixstat:"http://www.w3.org/ns/posix/stat#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",schema:"https://schema.org/",shacl:"http://www.w3.org/ns/shacl#",skos:"http://www.w3.org/2004/02/skos/core#",skosxl:"http://www.w3.org/2008/05/skos-xl#",solid:"http://www.w3.org/ns/solid/terms#",swapdoc:"http://www.w3.org/2000/10/swap/pim/doc#",ui:"http://www.w3.org/ns/ui#",vann:"http://purl.org/vocab/vann/",vcard:"http://www.w3.org/2006/vcard/ns#",ws:"http://www.w3.org/ns/pim/space#",xsd:"http://www.w3.org/2001/XMLSchema#"},Be=l.dataset;function He(e,t={}){var r,n;return(null!==(n=null===(r=t.datasetFactory)||void 0===r?void 0:r.dataset)&&void 0!==n?n:Be)(Fe(e,t))}var We=Object.freeze({__proto__:null,getJsonLdParser:q,getTurtleParser:Ue,solidDatasetAsTurtle:async function(e,t){const{prefixes:r=Me,thing:n}={...t},i=new a.Writer({format:"application/turtle",prefixes:r}),o=n?new a.NamedNode(n):void 0;for(const t of He(e).match(o))i.addQuad(t);return new Promise(((e,t)=>{i.end(((r,n)=>{r?t(r):e(n)}))}))}});const $e={fetch:y},Ve=["Slug","If-None-Match","Content-Type"];async function Ke(e,t=$e){const r={...$e,...t},n=g(e),i=await r.fetch(n,r.init);if(b(i))throw new G(`Fetching the File failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i);const o=m(i),s=await i.blob();return Object.assign(s,{internal_resourceInfo:o})}async function Je(e,t,r=$e){const n=g(e),i=await Ge(n,t,"PUT",r);if(b(i))throw new G(`Overwriting the file at [${n}] failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i);const o=v(t),s=m(i);return s.sourceIri=n,s.isRawData=!0,Object.assign(o,{internal_resourceInfo:s})}async function Ge(e,t,r,n){var i,o;const s={...$e,...n},a=function(e){if(void 0===e)return{};let t={};var r;return r=e,Array.isArray(r)?e.forEach((([e,r])=>{t[e]=r})):function(e){return"function"==typeof e.forEach}(e)?e.forEach(((e,r)=>{t[r]=e})):t=e,t}(null!==(o=null===(i=s.init)||void 0===i?void 0:i.headers)&&void 0!==o?o:{});if(c=a,Ve.some((e=>void 0!==c[e])))throw new Error(`No reserved header (${Ve.join(", ")}) should be set in the optional RequestInit.`);var c;void 0!==s.slug&&(a.Slug=s.slug),a["Content-Type"]=qe(t,n.contentType);const l=g(e);return s.fetch(l,{...s.init,headers:a,method:r,body:t})}function qe(e,t){if("string"==typeof t)return t;const r="object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&e.type.length>0?e.type:void 0;return null!=r?r:"application/octet-stream"}function ze(e){var t,r,n,i,o,s,a,c;if(be(e))return`<${e.value}> (URL)`;if(function(e){return we(e)&&"Literal"===e.termType}(e)){if(!be(e.datatype))return`[${e.value}] (RDF/JS Literal of unknown type)`;let l;switch(e.datatype.value){case re:return l=null!==(r=null===(t=ue(e.value))||void 0===t?void 0:t.valueOf())&&void 0!==r?r:`Invalid data: \`${e.value}\``,`${l} (boolean)`;case ne:return l=null!==(i=null===(n=he(e.value))||void 0===n?void 0:n.toUTCString())&&void 0!==i?i:`Invalid data: \`${e.value}\``,`${l} (datetime)`;case se:return l=null!==(s=null===(o=ye(e.value))||void 0===o?void 0:o.toString())&&void 0!==s?s:`Invalid data: \`${e.value}\``,`${l} (decimal)`;case ae:return l=null!==(c=null===(a=me(e.value))||void 0===a?void 0:a.toString())&&void 0!==c?c:`Invalid data: \`${e.value}\``,`${l} (integer)`;case le:return`"${e.value}" (${e.language} string)`;case ce:return`"${e.value}" (string)`;default:return`[${e.value}] (RDF/JS Literal of type: \`${e.datatype.value}\`)`}}return"BlankNode"===e.termType?`[${e.value}] (RDF/JS BlankNode)`:"Quad"===e.termType?"??? (nested RDF* Quad)":"Variable"===e.termType?`?${e.value} (RDF/JS Variable)`:e}function Ye(e){if(!bt(e))throw new At(e)}function Qe(e,t){const r=f(e)?e.internal_changeLog:{additions:[],deletions:[]},[n,i]=t.filter((e=>!Xe(e))).reduce((([e,t],r)=>void 0!==e.find((e=>e.equals(r)))?[e.filter((e=>!e.equals(r))),t]:[e,t.concat(r)]),[r.additions,r.deletions]);return Y({...e,internal_changeLog:{additions:n,deletions:i}})}function Xe(e){return"BlankNode"===e.subject.termType||"BlankNode"===e.object.termType}function Ze(e,t){var r,n,i;if(Ye(e),!Se(t))throw new Rt(t);const o=g(t),s=null!==(i=null===(n=null===(r=e.predicates[o])||void 0===r?void 0:r.namedNodes)||void 0===n?void 0:n[0])&&void 0!==i?i:null;return null===s?null:Q(s)?`#${X(s)}`:s}const et=Ze;function tt(e,t){var r,n,i;if(Ye(e),!Se(t))throw new Rt(t);const o=g(t);return null!==(i=null===(n=null===(r=e.predicates[o])||void 0===r?void 0:r.namedNodes)||void 0===n?void 0:n.map((e=>Q(e)?`#${X(e)}`:e)))&&void 0!==i?i:[]}const rt=tt;function nt(e,t,r){var n,i;if(Ye(e),!Se(t))throw new Rt(t);const o=g(t),s=null!==(i=null===(n=e.predicates[o])||void 0===n?void 0:n.langStrings)&&void 0!==i?i:{},a=Object.keys(s).find((e=>e.toLowerCase()===r.toLowerCase()&&Array.isArray(s[e])&&s[e].length>0));return"string"==typeof a?s[a][0]:null}function it(e,t,r){var n,i;if(Ye(e),!Se(t))throw new Rt(t);const o=g(t),s=null!==(i=null===(n=e.predicates[o])||void 0===n?void 0:n.langStrings)&&void 0!==i?i:{},a=Object.keys(s).find((e=>e.toLowerCase()===r.toLowerCase()&&Array.isArray(s[e])&&s[e].length>0));return"string"==typeof a?[...s[a]]:[]}function ot(e,t){return Ye(e),ft(e,t,ce)}function st(e,t){const r=et(e,t);return null===r?null:Re.namedNode(r)}function at(e,t){return rt(e,t).map((e=>Re.namedNode(e)))}function ct(e,t){var r,n,i,o;if(Ye(e),!Se(t))throw new Rt(t);const s=g(t),a=null!==(n=null===(r=e.predicates[s])||void 0===r?void 0:r.langStrings)&&void 0!==n?n:{},c=Object.keys(a);if(c.length>0){const e=c.find((e=>Array.isArray(a[e])&&a[e].length>0));if("string"==typeof e)return Re.literal(a[e][0],e)}const l=null!==(o=null===(i=e.predicates[s])||void 0===i?void 0:i.literals)&&void 0!==o?o:{},u=Object.keys(l);if(u.length>0){const e=u.find((e=>Array.isArray(l[e])&&l[e].length>0));if("string"==typeof e)return Re.literal(l[e][0],Re.namedNode(e))}return null}function lt(e,t){var r,n,i,o;if(Ye(e),!Se(t))throw new Rt(t);const s=g(t);let a=[];const c=null!==(n=null===(r=e.predicates[s])||void 0===r?void 0:r.langStrings)&&void 0!==n?n:{},l=Object.keys(c);for(const e of l){const t=c[e].map((t=>Re.literal(t,e)));a=a.concat(t)}const u=null!==(o=null===(i=e.predicates[s])||void 0===i?void 0:i.literals)&&void 0!==o?o:{},d=Object.keys(u);for(const e of d){const t=u[e],r=Re.namedNode(e),n=t.map((e=>Re.literal(e,r)));a=a.concat(n)}return a}function ut(e,t){var r,n;Ye(e);const i=st(e,t);if(null!==i)return i;const o=ct(e,t);if(null!==o)return o;const s=g(t),a=null!==(n=null===(r=e.predicates[s])||void 0===r?void 0:r.blankNodes)&&void 0!==n?n:[];if(a.length>0){const e=Z(a[0])?ee(a[0]):void 0;return Re.blankNode(e)}return null}function dt(e,t){var r,n;Ye(e);const i=at(e,t),o=lt(e,t),s=g(t),a=(null!==(n=null===(r=e.predicates[s])||void 0===r?void 0:r.blankNodes)&&void 0!==n?n:[]).map((e=>{const t=Z(e)?ee(e):void 0;return Re.blankNode(t)}));return i.concat(o).concat(a)}function ht(e,t,r){var n,i,o,s;if(!Se(t))throw new Rt(t);const a=g(t);return null!==(s=null===(o=null===(i=null===(n=e.predicates[a])||void 0===n?void 0:n.literals)||void 0===i?void 0:i[r])||void 0===o?void 0:o[0])&&void 0!==s?s:null}function ft(e,t,r){var n,i,o;if(!Se(t))throw new Rt(t);const s=g(t);return[...null!==(o=null===(i=null===(n=e.predicates[s])||void 0===n?void 0:n.literals)||void 0===i?void 0:i[r])&&void 0!==o?o:[]]}function pt(e,t,r={}){var n;if(!Se(t))throw new Tt(t);const i=void 0!==r.scope?g(r.scope):"default",o=null!==(n=e.graphs[i])&&void 0!==n?n:{},s=g(t),a=o[Q(s)&&h(e)?Ae(X(s),$(e)):s];return void 0===a?null:a}function gt(e,t={acceptBlankNodes:!1}){var r;const n=void 0!==t.scope?g(t.scope):"default",i=null!==(r=e.graphs[n])&&void 0!==r?r:{};return Object.values(i).filter((e=>!Z(e.url)||t.acceptBlankNodes))}function yt(e,t){var r;const n=Et(t)&&h(e)?Ae(X(t.url),$(e)):t.url,i=e.graphs.default,o=Y({...i,[n]:Y({...t,url:n})}),s=Y({...e.graphs,default:o}),a=Re.namedNode(n),c=null===(r=e.graphs.default[n])||void 0===r?void 0:r.predicates,l=void 0!==c?Ne(c,a,Re.defaultGraph()):[],u=Ne(t.predicates,a,Re.defaultGraph());return function(e,t){const r=f(e)?e.internal_changeLog:{additions:[],deletions:[]},[n,i]=t.filter((e=>!Xe(e))).reduce((([e,t],r)=>void 0!==t.find((e=>e.equals(r)))?[e,t.filter((e=>!e.equals(r)))]:[e.concat(r),t]),[r.additions,r.deletions]);return Y({...e,internal_changeLog:{additions:n,deletions:i}})}(Qe(Y({...e,graphs:s}),l),u)}function mt(e,t){var r;let n;n=be(t)?t.value:"string"==typeof t?Q(t)&&h(e)?Ae(X(t),$(e)):t:Et(t)?t.url:_t(t);const i={...e.graphs.default};delete i[n];const o=Y({...e.graphs,default:Y(i)}),s=Re.namedNode(n),a=null===(r=e.graphs.default[n])||void 0===r?void 0:r.predicates,c=void 0!==a?Ne(a,s,Re.defaultGraph()):[];return Qe(Y({...e,graphs:o}),c)}function vt(e={}){var t;if(void 0!==e.url){const{url:t}=e;if(!Se(t))throw new Tt(t);return Y({type:"Subject",predicates:Y({}),url:t})}const r=null!==(t=e.name)&&void 0!==t?t:xt(),n=`${z}${r}`;return Y({type:"Subject",predicates:Y({}),url:n})}function bt(e){return"object"==typeof e&&null!==e&&"string"==typeof e.type&&"Subject"===e.type}function wt(e,t){if(Et(e)){if(void 0===t)throw new Error("The URL of a Thing that has not been persisted cannot be determined without a base URL.");return Ae(X(e.url),t)}return e.url}const _t=wt;function St(e){let t="";Et(e)?t+=`## Thing (no URL yet — identifier: \`#${X(e.url)}\`)\n`:t+=`## Thing: ${e.url}\n`;const r=Object.keys(e.predicates);if(0===r.length)t+="\n\n";else for(const n of r)t+=`\nProperty: ${n}\n`,t+=dt(e,n).reduce(((e,t)=>`${e}- ${ze(t)}\n`),"");return t}function Et(e){return Q(e.url)}class At extends p{constructor(e){super(`Expected a Thing, but received: [${e}].`),this.receivedValue=e}}class Rt extends p{constructor(e){const t=be(e)?e.value:e;super(`Expected a valid URL to identify a property, but received: [${t}].`),this.receivedProperty=t}}class It extends p{constructor(e){const t=be(e)?e.value:e;super(`Expected a valid URL value, but received: [${t}].`),this.receivedValue=t}}class Tt extends p{constructor(e){const t=be(e)?e.value:e;super(`Expected a valid URL to identify a Thing, but received: [${t}].`),this.receivedValue=t}}const xt=()=>u.v4();function Pt(e){const t=new URL(e);return t.hash="",t.href}function Ct(){return Y({type:"Dataset",graphs:{default:{}}})}async function kt(e,t={}){if(b(e))throw new G(`Fetching the SolidDataset at [${e.url}] failed: [${e.status}] [${e.statusText}] ${await e.text()}.`,e);const r=B(e),n={"text/turtle":Ue(),...t.parsers},i=W(r);if(null===i)throw new Error(`Could not determine the content type of the Resource at [${$(r)}].`);const o=i.split(";")[0],s=n[o];if(void 0===s)throw new Error(`The Resource at [${$(r)}] has a MIME type of [${o}], but the only parsers available are for the following MIME types: [${Object.keys(n).join(", ")}].`);const a=await e.text();return new Promise(((e,t)=>{let n=Y({graphs:Y({default:Y({})}),type:"Dataset"});const o=[],c=[];s.onError((e=>{t(new Error(`Encountered an error parsing the Resource at [${$(r)}] with content type [${i}]: ${e}`))})),s.onQuad((e=>{c.push(e),"BlankNode"===e.subject.termType||"BlankNode"===e.object.termType?o.push(e):n=Ie(n,e)})),s.onComplete((async()=>{const t=o.length<=20?Oe(o):[],i=o.filter((e=>t.every((t=>!t.equals(e.subject)))));n=i.reduce(((e,r)=>Ie(e,r,{otherQuads:c,chainBlankNodes:t})),n);const s=Y({...n,...r});e(s)})),s.parse(a,r)}))}async function Ot(e,t=j){var r;e=g(e);const n={...j,...t},i=Object.keys(null!==(r=t.parsers)&&void 0!==r?r:{}),o=i.length>0?i.join(", "):"text/turtle",s=await n.fetch(e,{headers:{Accept:o}});if(b(s))throw new G(`Fetching the Resource at [${e}] failed: [${s.status}] [${s.statusText}] ${await s.text()}.`,s);return await kt(s,t)}async function Ft(e,t,r=j){e=g(e);const n={...j,...r},i=function(e){return f(e)?e:Y({...e,internal_changeLog:{additions:[],deletions:[]}})}(t),o=Nt(i,e)?await async function(e){return{method:"PATCH",body:`${e.internal_changeLog.deletions.length>0?`DELETE DATA {${(await je(e.internal_changeLog.deletions.map(jt))).trim()}};`:""} ${e.internal_changeLog.additions.length>0?`INSERT DATA {${(await je(e.internal_changeLog.additions.map(jt))).trim()}};`:""}`,headers:{"Content-Type":"application/sparql-update"}}}(i):await async function(e,t){return{method:"PUT",body:await je(Fe(e).map(jt),t),headers:{"Content-Type":"text/turtle","If-None-Match":"*",Link:`<${k}>; rel="type"`}}}(i,r),s=await n.fetch(e,o);if(b(s)){const t=Nt(i,e)?`The changes that were sent to the Pod are listed below.\n\n${Ut(i)}`:`The SolidDataset that was sent to the Pod is listed below.\n\n${Lt(i)}`;throw new G(`Storing the Resource at [${e}] failed: [${s.status}] [${s.statusText}] ${await s.text()}.\n\n${t}`,s)}const a={...m(s),isRawData:!1};return Bt(Y({...t,internal_changeLog:{additions:[],deletions:[]},internal_resourceInfo:a}))}function Nt(e,t){return f(e)&&d(e)&&"string"==typeof e.internal_resourceInfo.sourceIri&&(r=t,Pt(e.internal_resourceInfo.sourceIri)===Pt(r));var r}function Dt(e,t){const r=new URL(t),n=new URL(e),i=n.href.startsWith(r.href),o=n.pathname.substring(r.pathname.length,n.pathname.length).replace(/(^\/)|(\/$)/g,"");return i&&o.length>=1&&!o.includes("/")}function Lt(e){let t="";d(e)?t+=`# SolidDataset: ${$(e)}\n`:t+="# SolidDataset (no URL yet)\n";const r=gt(e);return 0===r.length?t+="\n\n":r.forEach((r=>{t+=`\n${St(r)}`,f(e)&&(t+=`\n${function(e,t){const r=Re.namedNode(t.url),n=e.internal_changeLog.additions.reduce(((e,t)=>t.subject.equals(r)?e+1:e),0),i=e.internal_changeLog.deletions.reduce(((e,t)=>t.subject.equals(r)?e+1:e),0);return`(${1===n?"1 new value added":`${n} new values added`} / ${1===i?"1 value removed":`${i} values removed`})`}(e,r)}\n`)})),t}function Ut(e){if(!d(e))return"This is a newly initialized SolidDataset, so there is no source to compare it to.";if(!f(e)||0===e.internal_changeLog.additions.length&&0===e.internal_changeLog.deletions.length)return`## Changes compared to ${$(e)}\n\nThis SolidDataset has not been modified since it was fetched from ${$(e)}.\n`;let t=`## Changes compared to ${$(e)}\n`;const r=function(e){const t=Object.create(null);return e.internal_changeLog.deletions.forEach((r=>{var n,i,o;const s=_e(r.subject)?Ee(r.subject,$(e)):r.subject;if(!be(s)||!be(r.predicate))return;const a=g(s),c=g(r.predicate);null!==(n=t[a])&&void 0!==n||(t[a]=Object.create(null)),null!==(i=(o=t[a])[c])&&void 0!==i||(o[c]={added:[],deleted:[]}),t[a][c].deleted.push(r.object)})),e.internal_changeLog.additions.forEach((r=>{var n,i,o;const s=_e(r.subject)?Ee(r.subject,$(e)):r.subject;if(!be(s)||!be(r.predicate))return;const a=g(s),c=g(r.predicate);null!==(n=t[a])&&void 0!==n||(t[a]=Object.create(null)),null!==(i=(o=t[a])[c])&&void 0!==i||(o[c]={added:[],deleted:[]}),t[a][c].added.push(r.object)})),t}(e);return Object.keys(r).forEach((e=>{t+=`\n### Thing: ${e}\n`;const n=r[e];Object.keys(n).forEach((e=>{t+=`\nProperty: ${e}\n`;const{deleted:r}=n[e],{added:i}=n[e];r.length>0&&(t+="- Removed:\n",t+=r.reduce(((e,t)=>`${e} - ${ze(t)}\n`),"")),i.length>0&&(t+="- Added:\n",t+=i.reduce(((e,t)=>`${e} - ${ze(t)}\n`),""))}))})),t}function jt(e){const t=be(e.subject)?Mt(e.subject):e.subject,r=be(e.object)?Mt(e.object):e.object;return Re.quad(t,e.predicate,r,e.graph)}function Mt(e){return Q(e.value)?Re.namedNode(`#${X(e.value)}`):e}function Bt(e){const t=$(e),r=e.graphs.default,n=Object.keys(r).reduce(((e,r)=>{const n=function(e,t){const r=Object.keys(e.predicates).reduce(((e,r)=>{var n;const i=null!==(n=e[r].namedNodes)&&void 0!==n?n:[];if(i.every((e=>!Q(e))))return e;const o=Y(i.map((e=>Q(e)?`${t}#${X(e)}`:e))),s=Y({...e[r],namedNodes:o});return Y({...e,[r]:s})}),e.predicates);return Y({...e,predicates:r,url:Q(e.url)?`${t}#${X(e.url)}`:e.url})}(e[r],t),i=Q(r)?`${t}#${X(r)}`:r,o={...e};return delete o[r],o[i]=n,Y(o)}),r),i=Y({...e.graphs,default:n});return Y({...e,graphs:i})}function Ht(e){return{...Ct(),internal_resourceInfo:{sourceIri:g(e),isRawData:!1,contentType:"text/turtle",linkedResources:{}}}}function Wt(e){const t=g(e);if(!t.endsWith("/"))throw new Error("A Container's URL should end in a slash. Please update your tests.");return Ht(t)}const $t=(e,t,r)=>{var n,i;if(Ye(e),!Se(t))throw new Rt(t);if(!bt(r)&&!Se(r))throw new It(r);const o=g(t),s=null!==(n=e.predicates[o])&&void 0!==n?n:{},a=null!==(i=s.namedNodes)&&void 0!==i?i:[];let c;c=be(r)?r.value:"string"==typeof r?r:Et(r)?r.url:_t(r);const l=Y(a.concat(g(c))),u=Y({...s,namedNodes:l}),d=Y({...e.predicates,[o]:u});return Y({...e,predicates:d})},Vt=$t,Kt=(e,t,r)=>(Ye(e),rr(e,t,function(e){return e?"true":"false"}(r),re)),Jt=(e,t,r)=>(Ye(e),rr(e,t,function(e){return e.toISOString()}(r),ne)),Gt=(e,t,r)=>(Ye(e),rr(e,t,function(e){const t=e.getFullYear(),r=e.getMonth()+1,n=e.getDate(),[,i]=pe(e.toISOString());return`${t}-${String(r).padStart(2,"0")}-${String(n).padStart(2,"0")}${i}`}(r),ie)),qt=(e,t,r)=>(Ye(e),rr(e,t,function(e){let t,r;if(e.millisecond&&(t=e.millisecond<10?`00${e.millisecond}`:e.millisecond<100?`0${e.millisecond}`:e.millisecond),"number"==typeof e.timezoneHourOffset){const t=Math.abs(e.timezoneHourOffset)<10?`0${Math.abs(e.timezoneHourOffset)}`:Math.abs(e.timezoneHourOffset);r=e.timezoneHourOffset>=0?`+${t}`:`-${t}`,e.timezoneMinuteOffset?r=`${r}:${e.timezoneMinuteOffset<10?`0${e.timezoneMinuteOffset}`:e.timezoneMinuteOffset}`:r+=":00"}return`${e.hour<10?`0${e.hour}`:e.hour}:${e.minute<10?`0${e.minute}`:e.minute}:${e.second<10?`0${e.second}`:e.second}${e.millisecond?`.${t}`:""}${r||""}`}(r),oe)),zt=(e,t,r)=>(Ye(e),rr(e,t,function(e){return e.toString()}(r),se)),Yt=(e,t,r)=>(Ye(e),rr(e,t,function(e){return e.toString()}(r),ae));function Qt(e,t,r,n){var i,o,s;if(Ye(e),!Se(t))throw new Rt(t);const a=g(t),c=ve(n),l=null!==(i=e.predicates[a])&&void 0!==i?i:{},u=null!==(o=l.langStrings)&&void 0!==o?o:{},d=null!==(s=u[c])&&void 0!==s?s:[],h=Y(d.concat(r)),f=Y({...u,[c]:h}),p=Y({...l,langStrings:f}),y=Y({...e.predicates,[a]:p});return Y({...e,predicates:y})}const Xt=(e,t,r)=>(Ye(e),rr(e,t,r,ce));function Zt(e,t,r){return $t(e,t,r.value)}function er(e,t,r){if(Ye(e),!Se(t))throw new Rt(t);return r.datatype.value===le?Qt(e,t,r.value,r.language):rr(e,t,r.value,r.datatype.value)}function tr(e,t,r){var n,i;if("NamedNode"===r.termType)return Zt(e,t,r);if("Literal"===r.termType)return er(e,t,r);if("BlankNode"===r.termType){if(Ye(e),!Se(t))throw new Rt(t);const o=g(t),s=null!==(n=e.predicates[o])&&void 0!==n?n:{},a=null!==(i=s.blankNodes)&&void 0!==i?i:[],c=Y(a.concat(te(r))),l=Y({...s,blankNodes:c}),u=Y({...e.predicates,[o]:l});return Y({...e,predicates:u})}throw new Error(`Term type [${r.termType}] is not supported by @inrupt/solid-client.`)}function rr(e,t,r,n){var i,o,s;if(Ye(e),!Se(t))throw new Rt(t);const a=g(t),c=null!==(i=e.predicates[a])&&void 0!==i?i:{},l=null!==(o=c.literals)&&void 0!==o?o:{},u=null!==(s=l[n])&&void 0!==s?s:[],d=Y(u.concat(r)),h=Y({...l,[n]:d}),f=Y({...c,literals:h}),p=Y({...e.predicates,[a]:f});return Y({...e,predicates:p})}function nr(e,t){if(Ye(e),!Se(t))throw new Rt(t);const r=g(t),n={...e.predicates};return delete n[r],Y({...e,predicates:Y(n)})}const ir=(e,t,r)=>{var n,i,o;if(Ye(e),!Se(t))throw new Rt(t);const s=g(t);if(!bt(r)&&!Se(r))throw new It(r);const a=bt(r)?_t(r):g(r),c=Y(null!==(o=null===(i=null===(n=e.predicates[s])||void 0===n?void 0:n.namedNodes)||void 0===i?void 0:i.filter((e=>e.toLowerCase()!==a.toLowerCase())))&&void 0!==o?o:[]),l=Y({...e.predicates[s],namedNodes:c}),u=Y({...e.predicates,[s]:l});return Y({...e,predicates:u})},or=ir,sr=(e,t,r)=>(Ye(e),yr(e,t,re,(e=>ue(e)===r))),ar=(e,t,r)=>(Ye(e),yr(e,t,ne,(e=>{var t;return(null===(t=he(e))||void 0===t?void 0:t.getTime())===r.getTime()}))),cr=(e,t,r)=>(Ye(e),yr(e,t,ie,(function(e){const t=fe(e);return!!t&&t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getUTCDate()===r.getUTCDate()}))),lr=(e,t,r)=>(Ye(e),yr(e,t,oe,(function(e){const t=de(e);return!!t&&t.hour===r.hour&&t.minute===r.minute&&t.second===r.second&&t.millisecond===r.millisecond&&t.timezoneHourOffset===r.timezoneHourOffset&&t.timezoneMinuteOffset===r.timezoneMinuteOffset}))),ur=(e,t,r)=>(Ye(e),yr(e,t,se,(e=>ye(e)===r))),dr=(e,t,r)=>(Ye(e),yr(e,t,ae,(e=>me(e)===r)));function hr(e,t,r,n){var i,o;if(Ye(e),!Se(t))throw new Rt(t);const s=g(t),a=null!==(o=null===(i=e.predicates[s])||void 0===i?void 0:i.langStrings)&&void 0!==o?o:{},c=Object.keys(a).find((e=>ve(e)===ve(n)&&Array.isArray(a[e])&&a[e].length>0));if("string"!=typeof c)return e;const l=a[c],u=Y(l.filter((e=>e!==r))),d=Y({...a,[c]:u}),h=Y({...e.predicates[s],langStrings:d}),f=Y({...e.predicates,[s]:h});return Y({...e,predicates:f})}const fr=(e,t,r)=>(Ye(e),yr(e,t,ce,(e=>e===r)));function pr(e,t,r){return ir(e,t,r.value)}function gr(e,t,r){var n,i,o;if(Ye(e),!Se(t))throw new Rt(t);const s=r.datatype.value;if(s===le)return hr(e,t,r.value,r.language);const a=g(t),c=null!==(n=e.predicates[a])&&void 0!==n?n:{},l=null!==(i=c.literals)&&void 0!==i?i:{},u=null!==(o=l[s])&&void 0!==o?o:[],d=Y(u.filter((e=>e!==r.value))),h=Y({...l,[s]:d}),f=Y({...c,literals:h}),p=Y({...e.predicates,[a]:f});return Y({...e,predicates:p})}function yr(e,t,r,n){var i,o,s;if(!Se(t))throw new Rt(t);const a=g(t),c=null!==(i=e.predicates[a])&&void 0!==i?i:{},l=null!==(o=c.literals)&&void 0!==o?o:{},u=null!==(s=l[r])&&void 0!==s?s:[],d=Y(u.filter((e=>!n(e)))),h=Y({...l,[r]:d}),f=Y({...c,literals:h}),p=Y({...e.predicates,[a]:f});return Y({...e,predicates:p})}const mr=(e,t,r)=>{if(Ye(e),!Se(t))throw new Rt(t);if(!bt(r)&&!Se(r))throw new It(r);return $t(nr(e,t),t,r)},vr=mr,br=(e,t,r)=>(Ye(e),Kt(nr(e,t),t,r)),wr=(e,t,r)=>(Ye(e),Jt(nr(e,t),t,r)),_r=(e,t,r)=>(Ye(e),Gt(nr(e,t),t,r)),Sr=(e,t,r)=>(Ye(e),qt(nr(e,t),t,r)),Er=(e,t,r)=>(Ye(e),zt(nr(e,t),t,r)),Ar=(e,t,r)=>(Ye(e),Yt(nr(e,t),t,r));function Rr(e,t,r,n){return Ye(e),Qt(nr(e,t),t,r,n)}const Ir=(e,t,r)=>(Ye(e),Xt(nr(e,t),t,r));function Tr(e,t,r){return Ye(e),Zt(nr(e,t),t,r)}function xr(e,t,r){return Ye(e),er(nr(e,t),t,r)}function Pr(e,t,r){if(Ye(e),!Se(t))throw new Rt(t);return tr(nr(e,t),t,r)}function Cr(e=vt()){let t=bt(e)?e:vt(e);function r(e){return(r,n)=>(t=e(t,r,n),o)}function n(e){return(r,n)=>(t=e(t,r,n),o)}function i(e){return(r,n)=>(t=e(t,r,n),o)}const o={build:()=>t,addUrl:r($t),addIri:r(Vt),addBoolean:r(Kt),addDatetime:r(Jt),addDate:r(Gt),addTime:r(qt),addDecimal:r(zt),addInteger:r(Yt),addStringNoLocale:r(Xt),addStringEnglish:(e,r)=>(t=Qt(t,e,r,"en"),o),addStringWithLocale:(e,r,n)=>(t=Qt(t,e,r,n),o),addNamedNode:r(Zt),addLiteral:r(er),addTerm:r(tr),setUrl:n(mr),setIri:n(vr),setBoolean:n(br),setDatetime:n(wr),setDate:n(_r),setTime:n(Sr),setDecimal:n(Er),setInteger:n(Ar),setStringNoLocale:n(Ir),setStringEnglish:(e,r)=>(t=Rr(t,e,r,"en"),o),setStringWithLocale:(e,r,n)=>(t=Rr(t,e,r,n),o),setNamedNode:n(Tr),setLiteral:n(xr),setTerm:n(Pr),removeAll:e=>(t=nr(t,e),o),removeUrl:i(ir),removeIri:i(or),removeBoolean:i(sr),removeDatetime:i(ar),removeDate:i(cr),removeTime:i(lr),removeDecimal:i(ur),removeInteger:i(dr),removeStringNoLocale:i(fr),removeStringEnglish:(e,r)=>Cr(hr(t,e,r,"en")),removeStringWithLocale:(e,r,n)=>Cr(hr(t,e,r,n)),removeNamedNode:i(pr),removeLiteral:i(gr)};return o}function kr(e){const t=J(e).type;return Array.isArray(t)&&t.includes(N.AccessControlResource)}async function Or(e,t=j){if(!sn(e))return{resourceAcl:null,fallbackAcl:null};try{const r=await Fr(e,t);return null===r?{resourceAcl:null,fallbackAcl:await Nr(e,t)}:{resourceAcl:r,fallbackAcl:null}}catch(e){if(e instanceof Qr)return{resourceAcl:null,fallbackAcl:null};throw e}}async function Fr(e,t=j){if(!sn(e))return null;try{const r=await Ot(e.internal_resourceInfo.aclUrl,t);if(kr(r))throw new Qr(e,r);return Y({...r,internal_accessTo:$(e)})}catch(e){if(e instanceof Qr)throw e;return null}}async function Nr(e,t=j){const r=new URL($(e)),n=r.pathname;if("/"===n)return null;const i=Dr(n),o=new URL(i,r.origin).href,s=await M(o,t);if(!sn(s))return null;const a=await Fr(s,t);return null===a?Nr(s,t):a}function Dr(e){const t="/"===e.substring(e.length-1)?e.substring(0,e.length-1):e;return`${e.substring(0,t.lastIndexOf("/"))}/`}function Lr(e){return gt(e).filter(Ur)}function Ur(e){return rt(e,P).includes(w)}function jr(e,t){return e.filter((e=>function(e,t){return rt(e,_).includes(t)}(e,t)))}function Mr(e,t){return e.filter((e=>function(e,t){return rt(e,R).includes(t)||rt(e,I).includes(t)}(e,t)))}function Br(e){const t=rt(e,T);return t.includes($r.write)?{read:t.includes($r.read),append:!0,write:!0,control:t.includes($r.control)}:{read:t.includes($r.read),append:t.includes($r.append),write:!1,control:t.includes($r.control)}}function Hr(e){return e.reduce(((e,t)=>e.write||t.write?{read:e.read||t.read,append:!0,write:!0,control:e.control||t.control}:{read:e.read||t.read,append:e.append||t.append,write:!1,control:e.control||t.control}),{read:!1,append:!1,write:!1,control:!1})}function Wr(e){return!Ne(e.predicates,Re.namedNode(e.url),Re.defaultGraph()).some((e=>!function(e){const{predicate:t}=e,{object:r}=e;return!(!t.equals(Re.namedNode(P))||!r.equals(Re.namedNode(w)))||(!!(t.equals(Re.namedNode(_))||t.equals(Re.namedNode(R))||t.equals(Re.namedNode(I)))||(!(!t.equals(Re.namedNode(T))||!Object.values($r).some((e=>r.equals(Re.namedNode(e)))))||(!!(t.equals(Re.namedNode(S))||t.equals(Re.namedNode(E))||t.equals(Re.namedNode(A)))||!!t.equals(Re.namedNode(x)))))}(e)))&&(null===et(e,_)&&null===et(e,R)&&null===et(e,I)||null===et(e,T)||null===et(e,S)&&null===et(e,E)&&null===et(e,A))}const $r={read:"http://www.w3.org/ns/auth/acl#Read",append:"http://www.w3.org/ns/auth/acl#Append",write:"http://www.w3.org/ns/auth/acl#Write",control:"http://www.w3.org/ns/auth/acl#Control"};function Vr(e,t,r){return e.filter((e=>rt(e,r).includes(t)))}function Kr(e,t){const r={};return e.forEach((e=>{const n=rt(e,t),i=Br(e);n.forEach((e=>{r[e]=void 0===r[e]?i:Hr([r[e],i])}))})),r}function Jr(e){let t=vt();return t=vr(t,P,w),e.read&&(t=Vt(t,T,$r.read)),e.append&&!e.write&&(t=Vt(t,T,$r.append)),e.write&&(t=Vt(t,T,$r.write)),e.control&&(t=Vt(t,T,$r.control)),t}function Gr(e,t){return Object.assign(v(e),{internal_acl:t})}const qr=[S,A,E,x];function zr(e,t,r,n,i){let o=e;gt(e).forEach((t=>{const[s,a]=function(e,t,r,n,i){if(!rt(e,r).includes(t))return[e,Jr({read:!1,append:!1,write:!1,control:!1})];const o=or(e,r,t);let s=function(e){let t=vt();function r(e,t,r){return rt(e,r).reduce(((e,t)=>Vt(e,r,t)),t)}return t=vr(t,P,w),t=r(e,t,_),t=r(e,t,R),t=r(e,t,I),t=r(e,t,S),t=r(e,t,E),t=r(e,t,A),t=r(e,t,x),t=r(e,t,T),t}(e);return s=or(s,"resource"===i?_:R,n),"default"===i&&(s=or(s,I,n)),s=vr(s,r,t),qr.filter((e=>e!==r)).forEach((e=>{s=nr(s,e)})),[o,s]}(t,i,r,e.internal_accessTo,n);o=yt(o,s),o=yt(o,a)}));let s=Jr(t);return s=vr(s,"resource"===n?_:R,e.internal_accessTo),s=vr(s,r,i),function(e){return Lr(e).filter(Wr).reduce(mt,e)}(yt(o,s))}function Yr(e,t){return Gr(e,{resourceAcl:t,fallbackAcl:null})}class Qr extends Error{constructor(e,t){super(`[${V(e)}] is governed by Access Control Policies in [${V(t)}] rather than by Web Access Control.`)}}function Xr(e){return null!==e.internal_acl.resourceAcl&&$(e)===e.internal_acl.resourceAcl.internal_accessTo&&e.internal_resourceInfo.aclUrl===$(e.internal_acl.resourceAcl)}function Zr(e){return Xr(e)?e.internal_acl.resourceAcl:null}function en(e){return null!==e.internal_acl.fallbackAcl}function tn(e){return en(e)?e.internal_acl.fallbackAcl:null}function rn(e){return Y({...Ct(),internal_accessTo:$(e),internal_resourceInfo:{sourceIri:e.internal_resourceInfo.aclUrl,isRawData:!1,linkedResources:{}}})}function nn(e){const t=rn(e);return Mr(Lr(e.internal_acl.fallbackAcl),e.internal_acl.fallbackAcl.internal_accessTo).map((t=>(t=nr(t,R),t=nr(t,I),t=vr(t,_,$(e)),vr(t,R,$(e))))).reduce(yt,t)}async function on(e,t,r=j){if(!sn(e))throw new Error(`Could not determine the location of the ACL for the Resource at [${$(e)}]; possibly the current user does not have Control access to that Resource. Try calling \`hasAccessibleAcl()\` before calling \`saveAclFor()\`.`);return{...await Ft(e.internal_resourceInfo.aclUrl,t,r),internal_accessTo:$(e)}}function sn(e){return"string"==typeof e.internal_resourceInfo.aclUrl}function an(e,t){return Xr(e)?ln(e.internal_acl.resourceAcl,t):en(e)?hn(e.internal_acl.fallbackAcl,t):null}function cn(e){return Xr(e)?un(Zr(e)):en(e)?fn(tn(e)):null}function ln(e,t){return Hr(pn(jr(Lr(e),e.internal_accessTo),t).map(Br))}function un(e){return mn(gn(jr(Lr(e),e.internal_accessTo)))}function dn(e,t,r){return zr(e,r,S,"resource",t)}function hn(e,t){return Hr(pn(Mr(Lr(e),e.internal_accessTo),t).map(Br))}function fn(e){return mn(gn(Mr(Lr(e),e.internal_accessTo)))}function pn(e,t){return Vr(e,t,S)}function gn(e){return e.filter(yn)}function yn(e){return null!==et(e,S)}function mn(e){return Kr(e,S)}function vn(e,t){return Xr(e)?wn(e.internal_acl.resourceAcl,t):en(e)?Sn(e.internal_acl.fallbackAcl,t):null}function bn(e){return Xr(e)?_n(Zr(e)):en(e)?En(tn(e)):null}function wn(e,t){return Hr(An(jr(Lr(e),e.internal_accessTo),t).map(Br))}function _n(e){return Rn(jr(Lr(e),e.internal_accessTo))}function Sn(e,t){return Hr(An(Mr(Lr(e),e.internal_accessTo),t).map(Br))}function En(e){return Rn(Mr(Lr(e),e.internal_accessTo))}function An(e,t){return Vr(e,t,E)}function Rn(e){return Kr(e,E)}function In(e,t,r){return zr(e,r,E,"resource",t)}function Tn(e){return Xr(e)?xn(e.internal_acl.resourceAcl):en(e)?Pn(e.internal_acl.fallbackAcl):null}function xn(e){return Hr(kn(jr(Lr(e),e.internal_accessTo),F).map(Br))}function Pn(e){return Hr(kn(Mr(Lr(e),e.internal_accessTo),F).map(Br))}function Cn(e,t){return zr(e,t,A,"resource",F)}function kn(e,t){return e.filter((e=>function(e,t){return rt(e,A).includes(t)}(e,t)))}function On(e,t){const r=pt(e,t);if(null===r)throw new Error(`Profile document [${$(e)}] does not include WebID [${t}]`);return r}function Fn(e,t){return Ze(On(e,t),L)}async function Nn(e,t,r=j){const n={...j,...r},i=await n.fetch(t);if(!i.ok)throw new Error(`Fetching [${t}] returned an error: ${i.status} ${i.statusText}`);try{const r=await i.json();if(!(e=>void 0!==e.keys)(r))throw new Error(`[${t}] does not dereference to a valid JWKS: ${JSON.stringify(r)}`);return{keys:[...r.keys,e]}}catch(e){throw new Error(`Parsing the document at [${t}] failed: ${e}`)}}function Dn(e,t){const r=pt(t,e),n=gt(t).filter((e=>rt(e,"http://xmlns.com/foaf/0.1/primaryTopic").length>0)).map(_t).concat(r?rt(r,"http://www.w3.org/2000/01/rdf-schema#seeAlso"):[]).concat(r?rt(r,"http://xmlns.com/foaf/0.1/isPrimaryTopicOf"):[]).filter((e=>e!==V(t)));return Array.from(new Set(n))}async function Ln(e,t=j){var r,n;const i=null!==(r=t.fetch)&&void 0!==r?r:y,o=null!==(n=t.webIdProfile)&&void 0!==n?n:await Ot(e,{fetch:y});return{webIdProfile:o,altProfileAll:(await Promise.allSettled(Dn(e,o).map((e=>Ot(e,{fetch:i}))))).filter((e=>"fulfilled"===e.status)).map((e=>e.value))}}function Un(e,t){const r=new Set;return[e.webIdProfile,...e.altProfileAll].forEach((e=>{const n=pt(e,t);null!==n&&rt(n,U).forEach((e=>r.add(e)))})),Array.from(r)}function jn(e){if(!Hi(e))throw new Error(`An Access Control Resource for [${$(e)}] is not available. This could be because the current user is not allowed to see it, or because their Pod Server does not support Access Control Resources.`);return e.internal_acp.acr}function Mn(e,t){return Object.assign(v(e),{internal_acp:{...e.internal_acp,acr:t}})}function Bn(e){let t=vt(e);return t=vr(t,P,N.AccessControl),t}function Hn(e,t){const r=gt(jn(e),t),n=r.filter((e=>rt(e,P).includes(N.AccessControl))),i=r.filter((e=>rt(e,N.accessControl).length>0)).map((e=>vt({url:rt(e,N.accessControl)[0]})));return n.concat(i)}function Wn(e,t){return Mn(e,yt(jn(e),t))}function $n(e,t){return Vt(e,N.apply,t)}function Vn(e){return rt(e,N.apply)}function Kn(e,t){return or(e,N.apply,t)}function Jn(e){return nr(e,N.apply)}function Gn(e,t){return Vt(e,N.applyMembers,t)}function qn(e){return rt(e,N.applyMembers)}function zn(e){return nr(e,N.applyMembers)}function Yn(e){const t=Hn(e);return 0===t.length?Bn():t[0]}function Qn(e){return h(e)&&Array.isArray(e.internal_resourceInfo.linkedResources[N.accessControl])&&1===e.internal_resourceInfo.linkedResources[N.accessControl].length}function Xn(e,t){var r;const n=jn(e),i=$(n);let o=null!==(r=pt(n,i))&&void 0!==r?r:vt({url:i});return o=Vt(o,N.access,t),Mn(e,yt(n,o))}function Zn(e,t){var r;const n=jn(e),i=$(n);let o=null!==(r=pt(n,i))&&void 0!==r?r:vt({url:i});return o=Vt(o,N.accessMembers,t),Mn(e,yt(n,o))}function ei(e){const t=jn(e),r=pt(t,$(t));return null===r?[]:rt(r,N.access)}function ti(e){const t=jn(e),r=pt(t,$(t));return null===r?[]:rt(r,N.accessMembers)}function ri(e,t){const r=jn(e),n=pt(r,$(r));return null===n?e:Mn(e,yt(r,or(n,N.access,t)))}function ni(e,t){const r=jn(e),n=pt(r,$(r));return null===n?e:Mn(e,yt(r,or(n,N.accessMembers,t)))}function ii(e){const t=jn(e),r=pt(t,$(t));return null===r?e:Mn(e,yt(t,nr(r,N.access)))}function oi(e){const t=jn(e),r=pt(t,$(t));return null===r?e:Mn(e,yt(t,nr(r,N.accessMembers)))}function si(e,t){return Wn(e,$n(Yn(e),t))}function ai(e,t){return Wn(e,Gn(Yn(e),t))}function ci(e){const t=Hn(e).map((e=>Vn(e))),r=new Set;return t.forEach((e=>{e.forEach((e=>r.add(e)))})),Array.from(r)}function li(e){const t=Hn(e).map((e=>qn(e))),r=new Set;return t.forEach((e=>{e.forEach((e=>r.add(e)))})),Array.from(r)}function ui(e,t){return Hn(e).map((e=>Kn(e,t))).reduce(Wn,e)}function di(e,t){const r=Hn(e).map((e=>function(e,t){return or(e,N.applyMembers,t)}(e,t)));return r.reduce(Wn,e)}function hi(e){return Hn(e).map((e=>Jn(e))).reduce(Wn,e)}function fi(e){return Hn(e).map((e=>zn(e))).reduce(Wn,e)}function pi(e){let t=`# Access controls for ${$(e)}\n`;const r=ci(e),n=li(e),i=ei(e),o=ti(e);return 0===r.length&&0===n.length&&0===i.length&&0===o.length&&(t+="\n\n"),r.length>0&&(t+="\nThe following policies apply to this resource:\n- ",t+=`${r.join("\n- ")}\n`),i.length>0&&(t+="\nThe following policies apply to the access control resource for this resource:\n- ",t+=`${i.join("\n- ")}\n`),n.length>0&&(t+="\nThe following policies apply to the children of this resource:\n- ",t+=`${n.join("\n- ")}\n`),o.length>0&&(t+="\nThe following policies apply to the access control resources for children of this resource:\n- ",t+=`${o.join("\n- ")}\n`),t}const gi="http://www.w3.org/ns/solid/acp#",yi={AccessControl:gi.concat("AccessControl"),AccessControlResource:gi.concat("AccessControlResource"),AuthenticatedAgent:gi.concat("AuthenticatedAgent"),CreatorAgent:gi.concat("CreatorAgent"),Matcher:gi.concat("Matcher"),Policy:gi.concat("Policy"),PublicAgent:gi.concat("PublicAgent"),access:gi.concat("access"),accessControl:gi.concat("accessControl"),agent:gi.concat("agent"),allOf:gi.concat("allOf"),allow:gi.concat("allow"),anyOf:gi.concat("anyOf"),apply:gi.concat("apply"),client:gi.concat("client"),deny:gi.concat("deny"),memberAccessControl:gi.concat("memberAccessControl"),noneOf:gi.concat("noneOf"),vc:gi.concat("vc")},mi="http://www.w3.org/ns/auth/acl#",vi={Append:mi.concat("Append"),Control:mi.concat("Control"),Read:mi.concat("Read"),Write:mi.concat("Write")};function bi(e){const t=jn(e);return pt(t,$(t))}const wi="defaultAccessControl",_i="defaultAcrAccessControl",Si="defaultMemberAccessControl",Ei="defaultMemberAcrAccessControl";function Ai(e,t){return $(jn(e)).concat("#").concat(t)}function Ri(e,t){const r=jn(e),n=Ai(e,t),i=pt(r,n);return null==i?vt({url:n}):i}function Ii(e,t){const r=rt(e,t);return{read:r.includes(vi.Read),append:r.includes(vi.Append),write:r.includes(vi.Write),controlRead:!1,controlWrite:!1}}function Ti(e,t,r){let n=nr(e,r);return(t.read||t.controlRead)&&(n=Vt(n,r,vi.Read)),t.append&&(n=Vt(n,r,vi.Append)),(t.write||t.controlWrite)&&(n=Vt(n,r,vi.Write)),n}const xi="defaultVcPolicy",Pi="defaultVcMatcher";function Ci(e,t,r={inherit:!1}){var n;let i=jn(e);const o=`${V(i)}#${xi}`,s=`${V(i)}#${Pi}`,{policy:a,matcher:c}=function(e,t,r,n){var i;let o=pt(e,t);null===o&&(o=Cr({url:t}).addIri(P,yi.Policy).addIri(yi.anyOf,r).build());const s=null!==(i=pt(e,r))&&void 0!==i?i:Cr({url:r}).addIri(P,yi.Matcher).addIri(yi.vc,"http://www.w3.org/ns/solid/vc#SolidAccessGrant").build();return o=Ti(o,{...Ii(o,yi.allow),...n},yi.allow),{matcher:s,policy:o}}(i,o,s,t);let l=Ri(e,"defaultAccessControl");rt(l,yi.apply).includes(_t(a))||(l=Vt(l,yi.apply,a));let u=Ri(e,"defaultMemberAccessControl"),d=null!==(n=bi(e))&&void 0!==n?n:vt({url:V(i)});return rt(d,yi.accessControl).includes(_t(l))||(d=Vt(d,yi.accessControl,l)),i=[d,l,a,c].reduce(yt,i),r.inherit&&(rt(u,yi.apply).includes(_t(a))||(u=Vt(u,yi.apply,a)),rt(d,yi.memberAccessControl).includes(_t(u))||(d=Vt(d,yi.memberAccessControl,u)),i=[d,u].reduce(yt,i)),function(e,t){return Object.assign(v(e),{internal_acp:{acr:t}})}(e,i)}const ki={read:!1,append:!1,write:!1,controlRead:!1,controlWrite:!1},Oi=(e,t,r)=>rt(e,t).includes(_t(r));function Fi(e){const t=jn(e),r=Ri(e,"defaultAccessControl"),n=bi(e);if(null===n||!Oi(n,yi.accessControl,r))return ki;const i=pt(t,`${V(t)}#${xi}`);if(null===i||!Oi(r,yi.apply,i))return ki;const o=pt(t,`${V(t)}#${Pi}`);return null!==o&&Oi(i,yi.anyOf,o)?Ii(i,yi.allow):ki}async function Ni(e,t=j){const r=g(e),n={...j,...t},i=await Ot(r,n),o=await Wi(i,n);return{...i,...o}}async function Di(e,t=j){const r=g(e),n={...j,...t},i=await Ke(r,n),o=await Wi(i,n);return Object.assign(i,o)}async function Li(e,t=j){const r=g(e),n={...j,...t},i=await M(r,n),o=await Wi(i,n);return{...i,...o}}async function Ui(e,t=j){const r=g(e),n={...j,...t},i=await Ot(r,n);if(sn(i))return Gr(i,await Or(i,n));const o=await Wi(i,n);return{...i,...o}}async function ji(e,t=j){const r=g(e),n={...j,...t},i=await Ke(r,n);if(sn(i))return Gr(i,await Or(i,n));const o=await Wi(i,n);return Object.assign(i,o)}async function Mi(e,t=j){const r=g(e),n={...j,...t},i=await M(r,n);if(sn(i))return Gr(i,await Or(i,n));const o=await Wi(i,n);return{...i,...o}}async function Bi(e,t=j){const r=jn(e),n={...j,...t};return Mn(e,await Ft($(r),r,n))}function Hi(e){return"object"==typeof e.internal_acp&&null!==e.internal_acp&&"object"==typeof e.internal_acp.acr&&null!==e.internal_acp.acr}async function Wi(e,t){let r,n;if(Qn(e)){const{linkedResources:t}=e.internal_resourceInfo;[r]=t[N.accessControl]}else if(sn(e)){let n;try{n=await M(e.internal_resourceInfo.aclUrl,t)}catch(e){}n&&kr(n)&&(r=$(n))}if("string"!=typeof r)return{internal_acp:{acr:null}};try{n=await Ot(r,t)}catch(e){return{internal_acp:{acr:null}}}return{internal_acp:{acr:{...n,accessTo:$(e)}}}}function $i(e){const t=ci(e).map(Pt).concat(li(e).map(Pt)).concat(ei(e).map(Pt)).concat(ti(e).map(Pt));return Array.from(new Set(t))}async function Vi(e,t=j){const r=g(e),n={...j,...t},i=await M(r,n);return Hi(await Wi(i,n))}function Ki(e){if(h(e))return[N.accessControl,"acl"].map((t=>{if(Array.isArray(e.internal_resourceInfo.linkedResources[t])&&1===e.internal_resourceInfo.linkedResources[t].length)return e.internal_resourceInfo.linkedResources[t][0]})).find((e=>void 0!==e))}function Ji(e){return rt(e,P).includes(N.Rule)}function Gi(e,t){return Vt(e,N.allOf,t)}function qi(e,t){return or(e,N.allOf,t)}function zi(e,t){return vr(e,N.allOf,t)}function Yi(e){return rt(e,N.allOf)}function Qi(e,t){return Vt(e,N.anyOf,t)}function Xi(e,t){return or(e,N.anyOf,t)}function Zi(e,t){return vr(e,N.anyOf,t)}function eo(e){return rt(e,N.anyOf)}function to(e,t){return Vt(e,N.noneOf,t)}function ro(e,t){return or(e,N.noneOf,t)}function no(e,t){return vr(e,N.noneOf,t)}function io(e){return rt(e,N.noneOf)}function oo(e){let t=vt({url:g(e)});return t=mr(t,P,N.Rule),t}function so(e,t){const r=jn(e),n=new URL($(r));n.hash=`#${t}`;let i=vt({url:n.href});return i=mr(i,P,N.Rule),i}function ao(e,t){const r=pt(e,t);return null===r||Ze(r,P)!==N.Rule?null:r}function co(e,t){const r=jn(e),n=$(r),i=new URL(n);i.hash=`#${t}`;const o=pt(r,i.href);return null!==o&&Ji(o)?o:null}function lo(e){return gt(e).filter(Ji)}function uo(e){return gt(jn(e)).filter(Ji)}function ho(e,t){return mt(e,t)}function fo(e,t){const r=jn(e);let n;if("string"==typeof t)if(Se(t))n=t;else{const e=new URL($(r));e.hash=`#${t}`,n=e.href}else n=be(t)?g(t):wt(t);const i=co(e,new URL(n).hash.substring(1));return null===i?e:Mn(e,mt(r,i))}function po(e,t){return yt(e,t)}function go(e,t){return Mn(e,yt(jn(e),t))}function yo(e){return rt(e,N.agent).filter((e=>e!==N.PublicAgent&&e!==N.AuthenticatedAgent&&e!==N.CreatorAgent))}function mo(e,t){const r=Ao(e),n=To(e),i=Co(e);let o=vr(e,N.agent,t);return r&&(o=Ro(o)),n&&(o=xo(o)),i&&(o=ko(o)),o}function vo(e,t){return Vt(e,N.agent,t)}function bo(e,t){return or(e,N.agent,t)}function wo(e){return rt(e,N.group)}function _o(e,t){return vr(e,N.group,t)}function So(e,t){return Vt(e,N.group,t)}function Eo(e,t){return or(e,N.group,t)}function Ao(e){return rt(e,N.agent).filter((e=>e===N.PublicAgent)).length>0}function Ro(e){if("object"==typeof arguments&&"boolean"==typeof arguments[1])throw new Error("The function `setPublic` no longer takes a second parameter. It is now used together with `removePublic` instead.");return Vt(e,N.agent,N.PublicAgent)}function Io(e){return or(e,N.agent,N.PublicAgent)}function To(e){return rt(e,N.agent).filter((e=>e===N.AuthenticatedAgent)).length>0}function xo(e){if("object"==typeof arguments&&"boolean"==typeof arguments[1])throw new Error("The function `setAuthenticated` no longer takes a second parameter. It is now used together with `removeAuthenticated` instead.");return Vt(e,N.agent,N.AuthenticatedAgent)}function Po(e){return or(e,N.agent,N.AuthenticatedAgent)}function Co(e){return rt(e,N.agent).filter((e=>e===N.CreatorAgent)).length>0}function ko(e){if("object"==typeof arguments&&"boolean"==typeof arguments[1])throw new Error("The function `setCreator` no longer takes a second parameter. It is now used together with `removeCreator` instead.");return Vt(e,N.agent,N.CreatorAgent)}function Oo(e){return or(e,N.agent,N.CreatorAgent)}function Fo(e){return rt(e,N.client).filter((e=>e!==D))}function No(e,t){const r=Uo(e);let n=vr(e,N.client,t);return r&&(n=jo(n)),n}function Do(e,t){return Vt(e,N.client,t)}function Lo(e,t){return or(e,N.client,t)}function Uo(e){return rt(e,N.client).filter((e=>e===D)).length>0}function jo(e){return Vt(e,N.client,D)}function Mo(e){return or(e,N.client,D)}function Bo(e){let t=`## Rule: ${wt(e)}\n\n`,r="";Ao(e)&&(r+="- Everyone\n"),To(e)&&(r+="- All authenticated agents\n"),Co(e)&&(r+="- The creator of this resource\n"),Uo(e)&&(r+="- Users of any client application\n");const n=yo(e);n.length>0&&(r+="- The following agents:\n - ",r+=`${n.join("\n - ")}\n`);const i=wo(e);i.length>0&&(r+="- Members of the following groups:\n - ",r+=`${i.join("\n - ")}\n`);const o=Fo(e);return o.length>0&&(r+="- Users of the following client applications:\n - ",r+=`${o.join("\n - ")}\n`),t+=r.length>0?`This rule applies to:\n${r}`:"\n",t}function Ho(e){return rt(e,P).includes(N.Policy)}function Wo(e){let t=vt({url:g(e)});return t=mr(t,P,N.Policy),t}function $o(e,t){const r=pt(e,t);return null!==r&&Ho(r)?r:null}function Vo(e){return gt(e).filter((e=>!Et(e)&&Ho(e)))}function Ko(e,t){return mt(e,t)}function Jo(e,t){return yt(e,t)}function Go(e,t){let r=nr(e,N.allow);return!0===t.read&&(r=Vt(r,N.allow,$r.read)),!0===t.append&&(r=Vt(r,N.allow,$r.append)),!0===t.write&&(r=Vt(r,N.allow,$r.write)),r}function qo(e,t){let r=nr(e,N.allow);return!0===t.read&&(r=Vt(r,N.allow,N.Read)),!0===t.append&&(r=Vt(r,N.allow,N.Append)),!0===t.write&&(r=Vt(r,N.allow,N.Write)),r}function zo(e){const t=rt(e,N.allow);return{read:t.includes($r.read),append:t.includes($r.append),write:t.includes($r.write)}}function Yo(e){const t=rt(e,N.allow);return{read:t.includes(N.Read),append:t.includes(N.Append),write:t.includes(N.Write)}}function Qo(e,t){let r=nr(e,N.deny);return!0===t.read&&(r=Vt(r,N.deny,$r.read)),!0===t.append&&(r=Vt(r,N.deny,$r.append)),!0===t.write&&(r=Vt(r,N.deny,$r.write)),r}function Xo(e,t){let r=nr(e,N.deny);return!0===t.read&&(r=Vt(r,N.deny,N.Read)),!0===t.append&&(r=Vt(r,N.deny,N.Append)),!0===t.write&&(r=Vt(r,N.deny,N.Write)),r}function Zo(e){const t=rt(e,N.deny);return{read:t.includes($r.read),append:t.includes($r.append),write:t.includes($r.write)}}function es(e){const t=rt(e,N.deny);return{read:t.includes(N.Read),append:t.includes(N.Append),write:t.includes(N.Write)}}function ts(e,t){const r=jn(e),n=new URL($(r));n.hash=`#${t}`;let i=vt({url:n.href});return i=mr(i,P,N.Policy),i}function rs(e,t){const r=jn(e),n=$(r),i=new URL(n);i.hash=`#${t}`;const o=pt(r,i.href);return ci(e).includes(i.href)&&null!==o&&Ho(o)?o:null}function ns(e,t){const r=jn(e),n=$(r),i=new URL(n);i.hash=`#${t}`;const o=pt(r,i.href);return ei(e).includes(i.href)&&null!==o&&Ho(o)?o:null}function is(e){const t=jn(e);return ci(e).map((e=>pt(t,e))).filter((e=>null!==e&&Ho(e)))}function os(e){const t=jn(e);return ei(e).map((e=>pt(t,e))).filter((e=>null!==e&&Ho(e)))}function ss(e,t){const r=jn(e);let n,i=t;if("string"==typeof i&&!1===Se(i)){const e=new URL($(r));e.hash=`#${t}`,i=e.href}return n="string"==typeof i?i:be(i)?g(i):wt(i,$(r)),null===rs(e,new URL(n).hash.substring(1))?e:ui(Mn(e,mt(r,i)),n)}function as(e,t){const r=jn(e);let n,i=t;if("string"==typeof i&&!1===Se(i)){const e=new URL($(r));e.hash=`#${t}`,i=e.href}return n="string"==typeof i?i:be(i)?g(i):wt(i,$(r)),null===ns(e,new URL(n).hash.substring(1))?e:ri(Mn(e,mt(r,i)),n)}function cs(e,t){const r=jn(e);return si(Mn(e,yt(r,t)),wt(t,$(r)))}function ls(e,t){const r=jn(e);return Xn(Mn(e,yt(r,t)),wt(t,$(r)))}function us(e){function t(e,t){return t?"denied":e?"allowed":"unspecified"}const r=Yo(e),n=es(e);let i=`## Policy: ${wt(e)}\n\n`;i+=`- Read: ${t(r.read,n.read)}\n`,i+=`- Append: ${t(r.append,n.append)}\n`,i+=`- Write: ${t(r.write,n.write)}\n`;const o=Yi(e),s=eo(e),a=io(e);return 0===o.length&&0===s.length&&0===a.length&&(i+="\n\n"),o.length>0&&(i+="\nAll of these rules should match:\n",i+=`- ${o.join("\n- ")}\n`),s.length>0&&(i+="\nAt least one of these rules should match:\n",i+=`- ${s.join("\n- ")}\n`),a.length>0&&(i+="\nNone of these rules should match:\n",i+=`- ${a.join("\n- ")}\n`),i}function ds(e){return{...Ht(new URL("access-control-resource",e).href),accessTo:e}}function hs(e,t=ds($(e))){return Object.assign(v(e),{internal_acp:{acr:t,aprs:{}}})}function fs(e,t){return t?Ro(e):Io(e)}function ps(e,t){return t?xo(e):Po(e)}function gs(e,t){return t?ko(e):Oo(e)}const ys={getFileWithAccessDatasets:ji,getFileWithAcr:Di,getReferencedPolicyUrlAll:$i,getResourceInfoWithAccessDatasets:Mi,getResourceInfoWithAcr:Li,getSolidDatasetWithAccessDatasets:Ui,getSolidDatasetWithAcr:Ni,hasAccessibleAcr:Hi,saveAcrFor:Bi,acrAsMarkdown:pi,addAcrPolicyUrl:Xn,addMemberAcrPolicyUrl:Zn,addMemberPolicyUrl:ai,addPolicyUrl:si,getAcrPolicyUrlAll:ei,getMemberAcrPolicyUrlAll:ti,getMemberPolicyUrlAll:li,getPolicyUrlAll:ci,hasLinkedAcr:Qn,removeAcrPolicyUrl:ri,removeAcrPolicyUrlAll:ii,removeMemberAcrPolicyUrl:ni,removeMemberAcrPolicyUrlAll:oi,removeMemberPolicyUrl:di,removeMemberPolicyUrlAll:fi,removePolicyUrl:ui,removePolicyUrlAll:hi,createPolicy:Wo,getAllowModes:Yo,getDenyModes:es,getPolicy:$o,getPolicyAll:Vo,policyAsMarkdown:us,removePolicy:Ko,setAllowModes:qo,setDenyModes:Xo,setPolicy:Jo,addAgent:vo,addForbiddenRuleUrl:to,addGroup:So,addOptionalRuleUrl:Qi,addRequiredRuleUrl:Gi,createRule:oo,getAgentAll:yo,getForbiddenRuleUrlAll:io,getGroupAll:wo,getOptionalRuleUrlAll:eo,getRequiredRuleUrlAll:Yi,getRule:ao,getRuleAll:lo,hasAuthenticated:To,hasCreator:Co,hasPublic:Ao,removeAgent:bo,removeForbiddenRuleUrl:ro,removeGroup:Eo,removeOptionalRuleUrl:Xi,removeRequiredRuleUrl:qi,removeRule:ho,ruleAsMarkdown:Bo,setAgent:mo,setForbiddenRuleUrl:no,setGroup:_o,setOptionalRuleUrl:Zi,setRequiredRuleUrl:zi,setRule:po,addMockAcrTo:hs,mockAcrFor:ds,getForbiddenRuleurlAll:io,setPublic:fs,setAuthenticated:ps,setCreator:gs},ms={getFileWithAccessDatasets:ji,getFileWithAcr:Di,getReferencedPolicyUrlAll:$i,getResourceInfoWithAccessDatasets:Mi,getResourceInfoWithAcr:Li,getSolidDatasetWithAccessDatasets:Ui,getSolidDatasetWithAcr:Ni,hasAccessibleAcr:Hi,saveAcrFor:Bi,createPolicy:Wo,getAllowModes:Yo,getDenyModes:es,getPolicy:$o,getPolicyAll:Vo,policyAsMarkdown:us,removePolicy:Ko,setAllowModes:qo,setDenyModes:Xo,setPolicy:Jo,addAgent:vo,addForbiddenRuleUrl:to,addGroup:So,addOptionalRuleUrl:Qi,addRequiredRuleUrl:Gi,createRule:oo,getAgentAll:yo,getForbiddenRuleUrlAll:io,getGroupAll:wo,getOptionalRuleUrlAll:eo,getRequiredRuleUrlAll:Yi,getRule:ao,getRuleAll:lo,hasAuthenticated:To,hasCreator:Co,hasPublic:Ao,removeAgent:bo,removeForbiddenRuleUrl:ro,removeGroup:Eo,removeOptionalRuleUrl:Xi,removeRequiredRuleUrl:qi,removeRule:ho,ruleAsMarkdown:Bo,setAgent:mo,setForbiddenRuleUrl:no,setGroup:_o,setOptionalRuleUrl:Zi,setRequiredRuleUrl:zi,setRule:po,addMockAcrTo:hs,mockAcrFor:ds,hasLinkedAcr:Qn,addAcrPolicyUrl:Xn,addMemberAcrPolicyUrl:Zn,getAcrPolicyUrlAll:ei,getMemberAcrPolicyUrlAll:ti,removeAcrPolicyUrl:ri,removeAcrPolicyUrlAll:ii,removeMemberAcrPolicyUrl:ni,removeMemberAcrPolicyUrlAll:oi,createControl:Bn,getControl:function(e,t,r){const n=pt(jn(e),t,r);return null!==n&&rt(n,P).includes(N.AccessControl)?n:null},getAllControl:Hn,getControlAll:Hn,setControl:Wn,removeControl:function(e,t){return Mn(e,mt(jn(e),t))},addPolicyUrl:$n,getPolicyUrlAll:Vn,removePolicyUrl:Kn,removePolicyUrlAll:Jn,addMemberPolicyUrl:Gn,getMemberPolicyUrlAll:qn,removeMemberPolicyUrl:qn,removeMemberPolicyUrlAll:zn,getForbiddenRuleurlAll:io,setPublic:fs,setAuthenticated:ps,setCreator:gs},vs={getFileWithAccessDatasets:ji,getFileWithAcr:Di,getLinkedAcrUrl:Ki,getReferencedPolicyUrlAll:$i,getResourceInfoWithAccessDatasets:Mi,getResourceInfoWithAcr:Li,getSolidDatasetWithAccessDatasets:Ui,getSolidDatasetWithAcr:Ni,hasAccessibleAcr:Hi,saveAcrFor:Bi,isAcpControlled:Vi,acrAsMarkdown:pi,addAcrPolicyUrl:Xn,addMemberAcrPolicyUrl:Zn,addMemberPolicyUrl:ai,addPolicyUrl:si,getAcrPolicyUrlAll:ei,getMemberAcrPolicyUrlAll:ti,getMemberPolicyUrlAll:li,getPolicyUrlAll:ci,hasLinkedAcr:Qn,removeAcrPolicyUrl:ri,removeAcrPolicyUrlAll:ii,removeMemberAcrPolicyUrl:ni,removeMemberAcrPolicyUrlAll:oi,removeMemberPolicyUrl:di,removeMemberPolicyUrlAll:fi,removePolicyUrl:ui,removePolicyUrlAll:hi,createPolicy:Wo,getAllowModes:Yo,getDenyModes:es,getPolicy:$o,getPolicyAll:Vo,policyAsMarkdown:us,removePolicy:Ko,setAllowModes:qo,setDenyModes:Xo,setPolicy:Jo,createResourcePolicyFor:ts,getResourceAcrPolicy:ns,getResourceAcrPolicyAll:os,getResourcePolicy:rs,getResourcePolicyAll:is,removeResourceAcrPolicy:as,removeResourcePolicy:ss,setResourceAcrPolicy:ls,setResourcePolicy:cs,addAgent:vo,addGroup:So,createRule:oo,getAgentAll:yo,getGroupAll:wo,getRule:ao,getRuleAll:lo,removeAgent:bo,removeGroup:Eo,removeRule:ho,ruleAsMarkdown:Bo,setAgent:mo,setGroup:_o,setRule:po,addClient:Do,getClientAll:Fo,hasAnyClient:Uo,removeClient:Lo,setAnyClient:jo,setClient:No,removeAnyClient:Mo,hasAuthenticated:To,hasCreator:Co,hasPublic:Ao,setAuthenticated:xo,setCreator:ko,setPublic:Ro,removeAuthenticated:Po,removeCreator:Oo,removePublic:Io,getAnyOfRuleUrlAll:eo,addAnyOfRuleUrl:Qi,removeAnyOfRuleUrl:Xi,setAnyOfRuleUrl:Zi,getAllOfRuleUrlAll:Yi,addAllOfRuleUrl:Gi,removeAllOfRuleUrl:qi,setAllOfRuleUrl:zi,getNoneOfRuleUrlAll:io,addNoneOfRuleUrl:to,removeNoneOfRuleUrl:ro,setNoneOfRuleUrl:no,createResourceRuleFor:so,getResourceRule:co,getResourceRuleAll:uo,removeResourceRule:fo,setResourceRule:go,addMockAcrTo:hs,mockAcrFor:ds};function bs(e,t){return Object.assign(v(e),{internal_acp:{...e.internal_acp,acr:yt(e.internal_acp.acr,t)}})}function ws(e){return e.includes("Member")?yi.memberAccessControl:yi.accessControl}function _s(e,t){const r=Ai(e,t),n=jn(e);let i=bi(e);return null==i&&(i=vt({url:$(n)})),rt(i,ws(t)).includes(r)?e:(i=Cr(i).addUrl(ws(t),r).build(),bs(e,i))}function Ss(e,t){const r=_s(e,_i);return bs(r,Cr(Ri(r,_i)).addUrl(yi.access,t).build())}function Es(e,t){const r=_s(e,Ei);return bs(r,Cr(Ri(r,Ei)).addUrl(yi.access,t).build())}function As(e,t){const r=_s(e,Si);return bs(r,Cr(Ri(r,Si)).addUrl(yi.apply,t).build())}function Rs(e,t){const r=_s(e,wi);return bs(r,Cr(Ri(r,wi)).addUrl(yi.apply,t).build())}function Is(e){const t=bi(e);return null===t?[]:rt(t,yi.accessControl)}function Ts(e,t,r){const n=jn(e);return Array.from(new Set(t.map((e=>{const t=pt(n,e);return null!==t?rt(t,r):[]})).reduce(((e,t)=>e.concat(t)),[])))}function xs(e){return Ts(e,Is(e),yi.access)}function Ps(e){const t=bi(e);return null===t?[]:rt(t,yi.memberAccessControl)}function Cs(e){return Ts(e,Ps(e),yi.access)}function ks(e){return Ts(e,Ps(e),yi.apply)}function Os(e){return Ts(e,Is(e),yi.apply)}function Fs(e,t){const r=Ri(e,_i);return bs(e,or(r,yi.access,t))}function Ns(e,t){const r=Ri(e,Ei);return bs(e,or(r,yi.access,t))}function Ds(e,t){const r=Ri(e,Si);return bs(e,or(r,yi.apply,t))}function Ls(e,t){const r=Ri(e,wi);return bs(e,or(r,yi.apply,t))}function Us(e,t){return bs(e,t)}function js(e){return rt(e,P).includes(N.Matcher)}function Ms(e,t){return Vt(e,N.allOf,t)}function Bs(e,t){return or(e,N.allOf,t)}function Hs(e,t){return vr(e,N.allOf,t)}function Ws(e){return rt(e,N.allOf)}function $s(e,t){return Vt(e,N.anyOf,t)}function Vs(e,t){return or(e,N.anyOf,t)}function Ks(e,t){return vr(e,N.anyOf,t)}function Js(e){return rt(e,N.anyOf)}function Gs(e,t){return Vt(e,N.noneOf,t)}function qs(e,t){return or(e,N.noneOf,t)}function zs(e,t){return vr(e,N.noneOf,t)}function Ys(e){return rt(e,N.noneOf)}function Qs(e){let t=vt({url:g(e)});return t=mr(t,P,N.Matcher),t}function Xs(e,t){const r=jn(e),n=new URL($(r));n.hash=`#${t}`;let i=vt({url:n.href});return i=mr(i,P,N.Matcher),i}function Zs(e,t){const r=pt(e,t);return null!==r&&js(r)?r:null}function ea(e,t){const r=jn(e),n=$(r),i=new URL(n);i.hash=`#${t}`;const o=pt(r,i.href);return null!==o&&js(o)?o:null}function ta(e){return gt(e).filter(js)}function ra(e){return gt(jn(e)).filter(js)}function na(e,t){return mt(e,t)}function ia(e,t){const r=jn(e);let n;if("string"==typeof t)if(Se(t))n=t;else{const e=new URL($(r));e.hash=`#${t}`,n=e.href}else n=be(t)?g(t):wt(t);const i=ea(e,new URL(n).hash.substring(1));return null===i?e:Mn(e,mt(r,i))}function oa(e,t){return yt(e,t)}function sa(e,t){return Mn(e,yt(jn(e),t))}function aa(e){return rt(e,N.agent).filter((e=>e!==N.PublicAgent&&e!==N.AuthenticatedAgent&&e!==N.CreatorAgent))}function ca(e,t){const r=da(e),n=pa(e),i=ma(e);let o=vr(e,N.agent,t);return r&&(o=ha(o)),n&&(o=ga(o)),i&&(o=va(o)),o}function la(e,t){return Vt(e,N.agent,t)}function ua(e,t){return or(e,N.agent,t)}function da(e){return rt(e,N.agent).filter((e=>e===N.PublicAgent)).length>0}function ha(e){if("object"==typeof arguments&&"boolean"==typeof arguments[1])throw new Error("The function `setPublic` no longer takes a second parameter. It is now used together with `removePublic` instead.");return Vt(e,N.agent,N.PublicAgent)}function fa(e){return or(e,N.agent,N.PublicAgent)}function pa(e){return rt(e,N.agent).filter((e=>e===N.AuthenticatedAgent)).length>0}function ga(e){if("object"==typeof arguments&&"boolean"==typeof arguments[1])throw new Error("The function `setAuthenticated` no longer takes a second parameter. It is now used together with `removeAuthenticated` instead.");return Vt(e,N.agent,N.AuthenticatedAgent)}function ya(e){return or(e,N.agent,N.AuthenticatedAgent)}function ma(e){return rt(e,N.agent).filter((e=>e===N.CreatorAgent)).length>0}function va(e){if("object"==typeof arguments&&"boolean"==typeof arguments[1])throw new Error("The function `setCreator` no longer takes a second parameter. It is now used together with `removeCreator` instead.");return Vt(e,N.agent,N.CreatorAgent)}function ba(e){return or(e,N.agent,N.CreatorAgent)}function wa(e){return rt(e,N.client).filter((e=>e!==D)).concat(ot(e,N.client))}function _a(e,t){return Se(t)?Vt(e,N.client,t):Xt(e,N.client,t)}function Sa(e,t){return Se(t)?or(e,N.client,t):fr(e,N.client,t)}function Ea(e){return rt(e,N.client).filter((e=>e===D)).length>0}function Aa(e){return Vt(e,N.client,D)}const Ra={getFileWithAccessDatasets:ji,getFileWithAcr:Di,getReferencedPolicyUrlAll:$i,getResourceInfoWithAccessDatasets:Mi,getResourceInfoWithAcr:Li,getSolidDatasetWithAccessDatasets:Ui,getSolidDatasetWithAcr:Ni,hasAccessibleAcr:Hi,saveAcrFor:Bi,isAcpControlled:Vi,getVcAccess:Fi,setVcAccess:Ci,addAcrPolicyUrl:Ss,addMemberAcrPolicyUrl:Es,addMemberPolicyUrl:As,addPolicyUrl:Rs,getAcrPolicyUrlAll:xs,getMemberAcrPolicyUrlAll:Cs,getMemberPolicyUrlAll:ks,getPolicyUrlAll:Os,hasLinkedAcr:Qn,removeAcrPolicyUrl:Fs,removeAcrPolicyUrlAll:ii,removeMemberAcrPolicyUrl:Ns,removeMemberAcrPolicyUrlAll:oi,removeMemberPolicyUrl:Ds,removeMemberPolicyUrlAll:fi,removePolicyUrl:Ls,removePolicyUrlAll:hi,createPolicy:Wo,getAllowModes:zo,getDenyModes:Zo,getPolicy:$o,getPolicyAll:Vo,removePolicy:Ko,setAllowModes:Go,setDenyModes:Qo,setPolicy:Jo,createResourcePolicyFor:ts,getResourceAcrPolicy:ns,getResourceAcrPolicyAll:os,getResourcePolicy:rs,getResourcePolicyAll:is,removeResourceAcrPolicy:as,removeResourcePolicy:ss,setResourcePolicy:Us,addAgent:la,createMatcher:Qs,getAgentAll:aa,getMatcher:Zs,getMatcherAll:ta,removeAgent:ua,removeMatcher:na,setAgent:ca,setMatcher:oa,addClient:_a,getClientAll:wa,hasAnyClient:Ea,removeClient:Sa,setAnyClient:Aa,setClient:function(e,t){const r=Ea(e);let n=vr(e,N.client,t);return r&&(n=Aa(n)),n},removeAnyClient:function(e){return or(e,N.client,D)},hasAuthenticated:pa,hasCreator:ma,hasPublic:da,setAuthenticated:ga,setCreator:va,setPublic:ha,removeAuthenticated:ya,removeCreator:ba,removePublic:fa,getAnyOfMatcherUrlAll:Js,addAnyOfMatcherUrl:$s,removeAnyOfMatcherUrl:Vs,setAnyOfMatcherUrl:Ks,getAllOfMatcherUrlAll:Ws,addAllOfMatcherUrl:Ms,removeAllOfMatcherUrl:Bs,setAllOfMatcherUrl:Hs,getNoneOfMatcherUrlAll:Ys,addNoneOfMatcherUrl:Gs,removeNoneOfMatcherUrl:qs,setNoneOfMatcherUrl:zs,createResourceMatcherFor:Xs,getResourceMatcher:ea,getResourceMatcherAll:ra,removeResourceMatcher:ia,setResourceMatcher:sa,addMockAcrTo:hs,mockAcrFor:ds},Ia=[N.agent,N.group];function Ta(e,t,r){if(e.inaccessibleUrls.length>0)return null;const n=e.acrPolicies.filter((n=>xa(n,t,r,e))),i=e.policies.filter((n=>xa(n,t,r,e))),o=n.reduce(((e,t)=>{const r={...e},n=Yo(t);return n.read&&(r.controlRead=!0),n.write&&(r.controlWrite=!0),r}),{read:!1,append:!1,write:!1,controlRead:!1,controlWrite:!1}),s=i.reduce(((e,t)=>{const r={...e},n=Yo(t);return n.read&&(r.read=!0),n.append&&(r.append=!0),n.write&&(r.write=!0),r}),o),a=n.reduce(((e,t)=>{const r={...e},n=es(t);return!0===n.read&&(r.controlRead=!1),!0===n.write&&(r.controlWrite=!1),r}),s);return i.reduce(((e,t)=>{const r={...e},n=es(t);return!0===n.read&&(r.read=!1),!0===n.append&&(r.append=!1),!0===n.write&&(r.write=!1),r}),a)}function xa(e,t,r,n){const i=rt(e,N.allow),o=rt(e,N.deny);if(i.length+o.length===0)return!1;const s=Yi(e).map((e=>n.rules.find((t=>_t(t)===e)))),a=eo(e).map((e=>n.rules.find((t=>_t(t)===e)))),c=io(e).map((e=>n.rules.find((t=>_t(t)===e))));return s.every((e=>Ca(e,t,r)))&&(0===a.length||a.some((e=>Ca(e,t,r))))&&0===c.length}function Pa(e,t){const r=rt(e,N.allow),n=rt(e,N.deny);return!0===t.read&&n.includes(N.Read)||!1===t.read&&r.includes(N.Read)&&!n.includes(N.Read)||!0===t.append&&n.includes(N.Append)||!1===t.append&&r.includes(N.Append)&&!n.includes(N.Append)||!0===t.write&&n.includes(N.Write)||!1===t.write&&r.includes(N.Write)&&!n.includes(N.Write)}function Ca(e,t,r){let n=!0;return Ia.forEach((t=>{n&&(n=null===et(e,t))})),n||rt(e,t).includes(r)}function ka(e,t){if(e.inaccessibleUrls.length>0)return null;const r={},n=function(e,t){const r=new Set;return e.rules.forEach((e=>{rt(e,t).filter((e=>![N.PublicAgent,N.CreatorAgent,N.AuthenticatedAgent].includes(e)||t!==N.agent)).forEach((e=>r.add(e)))})),r}(e,t);return n.forEach((n=>{const i=Ta(e,t,n);r[n]=i})),r}function Oa(e,t,r,n,i){var o,s,a,c,l;if(!Hi(e)||t.inaccessibleUrls.length>0)return null;const d=Ta(t,r,n);if(null===d)return null;const h=t.acrPolicies.filter((e=>xa(e,r,n,t))),f=t.policies.filter((e=>xa(e,r,n,t))),p=h.filter((e=>Pa(e,{read:i.controlRead,write:i.controlWrite}))),g=f.filter((e=>Pa(e,{read:i.read,append:i.append,write:i.write}))),y=p.filter((e=>Fa(e,r,n,t))),m=g.filter((e=>Fa(e,r,n,t))),v=Ta({...t,acrPolicies:t.acrPolicies.filter((e=>!y.includes(e))),policies:t.policies.filter((e=>!m.includes(e)))},r,n);if(null===v)return null;let b=e;y.forEach((i=>{const[o,s]=Da(i,e,t,r,n);b=ls(b,o),b=s.reduce(go,b)})),m.forEach((i=>{const[o,s]=Da(i,e,t,r,n);b=cs(b,o),b=s.reduce(go,b)}));const w=`rule_${encodeURIComponent(`${r}_${n}`)}`;let _=so(e,w);_=vr(_,r,n);const S=null!==(o=i.controlRead)&&void 0!==o?o:d.controlRead,E=null!==(s=i.controlWrite)&&void 0!==s?s:d.controlWrite;let A=y;if(S!==v.controlRead||E!==v.controlWrite){const t=u.v4();let r=ts(e,t);r=qo(r,{read:!0===S,append:!1,write:!0===E}),r=Vt(r,N.allOf,_),b=ls(b,r),b=go(b,_),A=p}const R=null!==(a=i.read)&&void 0!==a?a:d.read,I=null!==(c=i.append)&&void 0!==c?c:d.append,T=null!==(l=i.write)&&void 0!==l?l:d.write;let x=m;if(R!==v.read||I!==v.append||T!==v.write){const t=u.v4();let r=ts(e,t);r=qo(r,{read:!0===R,append:!0===I,write:!0===T}),r=Vt(r,N.allOf,_),b=cs(b,r),b=go(b,_),x=g}return A.forEach((e=>{b=ri(b,_t(e))})),x.forEach((e=>{b=ui(b,_t(e))})),b}function Fa(e,t,r,n){const i=rt(e,N.allOf).map((e=>n.rules.find((t=>_t(t)===e)))).some((e=>Na(e,t,r))),o=rt(e,N.anyOf).map((e=>n.rules.find((t=>_t(t)===e)))).some((e=>Na(e,t,r))),s=rt(e,N.noneOf).map((e=>n.rules.find((t=>_t(t)===e)))).some((e=>Na(e,t,r)));return i||o||s}function Na(e,t,r){const n=[];return Ia.forEach((i=>{const o=rt(e,i).filter((e=>e!==r||i!==t));n.push(...o)})),n.length>0}function Da(e,t,r,n,i){const o=u.v4(),s=La(rt(e,N.allOf),t,r,o,n,i),a=La(rt(e,N.anyOf),t,r,o,n,i),c=La(rt(e,N.noneOf),t,r,o,n,i);let l=ts(t,encodeURI(_t(e))+o);return rt(e,N.allow).forEach((e=>{l=Vt(l,N.allow,e)})),rt(e,N.deny).forEach((e=>{l=Vt(l,N.deny,e)})),s.forEach((e=>{l=Vt(l,N.allOf,e)})),a.forEach((e=>{l=Vt(l,N.anyOf,e)})),c.forEach((e=>{l=Vt(l,N.noneOf,e)})),[l,s.concat(a).concat(c)]}function La(e,t,r,n,i,o){return e.map((e=>{const s=r.rules.find((t=>_t(t)===e));if(void 0===s)return null;let a=so(t,encodeURI(_t(s))+n),c=!1;return Ia.forEach((e=>{rt(s,e).forEach((t=>{e===i&&t===o||(c=!0,a=Vt(a,e,t))}))})),c?a:null})).filter(Ua)}function Ua(e){return null!==e}async function ja(e,t=j){const r=ei(e),n=ci(e),i=Ba(r).concat(Ba(n)),o=await Ha(i,t),s=Wa(r,o).filter(Ua),a=Wa(n,o).filter(Ua),c=new Set;s.forEach((e=>{$a(e).forEach((e=>{c.add(e)}))})),a.forEach((e=>{$a(e).forEach((e=>{c.add(e)}))}));const l=Array.from(c),u=l.map((e=>Ma(e))).filter((e=>!i.includes(e))),d=await Ha(u,t),h={...o,...d},f=Wa(l,h).filter(Ua);return{inaccessibleUrls:Object.keys(h).filter((e=>null===h[e])),acrPolicies:s,policies:a,rules:f}}function Ma(e){const t=new URL(e);return t.hash="",t.href}function Ba(e){const t=[];return e.forEach((e=>{const r=Ma(e);t.includes(r)||t.push(r)})),t}async function Ha(e,t){const r=Array.from(new Set(e)),n={};return await Promise.all(r.map((async e=>{try{const r=await Ot(e,t);n[e]=r}catch(t){n[e]=null}}))),n}function Wa(e,t){return e.map((e=>{const r=Ma(e),n=t[r];return n?pt(n,e):null}))}function $a(e){return Yi(e).concat(eo(e)).concat(io(e))}function Va(e,t){var r,n,i,o;if(e.controlRead!==e.controlWrite)throw new Error("For Pods using Web Access Control, controlRead and controlWrite must be equal.");return{read:null!==(r=e.read)&&void 0!==r?r:t.read,append:null!==(n=e.append)&&void 0!==n?n:t.append,write:null!==(i=e.write)&&void 0!==i?i:t.write,control:null!==(o=e.controlRead)&&void 0!==o?o:t.control}}function Ka(e){return{read:e.read,write:e.write,append:e.append,controlRead:e.control,controlWrite:e.control}}async function Ja(e,t,r,n){const i=r(Gr(e,await Or(e,n)),t);return null===i?null:Ka(i)}async function Ga(e,t,r){const n=t(Gr(e,await Or(e,r)));if(null===n)return null;const i={};for(const[e,t]of Object.entries(n))i[e]=Ka(t);return i}function qa(e,t,r=j){return Ja(e,t,an,r)}function za(e,t,r=j){return Ja(e,t,vn,r)}function Ya(e,t=j){return async function(e,t,r){const n=t(Gr(e,await Or(e,r)));return null===n?null:Ka(n)}(e,Tn,t)}function Qa(e,t=j){return Ga(e,cn,t)}async function Xa(e,t){if(!sn(e))return null;const r=Gr(e,await Or(e,t));let n;if(Xr(r))n=function(e){return e.internal_acl.resourceAcl}(r);else{if(!en(r))return null;n=nn(r)}return Yr(r,n)}async function Za(e,t,r){let n=null;try{return n=await on(e,t,r),Yr(e,n)}catch(e){return null}}async function ec(e,t,r,n,i,o){const s=await Xa(e,o);if(null===s)return null;const a=n(s,t);return Za(s,i(Zr(s),t,Va(r,a)),o)}async function tc(e,t,r,n=j){return ec(e,t,r,an,dn,n)}async function rc(e,t,r=j){return async function(e,t,r,n,i){const o=await Xa(e,i);return null===o?null:Za(o,n(Zr(o),Va(t,r(o))),i)}(e,t,Tn,Cn,r)}var nc=Object.freeze({__proto__:null,getAccessFor:ic,getAccessForAll:oc,getAgentAccess:ac,getAgentAccessAll:lc,getGroupAccess:uc,getGroupAccessAll:dc,getPublicAccess:fc,setAccessFor:sc,setAgentAccess:cc,setGroupAccess:hc,setPublicAccess:pc});async function ic(e,t,r=j,n=j){if("agent"===t){if("string"!=typeof r)throw new Error("When reading Agent-specific access, the given agent cannot be left undefined.");return ac(e,r,n)}if("group"===t){if("string"!=typeof r)throw new Error("When reading Group-specific access, the given group cannot be left undefined.");return uc(e,r,n)}if("public"===t){if("string"==typeof r)throw new Error(`When reading public access, no actor type should be specified (here [${r}]).`);return fc(e,r)}return null}async function oc(e,t,r=j){return"agent"===t?lc(e,r):"group"===t?dc(e,r):null}async function sc(e,t,r,n=j,i=j){if("agent"===t){if("string"!=typeof n)throw new Error("When writing Agent-specific access, the given agent cannot be left undefined.");return cc(e,n,r,i)}if("group"===t){if("string"!=typeof n)throw new Error("When writing Group-specific access, the given group cannot be left undefined.");return hc(e,n,r,i)}if("public"===t){if("string"==typeof n)throw new Error(`When writing public access, no actor type should be specified (here [${n}]).`);return pc(e,r,n)}return null}async function ac(e,t,r=j){const n=await Li(e,r);return Hi(n)?function(e,t){return Ta(e,N.agent,t)}(await ja(n,r),t):sn(n)?qa(n,t,r):null}async function cc(e,t,r,n=j){const i=await Li(e,n);if(Hi(i)){const o=function(e,t,r,n){return Oa(e,t,N.agent,r,n)}(i,await ja(i,n),t,r);if(o)try{return await Bi(o,n),await ac(e,t,n)}catch(e){return null}return null}if(sn(i)){if(r.controlRead!==r.controlWrite)throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${V(i)}]), \`controlRead\` and \`controlWrite\` should have the same value.`);const e=r;return await tc(i,t,e,n),qa(i,t,n)}return null}async function lc(e,t=j){const r=await Li(e,t);return Hi(r)?ka(await ja(r,t),N.agent):sn(r)?Qa(r,t):null}async function uc(e,t,r=j){const n=await Li(e,r);return Hi(n)?(i=await ja(n,r),o=t,Ta(i,N.group,o)):sn(n)?za(n,t,r):null;var i,o}async function dc(e,t=j){const r=await Li(e,t);return Hi(r)?ka(await ja(r,t),N.group):sn(r)?function(e,t=j){return Ga(e,bn,t)}(r,t):null}async function hc(e,t,r,n=j){const i=await Li(e,n);if(Hi(i)){const o=function(e,t,r,n){return Oa(e,t,N.group,r,n)}(i,await ja(i,n),t,r);if(o)try{return await Bi(o,n),await uc(e,t,n)}catch(e){return null}return null}if(sn(i)){if(r.controlRead!==r.controlWrite)throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${V(i)}]), \`controlRead\` and \`controlWrite\` should have the same value.`);const e=r;return await async function(e,t,r,n=j){return ec(e,t,r,vn,In,n)}(i,t,e,n),za(i,t,n)}return null}async function fc(e,t=j){const r=await Li(e,t);return Hi(r)?Ta(await ja(r,t),N.agent,N.PublicAgent):sn(r)?Ya(r,t):null}async function pc(e,t,r=j){const n=await Li(e,r);if(Hi(n)){const i=function(e,t,r){return Oa(e,t,N.agent,N.PublicAgent,r)}(n,await ja(n,r),t);if(i)try{return await Bi(i,r),await fc(e,r)}catch(e){return null}return null}if(sn(n)){if(t.controlRead!==t.controlWrite)throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${V(n)}]), \`controlRead\` and \`controlWrite\` should have the same value.`);const e=t;return await rc(n,e,r),Ya(n,r)}return null}var gc=Object.freeze({__proto__:null,getAccessFor:ic,getAccessForAll:oc,getAgentAccess:ac,getAgentAccessAll:lc,getGroupAccess:uc,getGroupAccessAll:dc,getPublicAccess:fc,setAccessFor:sc,setAgentAccess:cc,setGroupAccess:hc,setPublicAccess:pc});const yc=[N.agent];function mc(e,t,r){if(e.inaccessibleUrls.length>0)return null;const n=e.acrPolicies.filter((n=>vc(n,t,r,e))),i=e.policies.filter((n=>vc(n,t,r,e))),o=n.reduce(((e,t)=>{const r={...e},n=zo(t);return n.read&&(r.controlRead=!0),n.write&&(r.controlWrite=!0),r}),{read:!1,append:!1,write:!1,controlRead:!1,controlWrite:!1}),s=i.reduce(((e,t)=>{const r={...e},n=zo(t);return n.read&&(r.read=!0),n.append&&(r.append=!0),n.write&&(r.write=!0),r}),o),a=n.reduce(((e,t)=>{const r={...e},n=Zo(t);return!0===n.read&&(r.controlRead=!1),!0===n.write&&(r.controlWrite=!1),r}),s);return i.reduce(((e,t)=>{const r={...e},n=Zo(t);return!0===n.read&&(r.read=!1),!0===n.append&&(r.append=!1),!0===n.write&&(r.write=!1),r}),a)}function vc(e,t,r,n){const i=rt(e,N.allow),o=rt(e,N.deny);if(i.length+o.length===0)return!1;const s=Ws(e).map((e=>n.matchers.find((t=>_t(t)===e)))),a=Js(e).map((e=>n.matchers.find((t=>_t(t)===e)))),c=Ys(e).map((e=>n.matchers.find((t=>_t(t)===e))));return s.every((e=>wc(e,t,r)))&&(0===a.length||a.some((e=>wc(e,t,r))))&&s.length+a.length>0&&0===c.length}function bc(e,t){const r=rt(e,N.allow),n=rt(e,N.deny);return!0===t.read&&n.includes($r.read)||!1===t.read&&r.includes($r.read)&&!n.includes($r.read)||!0===t.append&&n.includes($r.append)||!1===t.append&&r.includes($r.append)&&!n.includes($r.append)||!0===t.write&&n.includes($r.write)||!1===t.write&&r.includes($r.write)&&!n.includes($r.write)}function wc(e,t,r){return rt(e,t).includes(r)}function _c(e,t,r,n,i){var o,s,a,c,l;if(!Hi(e)||t.inaccessibleUrls.length>0)return null;const d=mc(t,r,n);if(null===d)return null;const h=t.acrPolicies.filter((e=>vc(e,r,n,t))),f=t.policies.filter((e=>vc(e,r,n,t))),p=h.filter((e=>bc(e,{read:i.controlRead,write:i.controlWrite}))),g=f.filter((e=>bc(e,{read:i.read,append:i.append,write:i.write}))),y=p.filter((e=>Sc(e,r,n,t))),m=g.filter((e=>Sc(e,r,n,t))),v=mc({...t,acrPolicies:t.acrPolicies.filter((e=>!y.includes(e))),policies:t.policies.filter((e=>!m.includes(e)))},r,n);if(null===v)return null;let b=e;y.forEach((i=>{const[o,s]=Ac(i,e,t,r,n);b=ls(b,o),b=s.reduce(sa,b)})),m.forEach((i=>{const[o,s]=Ac(i,e,t,r,n);b=cs(b,o),b=s.reduce(sa,b)}));const w=`matcher_${encodeURIComponent(`${r}_${n}`)}`;let _=Xs(e,w);_=vr(_,r,n);const S=null!==(o=i.controlRead)&&void 0!==o?o:d.controlRead,E=null!==(s=i.controlWrite)&&void 0!==s?s:d.controlWrite;let A=y;if(S!==v.controlRead||E!==v.controlWrite){const t=u.v4();let r=ts(e,t);r=Go(r,{read:!0===S,append:!1,write:!0===E}),r=Vt(r,N.allOf,_),b=ls(b,r),b=sa(b,_),A=p}const R=null!==(a=i.read)&&void 0!==a?a:d.read,I=null!==(c=i.append)&&void 0!==c?c:d.append,T=null!==(l=i.write)&&void 0!==l?l:d.write;let x=m;if(R!==v.read||I!==v.append||T!==v.write){const t=u.v4();let r=ts(e,t);r=Go(r,{read:!0===R,append:!0===I,write:!0===T}),r=Vt(r,N.allOf,_),b=cs(b,r),b=sa(b,_),x=g}return A.forEach((e=>{b=ri(b,_t(e))})),x.forEach((e=>{b=ui(b,_t(e))})),b}function Sc(e,t,r,n){const i=rt(e,N.allOf).map((e=>n.matchers.find((t=>_t(t)===e)))).some((e=>Ec(e,t,r))),o=rt(e,N.anyOf).map((e=>n.matchers.find((t=>_t(t)===e)))).some((e=>Ec(e,t,r))),s=rt(e,N.noneOf).map((e=>n.matchers.find((t=>_t(t)===e)))).some((e=>Ec(e,t,r)));return i||o||s}function Ec(e,t,r){const n=[];return yc.forEach((i=>{const o=rt(e,i).filter((e=>e!==r||i!==t));n.push(...o)})),n.length>0}function Ac(e,t,r,n,i){const o=u.v4(),s=Rc(rt(e,N.allOf),t,r,o,n,i),a=Rc(rt(e,N.anyOf),t,r,o,n,i),c=Rc(rt(e,N.noneOf),t,r,o,n,i);let l=ts(t,encodeURI(_t(e))+o);return rt(e,N.allow).forEach((e=>{l=Vt(l,N.allow,e)})),rt(e,N.deny).forEach((e=>{l=Vt(l,N.deny,e)})),s.forEach((e=>{l=Vt(l,N.allOf,e)})),a.forEach((e=>{l=Vt(l,N.anyOf,e)})),c.forEach((e=>{l=Vt(l,N.noneOf,e)})),[l,s.concat(a).concat(c)]}function Rc(e,t,r,n,i,o){return e.map((e=>{const s=r.matchers.find((t=>_t(t)===e));if(void 0===s)return null;let a=Xs(t,encodeURI(_t(s))+n),c=!1;return yc.forEach((e=>{rt(s,e).forEach((t=>{e===i&&t===o||(c=!0,a=Vt(a,e,t))}))})),c?a:null})).filter(Ic)}function Ic(e){return null!==e}async function Tc(e,t=j){const r=ei(e),n=ci(e),i=Pc(r).concat(Pc(n)),o=await Cc(i,t),s=kc(r,o).filter(Ic),a=kc(n,o).filter(Ic),c=new Set;s.forEach((e=>{Oc(e).forEach((e=>{c.add(e)}))})),a.forEach((e=>{Oc(e).forEach((e=>{c.add(e)}))}));const l=Array.from(c),u=l.map((e=>xc(e))).filter((e=>!i.includes(e))),d=await Cc(u,t),h={...o,...d},f=kc(l,h).filter(Ic);return{inaccessibleUrls:Object.keys(h).filter((e=>null===h[e])),acrPolicies:s,policies:a,matchers:f}}function xc(e){const t=new URL(e);return t.hash="",t.href}function Pc(e){const t=[];return e.forEach((e=>{const r=xc(e);t.includes(r)||t.push(r)})),t}async function Cc(e,t){const r=Array.from(new Set(e)),n={};return await Promise.all(r.map((async e=>{try{const r=await Ot(e,t);n[e]=r}catch(t){n[e]=null}}))),n}function kc(e,t){return e.map((e=>{const r=xc(e),n=t[r];return n?pt(n,e):null}))}function Oc(e){return Ws(e).concat(Js(e)).concat(Ys(e))}async function Fc(e,t,r=j){const n=await Li(e,r);return Hi(n)?function(e,t){return mc(e,N.agent,t)}(await Tc(n,r),t):sn(n)?qa(n,t,r):null}async function Nc(e,t=j){const r=await Li(e,t);return Hi(r)?mc(await Tc(r,t),N.agent,N.PublicAgent):sn(r)?Ya(r,t):null}var Dc=Object.freeze({__proto__:null,getAccessFor:ic,getAccessForAll:oc,getAgentAccess:Fc,getAgentAccessAll:async function(e,t=j){const r=await Li(e,t);return Hi(r)?function(e,t){if(e.inaccessibleUrls.length>0)return null;const r={},n=function(e,t){const r=new Set;return e.matchers.forEach((e=>{rt(e,t).filter((e=>![N.PublicAgent,N.CreatorAgent,N.AuthenticatedAgent].includes(e)||t!==N.agent)).forEach((e=>r.add(e)))})),r}(e,t);return n.forEach((n=>{const i=mc(e,t,n);r[n]=i})),r}(await Tc(r,t),N.agent):sn(r)?Qa(r,t):null},getPublicAccess:Nc,setAccessFor:sc,setAgentAccess:async function(e,t,r,n=j){const i=await Li(e,n);if(Hi(i)){const o=function(e,t,r,n){return _c(e,t,N.agent,r,n)}(i,await Tc(i,n),t,r);if(o)try{return await Bi(o,n),await Fc(e,t,n)}catch(e){return null}return null}if(sn(i)){if(r.controlRead!==r.controlWrite)throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${V(i)}]), \`controlRead\` and \`controlWrite\` should have the same value.`);const e=r;return await tc(i,t,e,n),qa(i,t,n)}return null},setPublicAccess:async function(e,t,r=j){const n=await Li(e,r);if(Hi(n)){const i=function(e,t,r){return _c(e,t,N.agent,N.PublicAgent,r)}(n,await Tc(n,r),t);if(i)try{return await Bi(i,r),await Nc(e,r)}catch(e){return null}return null}if(sn(n)){if(t.controlRead!==t.controlWrite)throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${V(n)}]), \`controlRead\` and \`controlWrite\` should have the same value.`);const e=t;return await rc(n,e,r),Ya(n,r)}return null}});async function Lc(e,t){if("string"!=typeof e.internal_resourceInfo.aclUrl)return null;try{return await M(e.internal_resourceInfo.aclUrl,t)}catch(e){return null}}function Uc(e,t,r){const n=tt(t,yi.allOf).map((t=>pt(jn(e),t))).filter((e=>null!==e)),i=n.every((e=>tt(e,yi.agent).includes(r))),o=tt(t,yi.anyOf).map((t=>pt(jn(e),t))).filter((e=>null!==e)),s=o.some((e=>tt(e,yi.agent).includes(r))),a=tt(t,yi.noneOf).map((t=>pt(jn(e),t))).filter((e=>null!==e)),c=a.some((e=>tt(e,yi.agent).includes(r)));return n.length+o.length>0&&(0===n.length||i)&&(0===o.length||s)&&(0===a.length||!c)}function jc(e,t,r){const n=function(e){return Ii(e,yi.allow)}(e),i=function(e){return Ii(e,yi.deny)}(e);return"control"===r?{read:t.read,append:t.append,write:t.write,controlRead:(t.controlRead||n.read)&&!i.read,controlWrite:(t.controlWrite||n.write)&&!i.write}:{read:(t.read||n.read)&&!i.read,append:(t.append||n.append)&&!i.append,write:(t.write||n.write)&&!i.write,controlRead:t.controlRead,controlWrite:t.controlWrite}}async function Mc(e,t){let r={read:!1,append:!1,write:!1,controlRead:!1,controlWrite:!1};return Os(e).map((t=>pt(jn(e),t))).filter((e=>null!==e)).forEach((n=>{Uc(e,n,t)&&(r=jc(n,r,"resource"))})),xs(e).map((t=>pt(jn(e),t))).filter((e=>null!==e)).forEach((n=>{Uc(e,n,t)&&(r=jc(n,r,"control"))})),r}async function Bc(e,t){const r=await async function(e,t){const r=function(e){const t=e.internal_resourceInfo.linkedResources[yi.accessControl];return Array.isArray(t)&&1===t.length?t[0]:null}(e);if(null!==r)return r;const n=await Lc(e,t);if(null===n)return null;const i=J(n).type;return Array.isArray(i)&&i.includes(yi.AccessControlResource)?$(n):null}(e,t);if(null===r)return null;let n;try{n=await Ot(r,t)}catch(e){return null}return{...e,internal_acp:{acr:{...n,accessTo:$(e)}}}}async function Hc(e,t,r){const n=await M(e,r),i=await Bc(n,r);return null===i?qa(n,t,r):Mc(i,t)}async function Wc(e,t){const r=await M(e,t),n=await Bc(r,t);return null===n?Ya(r,t):async function(e){return Mc(e,yi.PublicAgent)}(n)}function $c(e,t,r){return Ai(e,t).concat("AgentMatcher").concat(r.charAt(0).toUpperCase()+r.slice(1)).concat("Policy")}function Vc(e,t,r){return $c(e,t,r).concat("Matcher")}const Kc=yi.anyOf;function Jc(e,t,r,n,i){var o;const s=Vc(e,r,n),a=function(e,t,r){const n=$c(e,t,r),i=Vc(e,t,r);let o=pt(jn(e),n);return o||(e=function(e,t,r){const n=$c(e,t,r);return n.includes("Acr")?Ss(e,n):Rs(e,n)}(e,t,r),o=vt({url:n}),o=Ti(o,{[r]:!0},yi.allow)),rt(o,Kc).includes(i)?e:(o=Cr(o).addUrl(Kc,i).build(),bs(e,o))}(e,r,n),c=null!==(o=pt(jn(a),s))&&void 0!==o?o:vt({url:s});return bs(a,"add"===i?la(c,t):ua(c,t))}async function Gc(e,t,r){const n=await Mc(e,t);return"boolean"==typeof r.read&&n.read!==r.read&&(e=Jc(e,t,wi,"read",r.read?"add":"remove")),"boolean"==typeof r.append&&n.append!==r.append&&(e=Jc(e,t,wi,"append",r.append?"add":"remove")),"boolean"==typeof r.write&&n.write!==r.write&&(e=Jc(e,t,wi,"write",r.write?"add":"remove")),"boolean"==typeof r.controlRead&&n.controlRead!==r.controlRead&&(e=Jc(e,t,_i,"controlRead",r.controlRead?"add":"remove")),"boolean"==typeof r.controlWrite&&n.controlWrite!==r.controlWrite&&(e=Jc(e,t,_i,"controlWrite",r.controlWrite?"add":"remove")),e}var qc=Object.freeze({__proto__:null,getAclServerResourceInfo:Lc,getAgentAccess:Hc,getAgentAccessAll:async function(e,t){const r=await M(e,t),n=await Bc(r,t);return null===n?Qa(r,t):async function(e){return(await Promise.all((t=e,Array.from(new Set(gt(jn(t)).map((e=>tt(e,yi.agent))).reduce(((e,t)=>e.concat(t)),[])))).map((async t=>({[t]:await Mc(e,t)}))))).reduce(((e,t)=>({...e,...t})),{});var t}(n)},getPublicAccess:Wc,setAgentAccess:async function(e,t,r,n){const i=await M(e,n),o=await Bc(i,n);if(null===o)return await tc(i,t,r,n),qa(i,t,n);try{return await Bi(await Gc(o,t,r),n),await Hc(e,t,n)}catch(e){return null}},setPublicAccess:async function(e,t,r){const n=await M(e,r),i=await Bc(n,r);if(null===i)return await rc(n,t,r),Ya(n,r);try{return await Bi(await async function(e,t){return Gc(e,yi.PublicAgent,t)}(i,t),r),await Wc(e,r)}catch(e){return null}}}),zc=Object.freeze({__proto__:null,acrAsMarkdown:pi,addAcrPolicyUrl:Xn,addAgent:vo,addAllOfRuleUrl:Gi,addAnyOfRuleUrl:Qi,addClient:Do,addGroup:So,addMemberAcrPolicyUrl:Zn,addMemberPolicyUrl:ai,addMockAcrTo:hs,addNoneOfRuleUrl:to,addPolicyUrl:si,createPolicy:Wo,createResourcePolicyFor:ts,createResourceRuleFor:so,createRule:oo,getAcrPolicyUrlAll:ei,getAgentAll:yo,getAllOfRuleUrlAll:Yi,getAllowModes:Yo,getAnyOfRuleUrlAll:eo,getClientAll:Fo,getDenyModes:es,getFileWithAccessDatasets:ji,getFileWithAcr:Di,getGroupAll:wo,getLinkedAcrUrl:Ki,getMemberAcrPolicyUrlAll:ti,getMemberPolicyUrlAll:li,getNoneOfRuleUrlAll:io,getPolicy:$o,getPolicyAll:Vo,getPolicyUrlAll:ci,getReferencedPolicyUrlAll:$i,getResourceAcrPolicy:ns,getResourceAcrPolicyAll:os,getResourceInfoWithAccessDatasets:Mi,getResourceInfoWithAcr:Li,getResourcePolicy:rs,getResourcePolicyAll:is,getResourceRule:co,getResourceRuleAll:uo,getRule:ao,getRuleAll:lo,getSolidDatasetWithAccessDatasets:Ui,getSolidDatasetWithAcr:Ni,hasAccessibleAcr:Hi,hasAnyClient:Uo,hasAuthenticated:To,hasCreator:Co,hasLinkedAcr:Qn,hasPublic:Ao,isAcpControlled:Vi,mockAcrFor:ds,policyAsMarkdown:us,removeAcrPolicyUrl:ri,removeAcrPolicyUrlAll:ii,removeAgent:bo,removeAllOfRuleUrl:qi,removeAnyClient:Mo,removeAnyOfRuleUrl:Xi,removeAuthenticated:Po,removeClient:Lo,removeCreator:Oo,removeGroup:Eo,removeMemberAcrPolicyUrl:ni,removeMemberAcrPolicyUrlAll:oi,removeMemberPolicyUrl:di,removeMemberPolicyUrlAll:fi,removeNoneOfRuleUrl:ro,removePolicy:Ko,removePolicyUrl:ui,removePolicyUrlAll:hi,removePublic:Io,removeResourceAcrPolicy:as,removeResourcePolicy:ss,removeResourceRule:fo,removeRule:ho,ruleAsMarkdown:Bo,saveAcrFor:Bi,setAgent:mo,setAllOfRuleUrl:zi,setAllowModes:qo,setAnyClient:jo,setAnyOfRuleUrl:Zi,setAuthenticated:xo,setClient:No,setCreator:ko,setDenyModes:Xo,setGroup:_o,setNoneOfRuleUrl:no,setPolicy:Jo,setPublic:Ro,setResourceAcrPolicy:ls,setResourcePolicy:cs,setResourceRule:go,setRule:po}),Yc=Object.freeze({__proto__:null,addAcrPolicyUrl:Ss,addAgent:la,addAllOfMatcherUrl:Ms,addAnyOfMatcherUrl:$s,addClient:_a,addMemberAcrPolicyUrl:Es,addMemberPolicyUrl:As,addMockAcrTo:hs,addNoneOfMatcherUrl:Gs,addPolicyUrl:Rs,createMatcher:Qs,createPolicy:Wo,createResourceMatcherFor:Xs,createResourcePolicyFor:ts,getAcrPolicyUrlAll:xs,getAgentAll:aa,getAllOfMatcherUrlAll:Ws,getAllowModes:zo,getAnyOfMatcherUrlAll:Js,getClientAll:wa,getDenyModes:Zo,getFileWithAccessDatasets:ji,getFileWithAcr:Di,getLinkedAcrUrl:Ki,getMatcher:Zs,getMatcherAll:ta,getMemberAcrPolicyUrlAll:Cs,getMemberPolicyUrlAll:ks,getNoneOfMatcherUrlAll:Ys,getPolicy:$o,getPolicyAll:Vo,getPolicyUrlAll:Os,getReferencedPolicyUrlAll:$i,getResourceAcrPolicy:ns,getResourceAcrPolicyAll:os,getResourceInfoWithAccessDatasets:Mi,getResourceInfoWithAcr:Li,getResourceMatcher:ea,getResourceMatcherAll:ra,getResourcePolicy:rs,getResourcePolicyAll:is,getSolidDatasetWithAccessDatasets:Ui,getSolidDatasetWithAcr:Ni,getVcAccess:Fi,hasAccessibleAcr:Hi,hasAuthenticated:pa,hasCreator:ma,hasLinkedAcr:Qn,hasPublic:da,isAcpControlled:Vi,mockAcrFor:ds,removeAcrPolicyUrl:Fs,removeAcrPolicyUrlAll:ii,removeAgent:ua,removeAllOfMatcherUrl:Bs,removeAnyOfMatcherUrl:Vs,removeAuthenticated:ya,removeClient:Sa,removeCreator:ba,removeMatcher:na,removeMemberAcrPolicyUrl:Ns,removeMemberAcrPolicyUrlAll:oi,removeMemberPolicyUrl:Ds,removeMemberPolicyUrlAll:fi,removeNoneOfMatcherUrl:qs,removePolicy:Ko,removePolicyUrl:Ls,removePolicyUrlAll:hi,removePublic:fa,removeResourceAcrPolicy:as,removeResourceMatcher:ia,removeResourcePolicy:ss,saveAcrFor:Bi,setAgent:ca,setAllOfMatcherUrl:Hs,setAllowModes:Go,setAnyOfMatcherUrl:Ks,setAuthenticated:ga,setCreator:va,setDenyModes:Qo,setMatcher:oa,setNoneOfMatcherUrl:zs,setPolicy:Jo,setPublic:ha,setResourceMatcher:sa,setResourcePolicy:Us,setVcAccess:Ci});const{getJsonLdParser:Qc,getTurtleParser:Xc,solidDatasetAsTurtle:Zc}=We;t.FetchError=G,t.SolidClientError=p,t.ThingExpectedError=At,t.access=nc,t.access_v1=gc,t.access_v2=Dc,t.acp_ess_1=zc,t.acp_ess_2=Yc,t.acp_v1=ms,t.acp_v2=ys,t.acp_v3=vs,t.acp_v4=Ra,t.addBoolean=Kt,t.addDate=Gt,t.addDatetime=Jt,t.addDecimal=zt,t.addInteger=Yt,t.addIri=Vt,t.addJwkToJwks=Nn,t.addLiteral=er,t.addMockFallbackAclTo=function(e){const t=Dr(V(e)),r=`${t}.acl`,n=rn(function(e,t){return Object.assign(v(e),{internal_resourceInfo:{...e.internal_resourceInfo,aclUrl:t}})}(Wt(t),r));return Gr(v(e),{resourceAcl:null,fallbackAcl:n})},t.addMockResourceAclTo=function(e){var t;const r=null!==(t=e.internal_resourceInfo.aclUrl)&&void 0!==t?t:"https://your.pod/mock-acl.ttl",n=Object.assign(v(e),{internal_resourceInfo:{...e.internal_resourceInfo,aclUrl:r}});return Gr(n,{resourceAcl:rn(n),fallbackAcl:null})},t.addNamedNode=Zt,t.addPublicKeyToProfileJwks=async function(e,t,r=j){const n=await Ot(t,{fetch:r.fetch});if(null===n)throw new Error(`The profile document associated with WebID [${t}] could not be retrieved.`);const i=Fn(n,t);if(null===i)throw new Error(`No key set is declared for the property [${L}] in the profile of [${t}]`);const o=await Nn(e,i,r);return Je(i,new Blob([JSON.stringify(o)]),{contentType:"application/json",fetch:r.fetch})},t.addStringEnglish=function(e,t,r){return Qt(e,t,r,"en")},t.addStringNoLocale=Xt,t.addStringWithLocale=Qt,t.addTerm=tr,t.addTime=qt,t.addUrl=$t,t.asIri=_t,t.asUrl=wt,t.buildThing=Cr,t.changeLogAsMarkdown=Ut,t.createAcl=rn,t.createAclFromFallbackAcl=nn,t.createContainerAt=async function(e,t=j){var r;e=(e=g(e)).endsWith("/")?e:`${e}/`;const n={...j,...t},i=await n.fetch(e,{method:"PUT",body:n.initialContent?await je(Fe(n.initialContent).map(jt)):void 0,headers:{Accept:"text/turtle","Content-Type":"text/turtle","If-None-Match":"*",Link:`<${C}>; rel="type"`}});if(b(i)){const t=void 0===n.initialContent?"empty":"non-empty";throw new G(`Creating the ${t} Container at [${e}] failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i)}const o=m(i);return Y({...null!==(r=t.initialContent)&&void 0!==r?r:Ct(),internal_changeLog:{additions:[],deletions:[]},internal_resourceInfo:o})},t.createContainerInContainer=async function(e,t=j){e=g(e);const r={...j,...t},n={"Content-Type":"text/turtle",Link:`<${C}>; rel="type"`};t.slugSuggestion&&(n.slug=t.slugSuggestion);const i=await r.fetch(e,{method:"POST",headers:n});if(b(i))throw new G(`Creating an empty Container in the Container at [${e}] failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i);const o=m(i);if(!o.location)throw new Error("Could not determine the location of the newly created Container.");try{const e=new URL(o.location).toString();return Y({...Ct(),internal_resourceInfo:{...o,sourceIri:e}})}catch(e){}return Y({...Ct(),internal_resourceInfo:{...o,sourceIri:new URL(o.location,i.url).href}})},t.createSolidDataset=Ct,t.createThing=vt,t.deleteAclFor=async function(e,t=j){const r={...j,...t},n=await r.fetch(e.internal_resourceInfo.aclUrl,{method:"DELETE"});if(!n.ok)throw new Error(`Deleting the ACL of the Resource at [${$(e)}] failed: [${n.status}] [${n.statusText}].`);return Object.assign(v(e),{acl:{resourceAcl:null}})},t.deleteContainer=async function(e,t=j){const r=d(e)?g($(e)):g(e);if(!H(e))throw new Error(`You're trying to delete the Container at [${r}], but Container URLs should end in a \`/\`. Are you sure this is a Container?`);const n={...j,...t},i=await n.fetch(r,{method:"DELETE"});if(b(i))throw new G(`Deleting the Container at [${r}] failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i)},t.deleteFile=async function(e,t=$e){const r={...$e,...t},n=d(e)?g(V(e)):g(e),i=await r.fetch(n,{...r.init,method:"DELETE"});if(b(i))throw new G(`Deleting the file at [${n}] failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i)},t.deleteSolidDataset=async function(e,t=j){const r={...j,...t},n=d(e)?g($(e)):g(e),i=await r.fetch(n,{method:"DELETE"});if(b(i))throw new G(`Deleting the SolidDataset at [${n}] failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i)},t.fromRdfJsDataset=function(e){const t=Array.from(e),r=Oe(t);return t.filter((e=>r.every((t=>!t.equals(e.subject))))).reduce(((e,n)=>Ie(e,n,{otherQuads:t,chainBlankNodes:r})),{graphs:{default:{}},type:"Dataset"})},t.getAgentAccess=an,t.getAgentAccessAll=cn,t.getAgentDefaultAccess=hn,t.getAgentDefaultAccessAll=fn,t.getAgentResourceAccess=ln,t.getAgentResourceAccessAll=un,t.getAltProfileUrlAllFrom=Dn,t.getBoolean=function(e,t){Ye(e);const r=ht(e,t,re);return null===r?null:ue(r)},t.getBooleanAll=function(e,t){return Ye(e),ft(e,t,re).map(ue).filter((e=>null!==e))},t.getContainedResourceUrlAll=function(e){const t=$(e),r=pt(e,t);return null===r?[]:rt(r,O).filter((e=>Dt(e,t)))},t.getContentType=W,t.getDate=function(e,t){Ye(e);const r=ht(e,t,ie);return null===r?null:fe(r)},t.getDateAll=function(e,t){return Ye(e),ft(e,t,ie).map(fe).filter((e=>null!==e))},t.getDatetime=function(e,t){Ye(e);const r=ht(e,t,ne);return null===r?null:he(r)},t.getDatetimeAll=function(e,t){return Ye(e),ft(e,t,ne).map(he).filter((e=>null!==e))},t.getDecimal=function(e,t){Ye(e);const r=ht(e,t,se);return null===r?null:ye(r)},t.getDecimalAll=function(e,t){return Ye(e),ft(e,t,se).map((e=>ye(e))).filter((e=>null!==e))},t.getEffectiveAccess=function(e){var t,r,n,i,o,s,a;if("object"==typeof e.internal_resourceInfo.permissions)return{user:{read:e.internal_resourceInfo.permissions.user.read,append:e.internal_resourceInfo.permissions.user.append,write:e.internal_resourceInfo.permissions.user.write},public:{read:e.internal_resourceInfo.permissions.public.read,append:e.internal_resourceInfo.permissions.public.append,write:e.internal_resourceInfo.permissions.public.write}};const c=J(e);return{user:{read:null!==(r=null===(t=c[N.allow])||void 0===t?void 0:t.includes(N.Read))&&void 0!==r&&r,append:null!==(o=(null===(n=c[N.allow])||void 0===n?void 0:n.includes(N.Append))||(null===(i=c[N.allow])||void 0===i?void 0:i.includes(N.Write)))&&void 0!==o&&o,write:null!==(a=null===(s=c[N.allow])||void 0===s?void 0:s.includes(N.Write))&&void 0!==a&&a}}},t.getFallbackAcl=tn,t.getFile=Ke,t.getFileWithAcl=async function(e,t=j){const r=await Ke(e,t);return Gr(r,await Or(r,t))},t.getGroupAccess=vn,t.getGroupAccessAll=bn,t.getGroupDefaultAccess=Sn,t.getGroupDefaultAccessAll=En,t.getGroupResourceAccess=wn,t.getGroupResourceAccessAll=_n,t.getInteger=function(e,t){Ye(e);const r=ht(e,t,ae);return null===r?null:me(r)},t.getIntegerAll=function(e,t){return Ye(e),ft(e,t,ae).map((e=>me(e))).filter((e=>null!==e))},t.getIri=et,t.getIriAll=rt,t.getJsonLdParser=Qc,t.getLinkedResourceUrlAll=J,t.getLiteral=ct,t.getLiteralAll=lt,t.getNamedNode=st,t.getNamedNodeAll=at,t.getPodOwner=K,t.getPodUrlAll=async function(e,t=j){return Un(await Ln(e,t),e)},t.getPodUrlAllFrom=Un,t.getProfileAll=Ln,t.getProfileJwksIri=Fn,t.getPropertyAll=function(e){return Object.keys(e.predicates).filter((t=>null!==ut(e,t)))},t.getPublicAccess=Tn,t.getPublicDefaultAccess=Pn,t.getPublicResourceAccess=xn,t.getResourceAcl=Zr,t.getResourceInfo=M,t.getResourceInfoWithAcl=async function(e,t=j){const r=await M(e,t);return Gr(r,await Or(r,t))},t.getSolidDataset=Ot,t.getSolidDatasetWithAcl=async function(e,t=j){const r=await Ot(e,t);return Gr(r,await Or(r,t))},t.getSourceIri=V,t.getSourceUrl=$,t.getStringByLocaleAll=function(e,t){var r,n;if(Ye(e),!Se(t))throw new Rt(t);const i=g(t),o=null!==(n=null===(r=e.predicates[i])||void 0===r?void 0:r.langStrings)&&void 0!==n?n:{};return new Map(Object.entries(o).map((([e,t])=>[e,[...t]])))},t.getStringEnglish=function(e,t){return nt(e,t,"en")},t.getStringEnglishAll=function(e,t){return it(e,t,"en")},t.getStringNoLocale=function(e,t){return Ye(e),ht(e,t,ce)},t.getStringNoLocaleAll=ot,t.getStringWithLocale=nt,t.getStringWithLocaleAll=it,t.getTerm=ut,t.getTermAll=dt,t.getThing=pt,t.getThingAll=gt,t.getTime=function(e,t){Ye(e);const r=ht(e,t,oe);return null===r?null:de(r)},t.getTimeAll=function(e,t){return Ye(e),ft(e,t,oe).map(de).filter((e=>null!==e))},t.getTurtleParser=Xc,t.getUrl=Ze,t.getUrlAll=tt,t.getWebIdDataset=async function(e){return Ot(e,{fetch:y})},t.getWellKnownSolid=async function(e,t=j){const r=g(e);try{const e=new URL("/.well-known/solid",new URL(r).origin).href;return await Ot(e,{fetch:y})}catch(e){}const n=J(await M(r,{fetch:t.fetch,ignoreAuthenticationErrors:!0}))[U],i=1===(null==n?void 0:n.length)?n[0]:null;if(null!==i)return Ot(new URL(".well-known/solid",i.endsWith("/")?i:`${i}/`).href,{...t,parsers:{"application/ld+json":q()}});throw new Error("Could not determine storage root or well-known solid resource.")},t.hasAccessibleAcl=sn,t.hasAcl=function(e){return"object"==typeof e.internal_acl},t.hasFallbackAcl=en,t.hasResourceAcl=Xr,t.hasResourceInfo=d,t.hasServerResourceInfo=h,t.isContainer=H,t.isPodOwner=function(e,t){const r=K(t);return"string"!=typeof r?null:r===e},t.isRawData=function(e){return e.internal_resourceInfo.isRawData},t.isThing=bt,t.isThingLocal=Et,t.mockContainerFrom=Wt,t.mockFetchError=function(e,t=404,r="Not Found"){const n=new o.Response(void 0,{status:t,statusText:r});return new G(`Fetching the Resource at [${e}] failed: [${n.status}] [${n.statusText}].`,n)},t.mockFileFrom=function(e,t){const r=new Blob;return Object.assign(r,{internal_resourceInfo:{sourceIri:g(e),isRawData:!0,contentType:null==t?void 0:t.contentType,linkedResources:{}}})},t.mockSolidDatasetFrom=Ht,t.mockThingFrom=function(e){return{type:"Subject",predicates:{},url:g(e)}},t.overwriteFile=Je,t.removeAll=nr,t.removeBoolean=sr,t.removeDate=cr,t.removeDatetime=ar,t.removeDecimal=ur,t.removeInteger=dr,t.removeIri=or,t.removeLiteral=gr,t.removeNamedNode=pr,t.removeStringEnglish=function(e,t,r){return hr(e,t,r,"en")},t.removeStringNoLocale=fr,t.removeStringWithLocale=hr,t.removeThing=mt,t.removeTime=lr,t.removeUrl=ir,t.responseToResourceInfo=B,t.responseToSolidDataset=kt,t.saveAclFor=on,t.saveFileInContainer=async function(e,t,r=$e){const n=g(e),i=await Ge(n,t,"POST",r);if(b(i))throw new G(`Saving the file in [${e}] failed: [${i.status}] [${i.statusText}] ${await i.text()}.`,i);const o=i.headers.get("Location");if(null===o)throw new Error("Could not determine the location of the newly saved file.");const s=new URL(o,new URL(n).origin).href,a=v(t),c={internal_resourceInfo:{isRawData:!0,sourceIri:s,contentType:qe(t,r.contentType)}};return Object.assign(a,c)},t.saveSolidDatasetAt=Ft,t.saveSolidDatasetInContainer=async function(e,t,r=j){const n={...j,...r};e=g(e);const i=await je(Fe(t).map(jt)),o={"Content-Type":"text/turtle",Link:`<${k}>; rel="type"`};r.slugSuggestion&&(o.slug=r.slugSuggestion);const s=await n.fetch(e,{method:"POST",body:i,headers:o});if(b(s))throw new G(`Storing the Resource in the Container at [${e}] failed: [${s.status}] [${s.statusText}] ${await s.text()}.\n\nThe SolidDataset that was sent to the Pod is listed below.\n\n${Lt(t)}`,s);const a=m(s);if(!a.location)throw new Error("Could not determine the location of the newly saved SolidDataset.");let c;try{c=new URL(a.location).href}catch(e){c=new URL(a.location,s.url).href}const l={internal_resourceInfo:{isRawData:!1,sourceIri:c}};return Bt(Y({...t,...l}))},t.setAgentDefaultAccess=function(e,t,r){return zr(e,r,S,"default",t)},t.setAgentResourceAccess=dn,t.setBoolean=br,t.setDate=_r,t.setDatetime=wr,t.setDecimal=Er,t.setGroupDefaultAccess=function(e,t,r){return zr(e,r,E,"default",t)},t.setGroupResourceAccess=In,t.setInteger=Ar,t.setIri=vr,t.setLiteral=xr,t.setNamedNode=Tr,t.setProfileJwks=function(e,t,r){return yt(e,vr(On(e,t),L,r))},t.setPublicDefaultAccess=function(e,t){return zr(e,t,A,"default",F)},t.setPublicResourceAccess=Cn,t.setStringNoLocale=Ir,t.setStringWithLocale=Rr,t.setTerm=Pr,t.setThing=yt,t.setTime=Sr,t.setUrl=mr,t.solidDatasetAsMarkdown=Lt,t.solidDatasetAsTurtle=Zc,t.thingAsMarkdown=St,t.toRdfJsDataset=He,t.universalAccess=qc,t.validateContainedResourceAll=function(e){const t=$(e),r=pt(e,t);if(null===r)return{isValid:!0,invalidContainedResources:[]};const n=rt(r,O).filter((e=>!Dt(e,t)));return n.length>0?{isValid:!1,invalidContainedResources:n}:{isValid:!0,invalidContainedResources:[]}}},5914:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=globalThis.fetch;const{fetch:n,Response:i,Request:o,Headers:s}=globalThis;t.Headers=s,t.Request=o,t.Response=i,t.default=r,t.fetch=n},4727:function(e,t,r){const n=r(37);e.exports=n},377:function(e){class t{constructor(e){this.value=e||"b"+ ++t.nextId}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}t.prototype.termType="BlankNode",t.nextId=0,e.exports=t},37:function(e,t,r){const n=r(377),i=r(8144),o=r(3257),s=r(2704),a=r(9938),c=r(5304),l=r(7427),u={namedNode:function(e){return new a(e)},blankNode:function(e){return new n(e)},literal:function(e,t){return"string"==typeof t?-1===t.indexOf(":")?new s(e,t):new s(e,null,u.namedNode(t)):new s(e,null,t)},variable:function(e){return new l(e)},defaultGraph:function(){return u.defaultGraphInstance},triple:function(e,t,r){return u.quad(e,t,r)},quad:function(e,t,r,n){return new c(e,t,r,n||u.defaultGraphInstance)},fromTerm:function(e){return o.call(u,e)},fromQuad:function(e){return o.call(u,e)},defaultGraphInstance:new i};e.exports=u},8144:function(e){class t{equals(e){return!!e&&e.termType===this.termType}}t.prototype.termType="DefaultGraph",t.prototype.value="",e.exports=t},2704:function(e,t,r){const n=r(9938);class i{constructor(e,t,r){this.value=e,this.datatype=i.stringDatatype,this.language="",t?(this.language=t,this.datatype=i.langStringDatatype):r&&(this.datatype=r)}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)}}i.prototype.termType="Literal",i.langStringDatatype=new n("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),i.stringDatatype=new n("http://www.w3.org/2001/XMLSchema#string"),e.exports=i},9938:function(e){class t{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}t.prototype.termType="NamedNode",e.exports=t},5304:function(e,t,r){const n=r(8144);class i{constructor(e,t,r,i){this.subject=e,this.predicate=t,this.object=r,this.graph=i||new n}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}}i.prototype.termType="Quad",i.prototype.value="",e.exports=i},7427:function(e){class t{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}t.prototype.termType="Variable",e.exports=t},3257:function(e){e.exports=function(e){if(!e)return null;if("BlankNode"===e.termType)return this.blankNode(e.value);if("DefaultGraph"===e.termType)return this.defaultGraph();if("Literal"===e.termType)return this.literal(e.value,e.language||this.namedNode(e.datatype.value));if("NamedNode"===e.termType)return this.namedNode(e.value);if("Quad"===e.termType){const t=this.fromTerm(e.subject),r=this.fromTerm(e.predicate),n=this.fromTerm(e.object),i=this.fromTerm(e.graph);return this.quad(t,r,n,i)}if("Variable"===e.termType)return this.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}},2442:function(e){function t(e){return"string"==typeof e||e instanceof String}function r(e){if("string"==typeof e)return e;if(!e)return"";if(void 0!==e.id&&"Quad"!==e.termType)return e.id;let t,n,o,s;switch(e.termType){case"NamedNode":return e.value;case"BlankNode":return`_:${e.value}`;case"Variable":return`?${e.value}`;case"DefaultGraph":return"";case"Literal":return e.language?`"${e.value}"@${e.language}`:`"${e.value}"${e.datatype&&"http://www.w3.org/2001/XMLSchema#string"!==e.datatype.value?`^^${e.datatype.value}`:""}`;case"Quad":return t=i(r(e.subject)),n=i(r(e.predicate)),o=i(r(e.object)),s="DefaultGraph"===e.graph.termType?"":` ${r(e.graph)}`,`<<${t} ${n} ${o}${s}>>`;default:throw new Error(`Unexpected termType: ${e.termType}`)}}const n=/^"(.*".*)(?="[^"]*$)/;function i(e){return e.replace(n,((e,t)=>`"${t.replace(/"/g,'""')}`))}class o{constructor(e){if(this._size=0,this._graphs=Object.create(null),this._id=0,this._ids=Object.create(null),this._ids["><"]=0,this._entities=Object.create(null),this._quads=new Map,e)for(const t of e)this.add(t)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const o in r=t[i].subjects)for(const t in n=r[o])e+=Object.keys(n[t]).length;return this._size=e,this._size}add(e){let t=r(e.subject),n=r(e.predicate),i=r(e.object);const o=r(e.graph);let s=this._graphs[o];s||(s=this._graphs[o]={subjects:{},predicates:{},objects:{}},Object.freeze(s));const a=this._ids,c=this._entities;return t=a[t]||(a[c[++this._id]=t]=this._id),n=a[n]||(a[c[++this._id]=n]=this._id),i=a[i]||(a[c[++this._id]=i]=this._id),this._addToIndex(s.subjects,t,n,i),this._addToIndex(s.predicates,n,i,t),this._addToIndex(s.objects,i,t,n),this._setQuad(t,n,i,o,e),this._size=null,this}delete(e){let t=r(e.subject),n=r(e.predicate),i=r(e.object);const o=r(e.graph),s=this._ids,a=this._graphs;let c,l,u;if(!((t=s[t])&&(n=s[n])&&(i=s[i])&&(c=a[o])&&(l=c.subjects[t])&&(u=l[n])&&i in u))return this;for(t in this._removeFromIndex(c.subjects,t,n,i),this._removeFromIndex(c.predicates,n,i,t),this._removeFromIndex(c.objects,i,t,n),null!==this._size&&this._size--,this._deleteQuad(t,n,i,o),c.subjects)return this;return delete a[o],this}has(e){const n=r(e.subject),i=r(e.predicate),o=r(e.object),s=r(e.graph),a=this._graphs[s];if(!a)return!1;const c=this._ids;let l,u,d;return!(t(n)&&!(l=c[n])||t(i)&&!(u=c[i])||t(o)&&!(d=c[o]))&&1===this._countInIndex(a.objects,d,l,u)}match(e,t,r,n){return this._createDataset(this._match(e,t,r,n))}[Symbol.iterator](){return this._match()[Symbol.iterator]()}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),o=i[r]||(i[r]={}),s=n in o;return s||(o[n]=null),!s}_removeFromIndex(e,t,r,n){const i=e[t],o=i[r];delete o[n];for(const e in o)return;delete i[r];for(const e in i)return;delete e[t]}_findInIndex(e,t,r,n,i,o,s,a,c,l){let u,d,h;t&&((u=e,e={})[t]=u[t]);for(const t in e)if(d=e[t],d){r&&((u=d,d={})[r]=u[r]);for(const e in d)if(h=d[e],h){const r=n?n in h?[n]:[]:Object.keys(h);for(let n=0;n0?s-4:s;for(r=0;r>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[u++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,l=n-i;al?l:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8849:function(e,t,r){"use strict";r.r(t);var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,i=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),o=i&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),s=n&&n.prototype.append&&n.prototype.getBlob;function a(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var r=new Uint8Array(e.byteLength);r.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=r.buffer}return t}return e}))}function c(e,t){t=t||{};var r=new n;return a(e).forEach((function(e){r.append(e)})),t.type?r.getBlob(t.type):r.getBlob()}function l(e,t){return new Blob(a(e),t||{})}"undefined"!=typeof Blob&&(c.prototype=Blob.prototype,l.prototype=Blob.prototype),t.default=i?o?Blob:l:s?c:void 0},8287:function(e,t,r){"use strict";const n=r(7526),i=r(251),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|g(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(z(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(z(e,ArrayBuffer)||e&&z(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(z(e,SharedArrayBuffer)||e&&z(e.buffer,SharedArrayBuffer)))return f(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Y(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return u(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:J(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Y(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function R(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),l=this.slice(n,i),u=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return S(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function x(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n,i){W(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function D(e,t,r,n,i){W(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function j(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||O(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X((function(e){$(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||O(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||O(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||O(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X((function(e){$(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||O(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||F(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||F(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=X((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=X((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);F(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i>>=0,!n){const n=Math.pow(2,8*r-1);F(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=X((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=X((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function W(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new M.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){$(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||V(t,e.length-(r+1))}(n,i,o)}function $(e,t){if("number"!=typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,r){if(Math.floor(e)!==e)throw $(e,r),new M.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}B("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),B("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),B("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=H(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function J(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},2341:function(e){"use strict";e.exports=function e(t){return null===t||"object"!=typeof t||null!=t.toJSON?JSON.stringify(t):Array.isArray(t)?"["+t.reduce(((t,r,n)=>t+(0===n?"":",")+e(void 0===r||"symbol"==typeof r?null:r)),"")+"]":"{"+Object.keys(t).sort().reduce(((r,n,i)=>void 0===t[n]||"symbol"==typeof t[n]?r:r+(0===r.length?"":",")+e(n)+":"+e(t[n])),"")+"}"}},6547:function(){!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function l(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function h(e){this.map={},e instanceof h?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function g(e){var t=new FileReader,r=p(t);return t.readAsArrayBuffer(e),r}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e,t,r,n=f(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=p(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}})),t}function _(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new h(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];_.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,r){return new Promise((function(n,o){var s=new b(e,r);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new h,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();t.append(n,i)}})),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;n(new _(i,r))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,e.fetch||(e.fetch=E,e.Headers=h,e.Request=b,e.Response=_),t.Headers=h,t.Request=b,t.Response=_,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},7007:function(e){"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function l(e,t,r,n){var i,o,s,l;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=p(c,l);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},2384:function(e){"use strict";var t=/^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i,r=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,n=/\s|\uFEFF|\xA0/,i=/\r?\n[\x20\x09]+/g,o=/[;,"]/,s=/[;,"]|\s/,a=/^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/;function c(e){return e.replace(r,"")}function l(e){return n.test(e)}function u(e,t){for(;l(e[t]);)t++;return t}function d(e){return s.test(e)||!a.test(e)}class h{constructor(e){this.refs=[],e&&this.parse(e)}rel(e){for(var t=[],r=e.toLowerCase(),n=0;n{return r=t,n=e,Object.keys(r).length===Object.keys(n).length&&Object.keys(r).every((e=>e in n&&r[e]===n[e]));var r,n}))||this.refs.push(e),this}has(e,t){e=e.toLowerCase(),t=t.toLowerCase();for(var r=0;r",t)))throw new Error("Expected end of URI delimiter at offset "+t);s={uri:e.slice(t+1,f)},t=f,r=2,t++}else if(2===r){if(l(e[t])){t++;continue}if(";"===e[t])r=4,t++;else{if(","!==e[t])throw new Error('Unexpected character "'+e[t]+'" at offset '+t);r=1,t++}}else{if(4!==r)throw new Error('Unknown parser state "'+r+'"');if(";"===e[t]||l(e[t])){t++;continue}-1===(f=e.indexOf("=",t))&&(f=e.indexOf(";",t)),-1===f&&(f=e.length);var a=c(e.slice(t,f)).toLowerCase(),d="";if('"'===e[t=u(e,t=f+1)])for(t++;t"),e.push(t);return e.join(", ")}}h.isCompatibleEncoding=function(e){return t.test(e)},h.parse=function(e,t){return(new h).parse(e,t)},h.isSingleOccurenceAttr=function(e){return"rel"===e||"type"===e||"media"===e||"title"===e||"title*"===e},h.isTokenAttr=function(e){return"rel"===e||"type"===e||"anchor"===e},h.escapeQuotes=function(e){return e.replace(/"/g,'\\"')},h.expandRelations=function(e){return e.rel.split(" ").map((function(t){var r=Object.assign({},e);return r.rel=t,r}))},h.parseExtendedValue=function(e){var t=/([^']+)?(?:'([^']*)')?(.+)/.exec(e);return{language:t[2].toLowerCase(),encoding:h.isCompatibleEncoding(t[1])?null:t[1].toLowerCase(),value:h.isCompatibleEncoding(t[1])?decodeURIComponent(t[3]):t[3]}},h.formatExtendedAttribute=function(e,t){var r=(t.encoding||"utf-8").toUpperCase();return e+"="+r+"'"+(t.language||"en")+"'"+(Buffer.isBuffer(t.value)&&h.isCompatibleEncoding(r)?t.value.toString(r):Buffer.isBuffer(t.value)?t.value.toString("hex").replace(/[0-9a-f]{2}/gi,"%$1"):encodeURIComponent(t.value))},h.formatAttribute=function(e,t){return Array.isArray(t)?t.map((t=>h.formatAttribute(e,t))).join("; "):"*"===e[e.length-1]||"string"!=typeof t?h.formatExtendedAttribute(e,t):(h.isTokenAttr(e)?t=d(t)?'"'+h.escapeQuotes(t)+'"':h.escapeQuotes(t):d(t)&&(t='"'+(t=(t=encodeURIComponent(t)).replace(/%20/g," ").replace(/%2C/g,",").replace(/%3B/g,";"))+'"'),e+"="+t)},e.exports=h},251:function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,u=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-u)-1,f>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=256*s+e[t+d],d+=h,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=l}return(f?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,l=8*o-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(s=s<0;e[r+f]=255&s,f+=p,s/=256,l-=8);e[r+f-p]|=128*g}},2395:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(2803),t),i(r(5094),t),i(r(585),t),i(r(9146),t),i(r(5086),t),i(r(5215),t),i(r(4931),t)},2803:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContextParser=void 0,r(6547);const n=r(742),i=r(5094),o=r(585),s=r(5215),a=r(4931);class c{constructor(e){e=e||{},this.documentLoader=e.documentLoader||new o.FetchDocumentLoader,this.documentCache={},this.validateContext=!e.skipValidation,this.expandContentTypeToBase=!!e.expandContentTypeToBase,this.remoteContextsDepthLimit=e.remoteContextsDepthLimit||32,this.redirectSchemaOrgHttps=!("redirectSchemaOrgHttps"in e)||!!e.redirectSchemaOrgHttps}static validateLanguage(e,t,r){if("string"!=typeof e)throw new i.ErrorCoded(`The value of an '@language' must be a string, got '${JSON.stringify(e)}'`,r);if(!a.Util.REGEX_LANGUAGE_TAG.test(e)){if(t)throw new i.ErrorCoded(`The value of an '@language' must be a valid language tag, got '${JSON.stringify(e)}'`,r);return!1}return!0}static validateDirection(e,t){if("string"!=typeof e)throw new i.ErrorCoded(`The value of an '@direction' must be a string, got '${JSON.stringify(e)}'`,i.ERROR_CODES.INVALID_BASE_DIRECTION);if(!a.Util.REGEX_DIRECTION_TAG.test(e)){if(t)throw new i.ErrorCoded(`The value of an '@direction' must be 'ltr' or 'rtl', got '${JSON.stringify(e)}'`,i.ERROR_CODES.INVALID_BASE_DIRECTION);return!1}return!0}idifyReverseTerms(e){for(const t of Object.keys(e)){let r=e[t];if(r&&"object"==typeof r&&r["@reverse"]&&!r["@id"]){if("string"!=typeof r["@reverse"]||a.Util.isValidKeyword(r["@reverse"]))throw new i.ErrorCoded(`Invalid @reverse value, must be absolute IRI or blank node: '${r["@reverse"]}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);r=e[t]=Object.assign(Object.assign({},r),{"@id":r["@reverse"]}),r["@id"]=r["@reverse"],a.Util.isPotentialKeyword(r["@reverse"])?delete r["@reverse"]:r["@reverse"]=!0}}return e}expandPrefixedTerms(e,t,r){const n=e.getContextRaw();for(const o of r||Object.keys(n))if(a.Util.EXPAND_KEYS_BLACKLIST.indexOf(o)<0&&!a.Util.isReservedInternalKeyword(o)){const r=n[o];if(a.Util.isPotentialKeyword(o)&&a.Util.ALIAS_DOMAIN_BLACKLIST.indexOf(o)>=0&&("@type"!==o||"object"==typeof n[o]&&!n[o]["@protected"]&&"@set"!==n[o]["@container"]))throw new i.ErrorCoded(`Keywords can not be aliased to something else.\nTried mapping ${o} to ${JSON.stringify(r)}`,i.ERROR_CODES.KEYWORD_REDEFINITION);if(a.Util.ALIAS_RANGE_BLACKLIST.indexOf(a.Util.getContextValueId(r))>=0)throw new i.ErrorCoded(`Aliasing to certain keywords is not allowed.\nTried mapping ${o} to ${JSON.stringify(r)}`,i.ERROR_CODES.INVALID_KEYWORD_ALIAS);if(r&&a.Util.isPotentialKeyword(a.Util.getContextValueId(r))&&!0===r["@prefix"])throw new i.ErrorCoded(`Tried to use keyword aliases as prefix: '${o}': '${JSON.stringify(r)}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);for(;a.Util.isPrefixValue(n[o]);){const r=n[o];let i=!1;if("string"==typeof r)n[o]=e.expandTerm(r,!0),i=i||r!==n[o];else{const s=r["@id"],c=r["@type"],l=!("@prefix"in r)||a.Util.isValidIri(o);if("@id"in r)null!=s&&"string"==typeof s&&(n[o]=Object.assign(Object.assign({},n[o]),{"@id":e.expandTerm(s,!0)}),i=i||s!==n[o]["@id"]);else if(!a.Util.isPotentialKeyword(o)&&l){const t=e.expandTerm(o,!0);t!==o&&(n[o]=Object.assign(Object.assign({},n[o]),{"@id":t}),i=!0)}if(c&&"string"==typeof c&&"@vocab"!==c&&(!r["@container"]||!r["@container"]["@type"])&&l){let r=e.expandTerm(c,!0);t&&c===r&&(r=e.expandTerm(c,!1)),r!==c&&(i=!0,n[o]=Object.assign(Object.assign({},n[o]),{"@type":r}))}}if(!i)break}}}normalize(e,{processingMode:t,normalizeLanguageTags:r}){if(r||1===t)for(const t of Object.keys(e))if("@language"===t&&"string"==typeof e[t])e[t]=e[t].toLowerCase();else{const r=e[t];if(r&&"object"==typeof r&&"string"==typeof r["@language"]){const n=r["@language"].toLowerCase();n!==r["@language"]&&(e[t]=Object.assign(Object.assign({},r),{"@language":n}))}}}containersToHash(e){for(const t of Object.keys(e)){const r=e[t];if(r&&"object"==typeof r)if("string"==typeof r["@container"])e[t]=Object.assign(Object.assign({},r),{"@container":{[r["@container"]]:!0}});else if(Array.isArray(r["@container"])){const n={};for(const e of r["@container"])n[e]=!0;e[t]=Object.assign(Object.assign({},r),{"@container":n})}}}applyScopedProtected(e,{processingMode:t},r){if(t&&t>=1.1&&e["@protected"]){for(const t of Object.keys(e))if(!a.Util.isReservedInternalKeyword(t)&&!a.Util.isPotentialKeyword(t)&&!a.Util.isTermProtected(e,t)){const n=e[t];n&&"object"==typeof n?"@protected"in e[t]||(e[t]=Object.assign(Object.assign({},e[t]),{"@protected":!0})):(e[t]={"@id":n,"@protected":!0},a.Util.isSimpleTermDefinitionPrefix(n,r)&&(e[t]=Object.assign(Object.assign({},e[t]),{"@prefix":!0})))}delete e["@protected"]}}validateKeywordRedefinitions(e,t,r,n){for(const r of null!=n?n:Object.keys(t))if(a.Util.isTermProtected(e,r)&&("string"==typeof t[r]?t[r]={"@id":t[r],"@protected":!0}:t[r]=Object.assign(Object.assign({},t[r]),{"@protected":!0}),!a.Util.deepEqual(e[r],t[r])))throw new i.ErrorCoded(`Attempted to override the protected keyword ${r} from ${JSON.stringify(a.Util.getContextValueId(e[r]))} to ${JSON.stringify(a.Util.getContextValueId(t[r]))}`,i.ERROR_CODES.PROTECTED_TERM_REDEFINITION)}validate(e,{processingMode:t}){for(const r of Object.keys(e)){if(a.Util.isReservedInternalKeyword(r))continue;if(""===r)throw new i.ErrorCoded(`The empty term is not allowed, got: '${r}': '${JSON.stringify(e[r])}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);const n=e[r],o=typeof n;if(a.Util.isPotentialKeyword(r)){switch(r.substr(1)){case"vocab":if(null!==n&&"string"!==o)throw new i.ErrorCoded(`Found an invalid @vocab IRI: ${n}`,i.ERROR_CODES.INVALID_VOCAB_MAPPING);break;case"base":if(null!==n&&"string"!==o)throw new i.ErrorCoded(`Found an invalid @base IRI: ${e[r]}`,i.ERROR_CODES.INVALID_BASE_IRI);break;case"language":null!==n&&c.validateLanguage(n,!0,i.ERROR_CODES.INVALID_DEFAULT_LANGUAGE);break;case"version":if(null!==n&&"number"!==o)throw new i.ErrorCoded(`Found an invalid @version number: ${n}`,i.ERROR_CODES.INVALID_VERSION_VALUE);break;case"direction":null!==n&&c.validateDirection(n,!0);break;case"propagate":if(1===t)throw new i.ErrorCoded(`Found an illegal @propagate keyword: ${n}`,i.ERROR_CODES.INVALID_CONTEXT_ENTRY);if(null!==n&&"boolean"!==o)throw new i.ErrorCoded(`Found an invalid @propagate value: ${n}`,i.ERROR_CODES.INVALID_PROPAGATE_VALUE)}if(a.Util.isValidKeyword(r)&&a.Util.isValidKeyword(a.Util.getContextValueId(n)))throw new i.ErrorCoded(`Illegal keyword alias in term value, found: '${r}': '${a.Util.getContextValueId(n)}'`,i.ERROR_CODES.KEYWORD_REDEFINITION)}else if(null!==n)switch(o){case"string":if(a.Util.getPrefix(n,e)===r)throw new i.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.CYCLIC_IRI_MAPPING);if(a.Util.isValidIriWeak(r)){if("@type"===n)throw new i.ErrorCoded(`IRIs can not be mapped to @type, found: '${r}': '${n}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(a.Util.isValidIri(n)&&n!==new s.JsonLdContextNormalized(e).expandTerm(r))throw new i.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${r}': '${n}'`,i.ERROR_CODES.INVALID_IRI_MAPPING)}break;case"object":if(!(a.Util.isCompactIri(r)||"@id"in n||("@id"===n["@type"]?e["@base"]:e["@vocab"])))throw new i.ErrorCoded(`Missing @id in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);for(const l of Object.keys(n)){const u=n[l];if(u)switch(l){case"@id":if(a.Util.isValidKeyword(u)&&"@type"!==u&&"@id"!==u&&"@graph"!==u&&"@nest"!==u)throw new i.ErrorCoded(`Illegal keyword alias in term value, found: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(a.Util.isValidIriWeak(r)){if("@type"===u)throw new i.ErrorCoded(`IRIs can not be mapped to @type, found: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(a.Util.isValidIri(u)&&u!==new s.JsonLdContextNormalized(e).expandTerm(r))throw new i.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING)}if("string"!=typeof u)throw new i.ErrorCoded(`Detected non-string @id in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING);if(a.Util.getPrefix(u,e)===r)throw new i.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.CYCLIC_IRI_MAPPING);break;case"@type":if("@type"===n["@container"]&&"@id"!==u&&"@vocab"!==u)throw new i.ErrorCoded(`@container: @type only allows @type: @id or @vocab, but got: '${r}': '${u}'`,i.ERROR_CODES.INVALID_TYPE_MAPPING);if("string"!=typeof u)throw new i.ErrorCoded(`The value of an '@type' must be a string, got '${JSON.stringify(o)}'`,i.ERROR_CODES.INVALID_TYPE_MAPPING);if(!("@id"===u||"@vocab"===u||1!==t&&"@json"===u||1!==t&&"@none"===u||"_"!==u[0]&&a.Util.isValidIri(u)))throw new i.ErrorCoded(`A context @type must be an absolute IRI, found: '${r}': '${u}'`,i.ERROR_CODES.INVALID_TYPE_MAPPING);break;case"@reverse":if("string"==typeof u&&n["@id"]&&n["@id"]!==u)throw new i.ErrorCoded(`Found non-matching @id and @reverse term values in '${r}':'${u}' and '${n["@id"]}'`,i.ERROR_CODES.INVALID_REVERSE_PROPERTY);if("@nest"in n)throw new i.ErrorCoded(`@nest is not allowed in the reverse property '${r}'`,i.ERROR_CODES.INVALID_REVERSE_PROPERTY);break;case"@container":if(1===t&&(Object.keys(u).length>1||a.Util.CONTAINERS_1_0.indexOf(Object.keys(u)[0])<0))throw new i.ErrorCoded(`Invalid term @container for '${r}' ('${Object.keys(u)}') in 1.0, must be only one of ${a.Util.CONTAINERS_1_0.join(", ")}`,i.ERROR_CODES.INVALID_CONTAINER_MAPPING);for(const e of Object.keys(u)){if("@list"===e&&n["@reverse"])throw new i.ErrorCoded(`Term value can not be @container: @list and @reverse at the same time on '${r}'`,i.ERROR_CODES.INVALID_REVERSE_PROPERTY);if(a.Util.CONTAINERS.indexOf(e)<0)throw new i.ErrorCoded(`Invalid term @container for '${r}' ('${e}'), must be one of ${a.Util.CONTAINERS.join(", ")}`,i.ERROR_CODES.INVALID_CONTAINER_MAPPING)}break;case"@language":c.validateLanguage(u,!0,i.ERROR_CODES.INVALID_LANGUAGE_MAPPING);break;case"@direction":c.validateDirection(u,!0);break;case"@prefix":if(null!==u&&"boolean"!=typeof u)throw new i.ErrorCoded(`Found an invalid term @prefix boolean in: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_PREFIX_VALUE);if(!("@id"in n)&&!a.Util.isValidIri(r))throw new i.ErrorCoded(`Invalid @prefix definition for '${r}' ('${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);break;case"@index":if(1===t||!n["@container"]||!n["@container"]["@index"])throw new i.ErrorCoded(`Attempt to add illegal key to value object: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION);break;case"@nest":if(a.Util.isPotentialKeyword(u)&&"@nest"!==u)throw new i.ErrorCoded(`Found an invalid term @nest value in: '${r}': '${JSON.stringify(n)}'`,i.ERROR_CODES.INVALID_NEST_VALUE)}}break;default:throw new i.ErrorCoded(`Found an invalid term value: '${r}': '${n}'`,i.ERROR_CODES.INVALID_TERM_DEFINITION)}}}applyBaseEntry(e,t,r){return"string"==typeof e||(r&&!("@base"in e)&&t.parentContext&&"object"==typeof t.parentContext&&"@base"in t.parentContext&&(e["@base"]=t.parentContext["@base"],t.parentContext["@__baseDocument"]&&(e["@__baseDocument"]=!0)),t.baseIRI&&!t.external&&("@base"in e?null===e["@base"]||"string"!=typeof e["@base"]||a.Util.isValidIri(e["@base"])||(e["@base"]=(0,n.resolve)(e["@base"],t.parentContext&&t.parentContext["@base"]||t.baseIRI)):(e["@base"]=t.baseIRI,e["@__baseDocument"]=!0))),e}normalizeContextIri(e,t){if(!a.Util.isValidIri(e))try{e=(0,n.resolve)(e,t)}catch(t){throw new Error(`Invalid context IRI: ${e}`)}return this.redirectSchemaOrgHttps&&e.startsWith("http://schema.org")&&(e="https://schema.org/"),e}async parseInnerContexts(e,t,r){for(const n of null!=r?r:Object.keys(e)){const r=e[n];if(r&&"object"==typeof r&&"@context"in r&&null!==r["@context"]&&!t.ignoreScopedContexts){if(this.validateContext)try{const i=Object.assign(Object.assign({},e),{[n]:Object.assign({},e[n])});delete i[n]["@context"],await this.parse(r["@context"],Object.assign(Object.assign({},t),{external:!1,parentContext:i,ignoreProtection:!0,ignoreRemoteScopedContexts:!0,ignoreScopedContexts:!0}))}catch(e){throw new i.ErrorCoded(e.message,i.ERROR_CODES.INVALID_SCOPED_CONTEXT)}e[n]=Object.assign(Object.assign({},r),{"@context":(await this.parse(r["@context"],Object.assign(Object.assign({},t),{external:!1,minimalProcessing:!0,ignoreRemoteScopedContexts:!0,parentContext:e}))).getContextRaw()})}}return e}async parse(e,t={},r={}){const{baseIRI:n,parentContext:o,external:l,processingMode:u=c.DEFAULT_PROCESSING_MODE,normalizeLanguageTags:d,ignoreProtection:h,minimalProcessing:f}=t,p=t.remoteContexts||{};if(Object.keys(p).length>=this.remoteContextsDepthLimit)throw new i.ErrorCoded("Detected an overflow in remote context inclusions: "+Object.keys(p),i.ERROR_CODES.CONTEXT_OVERFLOW);if(null==e){if(!h&&o&&a.Util.hasProtectedTerms(o))throw new i.ErrorCoded("Illegal context nullification when terms are protected",i.ERROR_CODES.INVALID_CONTEXT_NULLIFICATION);return new s.JsonLdContextNormalized(this.applyBaseEntry({},t,!1))}if("string"==typeof e){const r=this.normalizeContextIri(e,n),i=this.getOverriddenLoad(r,t);if(i)return new s.JsonLdContextNormalized(i);const o=await this.parse(await this.load(r),Object.assign(Object.assign({},t),{baseIRI:r,external:!0,remoteContexts:Object.assign(Object.assign({},p),{[r]:!0})}));return this.applyBaseEntry(o.getContextRaw(),t,!0),o}if(Array.isArray(e)){const r=[],i=await Promise.all(e.map(((e,i)=>{if("string"==typeof e){const o=this.normalizeContextIri(e,n);r[i]=o;return this.getOverriddenLoad(o,t)||this.load(o)}return e})));if(f)return new s.JsonLdContextNormalized(i);const a=await i.reduce(((e,n,o)=>e.then((e=>this.parse(n,Object.assign(Object.assign({},t),{baseIRI:r[o]||t.baseIRI,external:!!r[o]||t.external,parentContext:e.getContextRaw(),remoteContexts:r[o]?Object.assign(Object.assign({},p),{[r[o]]:!0}):p}),{skipValidation:o=1.1))throw new i.ErrorCoded("Context importing is not supported in JSON-LD 1.0",i.ERROR_CODES.INVALID_CONTEXT_ENTRY);if("string"!=typeof e["@import"])throw new i.ErrorCoded("An @import value must be a string, but got "+typeof e["@import"],i.ERROR_CODES.INVALID_IMPORT_VALUE);p=await this.loadImportContext(this.normalizeContextIri(e["@import"],n)),delete e["@import"]}this.applyScopedProtected(p,{processingMode:u},s.defaultExpandOptions);const g=Object.assign(p,e);this.idifyReverseTerms(g),this.normalize(g,{processingMode:u,normalizeLanguageTags:d}),this.applyScopedProtected(g,{processingMode:u},s.defaultExpandOptions);const y=Object.keys(g),m=[];if("object"==typeof o)for(const e in o)e in g?m.push(e):g[e]=o[e];await this.parseInnerContexts(g,t,y);const v=new s.JsonLdContextNormalized(g);return(g&&g["@version"]||c.DEFAULT_PROCESSING_MODE)>=1.1&&(e["@vocab"]&&"string"==typeof e["@vocab"]||""===e["@vocab"])&&(o&&"@vocab"in o&&e["@vocab"].indexOf(":")<0?g["@vocab"]=o["@vocab"]+e["@vocab"]:(a.Util.isCompactIri(e["@vocab"])||e["@vocab"]in g)&&(g["@vocab"]=v.expandTerm(e["@vocab"],!0))),this.expandPrefixedTerms(v,this.expandContentTypeToBase,y),!h&&o&&u>=1.1&&this.validateKeywordRedefinitions(o,g,s.defaultExpandOptions,m),this.validateContext&&!r.skipValidation&&this.validate(g,{processingMode:u}),v}throw new i.ErrorCoded(`Tried parsing a context that is not a string, array or object, but got ${e}`,i.ERROR_CODES.INVALID_LOCAL_CONTEXT)}async load(e){const t=this.documentCache[e];if(t)return t;let r;try{r=await this.documentLoader.load(e)}catch(t){throw new i.ErrorCoded(`Failed to load remote context ${e}: ${t.message}`,i.ERROR_CODES.LOADING_REMOTE_CONTEXT_FAILED)}if(!("@context"in r))throw new i.ErrorCoded(`Missing @context in remote context at ${e}`,i.ERROR_CODES.INVALID_REMOTE_CONTEXT);return this.documentCache[e]=r["@context"]}getOverriddenLoad(e,t){if(e in(t.remoteContexts||{})){if(t.ignoreRemoteScopedContexts)return e;throw new i.ErrorCoded("Detected a cyclic context inclusion of "+e,i.ERROR_CODES.RECURSIVE_CONTEXT_INCLUSION)}return null}async loadImportContext(e){let t=await this.load(e);if("object"!=typeof t||Array.isArray(t))throw new i.ErrorCoded("An imported context must be a single object: "+e,i.ERROR_CODES.INVALID_REMOTE_CONTEXT);if("@import"in t)throw new i.ErrorCoded("An imported context can not import another context: "+e,i.ERROR_CODES.INVALID_CONTEXT_ENTRY);return t=Object.assign({},t),this.containersToHash(t),t}}c.DEFAULT_PROCESSING_MODE=1.1,t.ContextParser=c},5094:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERROR_CODES=t.ErrorCoded=void 0;class r extends Error{constructor(e,t){super(e),this.code=t}}var n;t.ErrorCoded=r,(n=t.ERROR_CODES||(t.ERROR_CODES={})).COLLIDING_KEYWORDS="colliding keywords",n.CONFLICTING_INDEXES="conflicting indexes",n.CYCLIC_IRI_MAPPING="cyclic IRI mapping",n.INVALID_ID_VALUE="invalid @id value",n.INVALID_INDEX_VALUE="invalid @index value",n.INVALID_NEST_VALUE="invalid @nest value",n.INVALID_PREFIX_VALUE="invalid @prefix value",n.INVALID_PROPAGATE_VALUE="invalid @propagate value",n.INVALID_REVERSE_VALUE="invalid @reverse value",n.INVALID_IMPORT_VALUE="invalid @import value",n.INVALID_VERSION_VALUE="invalid @version value",n.INVALID_BASE_IRI="invalid base IRI",n.INVALID_CONTAINER_MAPPING="invalid container mapping",n.INVALID_CONTEXT_ENTRY="invalid context entry",n.INVALID_CONTEXT_NULLIFICATION="invalid context nullification",n.INVALID_DEFAULT_LANGUAGE="invalid default language",n.INVALID_INCLUDED_VALUE="invalid @included value",n.INVALID_IRI_MAPPING="invalid IRI mapping",n.INVALID_JSON_LITERAL="invalid JSON literal",n.INVALID_KEYWORD_ALIAS="invalid keyword alias",n.INVALID_LANGUAGE_MAP_VALUE="invalid language map value",n.INVALID_LANGUAGE_MAPPING="invalid language mapping",n.INVALID_LANGUAGE_TAGGED_STRING="invalid language-tagged string",n.INVALID_LANGUAGE_TAGGED_VALUE="invalid language-tagged value",n.INVALID_LOCAL_CONTEXT="invalid local context",n.INVALID_REMOTE_CONTEXT="invalid remote context",n.INVALID_REVERSE_PROPERTY="invalid reverse property",n.INVALID_REVERSE_PROPERTY_MAP="invalid reverse property map",n.INVALID_REVERSE_PROPERTY_VALUE="invalid reverse property value",n.INVALID_SCOPED_CONTEXT="invalid scoped context",n.INVALID_SCRIPT_ELEMENT="invalid script element",n.INVALID_SET_OR_LIST_OBJECT="invalid set or list object",n.INVALID_TERM_DEFINITION="invalid term definition",n.INVALID_TYPE_MAPPING="invalid type mapping",n.INVALID_TYPE_VALUE="invalid type value",n.INVALID_TYPED_VALUE="invalid typed value",n.INVALID_VALUE_OBJECT="invalid value object",n.INVALID_VALUE_OBJECT_VALUE="invalid value object value",n.INVALID_VOCAB_MAPPING="invalid vocab mapping",n.IRI_CONFUSED_WITH_PREFIX="IRI confused with prefix",n.KEYWORD_REDEFINITION="keyword redefinition",n.LOADING_DOCUMENT_FAILED="loading document failed",n.LOADING_REMOTE_CONTEXT_FAILED="loading remote context failed",n.MULTIPLE_CONTEXT_LINK_HEADERS="multiple context link headers",n.PROCESSING_MODE_CONFLICT="processing mode conflict",n.PROTECTED_TERM_REDEFINITION="protected term redefinition",n.CONTEXT_OVERFLOW="context overflow",n.INVALID_BASE_DIRECTION="invalid base direction",n.RECURSIVE_CONTEXT_INCLUSION="recursive context inclusion",n.INVALID_STREAMING_KEY_ORDER="invalid streaming key order",n.INVALID_EMBEDDED_NODE="invalid embedded node",n.INVALID_ANNOTATION="invalid annotation"},585:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FetchDocumentLoader=void 0,r(6547);const n=r(5094),i=r(2384),o=r(742);t.FetchDocumentLoader=class{constructor(e){this.fetcher=e}async load(e){const t=await(this.fetcher||fetch)(e,{headers:new Headers({accept:"application/ld+json"})});if(t.ok&&t.headers){let r=t.headers.get("Content-Type");if(r){const e=r.indexOf(";");e>0&&(r=r.substr(0,e))}if("application/ld+json"===r)return await t.json();if(t.headers.has("Link")){let r;if(t.headers.forEach(((t,n)=>{if("link"===n){const n=(0,i.parse)(t);for(const t of n.get("type","application/ld+json"))if("alternate"===t.rel){if(r)throw new Error("Multiple JSON-LD alternate links were found on "+e);r=(0,o.resolve)(t.uri,e)}}})),r)return this.load(r)}throw new n.ErrorCoded(`Unsupported JSON-LD media type ${r}`,n.ERROR_CODES.LOADING_DOCUMENT_FAILED)}throw new Error(t.statusText||`Status code: ${t.status}`)}}},9146:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5086:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5215:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultExpandOptions=t.JsonLdContextNormalized=void 0;const n=r(742),i=r(5094),o=r(4931);t.JsonLdContextNormalized=class{constructor(e){this.contextRaw=e}getContextRaw(){return this.contextRaw}expandTerm(e,r,s=t.defaultExpandOptions){const a=this.contextRaw[e];if(null===a||a&&null===a["@id"])return null;let c=!0;if(a&&r){const t=o.Util.getContextValueId(a);if(t&&t!==e){if("string"==typeof t&&(o.Util.isValidIri(t)||o.Util.isValidKeyword(t)))return t;o.Util.isPotentialKeyword(t)||(c=!1)}}const l=o.Util.getPrefix(e,this.contextRaw),u=this.contextRaw["@vocab"],d=(!!u||""===u)&&u.indexOf(":")<0,h=this.contextRaw["@base"],f=o.Util.isPotentialKeyword(e);if(l){const t=this.contextRaw[l],r=o.Util.getContextValueId(t);if(r){if("string"!=typeof t&&s.allowPrefixForcing){if("_"!==r[0]&&!f&&!t["@prefix"]&&!(e in this.contextRaw))return e}else if(!o.Util.isSimpleTermDefinitionPrefix(r,s))return e;return r+e.substr(l.length+1)}}else{if(r&&(u||""===u||s.allowVocabRelativeToBase&&h&&d)&&!f&&!o.Util.isCompactIri(e)){if(d){if(s.allowVocabRelativeToBase)return(u||h?(0,n.resolve)(u,h):"")+e;throw new i.ErrorCoded(`Relative vocab expansion for term '${e}' with vocab '${u}' is not allowed.`,i.ERROR_CODES.INVALID_VOCAB_MAPPING)}return u+e}if(!r&&h&&!f&&!o.Util.isCompactIri(e))return(0,n.resolve)(e,h)}if(c)return e;throw new i.ErrorCoded(`Invalid IRI mapping found for context entry '${e}': '${JSON.stringify(a)}'`,i.ERROR_CODES.INVALID_IRI_MAPPING)}compactIri(e,t){if(t&&this.contextRaw["@vocab"]&&e.startsWith(this.contextRaw["@vocab"]))return e.substr(this.contextRaw["@vocab"].length);if(!t&&this.contextRaw["@base"]&&e.startsWith(this.contextRaw["@base"]))return e.substr(this.contextRaw["@base"].length);const r={prefix:"",suffix:e};for(const n in this.contextRaw){const i=this.contextRaw[n];if(i&&!o.Util.isPotentialKeyword(n)){const s=o.Util.getContextValueId(i);if(e.startsWith(s)){const i=e.substr(s.length);if(i)i.length0&&!(e&&"#"===e[0])}static getPrefix(e,t){if(e&&"#"===e[0])return null;const r=e.indexOf(":");if(r>=0){if(e.length>r+1&&"/"===e.charAt(r+1)&&"/"===e.charAt(r+2))return null;const n=e.substr(0,r);if("_"===n)return null;if(t[n])return n}return null}static getContextValueId(e){if(null===e||"string"==typeof e)return e;return e["@id"]||null}static isSimpleTermDefinitionPrefix(e,t){return!r.isPotentialKeyword(e)&&(t.allowPrefixNonGenDelims||"string"==typeof e&&("_"===e[0]||r.isPrefixIriEndingWithGenDelim(e)))}static isPotentialKeyword(e){return"string"==typeof e&&r.KEYWORD_REGEX.test(e)}static isPrefixIriEndingWithGenDelim(e){return r.ENDS_WITH_GEN_DELIM.test(e)}static isPrefixValue(e){return e&&("string"==typeof e||e&&"object"==typeof e)}static isValidIri(e){return Boolean(e&&r.IRI_REGEX.test(e))}static isValidIriWeak(e){return!!e&&":"!==e[0]&&r.IRI_REGEX_WEAK.test(e)}static isValidKeyword(e){return r.VALID_KEYWORDS[e]}static isTermProtected(e,t){const r=e[t];return!("string"==typeof r)&&r&&r["@protected"]}static hasProtectedTerms(e){for(const t of Object.keys(e))if(r.isTermProtected(e,t))return!0;return!1}static isReservedInternalKeyword(e){return e.startsWith("@__")}static deepEqual(e,t){const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every((r=>{const n=e[r],i=t[r];return n===i||null!==n&&null!==i&&"object"==typeof n&&"object"==typeof i&&this.deepEqual(n,i)}))}}r.IRI_REGEX=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^ "<>{}|\\\[\]`#]*(#[^#]*)?$/,r.IRI_REGEX_WEAK=/(?::[^:])|\//,r.KEYWORD_REGEX=/^@[a-z]+$/i,r.ENDS_WITH_GEN_DELIM=/[:/?#\[\]@]$/,r.REGEX_LANGUAGE_TAG=/^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/,r.REGEX_DIRECTION_TAG=/^(ltr)|(rtl)$/,r.VALID_KEYWORDS={"@annotation":!0,"@base":!0,"@container":!0,"@context":!0,"@direction":!0,"@graph":!0,"@id":!0,"@import":!0,"@included":!0,"@index":!0,"@json":!0,"@language":!0,"@list":!0,"@nest":!0,"@none":!0,"@prefix":!0,"@propagate":!0,"@protected":!0,"@reverse":!0,"@set":!0,"@type":!0,"@value":!0,"@version":!0,"@vocab":!0},r.EXPAND_KEYS_BLACKLIST=["@base","@vocab","@language","@version","@direction"],r.ALIAS_DOMAIN_BLACKLIST=["@container","@graph","@id","@index","@list","@nest","@none","@prefix","@reverse","@set","@type","@value","@version"],r.ALIAS_RANGE_BLACKLIST=["@context","@preserve"],r.CONTAINERS=["@list","@set","@index","@language","@graph","@id","@type"],r.CONTAINERS_1_0=["@list","@set","@index"],t.Util=r},8690:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(2277),t)},4405:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContextTree=void 0;class r{constructor(){this.subTrees={}}getContext(e){if(e.length>0){const[t,...r]=e,n=this.subTrees[t];if(n){const e=n.getContext(r);if(e)return e.then((({context:e,depth:t})=>({context:e,depth:t+1})))}}return this.context?this.context.then((e=>({context:e,depth:0}))):null}setContext(e,t){if(0===e.length)this.context=t;else{const[n,...i]=e;let o=this.subTrees[n];o||(o=this.subTrees[n]=new r),o.setContext(i,t)}}removeContext(e){this.setContext(e,null)}}t.ContextTree=r},2277:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JsonLdParser=void 0;const n=r(608),i=r(2395),o=r(2225),s=r(9693),a=r(4860),c=r(2386),l=r(6970),u=r(3809),d=r(5998),h=r(5517),f=r(736),p=r(4910),g=r(2036),y=r(6454),m=r(3283),v=r(3099),b=r(888),w=r(2384),_=r(6105);class S extends o.Transform{constructor(e){super({readableObjectMode:!0}),e=e||{},this.options=e,this.parsingContext=new v.ParsingContext(Object.assign({parser:this},e)),this.util=new b.Util({dataFactory:e.dataFactory,parsingContext:this.parsingContext}),this.jsonParser=new n,this.contextJobs=[],this.typeJobs=[],this.contextAwaitingJobs=[],this.lastDepth=0,this.lastKeys=[],this.lastOnValueJob=Promise.resolve(),this.attachJsonParserListeners(),this.on("end",(()=>{void 0!==this.jsonParser.mode&&this.emit("error",new Error("Unclosed document"))}))}static fromHttpResponse(e,t,r,n){let o,s,a=["application/activity+json"];if(n&&n.wellKnownMediaTypes&&(a=n.wellKnownMediaTypes),"application/ld+json"!==t&&!a.includes(t)){if("application/json"!==t&&!t.endsWith("+json"))throw new i.ErrorCoded(`Unsupported JSON-LD media type ${t}`,i.ERROR_CODES.LOADING_DOCUMENT_FAILED);if(r&&r.has("Link")&&r.forEach(((t,r)=>{if("link"===r){const r=(0,w.parse)(t);for(const t of r.get("rel","http://www.w3.org/ns/json-ld#context")){if(o)throw new i.ErrorCoded("Multiple JSON-LD context link headers were found on "+e,i.ERROR_CODES.MULTIPLE_CONTEXT_LINK_HEADERS);o=t.uri}}})),!o&&!(null==n?void 0:n.ignoreMissingContextLinkHeader))throw new i.ErrorCoded(`Missing context link header for media type ${t} on ${e}`,i.ERROR_CODES.LOADING_DOCUMENT_FAILED)}if(r&&r.has("Content-Type")){const e=r.get("Content-Type"),t=/; *profile=([^"]*)/.exec(e);t&&"http://www.w3.org/ns/json-ld#streaming"===t[1]&&(s=!0)}return new S(Object.assign({baseIRI:e,context:o,streamingProfile:s},n||{}))}import(e){if("pipe"in e){e.on("error",(e=>t.emit("error",e)));const t=e.pipe(new S(this.options));return t}{const t=new o.PassThrough({readableObjectMode:!0});e.on("error",(e=>r.emit("error",e))),e.on("data",(e=>t.push(e))),e.on("end",(()=>t.push(null)));const r=t.pipe(new S(this.options));return r}}_transform(e,t,r){this.jsonParser.write(e),this.lastOnValueJob.then((()=>r()),(e=>r(e)))}async newOnValueJob(e,t,r,n){let o=!0;if(n&&r1&&(u=this.parsingContext.validationStack[this.parsingContext.validationStack.length-1].property);for(let t=Math.max(1,this.parsingContext.validationStack.length-1);t=0?this.parsingContext.idStack[e-r-1]:[await this.util.getGraphContainerValue(t,e)];if(o)for(const t of o){this.parsingContext.emittedStack[e]=!0;for(const r of n)this.util.emitQuadChecked(e,i,r.predicate,r.object,t,r.reverse,r.isEmbedded)}else{const r=this.parsingContext.getUnidentifiedGraphBufferSafe(e-await this.util.getDepthOffsetGraph(e,t)-1);for(const e of n)e.reverse?r.push({object:i,predicate:e.predicate,subject:e.object,isEmbedded:e.isEmbedded}):r.push({object:e.object,predicate:e.predicate,subject:i,isEmbedded:e.isEmbedded})}}this.parsingContext.unidentifiedValuesBuffer.splice(e,1),this.parsingContext.literalStack.splice(e,1),this.parsingContext.jsonLiteralStack.splice(e,1)}const o=this.parsingContext.unidentifiedGraphsBuffer[e];if(o){for(const t of r){const r=1!==e||"BlankNode"!==t.termType||this.parsingContext.topLevelProperties?t:this.util.getDefaultGraph();this.parsingContext.emittedStack[e]=!0;for(const t of o)this.parsingContext.emitQuad(e,this.util.dataFactory.quad(t.subject,t.predicate,t.object,r))}this.parsingContext.unidentifiedGraphsBuffer.splice(e,1)}const s=this.parsingContext.annotationsBuffer[e];if(s){s.length>0&&1===e&&this.parsingContext.emitError(new i.ErrorCoded("Annotations can not be made on top-level nodes",i.ERROR_CODES.INVALID_ANNOTATION));const t=this.parsingContext.getAnnotationsBufferSafe(e-1);for(const e of s)t.push(e);delete this.parsingContext.annotationsBuffer[e]}}async validateKey(e,t,r){for(const n of S.ENTRY_HANDLERS)if(await n.validate(this.parsingContext,this.util,e,t,r))return{valid:!0,property:r||n.isPropertyHandler()};return{valid:!1,property:!1}}attachJsonParserListeners(){this.jsonParser.onValue=e=>{const t=this.jsonParser.stack.length,r=new Array(t+1).fill(0).map(((e,r)=>r===t?this.jsonParser.key:this.jsonParser.stack[r].key));if(!this.isParsingContextInner(t)){const n=()=>this.newOnValueJob(r,e,t,!0);if(this.parsingContext.streamingProfile||this.parsingContext.contextTree.getContext(r.slice(0,-1)))this.lastOnValueJob=this.lastOnValueJob.then(n);else if("@context"===r[t]){let e=this.contextJobs[t];e||(e=this.contextJobs[t]=[]),e.push(n)}else this.contextAwaitingJobs.push({job:n,keys:r,depth:t});this.parsingContext.streamingProfile||0!==t||(this.lastOnValueJob=this.lastOnValueJob.then((()=>this.executeBufferedJobs())))}},this.jsonParser.onError=e=>{this.emit("error",e)}}isParsingContextInner(e){for(let t=e;t>0;t--)if("@context"===this.jsonParser.stack[t-1].key)return!0;return!1}async executeBufferedJobs(){for(const e of this.contextJobs)if(e)for(const t of e)await t();this.parsingContext.unaliasedKeywordCacheStack.splice(0);const e=[];for(const t of this.contextAwaitingJobs)"@type"===await this.util.unaliasKeyword(t.keys[t.depth],t.keys,t.depth,!0)||"number"==typeof t.keys[t.depth]&&"@type"===await this.util.unaliasKeyword(t.keys[t.depth-1],t.keys,t.depth-1,!0)?this.typeJobs.push({job:t.job,keys:t.keys.slice(0,t.keys.length-1)}):e.push(t);for(const t of e){if(this.typeJobs.length>0){const e=[],r=[];for(let n=0;ne.keys.length-t.keys.length));for(const e of n)await e.job();const i=r.sort().reverse();for(const e of i)this.typeJobs.splice(e,1)}await t.job()}}}S.DEFAULT_PROCESSING_MODE="1.1",S.ENTRY_HANDLERS=[new s.EntryHandlerArrayValue,new u.EntryHandlerKeywordContext,new h.EntryHandlerKeywordId,new f.EntryHandlerKeywordIncluded,new d.EntryHandlerKeywordGraph,new p.EntryHandlerKeywordNest,new g.EntryHandlerKeywordType,new m.EntryHandlerKeywordValue,new _.EntryHandlerKeywordAnnotation,new a.EntryHandlerContainer,new y.EntryHandlerKeywordUnknownFallback,new l.EntryHandlerPredicate,new c.EntryHandlerInvalidFallback],t.JsonLdParser=S},3099:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ParsingContext=void 0;const n=r(2395),i=r(5094),o=r(4405),s=r(2277);class a{constructor(e){this.contextParser=new n.ContextParser({documentLoader:e.documentLoader,skipValidation:e.skipContextValidation}),this.streamingProfile=!!e.streamingProfile,this.baseIRI=e.baseIRI,this.produceGeneralizedRdf=!!e.produceGeneralizedRdf,this.allowSubjectList=!!e.allowSubjectList,this.processingMode=e.processingMode||s.JsonLdParser.DEFAULT_PROCESSING_MODE,this.strictValues=!!e.strictValues,this.validateValueIndexes=!!e.validateValueIndexes,this.defaultGraph=e.defaultGraph,this.rdfDirection=e.rdfDirection,this.normalizeLanguageTags=e.normalizeLanguageTags,this.streamingProfileAllowOutOfOrderPlainType=e.streamingProfileAllowOutOfOrderPlainType,this.rdfstar=!1!==e.rdfstar,this.rdfstarReverseInEmbedded=e.rdfstarReverseInEmbedded,this.topLevelProperties=!1,this.activeProcessingMode=parseFloat(this.processingMode),this.processingStack=[],this.processingType=[],this.emittedStack=[],this.idStack=[],this.graphStack=[],this.graphContainerTermStack=[],this.listPointerStack=[],this.contextTree=new o.ContextTree,this.literalStack=[],this.validationStack=[],this.unaliasedKeywordCacheStack=[],this.jsonLiteralStack=[],this.unidentifiedValuesBuffer=[],this.unidentifiedGraphsBuffer=[],this.annotationsBuffer=[],this.pendingContainerFlushBuffers=[],this.parser=e.parser,e.context?(this.rootContext=this.parseContext(e.context),this.rootContext.then((e=>this.validateContext(e)))):this.rootContext=Promise.resolve(new n.JsonLdContextNormalized(this.baseIRI?{"@base":this.baseIRI,"@__baseDocument":!0}:{}))}async parseContext(e,t,r){return this.contextParser.parse(e,{baseIRI:this.baseIRI,ignoreProtection:r,normalizeLanguageTags:this.normalizeLanguageTags,parentContext:t,processingMode:this.activeProcessingMode})}validateContext(e){const t=e.getContextRaw()["@version"];if(t){if(this.activeProcessingMode&&t>this.activeProcessingMode)throw new i.ErrorCoded(`Unsupported JSON-LD version '${t}' under active processing mode ${this.activeProcessingMode}.`,i.ERROR_CODES.PROCESSING_MODE_CONFLICT);if(this.activeProcessingMode&&t0&&!1===i.context.getContextRaw()["@propagate"]&&i.depth!==t&&!r);return 0===i.depth&&!1===i.context.getContextRaw()["@propagate"]&&i.depth!==t&&(i.context=new n.JsonLdContextNormalized({})),i}async newOnValueJob(e,t,r,n){await this.parser.newOnValueJob(e,t,r,n)}async handlePendingContainerFlushBuffers(){if(this.pendingContainerFlushBuffers.length>0){for(const e of this.pendingContainerFlushBuffers)await this.parser.flushBuffer(e.depth,e.keys),this.parser.flushStacks(e.depth);return this.pendingContainerFlushBuffers.splice(0,this.pendingContainerFlushBuffers.length),!0}return!1}emitQuad(e,t){1===e&&(this.topLevelProperties=!0),this.parser.push(t)}emitError(e){this.parser.emit("error",e)}emitContext(e){this.parser.emit("context",e)}getUnidentifiedValueBufferSafe(e){let t=this.unidentifiedValuesBuffer[e];return t||(t=[],this.unidentifiedValuesBuffer[e]=t),t}getUnidentifiedGraphBufferSafe(e){let t=this.unidentifiedGraphsBuffer[e];return t||(t=[],this.unidentifiedGraphsBuffer[e]=t),t}getAnnotationsBufferSafe(e){let t=this.annotationsBuffer[e];return t||(t=[],this.annotationsBuffer[e]=t),t}getExpandOptions(){return a.EXPAND_OPTIONS[this.activeProcessingMode]}shiftStack(e,t){const r=this.idStack[e+t];if(r&&(this.idStack[e]=r,this.emittedStack[e]=!0,delete this.idStack[e+t]),this.pendingContainerFlushBuffers.length)for(const r of this.pendingContainerFlushBuffers)r.depth>=e+t&&(r.depth-=t,r.keys.splice(e,t));this.unidentifiedValuesBuffer[e+t]&&(this.unidentifiedValuesBuffer[e]=this.unidentifiedValuesBuffer[e+t],delete this.unidentifiedValuesBuffer[e+t]),this.annotationsBuffer[e+t-1]&&(this.annotationsBuffer[e-1]||(this.annotationsBuffer[e-1]=[]),this.annotationsBuffer[e-1]=[...this.annotationsBuffer[e-1],...this.annotationsBuffer[e+t-1]],delete this.annotationsBuffer[e+t-1])}}a.EXPAND_OPTIONS={1:{allowPrefixForcing:!1,allowPrefixNonGenDelims:!1,allowVocabRelativeToBase:!1},1.1:{allowPrefixForcing:!0,allowPrefixNonGenDelims:!1,allowVocabRelativeToBase:!0}},t.ParsingContext=a},888:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Util=void 0;const n=r(2395),i=r(7793),o=r(4860),s=r(2341);class a{constructor(e){this.parsingContext=e.parsingContext,this.dataFactory=e.dataFactory||new i.DataFactory,this.rdfFirst=this.dataFactory.namedNode(a.RDF+"first"),this.rdfRest=this.dataFactory.namedNode(a.RDF+"rest"),this.rdfNil=this.dataFactory.namedNode(a.RDF+"nil"),this.rdfType=this.dataFactory.namedNode(a.RDF+"type"),this.rdfJson=this.dataFactory.namedNode(a.RDF+"JSON")}static getContextValue(e,t,r,n){const i=e.getContextRaw()[r];if(!i)return n;const o=i[t];return void 0===o?n:o}static getContextValueContainer(e,t){return a.getContextValue(e,"@container",t,{"@set":!0})}static getContextValueType(e,t){const r=a.getContextValue(e,"@type",t,null);return"@none"===r?null:r}static getContextValueLanguage(e,t){return a.getContextValue(e,"@language",t,e.getContextRaw()["@language"]||null)}static getContextValueDirection(e,t){return a.getContextValue(e,"@direction",t,e.getContextRaw()["@direction"]||null)}static isContextValueReverse(e,t){return!!a.getContextValue(e,"@reverse",t,null)}static getContextValueIndex(e,t){return a.getContextValue(e,"@index",t,e.getContextRaw()["@index"]||null)}static isPropertyReverse(e,t,r){return"@reverse"===r!==a.isContextValueReverse(e,t)}static isPropertyInEmbeddedNode(e){return"@id"===e}static isPropertyInAnnotationObject(e){return"@annotation"===e}static isValidIri(e){return null!==e&&n.Util.isValidIri(e)}static isPrefixArray(e,t){if(e.length>t.length)return!1;for(let r=0;r1)throw new n.ErrorCoded(`Found illegal neighbouring entries next to @set for key: '${t}'`,n.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);return[]}if("@list"in r){if(Object.keys(r).length>1)throw new n.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${t}'`,n.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);const e=r["@list"];return Array.isArray(e)?0===e.length?[this.rdfNil]:this.parsingContext.idStack[i+1]||[]:await this.valueToTerm(await this.parsingContext.getContext(o),t,e,i-1,o.slice(0,-1))}if("@reverse"in r&&"boolean"==typeof r["@reverse"])return[];if("@graph"in a.getContextValueContainer(await this.parsingContext.getContext(o),t)){const e=this.parsingContext.graphContainerTermStack[i+1];return e?Object.values(e):[this.dataFactory.blankNode()]}if("@id"in r){if(Object.keys(r).length>1&&(e=await this.parsingContext.getContext(o,0)),"@context"in r&&(e=await this.parsingContext.parseContext(r["@context"],e.getContextRaw())),"@vocab"===r["@type"])return this.nullableTermToArray(this.createVocabOrBaseTerm(e,r["@id"]));{const t=r["@id"];let o;if("object"==typeof t){if(!this.parsingContext.rdfstar)throw new n.ErrorCoded(`Found illegal @id '${r}'`,n.ERROR_CODES.INVALID_ID_VALUE);o=this.parsingContext.idStack[i+1][0]}else o=this.resourceToTerm(e,t);return this.nullableTermToArray(o)}}return this.parsingContext.emittedStack[i+1]||r&&"object"==typeof r&&0===Object.keys(r).length?this.parsingContext.idStack[i+1]||(this.parsingContext.idStack[i+1]=[this.dataFactory.blankNode()]):[];case"string":return this.nullableTermToArray(this.stringValueToTerm(i,await this.getContextSelfOrPropertyScoped(e,t),t,r,null));case"boolean":return this.nullableTermToArray(this.stringValueToTerm(i,await this.getContextSelfOrPropertyScoped(e,t),t,Boolean(r).toString(),this.dataFactory.namedNode(a.XSD_BOOLEAN)));case"number":return this.nullableTermToArray(this.stringValueToTerm(i,await this.getContextSelfOrPropertyScoped(e,t),t,r,this.dataFactory.namedNode(r%1==0&&r<1e21?a.XSD_INTEGER:a.XSD_DOUBLE)));default:return this.parsingContext.emitError(new Error(`Could not determine the RDF type of a ${s}`)),[]}}async getContextSelfOrPropertyScoped(e,t){const r=e.getContextRaw()[t];return r&&"object"==typeof r&&"@context"in r&&(e=await this.parsingContext.parseContext(r,e.getContextRaw(),!0)),e}nullableTermToArray(e){return e?[e]:[]}predicateToTerm(e,t){const r=e.expandTerm(t,!0,this.parsingContext.getExpandOptions());return r?"_"===r[0]&&":"===r[1]?this.parsingContext.produceGeneralizedRdf?this.dataFactory.blankNode(r.substr(2)):null:a.isValidIri(r)?this.dataFactory.namedNode(r):r&&this.parsingContext.strictValues?(this.parsingContext.emitError(new n.ErrorCoded(`Invalid predicate IRI: ${r}`,n.ERROR_CODES.INVALID_IRI_MAPPING)),null):null:null}resourceToTerm(e,t){if(t.startsWith("_:"))return this.dataFactory.blankNode(t.substr(2));const r=e.expandTerm(t,!1,this.parsingContext.getExpandOptions());if(!a.isValidIri(r)){if(!r||!this.parsingContext.strictValues)return null;this.parsingContext.emitError(new Error(`Invalid resource IRI: ${r}`))}return this.dataFactory.namedNode(r)}createVocabOrBaseTerm(e,t){if(t.startsWith("_:"))return this.dataFactory.blankNode(t.substr(2));const r=this.parsingContext.getExpandOptions();let n=e.expandTerm(t,!0,r);if(n===t&&(n=e.expandTerm(t,!1,r)),!a.isValidIri(n)){if(!n||!this.parsingContext.strictValues||n.startsWith("@"))return null;this.parsingContext.emitError(new Error(`Invalid term IRI: ${n}`))}return this.dataFactory.namedNode(n)}intToString(e,t){return"number"==typeof e?Number.isFinite(e)?e%1!=0||t&&t.value===a.XSD_DOUBLE?e.toExponential(15).replace(/(\d)0*e\+?/,"$1E"):Number(e).toString():e>0?"INF":"-INF":e}stringValueToTerm(e,t,r,n,i){const o=a.getContextValueType(t,r);if(o)if("@id"===o){if(!i)return this.resourceToTerm(t,this.intToString(n,i))}else if("@vocab"===o){if(!i)return this.createVocabOrBaseTerm(t,this.intToString(n,i))}else i=this.dataFactory.namedNode(o);if(!i){const o=a.getContextValueLanguage(t,r),s=a.getContextValueDirection(t,r);return s&&this.parsingContext.rdfDirection?this.createLanguageDirectionLiteral(e,this.intToString(n,i),o,s):this.dataFactory.literal(this.intToString(n,i),o)}return this.dataFactory.literal(this.intToString(n,i),i)}createLanguageDirectionLiteral(e,t,r,n){if("i18n-datatype"===this.parsingContext.rdfDirection)return r||(r=""),this.dataFactory.literal(t,this.dataFactory.namedNode(`https://www.w3.org/ns/i18n#${r}_${n}`));{const i=this.dataFactory.blankNode(),o=this.getDefaultGraph();return this.parsingContext.emitQuad(e,this.dataFactory.quad(i,this.dataFactory.namedNode(a.RDF+"value"),this.dataFactory.literal(t),o)),r&&this.parsingContext.emitQuad(e,this.dataFactory.quad(i,this.dataFactory.namedNode(a.RDF+"language"),this.dataFactory.literal(r),o)),this.parsingContext.emitQuad(e,this.dataFactory.quad(i,this.dataFactory.namedNode(a.RDF+"direction"),this.dataFactory.literal(n),o)),i}}valueToJsonString(e){return s(e)}async unaliasKeyword(e,t,r,i,o){if(Number.isInteger(e))return e;if(!i){const e=this.parsingContext.unaliasedKeywordCacheStack[r];if(e)return e}if(!n.Util.isPotentialKeyword(e)){let r=(o=o||await this.parsingContext.getContext(t)).getContextRaw()[e];r&&"object"==typeof r&&(r=r["@id"]),n.Util.isValidKeyword(r)&&(e=r)}return i?e:this.parsingContext.unaliasedKeywordCacheStack[r]=e}async unaliasKeywordParent(e,t){return await this.unaliasKeyword(t>0&&e[t-1],e,t-1)}async unaliasKeywords(e,t,r,n){const i={};for(const o in e)i[await this.unaliasKeyword(o,t,r+1,!0,n)]=e[o];return i}async isLiteral(e,t){for(let r=t;r>=0;r--){if("@annotation"===await this.unaliasKeyword(e[r],e,r))return!1;if(this.parsingContext.literalStack[r]||this.parsingContext.jsonLiteralStack[r])return!0}return!1}async getDepthOffsetGraph(e,t){for(let r=e-1;r>0;r--)if("@graph"===await this.unaliasKeyword(t[r],t,r)){const n=(await o.EntryHandlerContainer.getContainerHandler(this.parsingContext,t,r)).containers;return o.EntryHandlerContainer.isComplexGraphContainer(n)?-1:e-r-1}return-1}validateReverseSubject(e){if("Literal"===e.termType)throw new n.ErrorCoded(`Found illegal literal in subject position: ${e.value}`,n.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE)}getDefaultGraph(){return this.parsingContext.defaultGraph||this.dataFactory.defaultGraph()}async getGraphContainerValue(e,t){let r=this.getDefaultGraph();const{containers:n,depth:i}=await o.EntryHandlerContainer.getContainerHandler(this.parsingContext,e,t);if("@graph"in n){const t=o.EntryHandlerContainer.getContainerGraphIndex(n,i,e),s=this.parsingContext.graphContainerTermStack[i];if(r=s?s[t]:null,!r){let o=null;if("@id"in n){const t=await this.getContainerKey(e[i],e,i);null!==t&&(o=await this.resourceToTerm(await this.parsingContext.getContext(e),t))}o||(o=this.dataFactory.blankNode()),this.parsingContext.graphContainerTermStack[i]||(this.parsingContext.graphContainerTermStack[i]={}),r=this.parsingContext.graphContainerTermStack[i][t]=o}}return r}async getPropertiesDepth(e,t){let r=t;for(let n=t-1;n>0;n--)if("number"!=typeof e[n]){const t=await this.unaliasKeyword(e[n],e,n);if("@reverse"===t)return n;if("@nest"!==t)return r;r=n}return r}async getContainerKey(e,t,r){const n=await this.unaliasKeyword(e,t,r);return"@none"===n?null:n}validateReverseInEmbeddedNode(e,t,r){if(r&&t&&!this.parsingContext.rdfstarReverseInEmbedded)throw new n.ErrorCoded(`Illegal reverse property in embedded node in ${e}`,n.ERROR_CODES.INVALID_EMBEDDED_NODE)}emitQuadChecked(e,t,r,i,o,s,a){let c;if(s?(this.validateReverseSubject(i),c=this.dataFactory.quad(i,r,t,o)):c=this.dataFactory.quad(t,r,i,o),a){if("DefaultGraph"!==c.graph.termType&&(c=this.dataFactory.quad(c.subject,c.predicate,c.object)),this.parsingContext.idStack[e-1])throw new n.ErrorCoded("Illegal multiple properties in an embedded node",n.ERROR_CODES.INVALID_EMBEDDED_NODE);this.parsingContext.idStack[e-1]=[c]}else this.parsingContext.emitQuad(e,c);const l=this.parsingContext.annotationsBuffer[e];if(l){for(const t of l)this.emitAnnotation(e,c,t);delete this.parsingContext.annotationsBuffer[e]}}emitAnnotation(e,t,r){let n;r.reverse?(this.validateReverseSubject(r.object),n=this.dataFactory.quad(r.object,r.predicate,t)):n=this.dataFactory.quad(t,r.predicate,r.object),this.parsingContext.emitQuad(e,n);for(const t of r.nestedAnnotations)this.emitAnnotation(e,n,t)}}a.XSD="http://www.w3.org/2001/XMLSchema#",a.XSD_BOOLEAN=a.XSD+"boolean",a.XSD_INTEGER=a.XSD+"integer",a.XSD_DOUBLE=a.XSD+"double",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",t.Util=a},7986:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerIdentifier=void 0,t.ContainerHandlerIdentifier=class{canCombineWithGraph(){return!0}async handle(e,t,r,n,i,o){let s;if(t.emittedStack[o+1]&&t.idStack[o+1])s=t.idStack[o+1][0];else{const e=null!==await r.getContainerKey(n[o],n,o)?await r.resourceToTerm(await t.getContext(n),n[o]):r.dataFactory.blankNode();if(!e)return void(t.emittedStack[o]=!1);s=e,t.idStack[o+1]=[s]}let a=t.idStack[o];a||(a=t.idStack[o]=[]),a.some((e=>e.equals(s)))||a.push(s),await t.handlePendingContainerFlushBuffers()||(t.emittedStack[o]=!1)}}},1977:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerIndex=void 0;const n=r(2395),i=r(6970),o=r(888);t.ContainerHandlerIndex=class{canCombineWithGraph(){return!0}async handle(e,t,r,s,a,c){if(!Array.isArray(a)){const l="@graph"in e,u=await t.getContext(s),d=s[c-1],h=o.Util.getContextValueIndex(u,d);if(h){if(n.Util.isPotentialKeyword(h))throw new n.ErrorCoded(`Keywords can not be used as @index value, got: ${h}`,n.ERROR_CODES.INVALID_TERM_DEFINITION);if("string"!=typeof h)throw new n.ErrorCoded(`@index values must be strings, got: ${h}`,n.ERROR_CODES.INVALID_TERM_DEFINITION);if("object"!=typeof a){if("@id"!==o.Util.getContextValueType(u,d))throw new n.ErrorCoded(`Property-based index containers require nodes as values or strings with @type: @id, but got: ${a}`,n.ERROR_CODES.INVALID_VALUE_OBJECT);const e=r.resourceToTerm(u,a);e&&(t.idStack[c+1]=[e])}const e=r.createVocabOrBaseTerm(u,h);if(e){const n=await r.valueToTerm(u,h,await r.getContainerKey(s[c],s,c),c,s);if(l){const i=await r.getGraphContainerValue(s,c+1);for(const o of n)t.emitQuad(c,r.dataFactory.quad(i,e,o,r.getDefaultGraph()))}else for(const o of n)await i.EntryHandlerPredicate.handlePredicateObject(t,r,s,c+1,e,o,!1,!1,!1)}}const f=l?2:1;await t.newOnValueJob(s.slice(0,s.length-f),a,c-f,!0),await t.handlePendingContainerFlushBuffers()}t.emittedStack[c]=!1}}},3847:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerLanguage=void 0;const n=r(2395);t.ContainerHandlerLanguage=class{canCombineWithGraph(){return!1}async handle(e,t,r,i,o,s){const a=await r.getContainerKey(i[s],i,s);if(Array.isArray(o))o=o.map((e=>({"@value":e,"@language":a})));else{if("string"!=typeof o)throw new n.ErrorCoded(`Got invalid language map value, got '${JSON.stringify(o)}', but expected string`,n.ERROR_CODES.INVALID_LANGUAGE_MAP_VALUE);o={"@value":o,"@language":a}}await t.newOnValueJob(i.slice(0,i.length-1),o,s-1,!0),t.emittedStack[s]=!1}}},7229:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerHandlerType=void 0;const n=r(6970),i=r(888);t.ContainerHandlerType=class{canCombineWithGraph(){return!1}async handle(e,t,r,o,s,a){if(!Array.isArray(s)){if("string"==typeof s){const e=await t.getContext(o),n="@vocab"===i.Util.getContextValueType(e,o[a-1])?await r.createVocabOrBaseTerm(e,s):await r.resourceToTerm(e,s);if(n){const e={"@id":"NamedNode"===n.termType?n.value:s};await t.newOnValueJob(o.slice(0,o.length-1),e,a-1,!0),t.idStack[a+1]=[n]}}else{const e=!!t.idStack[a+1];e||delete t.idStack[a],await t.newOnValueJob(o.slice(0,o.length-1),s,a-1,!0),e||(t.idStack[a+1]=t.idStack[a])}const e=await r.getContainerKey(o[a],o,a),c=null!==e?r.createVocabOrBaseTerm(await t.getContext(o),e):null;c&&await n.EntryHandlerPredicate.handlePredicateObject(t,r,o,a+1,r.rdfType,c,!1,!1,!1),await t.handlePendingContainerFlushBuffers()}t.emittedStack[a]=!1}}},9693:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerArrayValue=void 0;const n=r(888),i=r(2395);t.EntryHandlerArrayValue=class{isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return this.test(e,t,null,r,n)}async test(e,t,r,n,i){return"number"==typeof n[i]}async handle(e,t,r,i,o,s){let a=await t.unaliasKeywordParent(i,s);if("@list"===a){let r=null,n=0;for(let e=s-2;e>0;e--){const t=i[e];if("string"==typeof t||"number"==typeof t){n=e,r=t;break}}if(null!==r){const a=await t.valueToTerm(await e.getContext(i),r,o,s,i);for(const r of a)await this.handleListElement(e,t,r,o,s,i.slice(0,n),n);0===a.length&&await this.handleListElement(e,t,null,o,s,i.slice(0,n),n)}}else if("@set"===a)await e.newOnValueJob(i.slice(0,-2),o,s-2,!1);else if(void 0!==a&&"@type"!==a){for(let e=s-1;e>0;e--)if("number"!=typeof i[e]){a=await t.unaliasKeyword(i[e],i,e);break}const r=await e.getContext(i.slice(0,-1));if("@list"in n.Util.getContextValueContainer(r,a)){e.emittedStack[s+1]=!0;const r=await t.valueToTerm(await e.getContext(i),a,o,s,i);for(const n of r)await this.handleListElement(e,t,n,o,s,i.slice(0,-1),s-1);0===r.length&&await this.handleListElement(e,t,null,o,s,i.slice(0,-1),s-1)}else e.shiftStack(s,1),await e.newOnValueJob(i.slice(0,-1),o,s-1,!1),e.contextTree.removeContext(i.slice(0,-1))}}async handleListElement(e,t,r,n,o,s,a){let c=e.listPointerStack[o];if(null!==n&&null!==(await t.unaliasKeywords(n,s,o))["@value"]){if(c&&c.value){const r=t.dataFactory.blankNode();e.emitQuad(o,t.dataFactory.quad(c.value,t.rdfRest,r,t.getDefaultGraph())),c.value=r}else{const e=t.dataFactory.blankNode();c={value:e,listRootDepth:a,listId:e}}r&&e.emitQuad(o,t.dataFactory.quad(c.value,t.rdfFirst,r,t.getDefaultGraph()))}else c||(c={listRootDepth:a,listId:t.rdfNil});e.listPointerStack[o]=c,e.rdfstar&&e.annotationsBuffer[o]&&e.emitError(new i.ErrorCoded("Found an illegal annotation inside a list",i.ERROR_CODES.INVALID_ANNOTATION))}}},4860:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerContainer=void 0;const n=r(7986),i=r(1977),o=r(3847),s=r(7229),a=r(888);class c{static isSimpleGraphContainer(e){return"@graph"in e&&("@set"in e&&2===Object.keys(e).length||1===Object.keys(e).length)}static isComplexGraphContainer(e){return"@graph"in e&&("@set"in e&&Object.keys(e).length>2||!("@set"in e)&&Object.keys(e).length>1)}static getContainerGraphIndex(e,t,r){let n=c.isSimpleGraphContainer(e),i="";for(let e=t;e=0;e--)if("number"!=typeof t[e]){const r=a.Util.getContextValue(o,"@container",t[e],!1);if(r&&c.isSimpleGraphContainer(r))return{containers:r,depth:e+1,fallback:!1};const s=a.Util.getContextValue(o,"@container",t[e-1],!1);if(s){const t="@graph"in s;for(const r in c.CONTAINER_HANDLERS)if(s[r])return t?c.CONTAINER_HANDLERS[r].canCombineWithGraph()?{containers:s,depth:e,fallback:!1}:n:i?n:{containers:s,depth:e,fallback:!1};return n}if(i)return n;i=!0}return n}static async isBufferableContainerHandler(e,t,r){const n=await c.getContainerHandler(e,t,r);return!n.fallback&&!("@graph"in n.containers)}isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return!!await this.test(e,t,null,r,n)}async test(e,t,r,n,i){const o=a.Util.getContextValueContainer(await e.getContext(n,2),n[i-1]);for(const e in c.CONTAINER_HANDLERS)if(o[e])return{containers:o,handler:c.CONTAINER_HANDLERS[e]};return null}async handle(e,t,r,n,i,o,s){return s.handler.handle(s.containers,e,t,n,i,o)}}c.CONTAINER_HANDLERS={"@id":new n.ContainerHandlerIdentifier,"@index":new i.ContainerHandlerIndex,"@language":new o.ContainerHandlerLanguage,"@type":new s.ContainerHandlerType},t.EntryHandlerContainer=c},2386:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerInvalidFallback=void 0,t.EntryHandlerInvalidFallback=class{isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return!1}async test(e,t,r,n,i){return!0}async handle(e,t,r,n,i,o){e.emittedStack[o]=!1}}},6970:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerPredicate=void 0;const n=r(2395),i=r(888);class o{static async handlePredicateObject(e,t,r,i,o,s,a,c,l){const u=await t.getPropertiesDepth(r,i),d=await t.getDepthOffsetGraph(i,r),h=i-d,f=e.idStack[u];if(f&&!l)for(const n of f)if(d>=0){const r=e.idStack[h-1];if(r)for(const e of r)t.emitQuadChecked(i,n,o,s,e,a,c);else a?(t.validateReverseSubject(s),e.getUnidentifiedGraphBufferSafe(h-1).push({subject:s,predicate:o,object:n,isEmbedded:c})):e.getUnidentifiedGraphBufferSafe(h-1).push({subject:n,predicate:o,object:s,isEmbedded:c})}else{const e=await t.getGraphContainerValue(r,u);t.emitQuadChecked(i,n,o,s,e,a,c)}else if(a&&t.validateReverseSubject(s),l){if(e.rdfstar){e.idStack[i]&&e.emitError(new n.ErrorCoded(`Found an illegal @id inside an annotation: ${e.idStack[i][0].value}`,n.ERROR_CODES.INVALID_ANNOTATION));for(let o=0;o=0;e--){const t=c[e];t.depth>u&&(l.nestedAnnotations.push(t),c.splice(e,1))}}}else e.getUnidentifiedValueBufferSafe(u).push({predicate:o,object:s,reverse:a,isEmbedded:c})}isPropertyHandler(){return!0}isStackProcessor(){return!0}async validate(e,t,r,n,o){const s=r[n];if(s){const o=await e.getContext(r);if(!e.jsonLiteralStack[n]&&await t.predicateToTerm(o,r[n]))return"@json"===i.Util.getContextValueType(o,s)&&(e.jsonLiteralStack[n+1]=!0),!0}return!1}async test(e,t,r,n,i){return n[i]}async handle(e,t,r,s,a,c,l){const u=s[c],d=await e.getContext(s),h=await t.predicateToTerm(d,r);if(h){const l=await t.valueToTerm(d,r,a,c,s);if(l.length)for(let f of l){let l=await t.unaliasKeywordParent(s,c);const p=i.Util.isPropertyReverse(d,u,l);let g=0;for(;"@reverse"===l||"number"==typeof l;)"number"==typeof l?g++:c--,l=await t.unaliasKeywordParent(s,c-g);const y=i.Util.isPropertyInEmbeddedNode(l);t.validateReverseInEmbeddedNode(r,p,y);const m=i.Util.isPropertyInAnnotationObject(l);if(a){const o="@list"in i.Util.getContextValueContainer(d,r);if(o||a["@list"]){if((o&&!Array.isArray(a)&&!a["@list"]||a["@list"]&&!Array.isArray(a["@list"]))&&f!==t.rdfNil){const r=t.dataFactory.blankNode();e.emitQuad(c,t.dataFactory.quad(r,t.rdfRest,t.rdfNil,t.getDefaultGraph())),e.emitQuad(c,t.dataFactory.quad(r,t.rdfFirst,f,t.getDefaultGraph())),f=r}if(p&&!e.allowSubjectList)throw new n.ErrorCoded(`Found illegal list value in subject position at ${r}`,n.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE)}}await o.handlePredicateObject(e,t,s,c,h,f,p,y,m)}}}}t.EntryHandlerPredicate=o},1548:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeyword=void 0,t.EntryHandlerKeyword=class{constructor(e){this.keyword=e}isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,n,i){return!1}async test(e,t,r,n,i){return r===this.keyword}}},6105:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordAnnotation=void 0;const n=r(1548),i=r(2395);class o extends n.EntryHandlerKeyword{constructor(){super("@annotation")}async handle(e,t,r,n,o,s){("string"==typeof o||"object"==typeof o&&o["@value"])&&e.emitError(new i.ErrorCoded(`Found illegal annotation value: ${JSON.stringify(o)}`,i.ERROR_CODES.INVALID_ANNOTATION))}}t.EntryHandlerKeywordAnnotation=o},3809:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordContext=void 0;const n=r(2395),i=r(1548);class o extends i.EntryHandlerKeyword{constructor(){super("@context")}isStackProcessor(){return!1}async handle(e,t,r,i,o,s){e.streamingProfile&&(e.processingStack[s]||e.processingType[s]||void 0!==e.idStack[s])&&e.emitError(new n.ErrorCoded("Found an out-of-order context, while streaming is enabled.(disable `streamingProfile`)",n.ERROR_CODES.INVALID_STREAMING_KEY_ORDER));const a=e.getContext(i),c=e.parseContext(o,(await a).getContextRaw());e.contextTree.setContext(i.slice(0,-1),c),e.emitContext(o),await e.validateContext(await c)}}t.EntryHandlerKeywordContext=o},5998:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordGraph=void 0;const n=r(1548);class i extends n.EntryHandlerKeyword{constructor(){super("@graph")}async handle(e,t,r,n,i,o){e.graphStack[o+1]=!0}}t.EntryHandlerKeywordGraph=i},5517:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordId=void 0;const n=r(2395),i=r(1548);class o extends i.EntryHandlerKeyword{constructor(){super("@id")}isStackProcessor(){return!1}async handle(e,t,r,i,o,s){if("string"!=typeof o){if(e.rdfstar&&"object"==typeof o){const t=Object.keys(o);1===t.length&&"@id"===t[0]&&e.emitError(new n.ErrorCoded(`Invalid embedded node without property with @id ${o["@id"]}`,n.ERROR_CODES.INVALID_EMBEDDED_NODE))}else e.emitError(new n.ErrorCoded(`Found illegal @id '${o}'`,n.ERROR_CODES.INVALID_ID_VALUE));return}const a=await t.getPropertiesDepth(i,s);if(void 0!==e.idStack[a]&&(e.idStack[a][0].listHead?e.emitError(new n.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${i[s-1]}'`,n.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT)):e.emitError(new n.ErrorCoded(`Found duplicate @ids '${e.idStack[a][0].value}' and '${o}'`,n.ERROR_CODES.COLLIDING_KEYWORDS))),e.rdfstar&&e.annotationsBuffer[s])for(const t of e.annotationsBuffer[s])t.depth===s&&e.emitError(new n.ErrorCoded(`Found an illegal @id inside an annotation: ${o}`,n.ERROR_CODES.INVALID_ANNOTATION));e.idStack[a]=t.nullableTermToArray(await t.resourceToTerm(await e.getContext(i),o))}}t.EntryHandlerKeywordId=o},736:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordIncluded=void 0;const n=r(2395),i=r(1548);class o extends i.EntryHandlerKeyword{constructor(){super("@included")}async handle(e,t,r,i,o,s){"object"!=typeof o&&e.emitError(new n.ErrorCoded(`Found illegal @included '${o}'`,n.ERROR_CODES.INVALID_INCLUDED_VALUE));const a=await t.unaliasKeywords(o,i,s,await e.getContext(i));"@value"in a&&e.emitError(new n.ErrorCoded(`Found an illegal @included @value node '${JSON.stringify(o)}'`,n.ERROR_CODES.INVALID_INCLUDED_VALUE)),"@list"in a&&e.emitError(new n.ErrorCoded(`Found an illegal @included @list node '${JSON.stringify(o)}'`,n.ERROR_CODES.INVALID_INCLUDED_VALUE)),e.emittedStack[s]=!1}}t.EntryHandlerKeywordIncluded=o},4910:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordNest=void 0;const n=r(2395),i=r(1548);class o extends i.EntryHandlerKeyword{constructor(){super("@nest")}async handle(e,t,r,i,o,s){"object"!=typeof o&&e.emitError(new n.ErrorCoded(`Found invalid @nest entry for '${r}': '${o}'`,n.ERROR_CODES.INVALID_NEST_VALUE)),"@value"in await t.unaliasKeywords(o,i,s,await e.getContext(i))&&e.emitError(new n.ErrorCoded(`Found an invalid @value node for '${r}'`,n.ERROR_CODES.INVALID_NEST_VALUE)),e.emittedStack[s]=!1}}t.EntryHandlerKeywordNest=o},2036:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordType=void 0;const n=r(2395),i=r(888),o=r(6970),s=r(1548);class a extends s.EntryHandlerKeyword{constructor(){super("@type")}isStackProcessor(){return!1}async handle(e,t,r,s,a,c){const l=s[c],u=await e.getContext(s),d=t.rdfType,h=await t.unaliasKeywordParent(s,c),f=i.Util.isPropertyReverse(u,l,h),p=i.Util.isPropertyInEmbeddedNode(h);t.validateReverseInEmbeddedNode(r,f,p);const g=i.Util.isPropertyInAnnotationObject(h),y=Array.isArray(a)?a:[a];for(const r of y){"string"!=typeof r&&e.emitError(new n.ErrorCoded(`Found illegal @type '${r}'`,n.ERROR_CODES.INVALID_TYPE_VALUE));const i=t.createVocabOrBaseTerm(u,r);i&&await o.EntryHandlerPredicate.handlePredicateObject(e,t,s,c,d,i,f,p,g)}let m=Promise.resolve(u),v=!1;for(const t of y.sort()){const r=i.Util.getContextValue(u,"@context",t,null);r&&(v=!0,m=m.then((t=>e.parseContext(r,t.getContextRaw()))))}!e.streamingProfile||!v&&e.streamingProfileAllowOutOfOrderPlainType||!e.processingStack[c]&&!e.idStack[c]||e.emitError(new n.ErrorCoded("Found an out-of-order type-scoped context, while streaming is enabled.(disable `streamingProfile`)",n.ERROR_CODES.INVALID_STREAMING_KEY_ORDER)),v&&(m=m.then((e=>!0!==e.getContextRaw()["@propagate"]?new n.JsonLdContextNormalized(Object.assign(Object.assign({},e.getContextRaw()),{"@propagate":!1,"@__propagateFallback":u.getContextRaw()})):e)),e.contextTree.setContext(s.slice(0,s.length-1),m)),e.processingType[c]=!0}}t.EntryHandlerKeywordType=a},6454:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordUnknownFallback=void 0;const n=r(2395);class i{isPropertyHandler(){return!1}isStackProcessor(){return!0}async validate(e,t,r,i,o){const s=await t.unaliasKeyword(r[i],r,i);return!(!n.Util.isPotentialKeyword(s)||!o&&"@list"===s)}async test(e,t,r,i,o){return n.Util.isPotentialKeyword(r)}async handle(e,t,r,o,s,a){const c=i.VALID_KEYWORDS_TYPES[r];void 0!==c?c&&typeof s!==c.type&&e.emitError(new n.ErrorCoded(`Invalid value type for '${r}' with value '${s}'`,c.errorCode)):e.strictValues&&e.emitError(new Error(`Unknown keyword '${r}' with value '${s}'`)),e.emittedStack[a]=!1}}i.VALID_KEYWORDS_TYPES={"@index":{type:"string",errorCode:n.ERROR_CODES.INVALID_INDEX_VALUE},"@list":null,"@reverse":{type:"object",errorCode:n.ERROR_CODES.INVALID_REVERSE_VALUE},"@set":null,"@value":null},t.EntryHandlerKeywordUnknownFallback=i},3283:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EntryHandlerKeywordValue=void 0;const n=r(1548);class i extends n.EntryHandlerKeyword{constructor(){super("@value")}async validate(e,t,r,n,i){const o=r[n];return o&&!e.literalStack[n]&&await this.test(e,t,o,r,n)&&(e.literalStack[n]=!0),super.validate(e,t,r,n,i)}async test(e,t,r,n,i){return"@value"===await t.unaliasKeyword(n[i],n.slice(0,n.length-1),i-1,!0)}async handle(e,t,r,n,i,o){e.literalStack[o]=!0,delete e.unidentifiedValuesBuffer[o],delete e.unidentifiedGraphsBuffer[o],e.emittedStack[o]=!1}}t.EntryHandlerKeywordValue=i},2194:function(e,t,r){"use strict";const{SymbolDispose:n}=r(2057),{AbortError:i,codes:o}=r(54),{isNodeStream:s,isWebStream:a,kControllerErrorFunction:c}=r(9232),l=r(3789),{ERR_INVALID_ARG_TYPE:u}=o;let d;e.exports.addAbortSignal=function(t,r){if((e=>{if("object"!=typeof e||!("aborted"in e))throw new u("signal","AbortSignal",e)})(t),!s(r)&&!a(r))throw new u("stream",["ReadableStream","WritableStream","Stream"],r);return e.exports.addAbortSignalNoValidate(t,r)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const o=s(t)?()=>{t.destroy(new i(void 0,{cause:e.reason}))}:()=>{t[c](new i(void 0,{cause:e.reason}))};if(e.aborted)o();else{d=d||r(6745).addAbortListener;const i=d(e,o);l(t,i[n])}return t}},6442:function(e,t,r){"use strict";const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:s}=r(2057),{Buffer:a}=r(8287),{inspect:c}=r(6745);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return a.alloc(0);const t=a.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(eo.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=a.allocUnsafe(e),r=e;let n=this.head,i=0;do{const a=n.data;if(!(e>a.length)){e===a.length?(o(t,a,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new s(a.buffer,a.byteOffset,e),r-e),this.head=n,n.data=a.slice(e));break}o(t,a,r-e),e-=a.length,++i}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return c(this,{...t,depth:0,customInspect:!1})}}},769:function(e,t,r){"use strict";const{pipeline:n}=r(5783),i=r(399),{destroyer:o}=r(2295),{isNodeStream:s,isReadable:a,isWritable:c,isWebStream:l,isTransformStream:u,isWritableStream:d,isReadableStream:h}=r(9232),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:g}}=r(54),y=r(3789);e.exports=function(...e){if(0===e.length)throw new g("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t])}for(let r=0;r0&&!(c(e[r])||d(e[r])||u(e[r])))throw new p(`streams[${r}]`,t[r],"must be writable")}let r,m,v,b,w;const _=e[0],S=n(e,(function(e){const t=b;b=null,t?t(e):e?w.destroy(e):A||E||w.destroy()})),E=!!(c(_)||d(_)||u(_)),A=!!(a(S)||h(S)||u(S));if(w=new i({writableObjectMode:!(null==_||!_.writableObjectMode),readableObjectMode:!(null==S||!S.readableObjectMode),writable:E,readable:A}),E){if(s(_))w._write=function(e,t,n){_.write(e,t)?n():r=n},w._final=function(e){_.end(),m=e},_.on("drain",(function(){if(r){const e=r;r=null,e()}}));else if(l(_)){const e=(u(_)?_.writable:_).getWriter();w._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n()}catch(e){n(e)}},w._final=async function(t){try{await e.ready,e.close().catch((()=>{})),m=t}catch(e){t(e)}}}const e=u(S)?S.readable:S;y(e,(()=>{if(m){const e=m;m=null,e()}}))}if(A)if(s(S))S.on("readable",(function(){if(v){const e=v;v=null,e()}})),S.on("end",(function(){w.push(null)})),w._read=function(){for(;;){const e=S.read();if(null===e)return void(v=w._read);if(!w.push(e))return}};else if(l(S)){const e=(u(S)?S.readable:S).getReader();w._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!w.push(t))return;if(r)return void w.push(null)}catch{return}}}return w._destroy=function(e,t){e||null===b||(e=new f),v=null,r=null,m=null,null===b?t(e):(b=t,s(S)&&o(S,e))},w}},2295:function(e,t,r){"use strict";const n=r(5606),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:s}=r(54),{Symbol:a}=r(2057),{kIsDestroyed:c,isDestroyed:l,isFinished:u,isServerRequest:d}=r(9232),h=a("kDestroy"),f=a("kConstruct");function p(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function g(e,t,r){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,s=e._writableState;p(t,s,o),s&&(s.closed=!0),o&&(o.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(y,e,t):n.nextTick(m,e)}try{e._destroy(t||null,o)}catch(t){o(t)}}function y(e,t){v(e,t),m(e)}function m(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function v(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function b(e,t,r){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function w(e){let t=!1;function r(r){if(t)return void b(e,null!=r?r:new o);t=!0;const i=e._readableState,s=e._writableState,a=s||i;i&&(i.constructed=!0),s&&(s.constructed=!0),a.destroyed?e.emit(h,r):r?b(e,r,!0):n.nextTick(_,e)}try{e._construct((e=>{n.nextTick(r,e)}))}catch(e){n.nextTick(r,e)}}function _(e){e.emit(f)}function S(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function E(e){e.emit("close")}function A(e,t){e.emit("error",t),n.nextTick(E,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||n.nextTick(w,e)},destroyer:function(e,t){e&&!l(e)&&(t||u(e)||(t=new s),d(e)?(e.socket=null,e.destroy(t)):S(e)?e.abort():S(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(A,e,t):n.nextTick(E,e),e.destroyed||(e[c]=!0))},destroy:function(e,t){const r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(p(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?g(this,e,t):this.once(h,(function(r){g(this,i(r,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:b}},399:function(e,t,r){"use strict";const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:s}=r(2057);e.exports=l;const a=r(5277),c=r(4461);s(l.prototype,a.prototype),s(l,a);{const e=o(c.prototype);for(let t=0;t{d=!1,e&&v(t,e),h(e)})),l._write=function(e,t,i){r.write(e,t)?i():n=i},l._final=function(e){r.end(),i=e},r.on("drain",(function(){if(n){const e=n;n=null,e()}})),r.on("finish",(function(){if(i){const e=i;i=null,e()}}))),u&&(p(t,(e=>{u=!1,e&&v(t,e),h(e)})),t.on("readable",(function(){if(a){const e=a;a=null,e()}})),t.on("end",(function(){l.push(null)})),l._read=function(){for(;;){const e=t.read();if(null===e)return void(a=l._read);if(!l.push(e))return}}),l._destroy=function(e,o){e||null===c||(e=new g),a=null,n=null,i=null,null===c?o(e):(c=o,v(r,e),v(t,e))},l}e.exports=function e(t,r){if(d(t))return t;if(l(t))return P({readable:t});if(u(t))return P({writable:t});if(c(t))return P({writable:!1,readable:!1});if(h(t))return P({readable:w.fromWeb(t)});if(f(t))return P({writable:_.fromWeb(t)});if("function"==typeof t){const{value:e,write:i,final:o,destroy:s}=function(e){let{promise:t,resolve:r}=S();const i=new I,o=i.signal;return{value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:s,cb:a}=await e;if(n.nextTick(a),s)return;if(o.aborted)throw new g(void 0,{cause:o.reason});({promise:t,resolve:r}=S()),yield i}}(),{signal:o}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){const t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(t);if(a(e))return E(x,e,{objectMode:!0,write:i,final:o,destroy:s});const c=null==e?void 0:e.then;if("function"==typeof c){let t;const r=T(c,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{v(t,e)}));return t=new x({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}}))},destroy:s})}throw new m("Iterable, AsyncIterable or AsyncFunction",r,e)}if(R(t))return e(t.arrayBuffer());if(a(t))return E(x,t,{objectMode:!0,writable:!1});if(h(null==t?void 0:t.readable)&&f(null==t?void 0:t.writable))return x.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return P({readable:null!=t&&t.readable?l(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?u(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return T(i,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{v(e,t)})),e=new x({objectMode:!0,writable:!1,read(){}})}throw new y(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},3789:function(e,t,r){const n=r(5606),{AbortError:i,codes:o}=r(54),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_PREMATURE_CLOSE:a}=o,{kEmptyObject:c,once:l}=r(6745),{validateAbortSignal:u,validateFunction:d,validateObject:h,validateBoolean:f}=r(5432),{Promise:p,PromisePrototypeThen:g,SymbolDispose:y}=r(2057),{isClosed:m,isReadable:v,isReadableNodeStream:b,isReadableStream:w,isReadableFinished:_,isReadableErrored:S,isWritable:E,isWritableNodeStream:A,isWritableStream:R,isWritableFinished:I,isWritableErrored:T,isNodeStream:x,willEmitClose:P,kIsClosedPromise:C}=r(9232);let k;const O=()=>{};function F(e,t,o){var f,p;if(2===arguments.length?(o=t,t=c):null==t?t=c:h(t,"options"),d(o,"callback"),u(t.signal,"options.signal"),o=l(o),w(e)||R(e))return function(e,t,o){let s=!1,a=O;if(t.signal)if(a=()=>{s=!0,o.call(e,new i(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(a);else{k=k||r(6745).addAbortListener;const n=k(t.signal,a),i=o;o=l(((...t)=>{n[y](),i.apply(e,t)}))}const c=(...t)=>{s||n.nextTick((()=>o.apply(e,t)))};return g(e[C].promise,c,c),O}(e,t,o);if(!x(e))throw new s("stream",["ReadableStream","WritableStream","Stream"],e);const F=null!==(f=t.readable)&&void 0!==f?f:b(e),N=null!==(p=t.writable)&&void 0!==p?p:A(e),D=e._writableState,L=e._readableState,U=()=>{e.writable||B()};let j=P(e)&&b(e)===F&&A(e)===N,M=I(e,!1);const B=()=>{M=!0,e.destroyed&&(j=!1),(!j||e.readable&&!F)&&(F&&!H||o.call(e))};let H=_(e,!1);const W=()=>{H=!0,e.destroyed&&(j=!1),(!j||e.writable&&!N)&&(N&&!M||o.call(e))},$=t=>{o.call(e,t)};let V=m(e);const K=()=>{V=!0;const t=T(e)||S(e);return t&&"boolean"!=typeof t?o.call(e,t):F&&!H&&b(e,!0)&&!_(e,!1)?o.call(e,new a):!N||M||I(e,!1)?void o.call(e):o.call(e,new a)},J=()=>{V=!0;const t=T(e)||S(e);if(t&&"boolean"!=typeof t)return o.call(e,t);o.call(e)},G=()=>{e.req.on("finish",B)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?N&&!D&&(e.on("end",U),e.on("close",U)):(e.on("complete",B),j||e.on("abort",K),e.req?G():e.on("request",G)),j||"boolean"!=typeof e.aborted||e.on("aborted",K),e.on("end",W),e.on("finish",B),!1!==t.error&&e.on("error",$),e.on("close",K),V?n.nextTick(K):null!=D&&D.errorEmitted||null!=L&&L.errorEmitted?j||n.nextTick(J):(F||j&&!v(e)||!M&&!1!==E(e))&&(N||j&&!E(e)||!H&&!1!==v(e))?L&&e.req&&e.aborted&&n.nextTick(J):n.nextTick(J);const q=()=>{o=O,e.removeListener("aborted",K),e.removeListener("complete",B),e.removeListener("abort",K),e.removeListener("request",G),e.req&&e.req.removeListener("finish",B),e.removeListener("end",U),e.removeListener("close",U),e.removeListener("finish",B),e.removeListener("end",W),e.removeListener("error",$),e.removeListener("close",K)};if(t.signal&&!V){const s=()=>{const r=o;q(),r.call(e,new i(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(s);else{k=k||r(6745).addAbortListener;const n=k(t.signal,s),i=o;o=l(((...t)=>{n[y](),i.apply(e,t)}))}}return q}e.exports=F,e.exports.finished=function(e,t){var r;let n=!1;return null===t&&(t=c),null!==(r=t)&&void 0!==r&&r.cleanup&&(f(t.cleanup,"cleanup"),n=t.cleanup),new p(((r,i)=>{const o=F(e,t,(e=>{n&&o(),e?i(e):r()}))}))}},4181:function(e,t,r){"use strict";const n=r(5606),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:s}=r(2057),{Buffer:a}=r(8287),{ERR_INVALID_ARG_TYPE:c,ERR_STREAM_NULL_VALUES:l}=r(54).codes;e.exports=function(e,t,r){let u,d;if("string"==typeof t||t instanceof a)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});if(t&&t[o])d=!0,u=t[o]();else{if(!t||!t[s])throw new c("iterable",["Iterable"],t);d=!1,u=t[s]()}const h=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;return h._read=function(){f||(f=!0,async function(){for(;;){try{const{value:e,done:t}=d?await u.next():u.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new l;if(h.push(t))continue;f=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){i(async function(e){const t=null!=e,r="function"==typeof u.throw;if(t&&r){const{value:t,done:r}=await u.throw(e);if(await t,r)return}if("function"==typeof u.return){const{value:e}=await u.return();await e}}(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)))},h}},9526:function(e,t,r){"use strict";const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=r(2057),{EventEmitter:o}=r(7007);function s(e){o.call(this,e)}function a(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}i(s.prototype,o.prototype),i(s,o),s.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",c),r.on("close",l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e)}function d(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",c),r.removeListener("close",l),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d)}return a(r,"error",u),a(e,"error",u),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e},e.exports={Stream:s,prependListener:a}},2892:function(e,t,r){"use strict";const n=globalThis.AbortController||r(5568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:a},AbortError:c}=r(54),{validateAbortSignal:l,validateInteger:u,validateObject:d}=r(5432),h=r(2057).Symbol("kWeak"),f=r(2057).Symbol("kResistStopPropagation"),{finished:p}=r(3789),g=r(769),{addAbortSignalNoValidate:y}=r(2194),{isWritable:m,isNodeStream:v}=r(9232),{deprecate:b}=r(6745),{ArrayPrototypePush:w,Boolean:_,MathFloor:S,Number:E,NumberIsNaN:A,Promise:R,PromiseReject:I,PromiseResolve:T,PromisePrototypeThen:x,Symbol:P}=r(2057),C=P("kEmpty"),k=P("kEof");function O(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal");let n=1;null!=(null==t?void 0:t.concurrency)&&(n=S(t.concurrency));let i=n-1;return null!=(null==t?void 0:t.highWaterMark)&&(i=S(t.highWaterMark)),u(n,"options.concurrency",1),u(i,"options.highWaterMark",0),i+=n,async function*(){const o=r(6745).AbortSignalAny([null==t?void 0:t.signal].filter(_)),s=this,a=[],l={signal:o};let u,d,h=!1,f=0;function p(){h=!0,g()}function g(){f-=1,y()}function y(){d&&!h&&f=i||f>=n)&&await new R((e=>{d=e}))}a.push(k)}catch(e){const t=I(e);x(t,g,p),a.push(t)}finally{h=!0,u&&(u(),u=null)}}();try{for(;;){for(;a.length>0;){const e=await a[0];if(e===k)return;if(o.aborted)throw new c;e!==C&&(yield e),a.shift(),y()}await new R((e=>{u=e}))}}finally{h=!0,d&&(d(),d=null)}}.call(this)}async function F(e,t=void 0){for await(const r of N.call(this,e,t))return!0;return!1}function N(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return O.call(this,(async function(t,r){return await e(t,r)?t:C}),t)}class D extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function L(e){if(e=E(e),A(e))return 0;if(e<0)throw new a("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:b((function(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new c({cause:e.signal.reason});yield[t++,n]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=L(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new c;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new c;e--<=0&&(yield r)}}.call(this)},filter:N,flatMap:function(e,t){const r=O.call(this,e,t);return async function*(){for await(const e of r)yield*e}.call(this)},map:O,take:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=L(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new c;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new c;if(e-- >0&&(yield r),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),v(e)&&!m(e))throw new i("stream",e,"must be writable");const r=g(this,e);return null!=t&&t.signal&&y(t.signal,r),r}},e.exports.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return!await F.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);for await(const r of O.call(this,(async function(t,r){return await e(t,r),C}),t));},reduce:async function(e,t,r){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=r&&d(r,"options"),null!=(null==r?void 0:r.signal)&&l(r.signal,"options.signal");let s=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new c(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await p(this.destroy(e)),e}const a=new n,u=a.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this,[f]:!0};r.signal.addEventListener("abort",(()=>a.abort()),e)}let g=!1;try{for await(const n of this){var y;if(g=!0,null!=r&&null!==(y=r.signal)&&void 0!==y&&y.aborted)throw new c;s?t=await e(t,n,{signal:u}):(t=n,s=!0)}if(!g&&!s)throw new D}finally{a.abort()}return t},toArray:async function(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new c(void 0,{cause:e.signal.reason});w(t,n)}return t},some:F,find:async function(e,t){for await(const r of N.call(this,e,t))return r}}},2163:function(e,t,r){"use strict";const{ObjectSetPrototypeOf:n}=r(2057);e.exports=o;const i=r(97);function o(e){if(!(this instanceof o))return new o(e);i.call(this,e)}n(o.prototype,i.prototype),n(o,i),o.prototype._transform=function(e,t,r){r(null,e)}},5783:function(e,t,r){const n=r(5606),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:s,SymbolDispose:a}=r(2057),c=r(3789),{once:l}=r(6745),u=r(2295),d=r(399),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:g,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:v}=r(54),{validateFunction:b,validateAbortSignal:w}=r(5432),{isIterable:_,isReadable:S,isReadableNodeStream:E,isNodeStream:A,isTransformStream:R,isWebStream:I,isReadableStream:T,isReadableFinished:x}=r(9232),P=globalThis.AbortController||r(5568).AbortController;let C,k,O;function F(e,t,r){let n=!1;return e.on("close",(()=>{n=!0})),{destroy:t=>{n||(n=!0,u.destroyer(e,t||new y("pipe")))},cleanup:c(e,{readable:t,writable:r},(e=>{n=!e}))}}function N(e){if(_(e))return e;if(E(e))return async function*(e){k||(k=r(5277)),yield*k.prototype[s].call(e)}(e);throw new f("val",["Readable","Iterable","AsyncIterable"],e)}async function D(e,t,r,{end:n}){let i,s=null;const a=e=>{if(e&&(i=e),s){const e=s;s=null,e()}},l=()=>new o(((e,t)=>{i?t(i):s=()=>{i?t(i):e()}}));t.on("drain",a);const u=c(t,{readable:!1},a);try{t.writableNeedDrain&&await l();for await(const r of e)t.write(r)||await l();n&&(t.end(),await l()),r()}catch(e){r(i!==e?h(i,e):e)}finally{u(),t.off("drain",a)}}async function L(e,t,r,{end:n}){R(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r()}catch(e){try{await i.abort(e),r(e)}catch(e){r(e)}}}function U(e,t,o){if(1===e.length&&i(e[0])&&(e=e[0]),e.length<2)throw new g("streams");const s=new P,c=s.signal,l=null==o?void 0:o.signal,u=[];function h(){B(new v)}let y,m,b;w(l,"options.signal"),O=O||r(6745).addAbortListener,l&&(y=O(l,h));const x=[];let k,U=0;function M(e){B(e,0==--U)}function B(e,r){var i;if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||r){for(;x.length;)x.shift()(m);null===(i=y)||void 0===i||i[a](),s.abort(),r&&(m||u.forEach((e=>e())),n.nextTick(t,m,b))}}for(let V=0;V0,q=J||!1!==(null==o?void 0:o.end),z=V===e.length-1;if(A(K)){if(q){const{destroy:Y,cleanup:Q}=F(K,J,G);x.push(Y),S(K)&&z&&u.push(Q)}function H(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&M(e)}K.on("error",H),S(K)&&z&&u.push((()=>{K.removeListener("error",H)}))}if(0===V)if("function"==typeof K){if(k=K({signal:c}),!_(k))throw new p("Iterable, AsyncIterable or Stream","source",k)}else k=_(K)||E(K)||R(K)?K:d.from(K);else if("function"==typeof K){var W;if(k=R(k)?N(null===(W=k)||void 0===W?void 0:W.readable):N(k),k=K(k,{signal:c}),J){if(!_(k,!0))throw new p("AsyncIterable",`transform[${V-1}]`,k)}else{var $;C||(C=r(2163));const X=new C({objectMode:!0}),Z=null===($=k)||void 0===$?void 0:$.then;if("function"==typeof Z)U++,Z.call(k,(e=>{b=e,null!=e&&X.write(e),q&&X.end(),n.nextTick(M)}),(e=>{X.destroy(e),n.nextTick(M,e)}));else if(_(k,!0))U++,D(k,X,M,{end:q});else{if(!T(k)&&!R(k))throw new p("AsyncIterable or Promise","destination",k);{const re=k.readable||k;U++,D(re,X,M,{end:q})}}k=X;const{destroy:ee,cleanup:te}=F(k,!1,!0);x.push(ee),z&&u.push(te)}}else if(A(K)){if(E(k)){U+=2;const ne=j(k,K,M,{end:q});S(K)&&z&&u.push(ne)}else if(R(k)||T(k)){const ie=k.readable||k;U++,D(ie,K,M,{end:q})}else{if(!_(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);U++,D(k,K,M,{end:q})}k=K}else if(I(K)){if(E(k))U++,L(N(k),K,M,{end:q});else if(T(k)||_(k))U++,L(k,K,M,{end:q});else{if(!R(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);U++,L(k.readable,K,M,{end:q})}k=K}else k=d.from(K)}return(null!=c&&c.aborted||null!=l&&l.aborted)&&n.nextTick(h),k}function j(e,t,r,{end:i}){let o=!1;if(t.on("close",(()=>{o||r(new m)})),e.pipe(t,{end:!1}),i){function s(){o=!0,t.end()}x(e)?n.nextTick(s):e.once("end",s)}else r();return c(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t)})),c(t,{readable:!1,writable:!0},r)}e.exports={pipelineImpl:U,pipeline:function(...e){return U(e,l(function(e){return b(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},5277:function(e,t,r){const n=r(5606),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:s,NumberParseInt:a,ObjectDefineProperties:c,ObjectKeys:l,ObjectSetPrototypeOf:u,Promise:d,SafeSet:h,SymbolAsyncDispose:f,SymbolAsyncIterator:p,Symbol:g}=r(2057);e.exports=G,G.ReadableState=J;const{EventEmitter:y}=r(7007),{Stream:m,prependListener:v}=r(9526),{Buffer:b}=r(8287),{addAbortSignal:w}=r(2194),_=r(3789);let S=r(6745).debuglog("stream",(e=>{S=e}));const E=r(6442),A=r(2295),{getHighWaterMark:R,getDefaultHighWaterMark:I}=r(936),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:P,ERR_OUT_OF_RANGE:C,ERR_STREAM_PUSH_AFTER_EOF:k,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:O},AbortError:F}=r(54),{validateObject:N}=r(5432),D=g("kPaused"),{StringDecoder:L}=r(704),U=r(4181);u(G.prototype,m.prototype),u(G,m);const j=()=>{},{errorOrDestroy:M}=A,B=1,H=16,W=32,$=2048,V=4096;function K(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function J(e,t,n){"boolean"!=typeof n&&(n=t instanceof r(399)),this.state=$|V|H|W,e&&e.objectMode&&(this.state|=B),n&&e&&e.readableObjectMode&&(this.state|=B),this.highWaterMark=e?R(this,e,"readableHighWaterMark",n):I(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this[D]=null,e&&!1===e.emitClose&&(this.state&=~$),e&&!1===e.autoDestroy&&(this.state&=~V),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new L(e.encoding),this.encoding=e.encoding)}function G(e){if(!(this instanceof G))return new G(e);const t=this instanceof r(399);this._readableState=new J(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&w(e.signal,this)),m.call(this,e),A.construct(this,(()=>{this._readableState.needReadable&&Z(this,this._readableState)}))}function q(e,t,r,n){S("readableAddChunk",t);const i=e._readableState;let o;if(i.state&B||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=b.from(t,r).toString(i.encoding):(t=b.from(t,r),r=""))):t instanceof b?r="":m._isUint8Array(t)?(t=m._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new x("chunk",["string","Buffer","Uint8Array"],t))),o)M(e,o);else if(null===t)i.state&=-9,function(e,t){if(S("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?Q(e):(t.needReadable=!1,t.emittedReadable=!0,X(e))}}(e,i);else if(i.state&B||t&&t.length>0)if(n)if(4&i.state)M(e,new O);else{if(i.destroyed||i.errored)return!1;z(e,i,t,!0)}else if(i.ended)M(e,new k);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?z(e,i,t,!1):Z(e,i)):z(e,i,t,!1)}else n||(i.state&=-9,Z(e,i));return!i.ended&&(i.length0?(65536&t.state?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),64&t.state&&Q(e)),Z(e,t)}function Y(e,t){return e<=0||0===t.length&&t.ended?0:t.state&B?1:s(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function Q(e){const t=e._readableState;S("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(X,e))}function X(e){const t=e._readableState;S("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ie(e)}function Z(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(ee,e,t))}function ee(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!1===t[D]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function re(e){S("readable nexttick read 0"),e.read(0)}function ne(e,t){S("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ie(e),t.flowing&&!t.reading&&e.read(0)}function ie(e){const t=e._readableState;for(S("flow",t.flowing);t.flowing&&null!==e.read(););}function oe(e,t){"function"!=typeof e.read&&(e=G.wrap(e,{objectMode:!0}));const r=async function*(e,t){let r,n=j;function i(t){this===e?(n(),n=j):n=t}e.on("readable",i);const o=_(e,{writable:!1},(e=>{r=e?T(r,e):null,n(),n=j}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(r)throw r;if(null===r)return;await new d(i)}}}catch(e){throw r=T(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):A.destroyer(e,null)}}(e,t);return r.stream=e,r}function se(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ae(e){const t=e._readableState;S("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(ce,t,e))}function ce(e,t){if(S("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(le,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function le(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ue;function de(){return void 0===ue&&(ue={}),ue}c(J.prototype,{objectMode:K(B),ended:K(2),endEmitted:K(4),reading:K(8),constructed:K(H),sync:K(W),needReadable:K(64),emittedReadable:K(128),readableListening:K(256),resumeScheduled:K(512),errorEmitted:K(1024),emitClose:K($),autoDestroy:K(V),destroyed:K(8192),closed:K(16384),closeEmitted:K(32768),multiAwaitDrain:K(65536),readingMore:K(1<<17),dataEmitted:K(1<<18)}),G.prototype.destroy=A.destroy,G.prototype._undestroy=A.undestroy,G.prototype._destroy=function(e,t){t(e)},G.prototype[y.captureRejectionSymbol]=function(e){this.destroy(e)},G.prototype[f]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new F,this.destroy(e)),new d(((t,r)=>_(this,(n=>n&&n!==e?r(n):t(null)))))},G.prototype.push=function(e,t){return q(this,e,t,!1)},G.prototype.unshift=function(e,t){return q(this,e,t,!0)},G.prototype.isPaused=function(){const e=this._readableState;return!0===e[D]||!1===e.flowing},G.prototype.setEncoding=function(e){const t=new L(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this},G.prototype.read=function(e){S("read",e),void 0===e?e=NaN:o(e)||(e=a(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new C("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return S("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ae(this):Q(this),null;if(0===(e=Y(e,t))&&t.ended)return 0===t.length&&ae(this),null;let n,i=!!(64&t.state);if(S("need readable",i),(0===t.length||t.length-e0?se(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ae(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},G.prototype._read=function(e){throw new P("_read()")},G.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===n.stdout||e===n.stderr?g:s;function s(){S("onend"),e.end()}let a;i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",(function t(n,o){S("onunpipe"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,S("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),a&&e.removeListener("drain",a),e.removeListener("error",d),e.removeListener("unpipe",t),r.removeListener("end",s),r.removeListener("end",g),r.removeListener("data",u),c=!0,a&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&a())}));let c=!1;function l(){c||(1===i.pipes.length&&i.pipes[0]===e?(S("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),a||(a=function(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(S("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(S("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(r,e),e.on("drain",a))}function u(t){S("ondata");const r=e.write(t);S("dest.write",r),!1===r&&l()}function d(t){if(S("onerror",t),g(),e.removeListener("error",d),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?M(e,t):e.emit("error",t)}}function f(){e.removeListener("finish",p),g()}function p(){S("onfinish"),e.removeListener("close",f),g()}function g(){S("unpipe"),r.unpipe(e)}return r.on("data",u),v(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",r),!0===e.writableNeedDrain?l():i.flowing||(S("pipe resume"),r.resume()),e},G.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S("on readable",i.length,i.reading),i.length?Q(this):i.reading||n.nextTick(re,this))),r},G.prototype.addListener=G.prototype.on,G.prototype.removeListener=function(e,t){const r=m.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(te,this),r},G.prototype.off=G.prototype.removeListener,G.prototype.removeAllListeners=function(e){const t=m.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(te,this),t},G.prototype.resume=function(){const e=this._readableState;return e.flowing||(S("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ne,e,t))}(this,e)),e[D]=!1,this},G.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[D]=!0,this},G.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{M(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const r=l(e);for(let t=1;t{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e())}))}function d(){this._final!==u&&u.call(this)}l.prototype._final=u,l.prototype._transform=function(e,t,r){throw new o("_transform()")},l.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length{const e=this._writableState;e.writing||W(this,e),V(this,e)}))}function D(e,t,r,i){const o=e._writableState;if("function"==typeof r)i=r,r=o.defaultEncoding;else{if(r){if("buffer"!==r&&!g.isEncoding(r))throw new x(r)}else r=o.defaultEncoding;"function"!=typeof i&&(i=C)}if(null===t)throw new I;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=g.from(t,r),r="buffer");else if(t instanceof g)r="buffer";else{if(!p._isUint8Array(t))throw new w("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),r="buffer"}let s;return o.ending?s=new T:o.destroyed&&(s=new A("write")),s?(n.nextTick(i,s),P(e,s,!0),s):(o.pendingcb++,function(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const s=t.lengthr.bufferedIndex&&W(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},n.nextTick(M,r.afterWriteTickInfo)):B(e,r,1,o))):P(e,new S)}function M({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,B(e,t,r,n)}function B(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&H(t),V(e,t)}function H(e){if(e.writing)return;for(let r=e.bufferedIndex;r1&&e._writev){t.pendingcb-=s-1;const n=t.allNoop?C:e=>{for(let t=a;t256?(r.splice(0,a),t.bufferedIndex=0):t.bufferedIndex=a}t.bufferProcessing=!1}function $(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function V(e,t,r){$(t)&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let r=!1;function i(i){if(r)P(e,null!=i?i:S());else if(r=!0,t.pendingcb--,i){const r=t[k].splice(0);for(let e=0;e{$(t)?K(e,t):t.pendingcb--}),e,t)):$(t)&&(t.pendingcb++,K(e,t))))}function K(e,t){t.pendingcb--,t.finished=!0;const r=t[k].splice(0);for(let e=0;e{if("number"!=typeof e)throw new b(t,"number",e);if(!a(e))throw new _(t,"an integer",e);if(en)throw new _(t,`>= ${r} && <= ${n}`,e)})),P=m(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new b(t,"number",e);if(!a(e))throw new _(t,"an integer",e);if(en)throw new _(t,`>= ${r} && <= ${n}`,e)})),C=m(((e,t,r=!1)=>{if("number"!=typeof e)throw new b(t,"number",e);if(!a(e))throw new _(t,"an integer",e);const n=r?1:0,i=4294967295;if(ei)throw new _(t,`>= ${n} && <= ${i}`,e)}));function k(e,t){if("string"!=typeof e)throw new b(t,"string",e)}const O=m(((e,t,r)=>{if(!i(r,e)){const n=o(s(r,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new w(t,e,"must be one of: "+n)}}));function F(e,t){if("boolean"!=typeof e)throw new b(t,"boolean",e)}function N(e,t,r){return null!=e&&h(e,t)?e[t]:r}const D=m(((e,t,r=null)=>{const i=N(r,"allowArray",!1),o=N(r,"allowFunction",!1);if(!N(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new b(t,"Object",e)})),L=m(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new b(t,"a dictionary",e)})),U=m(((e,t,r=0)=>{if(!n(e))throw new b(t,"Array",e);if(e.length{if(!R(e))throw new b(t,["Buffer","TypedArray","DataView"],e)})),M=m(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new b(t,"AbortSignal",e)})),B=m(((e,t)=>{if("function"!=typeof e)throw new b(t,"Function",e)})),H=m(((e,t)=>{if("function"!=typeof e||A(e))throw new b(t,"Function",e)})),W=m(((e,t)=>{if(void 0!==e)throw new b(t,"undefined",e)})),$=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function V(e,t){if(void 0===e||!f($,e))throw new w(t,e,'must be an array or string of format "; rel=preload; as=style"')}e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===f(T,e))throw new w(t,e,"must be a 32-bit unsigned integer or an octal string");e=d(e,8)}return C(e,t),e},validateArray:U,validateStringArray:function(e,t){U(e,t);for(let r=0;rn||(null!=r||null!=n)&&c(e))throw new _(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)},validateObject:D,validateOneOf:O,validatePlainFunction:H,validatePort:function(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new v(t,e,r);return 0|e},validateSignalName:function(e,t="signal"){if(k(e,t),void 0===I[e]){if(void 0!==I[g(e)])throw new S(e+" (signals must use all capital letters)");throw new S(e)}},validateString:k,validateUint32:C,validateUndefined:W,validateUnion:function(e,t,r){if(!i(r,e))throw new b(t,`('${o(r,"|")}')`,e)},validateAbortSignal:M,validateLinkHeaderValue:function(e){if("string"==typeof e)return V(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n; rel=preload; as=style"')}}},2225:function(e,t,r){"use strict";const n=r(6897),i=r(7698),o=n.Readable.destroy;e.exports=n.Readable,e.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,e.exports._isUint8Array=n._isUint8Array,e.exports.isDisturbed=n.isDisturbed,e.exports.isErrored=n.isErrored,e.exports.isReadable=n.isReadable,e.exports.Readable=n.Readable,e.exports.Writable=n.Writable,e.exports.Duplex=n.Duplex,e.exports.Transform=n.Transform,e.exports.PassThrough=n.PassThrough,e.exports.addAbortSignal=n.addAbortSignal,e.exports.finished=n.finished,e.exports.destroy=n.destroy,e.exports.destroy=o,e.exports.pipeline=n.pipeline,e.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get(){return i}}),e.exports.Stream=n.Stream,e.exports.default=e.exports},54:function(e,t,r){"use strict";const{format:n,inspect:i,AggregateError:o}=r(6745),s=globalThis.AggregateError||o,a=Symbol("kIsNodeError"),c=["string","function","number","object","Function","Object","boolean","bigint","symbol"],l=/^([A-Z][a-z0-9]*)+$/,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function f(e,t,r){r||(r=Error);class i extends r{constructor(...r){super(function(e,t,r){if("function"==typeof t)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}(e,t,r))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[a]=!0,u[e]=i}function p(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class g extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new u.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}f("ERR_ASSERTION","%s",Error),f("ERR_INVALID_ARG_TYPE",((e,t,r)=>{d("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const o=[],s=[],a=[];for(const e of t)d("string"==typeof e,"All expected entries have to be of type string"),c.includes(e)?o.push(e.toLowerCase()):l.test(e)?s.push(e):(d("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(s.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),s.push("Object"))}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`}}(s.length>0||a.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+=`an instance of ${s[0]}`;break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`an instance of ${s.join(", ")}, or ${e}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`one of ${a.join(", ")}, or ${e}`}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var u;null!==(u=r.constructor)&&void 0!==u&&u.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`}else{let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`}return n}),TypeError),f("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),f("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return`Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),f("ERR_MISSING_ARGS",((...e)=>{let t;d(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}}return`${t} must be specified`}),TypeError),f("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return d(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=h(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=h(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),f("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),f("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),f("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),f("ERR_STREAM_WRITE_AFTER_END","write after end",Error),f("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:g,aggregateTwoErrors:p((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new s([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:p,codes:u}},2057:function(e){"use strict";e.exports={ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,r){return e.slice(t,r)},Error:Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,r){return Object.defineProperty(e,t,r)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise:Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,r){return e.then(t,r)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String:String,StringPrototypeSlice(e,t,r){return e.slice(t,r)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(e,t,r){return e.set(t,r)},Boolean:Boolean,Uint8Array:Uint8Array}},6745:function(e,t,r){"use strict";const n=r(8287),{kResistStopPropagation:i,SymbolDispose:o}=r(2057),s=globalThis.AbortSignal||r(5568).AbortSignal,a=globalThis.AbortController||r(5568).AbortController,c=Object.getPrototypeOf((async function(){})).constructor,l=globalThis.Blob||n.Blob,u=void 0!==l?function(e){return e instanceof l}:function(e){return!1},d=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class h extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r{e=r,t=n})),resolve:e,reject:t}},promisify(e){return new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)))}))},debuglog(){return function(){}},format(e,...t){return e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return"f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()}))},inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction(e){return e instanceof c},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:u,deprecate(e,t){return e},addAbortListener:r(7007).addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let r;return d(e,"signal"),(e=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE("listener","Function",e)})(t),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[i]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[o](){var e;null===(e=r)||void 0===e||e()}}},AbortSignalAny:s.any||function(e){if(1===e.length)return e[0];const t=new a,r=()=>t.abort();return e.forEach((e=>{d(e,"signals"),e.addEventListener("abort",r,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",r)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},6897:function(e,t,r){const{Buffer:n}=r(8287),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:s}=r(2057),{promisify:{custom:a}}=r(6745),{streamReturningOperators:c,promiseReturningOperators:l}=r(2892),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=r(54),d=r(769),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:f}=r(936),{pipeline:p}=r(5783),{destroyer:g}=r(2295),y=r(3789),m=r(7698),v=r(9232),b=e.exports=r(9526).Stream;b.isDestroyed=v.isDestroyed,b.isDisturbed=v.isDisturbed,b.isErrored=v.isErrored,b.isReadable=v.isReadable,b.isWritable=v.isWritable,b.Readable=r(5277);for(const S of o(c)){const E=c[S];function w(...e){if(new.target)throw u();return b.Readable.from(s(E,this,e))}i(w,"name",{__proto__:null,value:E.name}),i(w,"length",{__proto__:null,value:E.length}),i(b.Readable.prototype,S,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}for(const A of o(l)){const R=l[A];function w(...e){if(new.target)throw u();return s(R,this,e)}i(w,"name",{__proto__:null,value:R.name}),i(w,"length",{__proto__:null,value:R.length}),i(b.Readable.prototype,A,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}b.Writable=r(4461),b.Duplex=r(399),b.Transform=r(97),b.PassThrough=r(2163),b.pipeline=p;const{addAbortSignal:_}=r(2194);b.addAbortSignal=_,b.finished=y,b.destroy=g,b.compose=d,b.setDefaultHighWaterMark=h,b.getDefaultHighWaterMark=f,i(b,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return m}}),i(p,a,{__proto__:null,enumerable:!0,get(){return m.pipeline}}),i(y,a,{__proto__:null,enumerable:!0,get(){return m.finished}}),b.Stream=b,b._isUint8Array=function(e){return e instanceof Uint8Array},b._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}},7698:function(e,t,r){"use strict";const{ArrayPrototypePop:n,Promise:i}=r(2057),{isIterable:o,isNodeStream:s,isWebStream:a}=r(9232),{pipelineImpl:c}=r(5783),{finished:l}=r(3789);r(6897),e.exports={finished:l,pipeline:function(...e){return new i(((t,r)=>{let i,l;const u=e[e.length-1];if(u&&"object"==typeof u&&!s(u)&&!o(u)&&!a(u)){const t=n(e);i=t.signal,l=t.end}c(e,((e,n)=>{e?r(e):t(n)}),{signal:i,end:l})}))}}},8572:function(e,t,r){var n=r(8287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},704:function(e,t,r){"use strict";var n=r(8572).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=d,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},810:function(e,t,r){"use strict";const{SymbolDispose:n}=r(4641),{AbortError:i,codes:o}=r(8526),{isNodeStream:s,isWebStream:a,kControllerErrorFunction:c}=r(136),l=r(9365),{ERR_INVALID_ARG_TYPE:u}=o;let d;e.exports.addAbortSignal=function(t,r){if((e=>{if("object"!=typeof e||!("aborted"in e))throw new u("signal","AbortSignal",e)})(t),!s(r)&&!a(r))throw new u("stream",["ReadableStream","WritableStream","Stream"],r);return e.exports.addAbortSignalNoValidate(t,r)},e.exports.addAbortSignalNoValidate=function(e,t){if("object"!=typeof e||!("aborted"in e))return t;const o=s(t)?()=>{t.destroy(new i(void 0,{cause:e.reason}))}:()=>{t[c](new i(void 0,{cause:e.reason}))};if(e.aborted)o();else{d=d||r(6017).addAbortListener;const i=d(e,o);l(t,i[n])}return t}},5586:function(e,t,r){"use strict";const{StringPrototypeSlice:n,SymbolIterator:i,TypedArrayPrototypeSet:o,Uint8Array:s}=r(4641),{Buffer:a}=r(8287),{inspect:c}=r(6017);e.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return a.alloc(0);const t=a.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)o(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(eo.length)){e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(o,0,e),this.head=r,r.data=n(o,e));break}t+=o,e-=o.length,++i}while(null!==(r=r.next));return this.length-=i,t}_getBuffer(e){const t=a.allocUnsafe(e),r=e;let n=this.head,i=0;do{const a=n.data;if(!(e>a.length)){e===a.length?(o(t,a,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(o(t,new s(a.buffer,a.byteOffset,e),r-e),this.head=n,n.data=a.slice(e));break}o(t,a,r-e),e-=a.length,++i}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return c(this,{...t,depth:0,customInspect:!1})}}},8489:function(e,t,r){"use strict";const{pipeline:n}=r(8431),i=r(3559),{destroyer:o}=r(7647),{isNodeStream:s,isReadable:a,isWritable:c,isWebStream:l,isTransformStream:u,isWritableStream:d,isReadableStream:h}=r(136),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:g}}=r(8526),y=r(9365);e.exports=function(...e){if(0===e.length)throw new g("streams");if(1===e.length)return i.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t])}for(let r=0;r0&&!(c(e[r])||d(e[r])||u(e[r])))throw new p(`streams[${r}]`,t[r],"must be writable")}let r,m,v,b,w;const _=e[0],S=n(e,(function(e){const t=b;b=null,t?t(e):e?w.destroy(e):A||E||w.destroy()})),E=!!(c(_)||d(_)||u(_)),A=!!(a(S)||h(S)||u(S));if(w=new i({writableObjectMode:!(null==_||!_.writableObjectMode),readableObjectMode:!(null==S||!S.readableObjectMode),writable:E,readable:A}),E){if(s(_))w._write=function(e,t,n){_.write(e,t)?n():r=n},w._final=function(e){_.end(),m=e},_.on("drain",(function(){if(r){const e=r;r=null,e()}}));else if(l(_)){const e=(u(_)?_.writable:_).getWriter();w._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n()}catch(e){n(e)}},w._final=async function(t){try{await e.ready,e.close().catch((()=>{})),m=t}catch(e){t(e)}}}const e=u(S)?S.readable:S;y(e,(()=>{if(m){const e=m;m=null,e()}}))}if(A)if(s(S))S.on("readable",(function(){if(v){const e=v;v=null,e()}})),S.on("end",(function(){w.push(null)})),w._read=function(){for(;;){const e=S.read();if(null===e)return void(v=w._read);if(!w.push(e))return}};else if(l(S)){const e=(u(S)?S.readable:S).getReader();w._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!w.push(t))return;if(r)return void w.push(null)}catch{return}}}return w._destroy=function(e,t){e||null===b||(e=new f),v=null,r=null,m=null,null===b?t(e):(b=t,s(S)&&o(S,e))},w}},7647:function(e,t,r){"use strict";const n=r(5606),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:o},AbortError:s}=r(8526),{Symbol:a}=r(4641),{kIsDestroyed:c,isDestroyed:l,isFinished:u,isServerRequest:d}=r(136),h=a("kDestroy"),f=a("kConstruct");function p(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function g(e,t,r){let i=!1;function o(t){if(i)return;i=!0;const o=e._readableState,s=e._writableState;p(t,s,o),s&&(s.closed=!0),o&&(o.closed=!0),"function"==typeof r&&r(t),t?n.nextTick(y,e,t):n.nextTick(m,e)}try{e._destroy(t||null,o)}catch(t){o(t)}}function y(e,t){v(e,t),m(e)}function m(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function v(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function b(e,t,r){const i=e._readableState,o=e._writableState;if(null!=o&&o.destroyed||null!=i&&i.destroyed)return this;null!=i&&i.autoDestroy||null!=o&&o.autoDestroy?e.destroy(t):t&&(t.stack,o&&!o.errored&&(o.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function w(e){let t=!1;function r(r){if(t)return void b(e,null!=r?r:new o);t=!0;const i=e._readableState,s=e._writableState,a=s||i;i&&(i.constructed=!0),s&&(s.constructed=!0),a.destroyed?e.emit(h,r):r?b(e,r,!0):n.nextTick(_,e)}try{e._construct((e=>{n.nextTick(r,e)}))}catch(e){n.nextTick(r,e)}}function _(e){e.emit(f)}function S(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function E(e){e.emit("close")}function A(e,t){e.emit("error",t),n.nextTick(E,e)}e.exports={construct:function(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),e.listenerCount(f)>1||n.nextTick(w,e)},destroyer:function(e,t){e&&!l(e)&&(t||u(e)||(t=new s),d(e)?(e.socket=null,e.destroy(t)):S(e)?e.abort():S(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?n.nextTick(A,e,t):n.nextTick(E,e),e.destroyed||(e[c]=!0))},destroy:function(e,t){const r=this._readableState,n=this._writableState,o=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(p(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),o.constructed?g(this,e,t):this.once(h,(function(r){g(this,i(r,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:b}},3559:function(e,t,r){"use strict";const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:o,ObjectSetPrototypeOf:s}=r(4641);e.exports=l;const a=r(3125),c=r(7221);s(l.prototype,a.prototype),s(l,a);{const e=o(c.prototype);for(let t=0;t{d=!1,e&&v(t,e),h(e)})),l._write=function(e,t,i){r.write(e,t)?i():n=i},l._final=function(e){r.end(),i=e},r.on("drain",(function(){if(n){const e=n;n=null,e()}})),r.on("finish",(function(){if(i){const e=i;i=null,e()}}))),u&&(p(t,(e=>{u=!1,e&&v(t,e),h(e)})),t.on("readable",(function(){if(a){const e=a;a=null,e()}})),t.on("end",(function(){l.push(null)})),l._read=function(){for(;;){const e=t.read();if(null===e)return void(a=l._read);if(!l.push(e))return}}),l._destroy=function(e,o){e||null===c||(e=new g),a=null,n=null,i=null,null===c?o(e):(c=o,v(r,e),v(t,e))},l}e.exports=function e(t,r){if(d(t))return t;if(l(t))return P({readable:t});if(u(t))return P({writable:t});if(c(t))return P({writable:!1,readable:!1});if(h(t))return P({readable:w.fromWeb(t)});if(f(t))return P({writable:_.fromWeb(t)});if("function"==typeof t){const{value:e,write:i,final:o,destroy:s}=function(e){let{promise:t,resolve:r}=S();const i=new I,o=i.signal;return{value:e(async function*(){for(;;){const e=t;t=null;const{chunk:i,done:s,cb:a}=await e;if(n.nextTick(a),s)return;if(o.aborted)throw new g(void 0,{cause:o.reason});({promise:t,resolve:r}=S()),yield i}}(),{signal:o}),write(e,t,n){const i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){const t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(t);if(a(e))return E(x,e,{objectMode:!0,write:i,final:o,destroy:s});const c=null==e?void 0:e.then;if("function"==typeof c){let t;const r=T(c,e,(e=>{if(null!=e)throw new m("nully","body",e)}),(e=>{v(t,e)}));return t=new x({objectMode:!0,readable:!1,write:i,final(e){o((async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}}))},destroy:s})}throw new m("Iterable, AsyncIterable or AsyncFunction",r,e)}if(R(t))return e(t.arrayBuffer());if(a(t))return E(x,t,{objectMode:!0,writable:!1});if(h(null==t?void 0:t.readable)&&f(null==t?void 0:t.writable))return x.fromWeb(t);if("object"==typeof(null==t?void 0:t.writable)||"object"==typeof(null==t?void 0:t.readable))return P({readable:null!=t&&t.readable?l(null==t?void 0:t.readable)?null==t?void 0:t.readable:e(t.readable):void 0,writable:null!=t&&t.writable?u(null==t?void 0:t.writable)?null==t?void 0:t.writable:e(t.writable):void 0});const i=null==t?void 0:t.then;if("function"==typeof i){let e;return T(i,t,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{v(e,t)})),e=new x({objectMode:!0,writable:!1,read(){}})}throw new y(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],t)}},9365:function(e,t,r){const n=r(5606),{AbortError:i,codes:o}=r(8526),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_PREMATURE_CLOSE:a}=o,{kEmptyObject:c,once:l}=r(6017),{validateAbortSignal:u,validateFunction:d,validateObject:h,validateBoolean:f}=r(2224),{Promise:p,PromisePrototypeThen:g,SymbolDispose:y}=r(4641),{isClosed:m,isReadable:v,isReadableNodeStream:b,isReadableStream:w,isReadableFinished:_,isReadableErrored:S,isWritable:E,isWritableNodeStream:A,isWritableStream:R,isWritableFinished:I,isWritableErrored:T,isNodeStream:x,willEmitClose:P,kIsClosedPromise:C}=r(136);let k;const O=()=>{};function F(e,t,o){var f,p;if(2===arguments.length?(o=t,t=c):null==t?t=c:h(t,"options"),d(o,"callback"),u(t.signal,"options.signal"),o=l(o),w(e)||R(e))return function(e,t,o){let s=!1,a=O;if(t.signal)if(a=()=>{s=!0,o.call(e,new i(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(a);else{k=k||r(6017).addAbortListener;const n=k(t.signal,a),i=o;o=l(((...t)=>{n[y](),i.apply(e,t)}))}const c=(...t)=>{s||n.nextTick((()=>o.apply(e,t)))};return g(e[C].promise,c,c),O}(e,t,o);if(!x(e))throw new s("stream",["ReadableStream","WritableStream","Stream"],e);const F=null!==(f=t.readable)&&void 0!==f?f:b(e),N=null!==(p=t.writable)&&void 0!==p?p:A(e),D=e._writableState,L=e._readableState,U=()=>{e.writable||B()};let j=P(e)&&b(e)===F&&A(e)===N,M=I(e,!1);const B=()=>{M=!0,e.destroyed&&(j=!1),(!j||e.readable&&!F)&&(F&&!H||o.call(e))};let H=_(e,!1);const W=()=>{H=!0,e.destroyed&&(j=!1),(!j||e.writable&&!N)&&(N&&!M||o.call(e))},$=t=>{o.call(e,t)};let V=m(e);const K=()=>{V=!0;const t=T(e)||S(e);return t&&"boolean"!=typeof t?o.call(e,t):F&&!H&&b(e,!0)&&!_(e,!1)?o.call(e,new a):!N||M||I(e,!1)?void o.call(e):o.call(e,new a)},J=()=>{V=!0;const t=T(e)||S(e);if(t&&"boolean"!=typeof t)return o.call(e,t);o.call(e)},G=()=>{e.req.on("finish",B)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?N&&!D&&(e.on("end",U),e.on("close",U)):(e.on("complete",B),j||e.on("abort",K),e.req?G():e.on("request",G)),j||"boolean"!=typeof e.aborted||e.on("aborted",K),e.on("end",W),e.on("finish",B),!1!==t.error&&e.on("error",$),e.on("close",K),V?n.nextTick(K):null!=D&&D.errorEmitted||null!=L&&L.errorEmitted?j||n.nextTick(J):(F||j&&!v(e)||!M&&!1!==E(e))&&(N||j&&!E(e)||!H&&!1!==v(e))?L&&e.req&&e.aborted&&n.nextTick(J):n.nextTick(J);const q=()=>{o=O,e.removeListener("aborted",K),e.removeListener("complete",B),e.removeListener("abort",K),e.removeListener("request",G),e.req&&e.req.removeListener("finish",B),e.removeListener("end",U),e.removeListener("close",U),e.removeListener("finish",B),e.removeListener("end",W),e.removeListener("error",$),e.removeListener("close",K)};if(t.signal&&!V){const s=()=>{const r=o;q(),r.call(e,new i(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(s);else{k=k||r(6017).addAbortListener;const n=k(t.signal,s),i=o;o=l(((...t)=>{n[y](),i.apply(e,t)}))}}return q}e.exports=F,e.exports.finished=function(e,t){var r;let n=!1;return null===t&&(t=c),null!==(r=t)&&void 0!==r&&r.cleanup&&(f(t.cleanup,"cleanup"),n=t.cleanup),new p(((r,i)=>{const o=F(e,t,(e=>{n&&o(),e?i(e):r()}))}))}},333:function(e,t,r){"use strict";const n=r(5606),{PromisePrototypeThen:i,SymbolAsyncIterator:o,SymbolIterator:s}=r(4641),{Buffer:a}=r(8287),{ERR_INVALID_ARG_TYPE:c,ERR_STREAM_NULL_VALUES:l}=r(8526).codes;e.exports=function(e,t,r){let u,d;if("string"==typeof t||t instanceof a)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});if(t&&t[o])d=!0,u=t[o]();else{if(!t||!t[s])throw new c("iterable",["Iterable"],t);d=!1,u=t[s]()}const h=new e({objectMode:!0,highWaterMark:1,...r});let f=!1;return h._read=function(){f||(f=!0,async function(){for(;;){try{const{value:e,done:t}=d?await u.next():u.next();if(t)h.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw f=!1,new l;if(h.push(t))continue;f=!1}}catch(e){h.destroy(e)}break}}())},h._destroy=function(e,t){i(async function(e){const t=null!=e,r="function"==typeof u.throw;if(t&&r){const{value:t,done:r}=await u.throw(e);if(await t,r)return}if("function"==typeof u.return){const{value:e}=await u.return();await e}}(e),(()=>n.nextTick(t,e)),(r=>n.nextTick(t,r||e)))},h}},334:function(e,t,r){"use strict";const{ArrayIsArray:n,ObjectSetPrototypeOf:i}=r(4641),{EventEmitter:o}=r(7007);function s(e){o.call(this,e)}function a(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}i(s.prototype,o.prototype),i(s,o),s.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",c),r.on("close",l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,"function"==typeof e.destroy&&e.destroy())}function u(e){d(),0===o.listenerCount(this,"error")&&this.emit("error",e)}function d(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",c),r.removeListener("close",l),r.removeListener("error",u),e.removeListener("error",u),r.removeListener("end",d),r.removeListener("close",d),e.removeListener("close",d)}return a(r,"error",u),a(e,"error",u),r.on("end",d),r.on("close",d),e.on("close",d),e.emit("pipe",r),e},e.exports={Stream:s,prependListener:a}},1284:function(e,t,r){"use strict";const n=globalThis.AbortController||r(5568).AbortController,{codes:{ERR_INVALID_ARG_VALUE:i,ERR_INVALID_ARG_TYPE:o,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:a},AbortError:c}=r(8526),{validateAbortSignal:l,validateInteger:u,validateObject:d}=r(2224),h=r(4641).Symbol("kWeak"),f=r(4641).Symbol("kResistStopPropagation"),{finished:p}=r(9365),g=r(8489),{addAbortSignalNoValidate:y}=r(810),{isWritable:m,isNodeStream:v}=r(136),{deprecate:b}=r(6017),{ArrayPrototypePush:w,Boolean:_,MathFloor:S,Number:E,NumberIsNaN:A,Promise:R,PromiseReject:I,PromiseResolve:T,PromisePrototypeThen:x,Symbol:P}=r(4641),C=P("kEmpty"),k=P("kEof");function O(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal");let n=1;null!=(null==t?void 0:t.concurrency)&&(n=S(t.concurrency));let i=n-1;return null!=(null==t?void 0:t.highWaterMark)&&(i=S(t.highWaterMark)),u(n,"options.concurrency",1),u(i,"options.highWaterMark",0),i+=n,async function*(){const o=r(6017).AbortSignalAny([null==t?void 0:t.signal].filter(_)),s=this,a=[],l={signal:o};let u,d,h=!1,f=0;function p(){h=!0,g()}function g(){f-=1,y()}function y(){d&&!h&&f=i||f>=n)&&await new R((e=>{d=e}))}a.push(k)}catch(e){const t=I(e);x(t,g,p),a.push(t)}finally{h=!0,u&&(u(),u=null)}}();try{for(;;){for(;a.length>0;){const e=await a[0];if(e===k)return;if(o.aborted)throw new c;e!==C&&(yield e),a.shift(),y()}await new R((e=>{u=e}))}}finally{h=!0,d&&(d(),d=null)}}.call(this)}async function F(e,t=void 0){for await(const r of N.call(this,e,t))return!0;return!1}function N(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return O.call(this,(async function(t,r){return await e(t,r)?t:C}),t)}class D extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function L(e){if(e=E(e),A(e))return 0;if(e<0)throw new a("number",">= 0",e);return e}e.exports.streamReturningOperators={asIndexedPairs:b((function(e=void 0){return null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new c({cause:e.signal.reason});yield[t++,n]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=L(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new c;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new c;e--<=0&&(yield r)}}.call(this)},filter:N,flatMap:function(e,t){const r=O.call(this,e,t);return async function*(){for await(const e of r)yield*e}.call(this)},map:O,take:function(e,t=void 0){return null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),e=L(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new c;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new c;if(e-- >0&&(yield r),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&d(t,"options"),null!=(null==t?void 0:t.signal)&&l(t.signal,"options.signal"),v(e)&&!m(e))throw new i("stream",e,"must be writable");const r=g(this,e);return null!=t&&t.signal&&y(t.signal,r),r}},e.exports.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);return!await F.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new o("fn",["Function","AsyncFunction"],e);for await(const r of O.call(this,(async function(t,r){return await e(t,r),C}),t));},reduce:async function(e,t,r){var i;if("function"!=typeof e)throw new o("reducer",["Function","AsyncFunction"],e);null!=r&&d(r,"options"),null!=(null==r?void 0:r.signal)&&l(r.signal,"options.signal");let s=arguments.length>1;if(null!=r&&null!==(i=r.signal)&&void 0!==i&&i.aborted){const e=new c(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await p(this.destroy(e)),e}const a=new n,u=a.signal;if(null!=r&&r.signal){const e={once:!0,[h]:this,[f]:!0};r.signal.addEventListener("abort",(()=>a.abort()),e)}let g=!1;try{for await(const n of this){var y;if(g=!0,null!=r&&null!==(y=r.signal)&&void 0!==y&&y.aborted)throw new c;s?t=await e(t,n,{signal:u}):(t=n,s=!0)}if(!g&&!s)throw new D}finally{a.abort()}return t},toArray:async function(e){null!=e&&d(e,"options"),null!=(null==e?void 0:e.signal)&&l(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new c(void 0,{cause:e.signal.reason});w(t,n)}return t},some:F,find:async function(e,t){for await(const r of N.call(this,e,t))return r}}},2091:function(e,t,r){"use strict";const{ObjectSetPrototypeOf:n}=r(4641);e.exports=o;const i=r(8649);function o(e){if(!(this instanceof o))return new o(e);i.call(this,e)}n(o.prototype,i.prototype),n(o,i),o.prototype._transform=function(e,t,r){r(null,e)}},8431:function(e,t,r){const n=r(5606),{ArrayIsArray:i,Promise:o,SymbolAsyncIterator:s,SymbolDispose:a}=r(4641),c=r(9365),{once:l}=r(6017),u=r(7647),d=r(3559),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:g,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:v}=r(8526),{validateFunction:b,validateAbortSignal:w}=r(2224),{isIterable:_,isReadable:S,isReadableNodeStream:E,isNodeStream:A,isTransformStream:R,isWebStream:I,isReadableStream:T,isReadableFinished:x}=r(136),P=globalThis.AbortController||r(5568).AbortController;let C,k,O;function F(e,t,r){let n=!1;return e.on("close",(()=>{n=!0})),{destroy:t=>{n||(n=!0,u.destroyer(e,t||new y("pipe")))},cleanup:c(e,{readable:t,writable:r},(e=>{n=!e}))}}function N(e){if(_(e))return e;if(E(e))return async function*(e){k||(k=r(3125)),yield*k.prototype[s].call(e)}(e);throw new f("val",["Readable","Iterable","AsyncIterable"],e)}async function D(e,t,r,{end:n}){let i,s=null;const a=e=>{if(e&&(i=e),s){const e=s;s=null,e()}},l=()=>new o(((e,t)=>{i?t(i):s=()=>{i?t(i):e()}}));t.on("drain",a);const u=c(t,{readable:!1},a);try{t.writableNeedDrain&&await l();for await(const r of e)t.write(r)||await l();n&&(t.end(),await l()),r()}catch(e){r(i!==e?h(i,e):e)}finally{u(),t.off("drain",a)}}async function L(e,t,r,{end:n}){R(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r()}catch(e){try{await i.abort(e),r(e)}catch(e){r(e)}}}function U(e,t,o){if(1===e.length&&i(e[0])&&(e=e[0]),e.length<2)throw new g("streams");const s=new P,c=s.signal,l=null==o?void 0:o.signal,u=[];function h(){B(new v)}let y,m,b;w(l,"options.signal"),O=O||r(6017).addAbortListener,l&&(y=O(l,h));const x=[];let k,U=0;function M(e){B(e,0==--U)}function B(e,r){var i;if(!e||m&&"ERR_STREAM_PREMATURE_CLOSE"!==m.code||(m=e),m||r){for(;x.length;)x.shift()(m);null===(i=y)||void 0===i||i[a](),s.abort(),r&&(m||u.forEach((e=>e())),n.nextTick(t,m,b))}}for(let V=0;V0,q=J||!1!==(null==o?void 0:o.end),z=V===e.length-1;if(A(K)){if(q){const{destroy:Y,cleanup:Q}=F(K,J,G);x.push(Y),S(K)&&z&&u.push(Q)}function H(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&M(e)}K.on("error",H),S(K)&&z&&u.push((()=>{K.removeListener("error",H)}))}if(0===V)if("function"==typeof K){if(k=K({signal:c}),!_(k))throw new p("Iterable, AsyncIterable or Stream","source",k)}else k=_(K)||E(K)||R(K)?K:d.from(K);else if("function"==typeof K){var W;if(k=R(k)?N(null===(W=k)||void 0===W?void 0:W.readable):N(k),k=K(k,{signal:c}),J){if(!_(k,!0))throw new p("AsyncIterable",`transform[${V-1}]`,k)}else{var $;C||(C=r(2091));const X=new C({objectMode:!0}),Z=null===($=k)||void 0===$?void 0:$.then;if("function"==typeof Z)U++,Z.call(k,(e=>{b=e,null!=e&&X.write(e),q&&X.end(),n.nextTick(M)}),(e=>{X.destroy(e),n.nextTick(M,e)}));else if(_(k,!0))U++,D(k,X,M,{end:q});else{if(!T(k)&&!R(k))throw new p("AsyncIterable or Promise","destination",k);{const re=k.readable||k;U++,D(re,X,M,{end:q})}}k=X;const{destroy:ee,cleanup:te}=F(k,!1,!0);x.push(ee),z&&u.push(te)}}else if(A(K)){if(E(k)){U+=2;const ne=j(k,K,M,{end:q});S(K)&&z&&u.push(ne)}else if(R(k)||T(k)){const ie=k.readable||k;U++,D(ie,K,M,{end:q})}else{if(!_(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);U++,D(k,K,M,{end:q})}k=K}else if(I(K)){if(E(k))U++,L(N(k),K,M,{end:q});else if(T(k)||_(k))U++,L(k,K,M,{end:q});else{if(!R(k))throw new f("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],k);U++,L(k.readable,K,M,{end:q})}k=K}else k=d.from(K)}return(null!=c&&c.aborted||null!=l&&l.aborted)&&n.nextTick(h),k}function j(e,t,r,{end:i}){let o=!1;if(t.on("close",(()=>{o||r(new m)})),e.pipe(t,{end:!1}),i){function s(){o=!0,t.end()}x(e)?n.nextTick(s):e.once("end",s)}else r();return c(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t)})),c(t,{readable:!1,writable:!0},r)}e.exports={pipelineImpl:U,pipeline:function(...e){return U(e,l(function(e){return b(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}}},3125:function(e,t,r){const n=r(5606),{ArrayPrototypeIndexOf:i,NumberIsInteger:o,NumberIsNaN:s,NumberParseInt:a,ObjectDefineProperties:c,ObjectKeys:l,ObjectSetPrototypeOf:u,Promise:d,SafeSet:h,SymbolAsyncDispose:f,SymbolAsyncIterator:p,Symbol:g}=r(4641);e.exports=G,G.ReadableState=J;const{EventEmitter:y}=r(7007),{Stream:m,prependListener:v}=r(334),{Buffer:b}=r(8287),{addAbortSignal:w}=r(810),_=r(9365);let S=r(6017).debuglog("stream",(e=>{S=e}));const E=r(5586),A=r(7647),{getHighWaterMark:R,getDefaultHighWaterMark:I}=r(3920),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:P,ERR_OUT_OF_RANGE:C,ERR_STREAM_PUSH_AFTER_EOF:k,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:O},AbortError:F}=r(8526),{validateObject:N}=r(2224),D=g("kPaused"),{StringDecoder:L}=r(6600),U=r(333);u(G.prototype,m.prototype),u(G,m);const j=()=>{},{errorOrDestroy:M}=A,B=1,H=16,W=32,$=2048,V=4096;function K(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function J(e,t,n){"boolean"!=typeof n&&(n=t instanceof r(3559)),this.state=$|V|H|W,e&&e.objectMode&&(this.state|=B),n&&e&&e.readableObjectMode&&(this.state|=B),this.highWaterMark=e?R(this,e,"readableHighWaterMark",n):I(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this[D]=null,e&&!1===e.emitClose&&(this.state&=~$),e&&!1===e.autoDestroy&&(this.state&=~V),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new L(e.encoding),this.encoding=e.encoding)}function G(e){if(!(this instanceof G))return new G(e);const t=this instanceof r(3559);this._readableState=new J(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&w(e.signal,this)),m.call(this,e),A.construct(this,(()=>{this._readableState.needReadable&&Z(this,this._readableState)}))}function q(e,t,r,n){S("readableAddChunk",t);const i=e._readableState;let o;if(i.state&B||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=b.from(t,r).toString(i.encoding):(t=b.from(t,r),r=""))):t instanceof b?r="":m._isUint8Array(t)?(t=m._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new x("chunk",["string","Buffer","Uint8Array"],t))),o)M(e,o);else if(null===t)i.state&=-9,function(e,t){if(S("onEofChunk"),!t.ended){if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?Q(e):(t.needReadable=!1,t.emittedReadable=!0,X(e))}}(e,i);else if(i.state&B||t&&t.length>0)if(n)if(4&i.state)M(e,new O);else{if(i.destroyed||i.errored)return!1;z(e,i,t,!0)}else if(i.ended)M(e,new k);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?z(e,i,t,!1):Z(e,i)):z(e,i,t,!1)}else n||(i.state&=-9,Z(e,i));return!i.ended&&(i.length0?(65536&t.state?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),64&t.state&&Q(e)),Z(e,t)}function Y(e,t){return e<=0||0===t.length&&t.ended?0:t.state&B?1:s(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function Q(e){const t=e._readableState;S("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(X,e))}function X(e){const t=e._readableState;S("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ie(e)}function Z(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(ee,e,t))}function ee(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!1===t[D]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function re(e){S("readable nexttick read 0"),e.read(0)}function ne(e,t){S("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ie(e),t.flowing&&!t.reading&&e.read(0)}function ie(e){const t=e._readableState;for(S("flow",t.flowing);t.flowing&&null!==e.read(););}function oe(e,t){"function"!=typeof e.read&&(e=G.wrap(e,{objectMode:!0}));const r=async function*(e,t){let r,n=j;function i(t){this===e?(n(),n=j):n=t}e.on("readable",i);const o=_(e,{writable:!1},(e=>{r=e?T(r,e):null,n(),n=j}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(r)throw r;if(null===r)return;await new d(i)}}}catch(e){throw r=T(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):A.destroyer(e,null)}}(e,t);return r.stream=e,r}function se(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ae(e){const t=e._readableState;S("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(ce,t,e))}function ce(e,t){if(S("endReadableNT",e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&0===e.length)if(e.endEmitted=!0,t.emit("end"),t.writable&&!1===t.allowHalfOpen)n.nextTick(le,t);else if(e.autoDestroy){const e=t._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&t.destroy()}}function le(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ue;function de(){return void 0===ue&&(ue={}),ue}c(J.prototype,{objectMode:K(B),ended:K(2),endEmitted:K(4),reading:K(8),constructed:K(H),sync:K(W),needReadable:K(64),emittedReadable:K(128),readableListening:K(256),resumeScheduled:K(512),errorEmitted:K(1024),emitClose:K($),autoDestroy:K(V),destroyed:K(8192),closed:K(16384),closeEmitted:K(32768),multiAwaitDrain:K(65536),readingMore:K(1<<17),dataEmitted:K(1<<18)}),G.prototype.destroy=A.destroy,G.prototype._undestroy=A.undestroy,G.prototype._destroy=function(e,t){t(e)},G.prototype[y.captureRejectionSymbol]=function(e){this.destroy(e)},G.prototype[f]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new F,this.destroy(e)),new d(((t,r)=>_(this,(n=>n&&n!==e?r(n):t(null)))))},G.prototype.push=function(e,t){return q(this,e,t,!1)},G.prototype.unshift=function(e,t){return q(this,e,t,!0)},G.prototype.isPaused=function(){const e=this._readableState;return!0===e[D]||!1===e.flowing},G.prototype.setEncoding=function(e){const t=new L(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this},G.prototype.read=function(e){S("read",e),void 0===e?e=NaN:o(e)||(e=a(e,10));const t=this._readableState,r=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new C("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return S("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ae(this):Q(this),null;if(0===(e=Y(e,t))&&t.ended)return 0===t.length&&ae(this),null;let n,i=!!(64&t.state);if(S("need readable",i),(0===t.length||t.length-e0?se(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&ae(this)),null===n||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",n)),n},G.prototype._read=function(e){throw new P("_read()")},G.prototype.pipe=function(e,t){const r=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new h(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S("pipe count=%d opts=%j",i.pipes.length,t);const o=t&&!1===t.end||e===n.stdout||e===n.stderr?g:s;function s(){S("onend"),e.end()}let a;i.endEmitted?n.nextTick(o):r.once("end",o),e.on("unpipe",(function t(n,o){S("onunpipe"),n===r&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,S("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),a&&e.removeListener("drain",a),e.removeListener("error",d),e.removeListener("unpipe",t),r.removeListener("end",s),r.removeListener("end",g),r.removeListener("data",u),c=!0,a&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&a())}));let c=!1;function l(){c||(1===i.pipes.length&&i.pipes[0]===e?(S("false write response, pause",0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),a||(a=function(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(S("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(S("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(r,e),e.on("drain",a))}function u(t){S("ondata");const r=e.write(t);S("dest.write",r),!1===r&&l()}function d(t){if(S("onerror",t),g(),e.removeListener("error",d),0===e.listenerCount("error")){const r=e._writableState||e._readableState;r&&!r.errorEmitted?M(e,t):e.emit("error",t)}}function f(){e.removeListener("finish",p),g()}function p(){S("onfinish"),e.removeListener("close",f),g()}function g(){S("unpipe"),r.unpipe(e)}return r.on("data",u),v(e,"error",d),e.once("close",f),e.once("finish",p),e.emit("pipe",r),!0===e.writableNeedDrain?l():i.flowing||(S("pipe resume"),r.resume()),e},G.prototype.unpipe=function(e){const t=this._readableState;if(0===t.pipes.length)return this;if(!e){const e=t.pipes;t.pipes=[],this.pause();for(let t=0;t0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S("on readable",i.length,i.reading),i.length?Q(this):i.reading||n.nextTick(re,this))),r},G.prototype.addListener=G.prototype.on,G.prototype.removeListener=function(e,t){const r=m.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(te,this),r},G.prototype.off=G.prototype.removeListener,G.prototype.removeAllListeners=function(e){const t=m.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(te,this),t},G.prototype.resume=function(){const e=this._readableState;return e.flowing||(S("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(ne,e,t))}(this,e)),e[D]=!1,this},G.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[D]=!0,this},G.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{M(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const r=l(e);for(let t=1;t{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e())}))}function d(){this._final!==u&&u.call(this)}l.prototype._final=u,l.prototype._transform=function(e,t,r){throw new o("_transform()")},l.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length{const e=this._writableState;e.writing||W(this,e),V(this,e)}))}function D(e,t,r,i){const o=e._writableState;if("function"==typeof r)i=r,r=o.defaultEncoding;else{if(r){if("buffer"!==r&&!g.isEncoding(r))throw new x(r)}else r=o.defaultEncoding;"function"!=typeof i&&(i=C)}if(null===t)throw new I;if(!o.objectMode)if("string"==typeof t)!1!==o.decodeStrings&&(t=g.from(t,r),r="buffer");else if(t instanceof g)r="buffer";else{if(!p._isUint8Array(t))throw new w("chunk",["string","Buffer","Uint8Array"],t);t=p._uint8ArrayToBuffer(t),r="buffer"}let s;return o.ending?s=new T:o.destroyed&&(s=new A("write")),s?(n.nextTick(i,s),P(e,s,!0),s):(o.pendingcb++,function(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const s=t.lengthr.bufferedIndex&&W(e,r),i?null!==r.afterWriteTickInfo&&r.afterWriteTickInfo.cb===o?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:o,stream:e,state:r},n.nextTick(M,r.afterWriteTickInfo)):B(e,r,1,o))):P(e,new S)}function M({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,B(e,t,r,n)}function B(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&H(t),V(e,t)}function H(e){if(e.writing)return;for(let r=e.bufferedIndex;r1&&e._writev){t.pendingcb-=s-1;const n=t.allNoop?C:e=>{for(let t=a;t256?(r.splice(0,a),t.bufferedIndex=0):t.bufferedIndex=a}t.bufferProcessing=!1}function $(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function V(e,t,r){$(t)&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.finalCalled=!0,function(e,t){let r=!1;function i(i){if(r)P(e,null!=i?i:S());else if(r=!0,t.pendingcb--,i){const r=t[k].splice(0);for(let e=0;e{$(t)?K(e,t):t.pendingcb--}),e,t)):$(t)&&(t.pendingcb++,K(e,t))))}function K(e,t){t.pendingcb--,t.finished=!0;const r=t[k].splice(0);for(let e=0;e{if("number"!=typeof e)throw new b(t,"number",e);if(!a(e))throw new _(t,"an integer",e);if(en)throw new _(t,`>= ${r} && <= ${n}`,e)})),P=m(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new b(t,"number",e);if(!a(e))throw new _(t,"an integer",e);if(en)throw new _(t,`>= ${r} && <= ${n}`,e)})),C=m(((e,t,r=!1)=>{if("number"!=typeof e)throw new b(t,"number",e);if(!a(e))throw new _(t,"an integer",e);const n=r?1:0,i=4294967295;if(ei)throw new _(t,`>= ${n} && <= ${i}`,e)}));function k(e,t){if("string"!=typeof e)throw new b(t,"string",e)}const O=m(((e,t,r)=>{if(!i(r,e)){const n=o(s(r,(e=>"string"==typeof e?`'${e}'`:p(e))),", ");throw new w(t,e,"must be one of: "+n)}}));function F(e,t){if("boolean"!=typeof e)throw new b(t,"boolean",e)}function N(e,t,r){return null!=e&&h(e,t)?e[t]:r}const D=m(((e,t,r=null)=>{const i=N(r,"allowArray",!1),o=N(r,"allowFunction",!1);if(!N(r,"nullable",!1)&&null===e||!i&&n(e)||"object"!=typeof e&&(!o||"function"!=typeof e))throw new b(t,"Object",e)})),L=m(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new b(t,"a dictionary",e)})),U=m(((e,t,r=0)=>{if(!n(e))throw new b(t,"Array",e);if(e.length{if(!R(e))throw new b(t,["Buffer","TypedArray","DataView"],e)})),M=m(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new b(t,"AbortSignal",e)})),B=m(((e,t)=>{if("function"!=typeof e)throw new b(t,"Function",e)})),H=m(((e,t)=>{if("function"!=typeof e||A(e))throw new b(t,"Function",e)})),W=m(((e,t)=>{if(void 0!==e)throw new b(t,"undefined",e)})),$=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function V(e,t){if(void 0===e||!f($,e))throw new w(t,e,'must be an array or string of format "; rel=preload; as=style"')}e.exports={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===f(T,e))throw new w(t,e,"must be a 32-bit unsigned integer or an octal string");e=d(e,8)}return C(e,t),e},validateArray:U,validateStringArray:function(e,t){U(e,t);for(let r=0;rn||(null!=r||null!=n)&&c(e))throw new _(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)},validateObject:D,validateOneOf:O,validatePlainFunction:H,validatePort:function(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===y(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new v(t,e,r);return 0|e},validateSignalName:function(e,t="signal"){if(k(e,t),void 0===I[e]){if(void 0!==I[g(e)])throw new S(e+" (signals must use all capital letters)");throw new S(e)}},validateString:k,validateUint32:C,validateUndefined:W,validateUnion:function(e,t,r){if(!i(r,e))throw new b(t,`('${o(r,"|")}')`,e)},validateAbortSignal:M,validateLinkHeaderValue:function(e){if("string"==typeof e)return V(e,"hints"),e;if(n(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n; rel=preload; as=style"')}}},5721:function(e,t,r){"use strict";const n=r(2825),i=r(5018),o=n.Readable.destroy;e.exports=n.Readable,e.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,e.exports._isUint8Array=n._isUint8Array,e.exports.isDisturbed=n.isDisturbed,e.exports.isErrored=n.isErrored,e.exports.isReadable=n.isReadable,e.exports.Readable=n.Readable,e.exports.Writable=n.Writable,e.exports.Duplex=n.Duplex,e.exports.Transform=n.Transform,e.exports.PassThrough=n.PassThrough,e.exports.addAbortSignal=n.addAbortSignal,e.exports.finished=n.finished,e.exports.destroy=n.destroy,e.exports.destroy=o,e.exports.pipeline=n.pipeline,e.exports.compose=n.compose,Object.defineProperty(n,"promises",{configurable:!0,enumerable:!0,get(){return i}}),e.exports.Stream=n.Stream,e.exports.default=e.exports},8526:function(e,t,r){"use strict";const{format:n,inspect:i,AggregateError:o}=r(6017),s=globalThis.AggregateError||o,a=Symbol("kIsNodeError"),c=["string","function","number","object","Function","Object","boolean","bigint","symbol"],l=/^([A-Z][a-z0-9]*)+$/,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function h(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function f(e,t,r){r||(r=Error);class i extends r{constructor(...r){super(function(e,t,r){if("function"==typeof t)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),0===r.length?t:n(t,...r)}(e,t,r))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=e,i.prototype[a]=!0,u[e]=i}function p(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}class g extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new u.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}}f("ERR_ASSERTION","%s",Error),f("ERR_INVALID_ARG_TYPE",((e,t,r)=>{d("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const o=[],s=[],a=[];for(const e of t)d("string"==typeof e,"All expected entries have to be of type string"),c.includes(e)?o.push(e.toLowerCase()):l.test(e)?s.push(e):(d("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(s.length>0){const e=o.indexOf("object");-1!==e&&(o.splice(o,e,1),s.push("Object"))}if(o.length>0){switch(o.length){case 1:n+=`of type ${o[0]}`;break;case 2:n+=`one of type ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`one of type ${o.join(", ")}, or ${e}`}}(s.length>0||a.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+=`an instance of ${s[0]}`;break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{const e=s.pop();n+=`an instance of ${s.join(", ")}, or ${e}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`one of ${a.join(", ")}, or ${e}`}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var u;null!==(u=r.constructor)&&void 0!==u&&u.name?n+=`. Received an instance of ${r.constructor.name}`:n+=`. Received ${i(r,{depth:-1})}`}else{let e=i(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`}return n}),TypeError),f("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=i(t);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),f("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return`Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),f("ERR_MISSING_ARGS",((...e)=>{let t;d(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}}return`${t} must be specified`}),TypeError),f("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return d(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=h(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=h(n)),n+="n"):n=i(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),f("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),f("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),f("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),f("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),f("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),f("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),f("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),f("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),f("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),f("ERR_STREAM_WRITE_AFTER_END","write after end",Error),f("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),e.exports={AbortError:g,aggregateTwoErrors:p((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new s([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:p,codes:u}},4641:function(e){"use strict";e.exports={ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,r){return e.slice(t,r)},Error:Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,r){return Object.defineProperty(e,t,r)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise:Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,r){return e.then(t,r)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String:String,StringPrototypeSlice(e,t,r){return e.slice(t,r)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(e,t,r){return e.set(t,r)},Boolean:Boolean,Uint8Array:Uint8Array}},6017:function(e,t,r){"use strict";const n=r(8287),{kResistStopPropagation:i,SymbolDispose:o}=r(4641),s=globalThis.AbortSignal||r(5568).AbortSignal,a=globalThis.AbortController||r(5568).AbortController,c=Object.getPrototypeOf((async function(){})).constructor,l=globalThis.Blob||n.Blob,u=void 0!==l?function(e){return e instanceof l}:function(e){return!1},d=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class h extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r{e=r,t=n})),resolve:e,reject:t}},promisify(e){return new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)))}))},debuglog(){return function(){}},format(e,...t){return e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();return"f"===r?n.toFixed(6):"j"===r?JSON.stringify(n):"s"===r&&"object"==typeof n?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.toString()}))},inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction(e){return e instanceof c},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:u,deprecate(e,t){return e},addAbortListener:r(7007).addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let r;return d(e,"signal"),(e=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE("listener","Function",e)})(t),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[i]:!0}),r=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[o](){var e;null===(e=r)||void 0===e||e()}}},AbortSignalAny:s.any||function(e){if(1===e.length)return e[0];const t=new a,r=()=>t.abort();return e.forEach((e=>{d(e,"signals"),e.addEventListener("abort",r,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",r)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},2825:function(e,t,r){const{Buffer:n}=r(8287),{ObjectDefineProperty:i,ObjectKeys:o,ReflectApply:s}=r(4641),{promisify:{custom:a}}=r(6017),{streamReturningOperators:c,promiseReturningOperators:l}=r(1284),{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=r(8526),d=r(8489),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:f}=r(3920),{pipeline:p}=r(8431),{destroyer:g}=r(7647),y=r(9365),m=r(5018),v=r(136),b=e.exports=r(334).Stream;b.isDestroyed=v.isDestroyed,b.isDisturbed=v.isDisturbed,b.isErrored=v.isErrored,b.isReadable=v.isReadable,b.isWritable=v.isWritable,b.Readable=r(3125);for(const S of o(c)){const E=c[S];function w(...e){if(new.target)throw u();return b.Readable.from(s(E,this,e))}i(w,"name",{__proto__:null,value:E.name}),i(w,"length",{__proto__:null,value:E.length}),i(b.Readable.prototype,S,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}for(const A of o(l)){const R=l[A];function w(...e){if(new.target)throw u();return s(R,this,e)}i(w,"name",{__proto__:null,value:R.name}),i(w,"length",{__proto__:null,value:R.length}),i(b.Readable.prototype,A,{__proto__:null,value:w,enumerable:!1,configurable:!0,writable:!0})}b.Writable=r(7221),b.Duplex=r(3559),b.Transform=r(8649),b.PassThrough=r(2091),b.pipeline=p;const{addAbortSignal:_}=r(810);b.addAbortSignal=_,b.finished=y,b.destroy=g,b.compose=d,b.setDefaultHighWaterMark=h,b.getDefaultHighWaterMark=f,i(b,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return m}}),i(p,a,{__proto__:null,enumerable:!0,get(){return m.pipeline}}),i(y,a,{__proto__:null,enumerable:!0,get(){return m.finished}}),b.Stream=b,b._isUint8Array=function(e){return e instanceof Uint8Array},b._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}},5018:function(e,t,r){"use strict";const{ArrayPrototypePop:n,Promise:i}=r(4641),{isIterable:o,isNodeStream:s,isWebStream:a}=r(136),{pipelineImpl:c}=r(8431),{finished:l}=r(9365);r(2825),e.exports={finished:l,pipeline:function(...e){return new i(((t,r)=>{let i,l;const u=e[e.length-1];if(u&&"object"==typeof u&&!s(u)&&!o(u)&&!a(u)){const t=n(e);i=t.signal,l=t.end}c(e,((e,n)=>{e?r(e):t(n)}),{signal:i,end:l})}))}}},2692:function(e,t,r){var n=r(8287),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},6600:function(e,t,r){"use strict";var n=r(2692).Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=u,this.end=d,t=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function u(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function f(e){return e&&e.length?this.write(e):""}t.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},8518:function(e,t,r){"use strict";r.r(t),r.d(t,{BlankNode:function(){return T},DataFactory:function(){return E},DefaultGraph:function(){return P},EntityIndex:function(){return fe},Lexer:function(){return m},Literal:function(){return I},NamedNode:function(){return R},Parser:function(){return H},Quad:function(){return O},Reasoner:function(){return be},Store:function(){return pe},StoreFactory:function(){return me},StreamParser:function(){return Se},StreamWriter:function(){return Ee},Term:function(){return A},Triple:function(){return O},Util:function(){return n},Variable:function(){return x},Writer:function(){return oe},default:function(){return Ae},getRulesFromDataset:function(){return ve},termFromId:function(){return C},termToId:function(){return k}});var n={};r.r(n),r.d(n,{inDefaultGraph:function(){return z},isBlankNode:function(){return K},isDefaultGraph:function(){return q},isLiteral:function(){return J},isNamedNode:function(){return V},isVariable:function(){return G},prefix:function(){return Y},prefixes:function(){return Q}});var i=r(8287),o=r(9596),s=r.n(o);const a="http://www.w3.org/1999/02/22-rdf-syntax-ns#",c="http://www.w3.org/2001/XMLSchema#",l="http://www.w3.org/2000/10/swap/";var u={xsd:{decimal:`${c}decimal`,boolean:`${c}boolean`,double:`${c}double`,integer:`${c}integer`,string:`${c}string`},rdf:{type:`${a}type`,nil:`${a}nil`,first:`${a}first`,rest:`${a}rest`,langString:`${a}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${l}reify#forSome`,forAll:`${l}reify#forAll`},log:{implies:`${l}log#implies`}};const{xsd:d}=u,h=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,f={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},p=/[\x00-\x20<>\\"\{\}\|\^\`]/,g={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},y=/$0^/;class m{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const e in this)!(e in g)&&this[e]instanceof RegExp&&(this[e]=y)}else this._n3Mode=!1!==e.n3;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let r=this._input,n=r.length;for(;;){let e,s;for(;e=this._newline.exec(r);)this.comments&&(s=this._comment.exec(e[0]))&&i("comment",s[1],"",this._line,e[0].length),r=r.substr(e[0].length,r.length),n=r.length,this._line++;if(!e&&(e=this._whitespace.exec(r))&&(r=r.substr(e[0].length,r.length)),this._endOfFile.test(r))return t&&(this.comments&&(s=this._comment.exec(r))&&i("comment",s[1],"",this._line,r.length),r=null,i("eof","","",this._line,0)),this._input=r;const a=this._line,c=r[0];let l="",u="",h="",f=null,g=0,y=!1;switch(c){case"^":if(r.length<3)break;if("^"!==r[1]){this._n3Mode&&(g=1,l="^");break}if(this._previousMarker="^^",r=r.substr(2),"<"!==r[0]){y=!0;break}case"<":if(f=this._unescapedIri.exec(r))l="IRI",u=f[1];else if(f=this._iri.exec(r)){if(u=this._unescape(f[1]),null===u||p.test(u))return o(this);l="IRI"}else r.length>1&&"<"===r[1]?(l="<<",g=2):this._n3Mode&&r.length>1&&"="===r[1]&&(l="inverse",g=2,u=">");break;case">":r.length>1&&">"===r[1]&&(l=">>",g=2);break;case"_":((f=this._blank.exec(r))||t&&(f=this._blank.exec(`${r} `)))&&(l="blank",h="_",u=f[1]);break;case'"':if(f=this._simpleQuotedString.exec(r))u=f[1];else if(({value:u,matchLength:g}=this._parseLiteral(r)),null===u)return o(this);null===f&&0===g||(l="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(f=this._simpleApostropheString.exec(r))u=f[1];else if(({value:u,matchLength:g}=this._parseLiteral(r)),null===u)return o(this);null===f&&0===g||(l="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(f=this._variable.exec(r))&&(l="var",u=f[0]);break;case"@":"literal"===this._previousMarker&&(f=this._langcode.exec(r))?(l="langcode",u=f[1]):(f=this._keyword.exec(r))&&(l=f[0]);break;case".":if(1===r.length?t:r[1]<"0"||r[1]>"9"){l=".",g=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(f=this._number.exec(r)||t&&(f=this._number.exec(`${r} `)))&&(l="literal",u=f[0],h="string"==typeof f[1]?d.double:"string"==typeof f[2]?d.decimal:d.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(f=this._sparqlKeyword.exec(r))?l=f[0].toUpperCase():y=!0;break;case"f":case"t":(f=this._boolean.exec(r))?(l="literal",u=f[0],h=d.boolean):y=!0;break;case"a":(f=this._shortPredicates.exec(r))?(l="abbreviation",u="a"):y=!0;break;case"=":this._n3Mode&&r.length>1&&(l="abbreviation",">"!==r[1]?(g=1,u="="):(g=2,u=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(g=1,l=c);break;case"{":!this._lineMode&&r.length>=2&&("|"===r[1]?(l="{|",g=2):(l=c,g=1));break;case"|":r.length>=2&&"}"===r[1]&&(l="|}",g=2);break;default:y=!0}if(y&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(f=this._prefix.exec(r))?((f=this._prefixed.exec(r))||t&&(f=this._prefixed.exec(`${r} `)))&&(l="prefixed",h=f[1]||"",u=this._unescape(f[2])):(l="prefix",u=f[1]||"")),"^^"===this._previousMarker)switch(l){case"prefixed":l="type";break;case"IRI":l="typeIRI";break;default:l=""}if(!l)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?o(this):this._input=r;const m=g||f[0].length,v=i(l,u,h,a,m);this.previousToken=v,this._previousMarker=l,r=r.substr(m,r.length)}function i(t,i,o,s,a){const c=r?n-r.length:n,l={type:t,value:i,prefix:o,line:s,start:c,end:c+a};return e(null,l),l}function o(t){e(t._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(e){let t=!1;const r=e.replace(h,((e,r,n,i)=>{if("string"==typeof r)return String.fromCharCode(Number.parseInt(r,16));if("string"==typeof n){let e=Number.parseInt(n,16);return e<=65535?String.fromCharCode(Number.parseInt(n,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(1023&e))}return i in f?f[i]:(t=!0,"")}));return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let n=Math.max(this._literalClosingPos,r);for(;(n=e.indexOf(t,n))>0;){let t=0;for(;"\\"===e[n-t-1];)t++;if(t%2==0){const t=e.substring(r,n),i=t.split(/\r\n|\r|\n/).length-1,o=n+r;if(1===r&&0!==i||3===r&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:o}}n++}this._literalClosingPos=e.length-r+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\ufeff")?e.substr(1):e}tokenize(e,t){if(this._line=1,"string"==typeof e){if(this._input=this._readStartingBom(e),"function"!=typeof t){const e=[];let t;if(this._tokenizeToEnd(((r,n)=>r?t=r:e.push(n)),!0),t)throw t;return e}s()((()=>this._tokenizeToEnd(t,!0)))}else this._pendingBuffer=null,"function"==typeof e.setEncoding&&e.setEncoding("utf8"),e.on("data",(e=>{null!==this._input&&0!==e.length&&(this._pendingBuffer&&(e=i.Buffer.concat([this._pendingBuffer,e]),this._pendingBuffer=null),128&e[e.length-1]?this._pendingBuffer=e:(void 0===this._input?this._input=this._readStartingBom("string"==typeof e?e:e.toString()):this._input+=e,this._tokenizeToEnd(t,!1)))})),e.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(t,!0)})),e.on("error",t)}}const{rdf:v,xsd:b}=u;let w,_=0;const S={namedNode:F,blankNode:N,variable:L,literal:D,defaultGraph:function(){return w},quad:U,triple:U,fromTerm:j,fromQuad:M};var E=S;class A{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof A?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class R extends A{get termType(){return"NamedNode"}}class I extends A{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t0?"INF":"-INF")))),""===r||r===b.string?new I(`"${e}"`):new I(`"${e}"^^${r}`)}function L(e){return new x(e)}function U(e,t,r,n){return new O(e,t,r,n)}function j(e){if(e instanceof A)return e;switch(e.termType){case"NamedNode":return F(e.value);case"BlankNode":return N(e.value);case"Variable":return L(e.value);case"DefaultGraph":return w;case"Literal":return D(e.value,e.language||e.datatype);case"Quad":return M(e);default:throw new Error(`Unexpected termType: ${e.termType}`)}}function M(e){if(e instanceof O)return e;if("Quad"!==e.termType)throw new Error(`Unexpected termType: ${e.termType}`);return U(j(e.subject),j(e.predicate),j(e.object),j(e.graph))}let B=0;class H{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&$(this,e.factory);const t="string"==typeof e.format?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),n=/trig/.test(t),i=/triple/.test(t),o=/quad/.test(t),s=this._n3Mode=/n3/.test(t),a=i||o;(this._supportsNamedGraphs=!(r||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||n||i||s),this._supportsRDFStar=""===t||/star|\*$/.test(t),a&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix="string"!=typeof e.blankNodePrefix?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new m({lineMode:a,n3:s}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){B=0}_setBase(e){if(e){const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}else this._base="",this._basePath=""}_saveContext(e,t,r,n,i){const o=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:n,object:i,graph:t,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,t){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(e){switch(e.type){case"eof":return null!==this._graph?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const t=this._resolveIRI(e.value);if(null===t)return this._error("Invalid IRI",e);r=this._factory.namedNode(t);break;case"type":case"prefixed":const n=this._prefixes[e.prefix];if(void 0===n)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._factory.namedNode(n+e.value);break;case"blank":r=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(0===e.prefix.length)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if(void 0===(this._subject=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${t}`,e):(this._subject=null,"]"===t?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if(void 0===(this._predicate=this._readEntity(e)))return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(0===e.prefix.length)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if(void 0===(this._object=this._readEntity(e)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return"{"===e.type?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return"{"!==e.type?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return"]"===e.type?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if("]"!==e.type)return this._readBlankNodePunctuation(e);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=null===this._predicate;return this._restoreContext("blank",e),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,n=this._readListItem;const i=this._subject,o=this._contextStack,s=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(n=this._readPredicate,this._subject===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._object===this.RDF_NIL)return n;r=this.RDF_NIL;break;case"literal":0===e.prefix.length?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if(void 0===(t=this._readEntity(e)))return}if(null===r&&(this._subject=r=this._factory.blankNode()),null===i?null===s.predicate?s.subject=r:s.object=r:this._emit(i,this.RDF_REST,r,this._graph),null!==t){if(this._n3Mode&&("IRI"===e.type||"prefixed"===e.type))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(void 0===r)return;t=this._factory.literal(this._literalValue,r),e=null;break;case"langcode":t=this._factory.literal(this._literalValue,e.value),e=null}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===r.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return"}"!==e.type?this._readPunctuation(e):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const n=this._subject,i=this._inversePredicate;switch(e.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case";":t=this._readPredicate;break;case",":t=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",e);const o=this._predicate,s=this._object;this._subject=this._factory.quad(n,o,s,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if("Quad"!==this._subject.termType)return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(r=this._readEntity(e))){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(null!==n){const e=this._predicate,t=this._object;i?this._emit(t,e,n,r):this._emit(n,e,t,r)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return"."!==e.type?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return"prefix"!==e.type?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if("IRI"!==e.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t="IRI"===e.type&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return"]"!==e.type?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):"."!==e.type?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if(void 0!==(t=this._readEntity(e,!0)))break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return","===e.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&"item"===r.type){const t=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,t,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,r;const n=this._factory.blankNode();if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(t=this._subject,this._subject=n):(t=this._object,this._object=n),this._emit(t,r,n,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let r,n;if(void 0!==(r=this._readEntity(e)))return null===this._predicate?(n=this._subject,this._subject=t):(n=this._object,this._object=t),this._emit(t,r,n,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return">>"!==e.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(e))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(">>"!==e.type)return this._error(`Expected >> but got ${e.type}`,e);const t=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),null===this._subject?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,n){this._callback(null,this._factory.quad(e,t,r,n||this.DEFAULTGRAPH))}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=W}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return("/"===e[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",n=-1,i=-1,o=0,s="/";for(;n=i&&(r=r.substr(0,o)),"/"!==s)return`${r}/${e.substr(n+1)}`;o=n+1}}}s=e[++n]}return r+e.substring(o)}parse(e,t,r){let n,i,o;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(n=t.onQuad,i=t.onPrefix,o=t.onComment):(n=t,i=r),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${B++}_`,this._prefixCallback=i||W,this._inversePredicate=!1,this._quantified=Object.create(null),!n){const t=[];let r;if(this._callback=(e,n)=>{e?r=e:n&&t.push(n)},this._lexer.tokenize(e).every((e=>this._readCallback=this._readCallback(e))),r)throw r;return t}let s=(e,t)=>{null!==e?(this._callback(e),this._callback=W):this._readCallback&&(this._readCallback=this._readCallback(t))};o&&(this._lexer.comments=!0,s=(e,t)=>{null!==e?(this._callback(e),this._callback=W):this._readCallback&&("comment"===t.type?o(t.value):this._readCallback=this._readCallback(t))}),this._callback=n,this._lexer.tokenize(e,s)}}function W(){}function $(e,t){e._factory=t,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=t.namedNode(u.rdf.first),e.RDF_REST=t.namedNode(u.rdf.rest),e.RDF_NIL=t.namedNode(u.rdf.nil),e.N3_FORALL=t.namedNode(u.r.forAll),e.N3_FORSOME=t.namedNode(u.r.forSome),e.ABBREVIATIONS={a:t.namedNode(u.rdf.type),"=":t.namedNode(u.owl.sameAs),">":t.namedNode(u.log.implies)},e.QUANTIFIERS_GRAPH=t.namedNode("urn:n3:quantifiers")}function V(e){return!!e&&"NamedNode"===e.termType}function K(e){return!!e&&"BlankNode"===e.termType}function J(e){return!!e&&"Literal"===e.termType}function G(e){return!!e&&"Variable"===e.termType}function q(e){return!!e&&"DefaultGraph"===e.termType}function z(e){return q(e.graph)}function Y(e,t){return Q({"":e.value||e},t)("")}function Q(e,t){const r=Object.create(null);for(const t in e)n(t,e[t]);function n(e,n){if("string"==typeof n){const i=Object.create(null);r[e]=e=>i[e]||(i[e]=t.namedNode(n+e))}else if(!(e in r))throw new Error(`Unknown prefix: ${e}`);return r[e]}return t=t||E,n}$(H.prototype,E);const X=E.defaultGraph(),{rdf:Z,xsd:ee}=u,te=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,re=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,ne={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class ie extends A{equals(e){return e===this}}class oe{constructor(e,t){if(this._prefixRegex=/$0^/,e&&"function"!=typeof e.write&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=void 0===t.end||!!t.end;else{let e="";this._outputStream={write(t,r,n){e+=t,n&&n()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=X,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseMatcher=new RegExp(`^${ae(t.baseIRI)}${t.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=t.baseIRI.length))}get _inDefaultGraph(){return X.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,r,n,i){try{n.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(X.equals(n)?"":`${this._encodeIriOrBlank(n)} {\n`)),this._graph=n,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,i)}catch(e){i&&i(e)}}_writeQuadLine(e,t,r,n,i){delete this._prefixMatch,this._write(this.quadToString(e,t,r,n),i)}quadToString(e,t,r,n){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${n&&n.value?` ${this._encodeIriOrBlank(n)} .\n`:" .\n"}`}quadsToString(e){let t="";for(const r of e)t+=this.quadToString(r.subject,r.predicate,r.object,r.graph);return t}_encodeSubject(e){return"Quad"===e.termType?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if("NamedNode"!==e.termType)return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseMatcher&&this._baseMatcher.test(t)&&(t=t.substr(this._baseLength)),te.test(t)&&(t=t.replace(re,se));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(te.test(t)&&(t=t.replace(re,se)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===ee.string)return`"${t}"`}else switch(e.datatype.value){case ee.string:return`"${t}"`;case ee.boolean:if("true"===t||"false"===t)return t;break;case ee.integer:if(/^[+-]?\d+$/.test(t))return t;break;case ee.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case ee.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Z.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:n}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${q(n)?"":` ${this._encodeIriOrBlank(n)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,n,i){void 0===r?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):"function"==typeof n?this._writeQuad(e,t,r,X,n):this._writeQuad(e,t,r,n||X,i)}addQuads(e){for(let t=0;t.\n`)}if(r){let e="",t="";for(const r in this._prefixIRIs)e+=e?`|${r}`:r,t+=(t?"|":"")+this._prefixIRIs[r];e=ae(e),this._prefixRegex=new RegExp(`^(?:${t})[^/]*$|^(${e})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(r?"\n":"",t)}blank(e,t){let r,n,i=e;switch(void 0===e?i=[]:e.termType?i=[{predicate:e,object:t}]:"length"in e||(i=[e]),n=i.length){case 0:return new ie("[]");case 1:if(r=i[0],!(r.object instanceof ie))return new ie(`[ ${this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)} ]`);default:let t="[";for(let o=0;o{t=null,e(r,n)});if(this._endStream)try{return this._outputStream.end(t)}catch(e){}t&&t()}}function se(e){let t=ne[e];return void 0===t&&(1===e.length?(t=e.charCodeAt(0).toString(16),t="\\u0000".substr(0,6-t.length)+t):(t=(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)+9216).toString(16),t="\\U00000000".substr(0,10-t.length)+t)),t}function ae(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var ce=r(5721);const le=Symbol("iter");function ue(e,t,r=4){if(0===r)return Object.assign(e,t);for(const n in t)e[n]=ue(e[n]||Object.create(null),t[n],r-1);return e}function de(e,t,r=4){let n=!1;for(const i in e)if(i in t){const o=0===r?null:de(e[i],t[i],r-1);if(!1!==o)n=n||Object.create(null),n[i]=o;else if(3===r)return!1}return n}function he(e,t,r=4){let n=!1;for(const i in e)if(i in t){if(0!==r){const o=he(e[i],t[i],r-1);if(!1!==o)n=n||Object.create(null),n[i]=o;else if(3===r)return!1}}else n=n||Object.create(null),n[i]=0===r?null:ue({},e[i],r-1);return n}class fe{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=e.factory||E}_termFromId(e){if("."===e[0]){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return C(e,this._factory)}_termToNumericId(e){if("Quad"===e.termType){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object);let i;return t&&r&&n&&(q(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${r}.${n}.${i}`:`.${t}.${r}.${n}`]}return this._ids[k(e)]}_termToNewNumericId(e){const t=e&&"Quad"===e.termType?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${q(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:k(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do{t="_:b"+this._blankNodeIndex++}while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class pe{constructor(e,t){this._size=0,this._graphs=Object.create(null),t||!e||e[0]||(t=e,e=null),t=t||{},this._factory=t.factory||E,this._entityIndex=t.entityIndex||new fe({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addQuads(e)}get size(){let e=this._size;if(null!==e)return e;e=0;const t=this._graphs;let r,n;for(const i in t)for(const o in r=t[i].subjects)for(const t in n=r[o])e+=Object.keys(n[t]).length;return this._size=e}_addToIndex(e,t,r,n){const i=e[t]||(e[t]={}),o=i[r]||(i[r]={}),s=n in o;return s||(o[n]=null),!s}_removeFromIndex(e,t,r,n){const i=e[t],o=i[r];delete o[n];for(const e in o)return;delete i[r];for(const e in i)return;delete e[t]}*_findInIndex(e,t,r,n,i,o,s,a){let c,l,u;const d=this._entities,h=this._termFromId(d[a]),f={subject:null,predicate:null,object:null};t&&((c=e,e={})[t]=c[t]);for(const t in e)if(l=e[t]){f[i]=this._termFromId(d[t]),r&&((c=l,l={})[r]=c[r]);for(const e in l)if(u=l[e]){f[o]=this._termFromId(d[e]);const t=n?n in u?[n]:[]:Object.keys(u);for(let e=0;e{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,r,n){t||(n=e.graph,r=e.object,t=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1;let i=this._graphs[n];return i||(i=this._graphs[n]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r),!!this._addToIndex(i.subjects,e,t,r)&&(this._addToIndex(i.predicates,t,r,e),this._addToIndex(i.objects,r,e,t),this._size=null,!0)}addQuads(e){for(let t=0;t{this.addQuad(e)})),e}removeQuad(e,t,r,n){t||({subject:e,predicate:t,object:r,graph:n}=e),n=n?this._termToNumericId(n):1;const i=this._graphs;let o,s,a;if(!((e=e&&this._termToNumericId(e))&&(t=t&&this._termToNumericId(t))&&(r=r&&this._termToNumericId(r))&&(o=i[n])&&(s=o.subjects[e])&&(a=s[t])&&r in a))return!1;for(e in this._removeFromIndex(o.subjects,e,t,r),this._removeFromIndex(o.predicates,t,r,e),this._removeFromIndex(o.objects,r,e,t),null!==this._size&&this._size--,o.subjects)return!0;return delete i[n],!0}removeQuads(e){for(let t=0;t{this.removeQuad(e)})),e}removeMatches(e,t,r,n){const i=new ce.Readable({objectMode:!0}),o=this.readQuads(e,t,r,n);return i._read=e=>{for(;--e>=0;){const{done:e,value:t}=o.next();if(e)return void i.push(null);i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,n){return[...this.readQuads(e,t,r,n)]}*readQuads(e,t,r,n){const i=this._getGraphs(n);let o,s,a,c;if(!(e&&!(s=this._termToNumericId(e))||t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r))))for(const e in i)(o=i[e])&&(s?c?yield*this._findInIndex(o.objects,c,s,a,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,s,a,null,"subject","predicate","object",e):a?yield*this._findInIndex(o.predicates,a,c,null,"predicate","object","subject",e):c?yield*this._findInIndex(o.objects,c,null,null,"object","subject","predicate",e):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",e))}match(e,t,r,n){return new ye(this,e,t,r,n,{entityIndex:this._entityIndex})}countQuads(e,t,r,n){const i=this._getGraphs(n);let o,s,a,c,l=0;if(e&&!(s=this._termToNumericId(e))||t&&!(a=this._termToNumericId(t))||r&&!(c=this._termToNumericId(r)))return 0;for(const n in i)(o=i[n])&&(l+=e?r?this._countInIndex(o.objects,c,s,a):this._countInIndex(o.subjects,s,a,c):t?this._countInIndex(o.predicates,a,c,s):this._countInIndex(o.objects,c,s,a));return l}forEach(e,t,r,n,i){this.some((t=>(e(t,this),!1)),t,r,n,i)}every(e,t,r,n,i){return!this.some((t=>!e(t,this)),t,r,n,i)}some(e,t,r,n,i){for(const o of this.readQuads(t,r,n,i))if(e(o))return!0;return!1}getSubjects(e,t,r){const n=[];return this.forSubjects((e=>{n.push(e)}),e,t,r),n}forSubjects(e,t,r,n){const i=this._getGraphs(n);let o,s,a;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(a=this._termToNumericId(r))))for(n in i)(o=i[n])&&(s?a?this._loopBy2Keys(o.predicates,s,a,e):this._loopByKey1(o.subjects,s,e):a?this._loopByKey0(o.objects,a,e):this._loop(o.subjects,e))}getPredicates(e,t,r){const n=[];return this.forPredicates((e=>{n.push(e)}),e,t,r),n}forPredicates(e,t,r,n){const i=this._getGraphs(n);let o,s,a;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(a=this._termToNumericId(r))))for(n in i)(o=i[n])&&(s?a?this._loopBy2Keys(o.objects,a,s,e):this._loopByKey0(o.subjects,s,e):a?this._loopByKey1(o.predicates,a,e):this._loop(o.predicates,e))}getObjects(e,t,r){const n=[];return this.forObjects((e=>{n.push(e)}),e,t,r),n}forObjects(e,t,r,n){const i=this._getGraphs(n);let o,s,a;if(e=this._uniqueEntities(e),!(t&&!(s=this._termToNumericId(t))||r&&!(a=this._termToNumericId(r))))for(n in i)(o=i[n])&&(s?a?this._loopBy2Keys(o.subjects,s,a,e):this._loopByKey1(o.objects,s,e):a?this._loopByKey0(o.predicates,a,e):this._loop(o.objects,e))}getGraphs(e,t,r){const n=[];return this.forGraphs((e=>{n.push(e)}),e,t,r),n}forGraphs(e,t,r,n){for(const i in this._graphs)this.some((t=>(e(t.graph),!0)),t,r,n,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},n=t?()=>!0:(e,t)=>{throw new Error(`${e.value} ${t}`)},i=this.getQuads(null,u.rdf.rest,u.rdf.nil,null),o=e?[...i]:[];return i.forEach((t=>{const i=[];let s,a,c=!1;const l=t.graph;let d=t.subject;for(;d&&!c;){const e=this.getQuads(null,null,d,null),t=this.getQuads(d,null,null,null);let r,h=null,f=null,p=null;for(let i=0;ithis.has(e)));const t=this._graphs,r=e._graphs;let n,i,o,s,a;for(const e in r){if(!(n=t[e]))return!1;n=n.subjects;for(const t in i=r[e].subjects){if(!(o=n[t]))return!1;for(const e in s=i[t]){if(!(a=o[e]))return!1;for(const t in s[e])if(!(t in a))return!1}}}return!0}deleteMatches(e,t,r,n){for(const i of this.match(e,t,r,n))this.removeQuad(i);return this}difference(e){if(e&&e instanceof ye&&(e=e.filtered),e===this)return new pe({entityIndex:this._entityIndex});if(e instanceof pe&&e._entityIndex===this._entityIndex){const t=new pe({entityIndex:this._entityIndex}),r=he(this._graphs,e._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter((t=>!e.has(t)))}equals(e){return e instanceof ye&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new pe({entityIndex:this._entityIndex});for(const r of this)e(r,this)&&t.add(r);return t}intersection(e){if(e instanceof ye&&(e=e.filtered),e===this){const e=new pe({entityIndex:this._entityIndex});return e._graphs=ue(Object.create(null),this._graphs),e._size=this._size,e}if(e instanceof pe&&this._entityIndex===e._entityIndex){const t=new pe({entityIndex:this._entityIndex}),r=de(e._graphs,this._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter((t=>e.has(t)))}map(e){const t=new pe({entityIndex:this._entityIndex});for(const r of this)t.add(e(r,this));return t}reduce(e,t){const r=this.readQuads();let n=void 0===t?r.next().value:t;for(const t of r)n=e(n,t,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return(new oe).quadsToString(this)}union(e){const t=new pe({entityIndex:this._entityIndex});return t._graphs=ue(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function ge(e,t,r=0){const n=t[r];if(n&&!(n in e))return!1;let i=!1;for(const o in n?{[n]:e[n]}:e){const n=2===r?null:ge(e[o],t,r+1);!1!==n&&(i=i||Object.create(null),i[o]=n)}return i}class ye extends ce.Readable{constructor(e,t,r,n,i,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:n,graph:i,options:o})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:n,subject:i}=this,o=this._filtered=new pe({factory:e._factory,entityIndex:this.options.entityIndex});let s,a,c;if(i&&!(s=o._termToNumericId(i))||n&&!(a=o._termToNumericId(n))||r&&!(c=o._termToNumericId(r)))return o;const l=e._getGraphs(t);for(const e in l){let t,r,n;!s&&a?(r=ge(l[e].predicates,[a,c,s]))&&(t=ge(l[e].subjects,[s,a,c]),n=ge(l[e].objects,[c,s,a])):c?(n=ge(l[e].objects,[c,s,a]))&&(t=ge(l[e].subjects,[s,a,c]),r=ge(l[e].predicates,[a,c,s])):(t=ge(l[e].subjects,[s,a,c]))&&(r=ge(l[e].predicates,[a,c,s]),n=ge(l[e].objects,[c,s,a])),t&&(o._graphs[e]={subjects:t,predicates:r,objects:n})}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[le]&&(this[le]=this[Symbol.iterator]());const t=this[le];for(;--e>=0;){const{done:e,value:r}=t.next();if(e)return void this.push(null);this.push(r)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,r,n){return this.filtered.deleteMatches(e,t,r,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,r,n,i){return this.filtered.every(e,t,r,n,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,r,n,i){return this.filtered.forEach(e,t,r,n,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,r,n,i){return this.filtered.some(e,t,r,n,i)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,t){return this.filtered.reduce(e,t)}toString(){return(new oe).quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,n){return new ye(this.filtered,e,t,r,n,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class me{dataset(e){return new pe(e)}}function ve(e){const t=[];for(const{subject:r,object:n}of e.match(null,E.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,E.defaultGraph())){const i=[...e.match(null,null,null,r)],o=[...e.match(null,null,null,n)];t.push({premise:i,conclusion:o})}return t}class be{constructor(e){this._store=e}_add(e,t,r,n,i){this._store._addToIndex(n.subjects,e,t,r)&&(this._store._addToIndex(n.predicates,t,r,e),this._store._addToIndex(n.objects,r,e,t),i())}_evaluatePremise(e,t,r,n=0){let i,o,s,a,c;const[l,u,d]=e.premise[n].value,h=t[e.premise[n].content],f=!(s=l.value);for(s in f?h:{[s]:h[s]})if(a=h[s]){for(s in f&&(l.value=Number(s)),i=!(s=u.value),i?a:{[s]:a[s]})if(c=a[s]){for(s in i&&(u.value=Number(s)),o=!(s=d.value),o?c:{[s]:c[s]})o&&(d.value=Number(s)),n===e.premise.length-1?e.conclusion.forEach((e=>{this._add(e.subject.value,e.predicate.value,e.object.value,t,(()=>{r(e)}))})):this._evaluatePremise(e,t,r,n+1);o&&(d.value=null)}i&&(u.value=null)}f&&(l.value=null)}_evaluateRules(e,t,r){for(let n=0;n{r.push([e.subject.value,e.predicate.value,e.object.value,t])}))}const i=e=>{e.forEach((e=>{this._add(e.subject.value,e.predicate.value,e.object.value,t,(()=>{n(e)}))}))};let o;for(this._evaluateRules(e,t,n);void 0!==(o=r.pop());){const[e,r,s,a]=o,c=a.basePremise.subject.value;c||(a.basePremise.subject.value=e);const l=a.basePremise.predicate.value;l||(a.basePremise.predicate.value=r);const u=a.basePremise.object.value;u||(a.basePremise.object.value=s),0===a.premise.length?i(a.conclusion):this._evaluatePremise(a,t,n),c||(a.basePremise.subject.value=null),l||(a.basePremise.predicate.value=null),u||(a.basePremise.object.value=null)}}_createRule({premise:e,conclusion:t}){const r={},n=e=>"Variable"===e.termType?r[e.value]=r[e.value]||{}:{value:this._store._termToNewNumericId(e)},i=e=>({subject:n(e.subject),predicate:n(e.predicate),object:n(e.object)});return{premise:e.map((e=>i(e))),conclusion:t.map((e=>i(e))),variables:Object.values(r)}}reason(e){Array.isArray(e)||(e=ve(e)),e=e.map((e=>this._createRule(e)));for(const t of e)for(const r of e)for(let e=0;e{e.value=null}))}}for(const t of e){const e=new Set;t.premise=t.premise.map((t=>we(t,e)))}const t=this._store._getGraphs();for(const r in t)this._reasonGraphNaive(e,t[r]);this._store._size=null}}function we({subject:e,predicate:t,object:r},n){const i=e.value||n.has(e)||(n.add(e),!1),o=t.value||n.has(t)||(n.add(t),!1),s=r.value||n.has(r)||(n.add(r),!1);return!i&&o?{content:"predicates",value:[t,r,e]}:s?{content:"objects",value:[r,e,t]}:{content:"subjects",value:[e,t,r]}}function _e(e,t){return null===e.value&&(e.value=t.value),e.value===t.value}class Se extends ce.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new H(e);let r,n;const i={onQuad:(e,t)=>{e&&this.emit("error",e)||t&&this.push(t)},onPrefix:(e,t)=>{this.emit("prefix",e,t)}};e&&e.comments&&(i.onComment=e=>{this.emit("comment",e)}),t.parse({on:(e,t)=>{switch(e){case"data":r=t;break;case"end":n=t}}},i),this._transform=(e,t,n)=>{r(e),n()},this._flush=e=>{n(),e()}}import(e){return e.on("data",(e=>{this.write(e)})),e.on("end",(()=>{this.end()})),e.on("error",(e=>{this.emit("error",e)})),this}}class Ee extends ce.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});const t=this._writer=new oe({write:(e,t,r)=>{this.push(e),r&&r()},end:e=>{this.push(null),e&&e()}},e);this._transform=(e,r,n)=>{t.addQuad(e,n)},this._flush=e=>{t.end(e)}}import(e){return e.on("data",(e=>{this.write(e)})),e.on("end",(()=>{this.end()})),e.on("error",(e=>{this.emit("error",e)})),e.on("prefix",((e,t)=>{this._writer.addPrefix(e,t)})),this}}var Ae={Lexer:m,Parser:H,Writer:oe,Store:pe,StoreFactory:me,EntityIndex:fe,StreamParser:Se,StreamWriter:Ee,Util:n,Reasoner:be,DataFactory:E,Term:A,NamedNode:R,Literal:I,BlankNode:T,Variable:x,DefaultGraph:P,Quad:O,Triple:O,termFromId:C,termToId:k}},5606:function(e){var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,c=[],l=!1,u=-1;function d(){l&&a&&(l=!1,a.length?c=a.concat(c):u=-1,c.length&&h())}function h(){if(!l){var e=s(d);l=!0;for(var t=c.length;t;){for(a=c,c=[];++u1)for(var r=1;r(n||(n=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))},7793:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(9931),t),i(r(8483),t),i(r(2142),t),i(r(2426),t),i(r(3988),t),i(r(6754),t),i(r(8401),t)},9931:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlankNode=void 0,t.BlankNode=class{constructor(e){this.termType="BlankNode",this.value=e}equals(e){return!!e&&"BlankNode"===e.termType&&e.value===this.value}}},8483:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataFactory=void 0;const n=r(9931),i=r(2142),o=r(2426),s=r(3988),a=r(6754),c=r(8401);let l=0;t.DataFactory=class{constructor(e){this.blankNodeCounter=0,e=e||{},this.blankNodePrefix=e.blankNodePrefix||`df_${l++}_`}namedNode(e){return new s.NamedNode(e)}blankNode(e){return new n.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new o.Literal(e,t)}variable(e){return new c.Variable(e)}defaultGraph(){return i.DefaultGraph.INSTANCE}quad(e,t,r,n){return new a.Quad(e,t,r,n||this.defaultGraph())}fromTerm(e){switch(e.termType){case"NamedNode":return this.namedNode(e.value);case"BlankNode":return this.blankNode(e.value);case"Literal":return e.language?this.literal(e.value,e.language):e.datatype.equals(o.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case"Variable":return this.variable(e.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}},2142:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(e){return!!e&&"DefaultGraph"===e.termType}}t.DefaultGraph=r,r.INSTANCE=new r},2426:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Literal=void 0;const n=r(3988);class i{constructor(e,t){this.termType="Literal",this.value=e,"string"==typeof t?(this.language=t,this.datatype=i.RDF_LANGUAGE_STRING):t?(this.language="",this.datatype=t):(this.language="",this.datatype=i.XSD_STRING)}equals(e){return!!e&&"Literal"===e.termType&&e.value===this.value&&e.language===this.language&&this.datatype.equals(e.datatype)}}t.Literal=i,i.RDF_LANGUAGE_STRING=new n.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),i.XSD_STRING=new n.NamedNode("http://www.w3.org/2001/XMLSchema#string")},3988:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NamedNode=void 0,t.NamedNode=class{constructor(e){this.termType="NamedNode",this.value=e}equals(e){return!!e&&"NamedNode"===e.termType&&e.value===this.value}}},6754:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Quad=void 0,t.Quad=class{constructor(e,t,r,n){this.termType="Quad",this.value="",this.subject=e,this.predicate=t,this.object=r,this.graph=n}equals(e){return!!e&&("Quad"===e.termType||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}},8401:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Variable=void 0,t.Variable=class{constructor(e){this.termType="Variable",this.value=e}equals(e){return!!e&&"Variable"===e.termType&&e.value===this.value}}},742:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4806),t)},4806:function(e,t){"use strict";function r(e){const t=[];let r=0;for(;re.join(""))).join("/")}function n(e,t){let n=t+1;t>=0?"/"===e[t+1]&&"/"===e[t+2]&&(n=t+3):"/"===e[0]&&"/"===e[1]&&(n=2);const i=e.indexOf("/",n);return i<0?e:e.substr(0,i)+r(e.substr(i))}function i(e){return!e||"#"===e||"?"===e||"/"===e}Object.defineProperty(t,"__esModule",{value:!0}),t.removeDotSegmentsOfPath=t.removeDotSegments=t.resolve=void 0,t.resolve=function(e,t){const i=(t=t||"").indexOf("#");if(i>0&&(t=t.substr(0,i)),!e.length){if(t.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${t}' for value '${e}'`);return t}if(e.startsWith("?")){const r=t.indexOf("?");return r>0&&(t=t.substr(0,r)),t+e}if(e.startsWith("#"))return t+e;if(!t.length){const t=e.indexOf(":");if(t<0)throw new Error(`Found invalid relative IRI '${e}' for a missing baseIRI`);return n(e,t)}const o=e.indexOf(":");if(o>=0)return n(e,o);const s=t.indexOf(":");if(s<0)throw new Error(`Found invalid baseIRI '${t}' for value '${e}'`);const a=t.substr(0,s+1);if(0===e.indexOf("//"))return a+n(e,o);let c;if(t.indexOf("//",s)===s+1){if(c=t.indexOf("/",s+3),c<0)return t.length>s+3?t+"/"+n(e,o):a+n(e,o)}else if(c=t.indexOf("/",s+1),c<0)return a+n(e,o);if(0===e.indexOf("/"))return t.substr(0,c)+r(e);let l=t.substr(c);const u=l.lastIndexOf("/");return u>=0&&u({name:e,mode:this.scopeModeMap[e]})))}get scopeParameter(){return this.scopes.map((e=>`${this._scopeNameForParameter(e)}:${e.mode}`)).join(" ")}claim(e,t){if("string"!=typeof e||-1!==e.indexOf("/")||0===e.length)throw new Error("Scope should be a non-empty string without forward slashes");if(!t.match(/^rw?$/))throw new Error("Mode should be either 'r' or 'rw'");this._adjustRootPaths(e),this.scopeModeMap[e]=t}get(e){return this.scopeModeMap[e]}remove(e){const t={};for(const e in this.scopeModeMap)t[e]=this.scopeModeMap[e];this.reset(),delete t[e];for(const e in t)this.claim(e,t[e])}checkPermission(e,t){const r=this.get(e);return r&&("r"===t||"rw"===r)}checkPathPermission(e,t){if(this.checkPermission("*",t))return!0;const r=this._getModuleName(e);return!!this.checkPermission(r,t)}reset(){this.rootPaths=[],this.scopeModeMap={}}_getModuleName(e){if("/"!==e[0])throw new Error("Path should start with a slash");const t=e.replace(/^\/public/,"").match(/^\/([^/]*)\//);return t?t[1]:"*"}_adjustRootPaths(e){"*"in this.scopeModeMap||"*"===e?this.rootPaths=["/"]:e in this.scopeModeMap||(this.rootPaths.push("/"+e+"/"),this.rootPaths.push("/public/"+e+"/"))}_scopeNameForParameter(e){if("*"===e.name&&this.storageType){if("2012.04"===this.storageType)return"";if(this.storageType.match(/remotestorage-0[01]/))return"root"}return e.name}setStorageType(e){this.storageType=e}}t.Access=r,t.default=r},3275:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Authorize=void 0;const o=i(r(3334)),s=r(7746),a=i(r(5503)),c=r(368);let l;function u(e){const t=e||d.getLocation().href,r={};for(const[e,n]of new URL(t).searchParams)r[e]=n;const n=t.indexOf("#");if(-1===n)return r;const i=t.substring(n+1);return i.includes("=")?i.split("&").reduce((function(e,t){const r=t.split("=");if("state"===r[0]&&r[1].match(/rsDiscovery/)){let t=decodeURIComponent(r[1]);const n=t.substr(t.indexOf("rsDiscovery=")).split("&")[0].split("=")[1];e.rsDiscovery=JSON.parse(atob(n)),t=t.replace(new RegExp("&?rsDiscovery="+n),""),t.length>0&&(e.state=t)}else e[decodeURIComponent(r[0])]=decodeURIComponent(r[1]);return e}),r):r}class d{static authorize(e,t){if((0,o.default)("[Authorize] authURL = ",t.authURL,"scope = ",t.scope,"redirectUri = ",t.redirectUri,"clientId = ",t.clientId,"response_type =",t.response_type),!t.scope)throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?");if(!(0,s.localStorageAvailable)()&&"remotestorage"===e.backend){t.redirectUri+=t.redirectUri.indexOf("#")>0?"&":"#";const r={userAddress:e.remote.userAddress,href:e.remote.href,storageApi:e.remote.storageApi,properties:e.remote.properties};t.redirectUri+="rsDiscovery="+(0,s.toBase64)(JSON.stringify(r))}const r=function(e){const t=new URL(e.redirectUri);e.state||(e.state=t.hash?t.hash.substring(1):""),e.response_type||(e.response_type="token");const r=new URL(e.authURL);r.searchParams.set("redirect_uri",e.redirectUri.replace(/#.*$/,"")),r.searchParams.set("scope",e.scope),r.searchParams.set("client_id",e.clientId);for(const t of["state","response_type","code_challenge","code_challenge_method","token_access_type"]){const n=e[t];n&&r.searchParams.set(t,n)}return r.href}(t);s.globalContext.cordova?d.openWindow(r,t.redirectUri,"location=yes,clearsessioncache=yes,clearcache=yes").then((t=>{e.remote.configure({token:t.access_token})})):d.setLocation(r)}static refreshAccessToken(e,t,r){return n(this,void 0,void 0,(function*(){var e,n,i;yield t.configure({token:null,tokenType:null});const s=new URLSearchParams({grant_type:"refresh_token",client_id:t.clientId,refresh_token:r}),l=yield(0,c.requestWithTimeout)("POST",t.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s.toString(),responseType:"json"});if(200!==(null==l?void 0:l.status))throw yield t.configure({refreshToken:null}),new a.default("refresh token rejected:"+JSON.stringify(l.response));{(0,o.default)(`[Authorize] access token good for ${null===(e=null==l?void 0:l.response)||void 0===e?void 0:e.expires_in} seconds`);const r={token:null===(n=null==l?void 0:l.response)||void 0===n?void 0:n.access_token,tokenType:null===(i=null==l?void 0:l.response)||void 0===i?void 0:i.token_type};if(!r.token)throw new Error(`no access_token in "successful" refresh: ${l.response}`);yield t.configure(r)}}))}static setLocation(e){if("string"==typeof e)document.location.href=e;else{if("object"!=typeof e)throw"Invalid location "+e;document.location=e}}static _rs_supported(){return"undefined"!=typeof document}static _rs_cleanup(e){e.removeEventListener("features-loaded",l)}}t.Authorize=d,d.IMPLIED_FAKE_TOKEN=!1,d.getLocation=function(){return document.location},d.openWindow=function(e,t,r){return new Promise(((n,i)=>{const o=open(e,"_blank",r);function s(){i("Authorization was canceled")}o&&!o.closed?(o.addEventListener("loadstart",(function(e){if(0!==e.url.indexOf(t))return;o.removeEventListener("exit",s),o.close();const r=u(e.url);r?n(r):i("Authorization error")})),o.addEventListener("exit",s)):i("Authorization popup was blocked")}))},d._rs_init=function(e){const t=u();let r;t&&(r=d.getLocation(),r.hash=""),l=function(){let i=!1;if(t){if(t.error)throw"access_denied"===t.error?new a.default("Authorization failed: access denied",{code:"access_denied"}):new a.default(`Authorization failed: ${t.error}`);t.rsDiscovery&&e.remote.configure(t.rsDiscovery),t.access_token&&(e.remote.configure({token:t.access_token}),i=!0),t.remotestorage&&(e.connect(t.remotestorage),i=!0),t.state&&(r=d.getLocation(),d.setLocation(r.href.split("#")[0]+"#"+t.state)),t.code&&(function(t){n(this,void 0,void 0,(function*(){var n,i,s,a;const l=sessionStorage.getItem("remotestorage:codeVerifier");if(!l)return void(0,o.default)("[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage");r=d.getLocation();let u=r.origin;"/"!==r.pathname&&(u+=r.pathname);const h=new URLSearchParams({code:t,grant_type:"authorization_code",client_id:e.remote.clientId,redirect_uri:u,code_verifier:l}),f=yield(0,c.requestWithTimeout)("POST",e.remote.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:h.toString(),responseType:"json"});if(200===f.status){(0,o.default)(`[Authorize] access token good for ${null===(n=null==f?void 0:f.response)||void 0===n?void 0:n.expires_in} seconds`);const t={token:null===(i=null==f?void 0:f.response)||void 0===i?void 0:i.access_token,refreshToken:null===(s=null==f?void 0:f.response)||void 0===s?void 0:s.refresh_token,tokenType:null===(a=null==f?void 0:f.response)||void 0===a?void 0:a.token_type};t.token?e.remote.configure(t):e._emit("error",new Error(`no access_token in "successful" response: ${f.response}`)),sessionStorage.removeItem("remotestorage:codeVerifier")}else e._emit("error",new Error(`${f.statusText}: ${f.response}`))}))}(t.code),i=!0),i||e.remote.stopWaitingForToken()}else e.remote.stopWaitingForToken()},e.on("features-loaded",l)},t.default=d},6424:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClient=void 0;const o=i(r(439)),s=i(r(1613)),a=i(r(6491)),c=i(r(93)),l=i(r(7028)),u=r(7746);class d{constructor(e,t){if(this.schemas={configurable:!0,get(){return d.Types.inScope(this.moduleName)}},"/"!==t[t.length-1])throw"Not a folder: "+t;"/"===t&&(this.makePath=e=>("/"===e[0]?"":"/")+e),this.storage=e,this.base=t,this.moduleName=function(e){const t=e.split("/");return e.length>2?t[1]:"root"}(this.base),this.addEvents(["change"]),this.on=this.on.bind(this),e.onChange(this.base,this._fireChange.bind(this))}scope(e){return new d(this.storage,this.makePath(e))}getListing(e,t){return n(this,void 0,void 0,(function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then((e=>404===e.statusCode?{}:e.body))}))}getAll(e,t){return n(this,void 0,void 0,(function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then((r=>{if(404===r.statusCode)return{};if("object"==typeof r.body){const n=Object.keys(r.body);if(0===n.length)return{};const i=n.map((n=>this.storage.get(this.makePath(e+n),t).then((e=>{if("string"==typeof e.body)try{e.body=JSON.parse(e.body)}catch(e){}"object"==typeof e.body&&(r.body[n]=e.body)}))));return Promise.all(i).then((()=>r.body))}}))}))}getFile(e,t){return n(this,void 0,void 0,(function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getFile must be a string"):this.storage.get(this.makePath(e),t).then((e=>({data:e.body,contentType:e.contentType,revision:e.revision})))}))}storeFile(e,t,r){return n(this,void 0,void 0,(function*(){return"string"!=typeof e?Promise.reject("Argument 'mimeType' of baseClient.storeFile must be a string"):"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.storeFile must be a string"):"string"!=typeof r&&"object"!=typeof r?Promise.reject("Argument 'body' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView"):(this.storage.access.checkPathPermission(this.makePath(t),"rw")||console.warn("WARNING: Editing a document to which only read access ('r') was claimed"),this.storage.put(this.makePath(t),r,e).then((e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode))))}))}getObject(e,t){return n(this,void 0,void 0,(function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getObject must be a string"):this.storage.get(this.makePath(e),t).then((t=>{if("object"==typeof t.body)return t.body;if("string"==typeof t.body)try{return JSON.parse(t.body)}catch(t){throw new Error("Not valid JSON: "+this.makePath(e))}else if(void 0!==t.body&&200===t.statusCode)return Promise.reject("Not an object: "+this.makePath(e))}))}))}storeObject(e,t,r){return n(this,void 0,void 0,(function*(){if("string"!=typeof e)return Promise.reject("Argument 'typeAlias' of baseClient.storeObject must be a string");if("string"!=typeof t)return Promise.reject("Argument 'path' of baseClient.storeObject must be a string");if("object"!=typeof r)return Promise.reject("Argument 'object' of baseClient.storeObject must be an object");this._attachType(r,e);try{const e=this.validate(r);if(!e.valid)return Promise.reject(e)}catch(e){return Promise.reject(e)}return this.storage.put(this.makePath(t),JSON.stringify(r),"application/json; charset=UTF-8").then((e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode)))}))}remove(e){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.remove must be a string"):(this.storage.access.checkPathPermission(this.makePath(e),"rw")||console.warn("WARNING: Removing a document to which only read access ('r') was claimed"),this.storage.delete(this.makePath(e)))}getItemURL(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.getItemURL must be a string";return this.storage.connected?(e=(0,u.cleanPath)(this.makePath(e)),this.storage.remote.href+e):void 0}cache(e,t="ALL"){if("string"!=typeof e)throw"Argument 'path' of baseClient.cache must be a string";if("string"!=typeof t)throw"Argument 'strategy' of baseClient.cache must be a string or undefined";if("FLUSH"!==t&&"SEEN"!==t&&"ALL"!==t)throw'Argument \'strategy\' of baseclient.cache must be one of ["FLUSH", "SEEN", "ALL"]';return this.storage.caching.set(this.makePath(e),t),this}declareType(e,t,r){let n;if(r&&"string"==typeof t)n=t;else if(r||"string"==typeof t){if(!r&&"string"==typeof t)throw new Error("declareType() requires a JSON Schema object to be passed, in order to validate object types/formats")}else r=t,n=this._defaultTypeURI(e);d.Types.declare(this.moduleName,e,n,r)}validate(e){const t=d.Types.getSchema(e["@context"]);if(t)return o.default.validateResult(e,t);throw new a.default(e["@context"])}_defaultTypeURI(e){return"http://remotestorage.io/spec/modules/"+encodeURIComponent(this.moduleName)+"/"+encodeURIComponent(e)}_attachType(e,t){e["@context"]=d.Types.resolveAlias(this.moduleName+"/"+t)||this._defaultTypeURI(t)}makePath(e){return this.base+(e||"")}_fireChange(e){l.default.changeEvents[e.origin]&&(["new","old","lastCommon"].forEach((function(t){if((!e[t+"ContentType"]||/^application\/(.*)json(.*)/.exec(e[t+"ContentType"]))&&"string"==typeof e[t+"Value"])try{e[t+"Value"]=JSON.parse(e[t+"Value"])}catch(e){}})),this._emit("change",e))}static _rs_init(){}}t.BaseClient=d,d.Types=s.default,(0,u.applyMixins)(d,[c.default]),t.default=d},7285:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Caching=void 0;const i=r(7746),o=n(r(3334));class s{constructor(){this.pendingActivations=[],this.reset()}set(e,t){if("string"!=typeof e)throw new Error("path should be a string");if(!(0,i.isFolder)(e))throw new Error("path should be a folder");if(!t.match(/^(FLUSH|SEEN|ALL)$/))throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'");this._rootPaths[e]=t,"ALL"===t&&(this.activateHandler?this.activateHandler(e):this.pendingActivations.push(e))}enable(e){this.set(e,"ALL")}disable(e){this.set(e,"FLUSH")}onActivate(e){(0,o.default)("[Caching] Setting activate handler",e,this.pendingActivations),this.activateHandler=e;for(let t=0;t{const i=l(n[e]);return u(n,t)?r(e):i?{statusCode:200,body:i.body||i.itemsMap,contentType:i.contentType}:{statusCode:404}})):this.getNodes([e]).then((t=>{const r=l(t[e]);if(r){if((0,c.isFolder)(e))for(const e in r.itemsMap)r.itemsMap.hasOwnProperty(e)&&!1===r.itemsMap[e]&&delete r.itemsMap[e];return{statusCode:200,body:r.body||r.itemsMap,contentType:r.contentType}}return{statusCode:404}}))}))}put(e,t,r){return n(this,void 0,void 0,(function*(){const n=(0,c.pathsFromRoot)(e);return this._updateNodes(n,(function(e,n){try{for(let i=0,o=e.length;i0)break}else console.error("Cannot delete non-existing node "+n)}return t}))}flush(e){return this._getAllDescendentPaths(e).then((e=>this.getNodes(e))).then((e=>{for(const t in e){const r=e[t];r&&r.common&&r.local&&this._emitChange({path:r.path,origin:"local",oldValue:!1===r.local.body?void 0:r.local.body,newValue:!1===r.common.body?void 0:r.common.body}),e[t]=void 0}return this.setNodes(e)}))}_emitChange(e){s.default.changeEvents[e.origin]&&this._emit("change",e)}fireInitial(){s.default.changeEvents.local&&this.forAllNodes((e=>{if((0,c.isDocument)(e.path)){const t=l(e);t&&this._emitChange({path:e.path,origin:"local",oldValue:void 0,oldContentType:void 0,newValue:t.body,newContentType:t.contentType})}})).then((()=>{this._emit("local-events-done")}))}onDiff(e){this.diffHandler=e}migrate(e){return"object"!=typeof e||e.common||(e.common={},"string"==typeof e.path?"/"===e.path.substr(-1)&&"object"==typeof e.body&&(e.common.itemsMap=e.body):(e.local||(e.local={}),e.local.body=e.body,e.local.contentType=e.contentType)),e}_updateNodes(e,t){return new Promise(((r,n)=>{this._doUpdateNodes(e,t,{resolve:r,reject:n})}))}_doUpdateNodes(e,t,r){this._updateNodesRunning?this._updateNodesQueued.push({paths:e,cb:t,promise:r}):(this._updateNodesRunning=!0,this.getNodes(e).then((n=>{const i=(0,c.deepClone)(n),o=[];n=t(e,n);for(const e in n){const t=n[e];(0,c.equal)(t,i[e])?delete n[e]:(0,c.isDocument)(e)&&((0,c.equal)(t.local.body,t.local.previousBody)&&t.local.contentType===t.local.previousContentType||o.push({path:e,origin:"window",oldValue:t.local.previousBody,newValue:!1===t.local.body?void 0:t.local.body,oldContentType:t.local.previousContentType,newContentType:t.local.contentType}),delete t.local.previousBody,delete t.local.previousContentType)}this.setNodes(n).then((()=>{this._emitChangeEvents(o),r.resolve({statusCode:200})}))})).then((()=>Promise.resolve()),(e=>{r.reject(e)})).then((()=>{this._updateNodesRunning=!1;const e=this._updateNodesQueued.shift();e&&this._doUpdateNodes(e.paths,e.cb,e.promise)})))}_emitChangeEvents(e){for(let t=0,r=e.length;t{const r=[e],n=l(t[e]),i=Object.keys(n.itemsMap).map((t=>this._getAllDescendentPaths(e+t).then((e=>{for(let t=0,n=e.length;tr))})):Promise.resolve([e])}_getInternals(){return{getLatest:l,makeNode:d,isOutdated:u}}}(0,c.applyMixins)(f,[o.default]),e.exports=f},7028:function(e){"use strict";e.exports={cache:!0,changeEvents:{local:!0,window:!1,remote:!0,conflict:!0},cordovaRedirectUri:void 0,logging:!1,modules:[],backgroundSyncInterval:6e4,disableFeatures:[],discoveryTimeout:5e3,isBackground:!1,requestTimeout:3e4,syncInterval:1e4}},5373:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(4199)),o=n(r(7028)),s=n(r(3334)),a=r(7746);let c;const l="remotestorage:discover";let u={};const d=function(e){return new Promise(((t,r)=>{if(e in u)return t(u[e]);const n=new i.default({tls_only:!1,uri_fallback:!0,request_timeout:o.default.discoveryTimeout});return setTimeout((()=>r(new Error("timed out"))),o.default.discoveryTimeout),n.lookup(e,(function(n,i){if(n)return r(n);if("object"!=typeof i.idx.links.remotestorage||"number"!=typeof i.idx.links.remotestorage.length||i.idx.links.remotestorage.length<=0)return(0,s.default)("[Discover] WebFinger record for "+e+" does not have remotestorage defined in the links section ",JSON.stringify(i.json)),r("WebFinger record for "+e+" does not have remotestorage defined in the links section.");const o=i.idx.links.remotestorage[0],a=o.properties["http://tools.ietf.org/html/rfc6749#section-4.2"]||o.properties["auth-endpoint"],d=o.properties["http://remotestorage.io/spec/version"]||o.type;return u[e]={href:o.href,storageApi:d,authURL:a,properties:o.properties},c&&localStorage.setItem(l,JSON.stringify({cache:u})),t(u[e])}))}))};(d.DiscoveryError=function(e){this.name="DiscoveryError",this.message=e,this.stack=(new Error).stack}).prototype=Object.create(Error.prototype),d.DiscoveryError.prototype.constructor=d.DiscoveryError,d._rs_init=function(){if(c=(0,a.localStorageAvailable)(),c)try{const e=JSON.parse(localStorage[l]);u=e.cache}catch(e){}},d._rs_supported=function(){return Object.prototype.hasOwnProperty.call(a.globalContext,"fetch")||Object.prototype.hasOwnProperty.call(a.globalContext,"XMLHttpRequest")},d._rs_cleanup=function(){c&&delete localStorage[l]},e.exports=d},5706:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=i(r(93)),s=i(r(6424)),a=i(r(6941)),c=i(r(6982)),l=i(r(5503)),u=r(7746),d=r(368),h=r(3684),f=i(r(3275));let p;const g="remotestorage:dropbox",y="https://api.dropboxapi.com/2/files/list_folder",m="https://api.dropboxapi.com/2/files/list_folder/continue",v="/remotestorage";function b(e){return(v+"/"+e).replace(/\/+$/,"").replace(/\/+/g,"/")}const w=/[\u007f-\uffff]/g;function _(e){return JSON.stringify(e).replace(w,(function(e){return"\\u"+("000"+e.charCodeAt(0).toString(16)).slice(-4)}))}function S(e,t){return new RegExp("^"+t.join("\\/")+"(\\/|$)").test(e.error_summary)}function E(e){return e instanceof ArrayBuffer||(0,d.isArrayBufferView)(e)}class A extends h.RemoteBase{constructor(e){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this._initialFetchDone=!1,this.addEvents(["connected","not-connected"]),this.clientId=e.apiKeys.dropbox.appKey,this.TOKEN_URL="https://api.dropboxapi.com/oauth2/token",this._revCache=new a.default("rev"),this._fetchDeltaCursor=null,this._fetchDeltaPromise=null,this._itemRefs={},p=(0,u.localStorageAvailable)(),p){const e=(0,u.getJSONFromLocalStorage)(g);e&&this.configure(e),this._itemRefs=(0,u.getJSONFromLocalStorage)(`${g}:shares`)||{}}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}connect(){return n(this,void 0,void 0,(function*(){try{if(this.rs.setBackend("dropbox"),this.token)T(this.rs);else{const{codeVerifier:e,codeChallenge:t,state:r}=yield(0,u.generateCodeVerifier)();sessionStorage.setItem("remotestorage:codeVerifier",e),sessionStorage.setItem("remotestorage:state",r),this.rs.authorize({authURL:"https://www.dropbox.com/oauth2/authorize",scope:"account_info.read files.content.read files.content.write files.metadata.read files.metadata.write",clientId:this.clientId,response_type:"code",state:r,code_challenge:t,code_challenge_method:"S256",token_access_type:"offline"})}}catch(e){throw this.rs._emit("error",e),this.rs.setBackend(void 0),e}}))}configure(e){return n(this,void 0,void 0,(function*(){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token),void 0!==e.refreshToken&&(this.refreshToken=e.refreshToken),void 0!==e.tokenType&&(this.tokenType=e.tokenType);const t=()=>{p&&localStorage.setItem(g,JSON.stringify({userAddress:this.userAddress,token:this.token,refreshToken:this.refreshToken,tokenType:this.tokenType}))};if(this.refreshToken||this.token)if(this.connected=!0,this.userAddress)this._emit("connected"),t();else try{const e=yield this.info();this.userAddress=e.email,this._emit("connected"),t()}catch(e){this.connected=!1,this.rs._emit("error",new Error("Could not fetch user info.")),t.apply(this)}else(()=>{this.connected=!1,p&&localStorage.removeItem(g),this.rs.setBackend(void 0)})()}))}_getFolder(e){const t=this._revCache,r=r=>{let i;if(200!==r.status&&409!==r.status)return Promise.reject("Unexpected response status: "+r.status);try{i=JSON.parse(r.responseText)}catch(e){return Promise.reject(e)}if(409===r.status)return S(i,["path","not_found"])?Promise.resolve({}):Promise.reject(new Error("API returned an error: "+i.error_summary));const o=i.entries.reduce(((r,n)=>{try{const i="folder"===n[".tag"],o=n.path_display.split("/").slice(-1)[0]+(i?"/":"");if(i)r[o]={ETag:t.get(e+o)};else{const t=new Date(n.server_modified);r[o]={ETag:n.rev,"Content-Length":n.size,"Last-Modified":t.toUTCString()},this._revCache.set(e+o,n.rev)}}catch(t){console.error(`[Dropbox] folder “${e}” has entry ${JSON.stringify(n)}:`,t)}return r}),{});return i.has_more?n(i.cursor).then((function(e){return Object.assign(o,e)})):Promise.resolve(o)},n=e=>{const t={body:{cursor:e}};return this._request("POST",m,t).then(r)};return this._request("POST",y,{body:{path:b(e)}}).then(r).then((function(r){return Promise.resolve({statusCode:200,body:r,contentType:"application/json; charset=UTF-8",revision:t.get(e)})}))}get(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const r=this._revCache.get(e);if(null===r)return Promise.resolve({statusCode:404});if(t&&t.ifNoneMatch){if(!this._initialFetchDone)return this.fetchDelta().then((()=>this.get(e,t)));if(r&&r===t.ifNoneMatch)return Promise.resolve({statusCode:304})}if("/"===e.slice(-1))return this._getFolder(e);const n={headers:{"Dropbox-API-Arg":_({path:b(e)})},responseType:"arraybuffer"};return t&&t.ifNoneMatch&&(n.headers["If-None-Match"]=t.ifNoneMatch),this._request("GET","https://content.dropboxapi.com/2/files/download",n).then((t=>{const r=t.status;let n,i,o,s;return 200!==r&&409!==r?Promise.resolve({statusCode:r}):(n=t.getResponseHeader("Dropbox-API-Result"),(0,u.getTextFromArrayBuffer)(t.response,"UTF-8").then((a=>{i=a,409===r&&(n=i);try{n=JSON.parse(n)}catch(e){return Promise.reject(e)}if(409===r)return S(n,["path","not_found"])?{statusCode:404}:Promise.reject(new Error('API error while downloading file ("'+e+'"): '+n.error_summary));if(o=t.getResponseHeader("Content-Type"),s=n.rev,this._revCache.set(e,s),this._shareIfNeeded(e),(0,u.shouldBeTreatedAsBinary)(a,o))i=t.response;else try{i=JSON.parse(i),o="application/json; charset=UTF-8"}catch(e){}return{statusCode:r,body:i,contentType:o,revision:s}})))}))}put(e,t,r){return n(this,arguments,void 0,(function*(e,t,r,n={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const i=this._revCache.get(e);if(n&&n.ifMatch&&i&&i!==n.ifMatch)return{statusCode:412,revision:i};if(n&&"*"===n.ifNoneMatch&&i&&"rev"!==i)return{statusCode:412,revision:i};if(!r.match(/charset=/)&&E(t)&&(r+="; charset=binary"),t.length>157286400)throw new Error("Cannot upload file larger than 150MB");const o={body:t,contentType:r,path:e};if(n&&(n.ifMatch||"*"===n.ifNoneMatch)){const t=yield this._getMetadata(e);if(n&&"*"===n.ifNoneMatch&&t)return{statusCode:412,revision:t.rev};if(n&&n.ifMatch&&t&&t.rev!==n.ifMatch)return{statusCode:412,revision:t.rev}}const s=yield this._uploadSimple(o);return this._shareIfNeeded(e),s}))}delete(e){return n(this,arguments,void 0,(function*(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const r=this._revCache.get(e);if((null==t?void 0:t.ifMatch)&&r&&t.ifMatch!==r)return{statusCode:412,revision:r};if(null==t?void 0:t.ifMatch){const r=yield this._getMetadata(e);if((null==t?void 0:t.ifMatch)&&r&&r.rev!==t.ifMatch)return{statusCode:412,revision:r.rev}}return this._deleteSimple(e)}))}_shareIfNeeded(e){if(e.match(/^\/public\/.*[^/]$/)&&void 0===this._itemRefs[e])return this.share(e)}share(e){const t={body:{path:b(e)}};return this._request("POST","https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings",t).then((t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status:"+t.status));let r;try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?S(r,["shared_link_already_exists"])?this._getSharedLink(e):Promise.reject(new Error("API error: "+r.error_summary)):Promise.resolve(r.url)})).then((t=>(this._itemRefs[e]=t,p&&localStorage.setItem(g+":shares",JSON.stringify(this._itemRefs)),Promise.resolve(t))),(t=>(t.message='Sharing Dropbox file or folder ("'+e+'") failed: '+t.message,Promise.reject(t))))}info(){return this._request("POST","https://api.dropboxapi.com/2/users/get_current_account",{}).then((function(e){let t;try{const r=JSON.parse(e.responseText);t=null==r?void 0:r.email}catch(t){return Promise.reject(new Error("Could not query current account info: Invalid API response: "+e.responseText))}return Promise.resolve({email:t})}))}_request(e,t,r){return n(this,arguments,void 0,(function*(e,t,r,n=1){if(this.isForbiddenRequestMethod(e,t))throw`Don't use ${e} on directories!`;if(!this.token)throw new l.default("No access token");r.headers||(r.headers={}),r.headers.Authorization="Bearer "+this.token,"object"!=typeof r.body||E(r.body)||(r.body=JSON.stringify(r.body),r.headers["Content-Type"]="application/json; charset=UTF-8"),this.rs._emit("wire-busy",{method:e,isFolder:(0,u.isFolder)(t)});try{const i=yield(0,d.requestWithTimeout)(e,t,r);return this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!0}),401===(null==i?void 0:i.status)&&this.refreshToken?n>=3?(console.error(`Abandoned after ${n} attempts: ${e} ${t}`),i):(this.rs._emit("wire-busy",{method:e,isFolder:(0,u.isFolder)(t)}),yield f.default.refreshAccessToken(this.rs,this,this.refreshToken),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!0}),this._request(e,t,r,n+1)):[503,429].includes(null==i?void 0:i.status)?(this.online&&(this.online=!1,this.rs._emit("network-offline")),n>=3?(console.warn(`Abandoned after ${n} attempts: ${e} ${t}`),i):(yield new Promise((e=>setTimeout(e,(0,d.retryAfterMs)(i)))),this._request(e,t,r,n+1))):i}catch(r){throw this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,u.isFolder)(t),success:!1}),r}}))}fetchDelta(...e){if(this._fetchDeltaPromise)return this._fetchDeltaPromise;const t=e=>n(this,void 0,void 0,(function*(){let r,n;"string"==typeof e?(r=m,n={cursor:e}):(r=y,n={path:v,recursive:!0,include_deleted:!0});try{const i=yield this._request("POST",r,{body:n});if(401===i.status)throw new l.default;if(200!==i.status&&409!==i.status)throw new Error("Invalid response status: "+i.status);let o;try{o=JSON.parse(i.responseText)}catch(e){throw new Error("Invalid response body: "+i.responseText)}if(409===i.status){if(!S(o,["path","not_found"]))throw new Error("API returned an error: "+o.error_summary);o={cursor:null,entries:[],has_more:!1}}if(e||this._revCache.deactivatePropagation(),o.entries.forEach((e=>{const t=e.path_display.slice(14);"deleted"===e[".tag"]?(this._revCache.delete(t),this._revCache.delete(t+"/")):"file"===e[".tag"]&&this._revCache.set(t,e.rev)})),this._fetchDeltaCursor=o.cursor,o.has_more)return t(o.cursor);this._revCache.activatePropagation(),this._initialFetchDone=!0}catch(e){if("timeout"===e)return;throw e}}));return this._fetchDeltaPromise=t(this._fetchDeltaCursor).catch((e=>("object"==typeof e&&"message"in e?e.message="Dropbox: fetchDelta: "+e.message:e=`Dropbox: fetchDelta: ${e}`,this.rs._emit("error",e),this._fetchDeltaPromise=null,Promise.reject(e)))).then((()=>(this._fetchDeltaPromise=null,Promise.resolve(e)))),this._fetchDeltaPromise}_getMetadata(e){const t={path:b(e)};return this._request("POST","https://api.dropboxapi.com/2/files/get_metadata",{body:t}).then((e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status:"+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?S(t,["path","not_found"])?Promise.resolve():Promise.reject(new Error("API error: "+t.error_summary)):Promise.resolve(t)})).then(void 0,(t=>(t.message='Could not load metadata for file or folder ("'+e+'"): '+t.message,Promise.reject(t))))}_uploadSimple(e){const t={path:b(e.path),mode:{".tag":"overwrite",update:void 0},mute:!0};return e.ifMatch&&(t.mode={".tag":"update",update:e.ifMatch}),this._request("POST","https://content.dropboxapi.com/2/files/upload",{body:e.body,headers:{"Content-Type":"application/octet-stream","Dropbox-API-Arg":_(t)}}).then((t=>{if(200!==t.status&&409!==t.status)return Promise.resolve({statusCode:t.status});let r;try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid API result: "+t.responseText))}return 409===t.status?S(r,["path","conflict"])?this._getMetadata(e.path).then((function(e){return Promise.resolve({statusCode:412,revision:e.rev})})):(this.rs._emit("error",new Error(r.error_summary)),Promise.resolve({statusCode:t.status})):(this._revCache.set(e.path,r.rev),Promise.resolve({statusCode:t.status,revision:r.rev}))}))}_deleteSimple(e){const t={path:b(e)};return this._request("POST","https://api.dropboxapi.com/2/files/delete",{body:t}).then((e=>{if(200!==e.status&&409!==e.status)return Promise.resolve({statusCode:e.status});let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}if(409===e.status){if(S(t,["path_lookup","not_found"]))return Promise.resolve({statusCode:404});this.rs._emit("error",new Error(t.error_summary))}return Promise.resolve({statusCode:e.status})})).then((t=>(200!==t.statusCode&&404!==t.statusCode||(this._revCache.delete(e),delete this._itemRefs[e]),Promise.resolve(t))),(t=>(t.message='Could not delete Dropbox file or folder ("'+e+'"): '+t.message,Promise.reject(t))))}_getSharedLink(e){return n(this,void 0,void 0,(function*(){const t={body:{path:b(e),direct_only:!0}};return this._request("POST","https://api.dropbox.com/2/sharing/list_shared_links",t).then((e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status: "+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?Promise.reject(new Error("API error: "+(null==t?void 0:t.error_summary)||0)):t.links.length?Promise.resolve(t.links[0].url):Promise.reject(new Error("No links returned"))}),(t=>(t.message='Could not get link to a shared file or folder ("'+e+'"): '+t.message,Promise.reject(t))))}))}static _rs_init(e){p=(0,u.localStorageAvailable)(),e.apiKeys.dropbox&&(e.dropbox=new A(e)),"dropbox"===e.backend&&T(e)}static _rs_supported(){return!0}static _rs_cleanup(e){!function(e){(function(e){e._origRemote&&(e.remote=e._origRemote,delete e._origRemote)})(e),function(e){e._dropboxOrigSync&&(e.sync.sync=e._dropboxOrigSync,delete e._dropboxOrigSync)}(e),function(e){e._origBaseClientGetItemURL&&(s.default.prototype.getItemURL=e._origBaseClientGetItemURL,delete e._origBaseClientGetItemURL)}(e),I(e)}(e),p&&localStorage.removeItem(g),e.setBackend(void 0)}}function R(e,...t){e._dropboxOrigSync||(e._dropboxOrigSync=e.sync.sync.bind(e.sync),e.sync.sync=function(){return this.dropbox.fetchDelta(e,...t).then(e._dropboxOrigSync,(function(t){e._emit("error",new c.default(t)),e._emit("sync-done")}))}.bind(e))}function I(e){e._dropboxOrigSyncCycle&&(e.syncCycle=e._dropboxOrigSyncCycle,delete e._dropboxOrigSyncCycle)}function T(e){!function(e){e._origRemote||(e._origRemote=e.remote,e.remote=e.dropbox)}(e),e.sync?R(e):function(e,...t){e._dropboxOrigSyncCycle||(e._dropboxOrigSyncCycle=e.syncCycle,e.syncCycle=()=>{if(!e.sync)throw new Error("expected sync to be initialized by now");R(e),e._dropboxOrigSyncCycle(e,...t),I(e)})}(e),function(e){e._origBaseClientGetItemURL||(e._origBaseClientGetItemURL=s.default.prototype.getItemURL,s.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Dropbox yet")})}(e)}(0,u.applyMixins)(A,[o.default]),e.exports=A},9451:function(e,t,r){"use strict";const n=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(93)),i=r(7746);class o{constructor(){this.addEvents(["background","foreground"]),this.mode="undefined"!=typeof window?"browser":"node","browser"===this.mode&&(this.setBrowserPrefixedNames(),document.addEventListener(this.visibilityChangeEvent,this.setVisibility.bind(this),!1),this.setVisibility())}setBrowserPrefixedNames(){"browser"===this.mode&&(void 0!==document.hidden?(this.hiddenProperty="hidden",this.visibilityChangeEvent="visibilitychange"):void 0!==document.mozHidden?(this.hiddenProperty="mozHidden",this.visibilityChangeEvent="mozvisibilitychange"):void 0!==document.msHidden?(this.hiddenProperty="msHidden",this.visibilityChangeEvent="msvisibilitychange"):void 0!==document.webkitHidden&&(this.hiddenProperty="webkitHidden",this.visibilityChangeEvent="webkitvisibilitychange"))}setVisibility(){document[this.hiddenProperty]?this.goBackground():this.goForeground()}isBrowser(){return"browser"===this.mode}isNode(){return"node"===this.mode}goBackground(){this._emit("background")}goForeground(){this._emit("foreground")}static _rs_init(){}static _rs_cleanup(){}}(0,i.applyMixins)(o,[n.default]),e.exports=o},93:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventHandling=void 0;const i=n(r(3334));class o{addEvents(e){e.forEach((e=>this._addEvent(e)))}addEventListener(e,t){if("string"!=typeof e)throw new Error("Argument eventName should be a string");if("function"!=typeof t)throw new Error("Argument handler should be a function");(0,i.default)("[EventHandling] Adding event listener",e),this._validateEvent(e),this._handlers[e].push(t)}on(e,t){return this.addEventListener(e,t)}removeEventListener(e,t){this._validateEvent(e);const r=this._handlers[e].length;for(let n=0;n{e.apply(this,t)}))}_validateEvent(e){if(!(e in this._handlers))throw new Error("Unknown event: "+e)}_delegateEvent(e,t){t.on(e,(t=>{this._emit(e,t)}))}_addEvent(e){void 0===this._handlers&&(this._handlers={}),this._handlers[e]=[]}}t.EventHandling=o,t.default=o},6545:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(7028)),o=n(r(9451)),s=n(r(3334)),a=r(7746),c=n(r(1370)),l=n(r(2548)),u=n(r(3275)),d=n(r(5373)),h=n(r(6424)),f=n(r(1801)),p=n(r(5706)),g=n(r(6467)),y=n(r(600)),m=n(r(313)),v=n(r(7285)),b=n(r(8567)),w=n(r(7794)),_=n(r(8365)),S={features:[],featuresDone:0,readyFired:!1,loadFeatures(){this.features=[],this.featuresDone=0,this.readyFired=!1,this.featureModules={WireClient:y.default,Dropbox:p.default,GoogleDrive:f.default,Solid:g.default,Access:l.default,Discover:d.default,Authorize:u.default,BaseClient:h.default,Env:o.default},i.default.cache&&(0,a.extend)(this.featureModules,{Caching:v.default,IndexedDB:b.default,LocalStorage:w.default,InMemoryStorage:_.default,Sync:m.default}),i.default.disableFeatures.forEach((e=>{this.featureModules[e]&&delete this.featureModules[e]})),this._allLoaded=!1;for(const e in this.featureModules)this.loadFeature(e)},hasFeature(e){for(let t=this.features.length-1;t>=0;t--)if(this.features[t].name===e)return this.features[t].supported;return!1},loadFeature(e){const t=this.featureModules[e],r=!t._rs_supported||t._rs_supported();(0,s.default)(`[RemoteStorage] [FEATURE ${e}] initializing ...`),"object"==typeof r?r.then((()=>{this.featureSupported(e,!0),this.initFeature(e)}),(()=>{this.featureSupported(e,!1)})):"boolean"==typeof r?(this.featureSupported(e,r),r&&this.initFeature(e)):this.featureSupported(e,!1)},initFeature(e){const t=this.featureModules[e];let r;try{r=t._rs_init(this)}catch(t){return void this.featureFailed(e,t)}"object"==typeof r&&"function"==typeof r.then?r.then((()=>{this.featureInitialized(e)}),(t=>{this.featureFailed(e,t)})):this.featureInitialized(e)},featureFailed(e,t){(0,s.default)(`[RemoteStorage] [FEATURE ${e}] initialization failed (${t})`),this.featureDone()},featureSupported(e,t){(0,s.default)(`[RemoteStorage] [FEATURE ${e}]${t?"":"not "} supported`),t||this.featureDone()},featureInitialized(e){(0,s.default)(`[RemoteStorage] [FEATURE ${e}] initialized`),this.features.push({name:e,init:this.featureModules[e]._rs_init,supported:!0,cleanup:this.featureModules[e]._rs_cleanup}),this.featureDone()},featureDone(){this.featuresDone++,this.featuresDone===Object.keys(this.featureModules).length&&setTimeout(this.featuresLoaded.bind(this),0)},_setCachingModule(){["IndexedDB","LocalStorage","InMemoryStorage"].some((e=>{if(this.features.some((t=>t.name===e)))return this.features.local=this.featureModules[e],!0}))},_fireReady(){try{this.readyFired||(this._emit("ready"),this.readyFired=!0)}catch(e){console.error("'ready' failed: ",e,e.stack),this._emit("error",e)}},featuresLoaded(){(0,s.default)("[RemoteStorage] All features loaded"),this._setCachingModule(),this.local=i.default.cache&&this.features.local&&new this.features.local,this.local&&this.remote?(this._setGPD(c.default,this),this._bindChange(this.local)):this.remote&&this._setGPD(this.remote,this.remote),this.remote&&(this.remote.on("connected",(()=>{this._fireReady(),this._emit("connected")})),this.remote.on("not-connected",(()=>{this._fireReady(),this._emit("not-connected")})),this.remote.connected&&(this._fireReady(),this._emit("connected")),this.hasFeature("Authorize")||this.remote.stopWaitingForToken()),this._collectCleanupFunctions();try{this._allLoaded=!0,this._emit("features-loaded")}catch(e){(0,a.logError)(e),this._emit("error",e)}this._processPending()},_collectCleanupFunctions(){this._cleanups=[];for(let e=0;e=r-this.maxAge?t.v:void 0}set(e,t){this._items[e]={v:t,t:(new Date).getTime()}}}class v extends c.RemoteBase{constructor(e,t){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this.addEvents(["connected","not-connected"]),this.clientId=t,this._fileIdCache=new m(300),h=(0,s.localStorageAvailable)(),h){const e=(0,s.getJSONFromLocalStorage)(u);e&&this.configure(e)}}configure(e){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token);const t=function(){h&&localStorage.setItem(u,JSON.stringify({userAddress:this.userAddress,token:this.token}))},r=function(){this.connected=!1,delete this.token,h&&localStorage.removeItem(u)};this.token?(this.connected=!0,this.userAddress?(this._emit("connected"),t.apply(this)):this.info().then((e=>{this.userAddress=e.user.emailAddress,this._emit("connected"),t.apply(this)})).catch((()=>{r.apply(this),this.rs._emit("error",new Error("Could not fetch user info."))}))):r.apply(this)}connect(){this.rs.setBackend("googledrive"),this.rs.authorize({authURL:"https://accounts.google.com/o/oauth2/auth",scope:"https://www.googleapis.com/auth/drive",clientId:this.clientId})}get(e,t={}){return(0,s.isFolder)(e)?this._getFolder(y(e)):this._getFile(y(e),t)}put(e,t,r,n={}){const i=y(e);function o(e){if(e.status>=200&&e.status<300){const t=JSON.parse(e.responseText),r=this.stripQuotes(t.etag);return Promise.resolve({statusCode:200,contentType:t.mimeType,revision:r})}return 412===e.status?Promise.resolve({statusCode:412,revision:"conflict"}):Promise.reject("PUT failed with status "+e.status+" ("+e.responseText+")")}return this._getFileId(i).then((e=>e?n&&"*"===n.ifNoneMatch?o({status:412}):this._updateFile(e,i,t,r,n).then(o):this._createFile(i,t,r).then(o)))}delete(e,t={}){const r=y(e);return this._getFileId(r).then((e=>e?this._getMeta(e).then((r=>{let n;return"object"==typeof r&&"string"==typeof r.etag&&(n=this.stripQuotes(r.etag)),t&&t.ifMatch&&t.ifMatch!==n?{statusCode:412,revision:n}:this._request("DELETE",l+"/drive/v2/files/"+e,{}).then((e=>200===e.status||204===e.status?{statusCode:200}:Promise.reject("Delete failed: "+e.status+" ("+e.responseText+")")))})):Promise.resolve({statusCode:200})))}info(){const e=l+"/drive/v2/about?fields=user";return this._request("GET",e,{}).then((function(e){try{const t=JSON.parse(e.responseText);return Promise.resolve(t)}catch(e){return Promise.reject(e)}}))}_updateFile(e,t,r,n,i){const o={mimeType:n},s={"Content-Type":"application/json; charset=UTF-8"};return i&&i.ifMatch&&(s["If-Match"]=this.addQuotes(i.ifMatch)),this._request("PUT",l+"/upload/drive/v2/files/"+e+"?uploadType=resumable",{body:JSON.stringify(o),headers:s}).then((e=>412===e.status?e:this._request("PUT",e.getResponseHeader("Location"),{body:n.match(/^application\/json/)?JSON.stringify(r):r})))}_createFile(e,t,r){return this._getParentId(e).then((n=>{const i={title:f(g(e)),mimeType:r,parents:[{kind:"drive#fileLink",id:n}]};return this._request("POST",l+"/upload/drive/v2/files?uploadType=resumable",{body:JSON.stringify(i),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then((e=>this._request("POST",e.getResponseHeader("Location"),{body:r.match(/^application\/json/)?JSON.stringify(t):t})))}))}_getFile(e,t){return this._getFileId(e).then((e=>this._getMeta(e).then((e=>{let r;if("object"==typeof e&&"string"==typeof e.etag&&(r=this.stripQuotes(e.etag)),t&&t.ifNoneMatch&&r===t.ifNoneMatch)return Promise.resolve({statusCode:304});if(!e.downloadUrl){if(!e.exportLinks||!e.exportLinks["text/html"])return Promise.resolve({statusCode:200,body:"",contentType:e.mimeType,revision:r});e.mimeType+=";export=text/html",e.downloadUrl=e.exportLinks["text/html"]}return this._request("GET",e.downloadUrl,{responseType:"arraybuffer"}).then((t=>(0,s.getTextFromArrayBuffer)(t.response,"UTF-8").then((function(n){let i=n;if(e.mimeType.match(/^application\/json/))try{i=JSON.parse(i)}catch(e){}else(0,s.shouldBeTreatedAsBinary)(n,e.mimeType)&&(i=t.response);return{statusCode:200,body:i,contentType:e.mimeType,revision:r}}))))}))))}_getFolder(e){return this._getFileId(e).then((t=>{let r,n,i;if(!t)return Promise.resolve({statusCode:404});const o="'"+t+"' in parents";return this._request("GET",l+"/drive/v2/files?q="+encodeURIComponent(o)+"&fields="+encodeURIComponent("items(downloadUrl,etag,fileSize,id,mimeType,title,labels)")+"&maxResults=1000&trashed=false",{}).then((t=>{var o;if(200!==t.status)return Promise.reject("request failed or something: "+t.status);try{r=JSON.parse(t.responseText)}catch(e){return Promise.reject("non-JSON response from GoogleDrive")}i={};for(const t of r.items)(null===(o=t.labels)||void 0===o?void 0:o.trashed)||(n=this.stripQuotes(t.etag),t.mimeType===d?(this._fileIdCache.set(e+(0,s.cleanPath)(t.title)+"/",t.id),i[t.title+"/"]={ETag:n}):(this._fileIdCache.set(e+(0,s.cleanPath)(t.title),t.id),i[t.title]={ETag:n,"Content-Type":t.mimeType,"Content-Length":t.fileSize}));return Promise.resolve({statusCode:200,body:i,contentType:"application/json; charset=UTF-8",revision:void 0})}))}))}_getParentId(e){const t=p(e);return this._getFileId(t).then((e=>e?Promise.resolve(e):this._createFolder(t)))}_createFolder(e){return this._getParentId(e).then((t=>this._request("POST",l+"/drive/v2/files",{body:JSON.stringify({title:f(g(e)),mimeType:d,parents:[{id:t}]}),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then((e=>{const t=JSON.parse(e.responseText);return Promise.resolve(t.id)}))))}_getFileId(e){let t;return"/"===e?Promise.resolve("root"):(t=this._fileIdCache.get(e))?Promise.resolve(t):this._getFolder(p(e)).then((()=>(t=this._fileIdCache.get(e),t?Promise.resolve(t):"/"===e.substr(-1)?this._createFolder(e).then((()=>this._getFileId(e))):Promise.resolve())))}_getMeta(e){return this._request("GET",l+"/drive/v2/files/"+e,{}).then((function(t){return 200===t.status?Promise.resolve(JSON.parse(t.responseText)):Promise.reject("request (getting metadata for "+e+") failed with status: "+t.status)}))}_request(e,t,r){return this.isForbiddenRequestMethod(e,t)?Promise.reject(`Don't use ${e} on directories!`):(r.headers||(r.headers={}),r.headers.Authorization="Bearer "+this.token,this.rs._emit("wire-busy",{method:e,isFolder:(0,s.isFolder)(t)}),(0,a.requestWithTimeout)(e,t,r).then((r=>r&&401===r.status?void this.connect():(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,s.isFolder)(t),success:!0}),Promise.resolve(r))),(r=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,s.isFolder)(t),success:!1}),Promise.reject(r)))))}static _rs_init(e){const t=e.apiKeys.googledrive;var r;t&&(e.googledrive=new v(e,t.clientId),"googledrive"===e.backend&&(e._origRemote=e.remote,e.remote=e.googledrive,(r=e)._origBaseClientGetItemURL||(r._origBaseClientGetItemURL=i.default.prototype.getItemURL,i.default.prototype.getItemURL=function(){throw new Error("getItemURL is not implemented for Google Drive yet")})))}static _rs_supported(){return!0}static _rs_cleanup(e){var t;e.setBackend(void 0),e._origRemote&&(e.remote=e._origRemote,delete e._origRemote),(t=e)._origBaseClientGetItemURL&&(i.default.prototype.getItemURL=t._origBaseClientGetItemURL,delete t._origBaseClientGetItemURL)}}(0,s.applyMixins)(v,[o.default]),e.exports=v},8567:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=i(r(93)),s=i(r(3496)),a=i(r(3334)),c=r(7746),l="remotestorage";let u;class d extends s.default{constructor(e){super(),this.addEvents(["change","local-events-done"]),this.db=e||u,this.db?(this.getsRunning=0,this.putsRunning=0,this.changesQueued={},this.changesRunning={},this.commitSlownessWarning=null):(0,a.default)("[IndexedDB] Failed to open DB")}getNodes(e){return n(this,void 0,void 0,(function*(){const t=[],r={};for(let n=0,i=e.length;n0?this.getNodesFromDb(t).then((function(e){for(const t in r)e[t]=r[t];return e})):Promise.resolve(r)}))}setNodes(e){return n(this,void 0,void 0,(function*(){for(const t in e)this.changesQueued[t]=e[t]||!1;return this.maybeFlush(),Promise.resolve()}))}maybeFlush(){0===this.putsRunning?this.flushChangesQueued():this.commitSlownessWarning||(this.commitSlownessWarning=r.g.setInterval((function(){console.warn("WARNING: waited more than 10 seconds for previous commit to finish")}),1e4))}flushChangesQueued(){this.commitSlownessWarning&&(clearInterval(this.commitSlownessWarning),this.commitSlownessWarning=null),Object.keys(this.changesQueued).length>0&&(this.changesRunning=this.changesQueued,this.changesQueued={},this.setNodesInDb(this.changesRunning).then(this.flushChangesQueued.bind(this)))}getNodesFromDb(e){return new Promise(((t,r)=>{const n=this.db.transaction(["nodes"],"readonly"),i=n.objectStore("nodes"),o={};this.getsRunning++,e.map((e=>{i.get(e).onsuccess=t=>{o[e]=t.target.result}})),n.oncomplete=()=>{t(o),this.getsRunning--},n.onerror=n.onabort=()=>{r("get transaction error/abort"),this.getsRunning--}}))}setNodesInDb(e){return n(this,void 0,void 0,(function*(){return new Promise(((t,r)=>{const n=this.db.transaction(["nodes"],"readwrite"),i=n.objectStore("nodes"),o=(new Date).getTime();this.putsRunning++,(0,a.default)("[IndexedDB] Starting put",e,this.putsRunning);for(const t in e){const r=e[t];if("object"==typeof r)try{i.put(r)}catch(e){throw(0,a.default)("[IndexedDB] Error while putting",r,e),e}else try{i.delete(t)}catch(e){throw(0,a.default)("[IndexedDB] Error while removing",i,r,e),e}}n.oncomplete=()=>{this.putsRunning--,(0,a.default)("[IndexedDB] Finished put",e,this.putsRunning,(new Date).getTime()-o+"ms"),t()},n.onerror=()=>{this.putsRunning--,r("transaction error")},n.onabort=()=>{r("transaction abort"),this.putsRunning--}}))}))}reset(e){const t=this.db.name;this.db.close(),d.clean(this.db.name,(()=>{d.open(t,((t,r)=>{t?(0,a.default)("[IndexedDB] Error while resetting local storage",t):this.db=r,"function"==typeof e&&e(self)}))}))}forAllNodes(e){return n(this,void 0,void 0,(function*(){return new Promise((t=>{this.db.transaction(["nodes"],"readonly").objectStore("nodes").openCursor().onsuccess=r=>{const n=r.target.result;n?(e(this.migrate(n.value)),n.continue()):t()}}))}))}closeDB(){0===this.putsRunning?this.db.close():setTimeout(this.closeDB.bind(this),100)}static open(e,t){const r=setTimeout((function(){t("timeout trying to open db")}),1e4);try{const n=indexedDB.open(e,2);n.onerror=function(){(0,a.default)("[IndexedDB] Opening DB failed",n),clearTimeout(r),t(n.error)},n.onupgradeneeded=function(e){const t=n.result;(0,a.default)("[IndexedDB] Upgrade: from ",e.oldVersion," to ",e.newVersion),1!==e.oldVersion&&((0,a.default)("[IndexedDB] Creating object store: nodes"),t.createObjectStore("nodes",{keyPath:"path"})),(0,a.default)("[IndexedDB] Creating object store: changes"),t.createObjectStore("changes",{keyPath:"path"})},n.onsuccess=function(){clearTimeout(r);const i=n.result;if(!i.objectStoreNames.contains("nodes")||!i.objectStoreNames.contains("changes"))return(0,a.default)("[IndexedDB] Missing object store. Resetting the database."),void d.clean(e,(function(){d.open(e,t)}));t(null,n.result)}}catch(n){(0,a.default)("[IndexedDB] Failed to open database: "+n),(0,a.default)("[IndexedDB] Resetting database and trying again."),clearTimeout(r),d.clean(e,(function(){d.open(e,t)}))}}static clean(e,t){const r=indexedDB.deleteDatabase(e);r.onsuccess=function(){(0,a.default)("[IndexedDB] Done removing DB"),t()},r.onerror=r.onabort=function(t){console.error('Failed to remove database "'+e+'"',t)}}static _rs_init(e){return new Promise(((t,r)=>{d.open(l,(function(n,i){n?r(n):(u=i,i.onerror=()=>{e._emit("error",n)},t())}))}))}static _rs_supported(){return new Promise(((e,t)=>{const r=(0,c.getGlobalContext)();let n=!1;if("undefined"!=typeof navigator&&navigator.userAgent.match(/Android (2|3|4\.[0-3])/)&&(navigator.userAgent.match(/Chrome|Firefox/)||(n=!0)),"indexedDB"in r&&!n)try{const r=indexedDB.open("rs-check");r.onerror=function(){t()},r.onsuccess=function(){r.result.close(),indexedDB.deleteDatabase("rs-check"),e()}}catch(e){t()}else t()}))}static _rs_cleanup(e){return new Promise((t=>{e.local&&e.local.closeDB(),d.clean(l,t)}))}diffHandler(){}}(0,c.applyMixins)(d,[o.default]),e.exports=d},8365:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=n(r(93)),o=n(r(3496)),s=r(7746);class a extends o.default{constructor(){super(),this._storage={},this.addEvents(["change","local-events-done"])}getNodes(e){const t={};for(let r=0,n=e.length;r{(0,s.default)("[LocalStorage] Removing",e),delete localStorage[e]}))}}(0,a.applyMixins)(u,[o.default]),e.exports=u},3334:function(e,t,r){"use strict";const n=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(7028));e.exports=function(...e){n.default.logging&&console.log(...e)}},3684:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RemoteBase=void 0;const i=n(r(93)),o=r(7746);class s extends i.default{constructor(e){super(),this.rs=e,this.connected=!1}stopWaitingForToken(){this.connected||this._emit("not-connected")}addQuotes(e){return"string"!=typeof e?e:"*"===e?"*":'"'+e+'"'}stripQuotes(e){return"string"!=typeof e?e:e.replace(/^["']|["']$/g,"")}isForbiddenRequestMethod(e,t){return("PUT"===e||"DELETE"===e)&&(0,o.isFolder)(t)}}t.RemoteBase=s},423:function(e,t,r){"use strict";var n,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),s=0;s=2e3&&e<=36e5}var x;!function(e){e.GOOGLE="googledrive",e.DROPBOX="dropbox"}(x||(x={}));class P{constructor(e){if(this._pending=[],this._cleanups=[],this._pathHandlers={change:{}},this.apiKeys={},this._init=S.default.loadFeatures,this.features=S.default.features,this.loadFeature=S.default.loadFeature,this.featureSupported=S.default.featureSupported,this.featureDone=S.default.featureDone,this.featuresDone=S.default.featuresDone,this.featuresLoaded=S.default.featuresLoaded,this.featureInitialized=S.default.featureInitialized,this.featureFailed=S.default.featureFailed,this.hasFeature=S.default.hasFeature,this._setCachingModule=S.default._setCachingModule,this._collectCleanupFunctions=S.default._collectCleanupFunctions,this._fireReady=S.default._fireReady,this.initFeature=S.default.initFeature,"object"==typeof e&&(0,u.extend)(c.default,e),this.addEvents(["ready","authing","connecting","pod-not-selected","connected","disconnected","not-connected","conflict","error","features-loaded","sync-interval-change","sync-req-done","sync-done","wire-busy","wire-done","network-offline","network-online"]),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")}),R=(0,u.localStorageAvailable)(),R){this.apiKeys=(0,u.getJSONFromLocalStorage)("remotestorage:api-keys")||{};const e=localStorage.getItem("remotestorage:backend");"dropbox"===e||"googledrive"===e||"solid"===e?this.setBackend(e):this.setBackend("remotestorage")}const t=this.on;this.on=function(e,r){if(this._allLoaded)switch(e){case"features-loaded":setTimeout(r,0);break;case"ready":this.remote&&setTimeout(r,0);break;case"connected":this.remote&&this.remote.connected&&setTimeout(r,0);break;case"not-connected":this.remote&&!this.remote.connected&&setTimeout(r,0);break;case"pod-not-selected":this.remote instanceof v.default&&this.remote.getPodURLs().length>0&&null===this.remote.getPodURL()&&setTimeout(r,0)}return t.call(this,e,r)},this._init(),this.fireInitial=function(){this.local&&setTimeout(this.local.fireInitial.bind(this.local),0)}.bind(this),this.on("ready",this.fireInitial.bind(this)),this.loadModules()}get connected(){return this.remote.connected}loadModules(){c.default.modules.forEach(this.addModule.bind(this))}authorize(e){if(this.access.setStorageType(this.remote.storageApi),void 0===e.scope&&(e.scope=this.access.scopeParameter),A.cordova)e.redirectUri=c.default.cordovaRedirectUri;else{const t=h.default.getLocation();let r=t.origin;"/"!==t.pathname&&(r+=t.pathname),e.redirectUri=r}void 0===e.clientId&&(e.clientId=e.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]),h.default.authorize(this,e)}impliedauth(e,t){e=e||this.remote.storageApi,t=t||String(document.location),(0,l.default)("ImpliedAuth proceeding due to absent authURL; storageApi = "+e+" redirectUri = "+t),this.remote.configure({token:h.default.IMPLIED_FAKE_TOKEN}),document.location.href=t}connect(e,t){if(this.setBackend("remotestorage"),e.indexOf("@")<0&&!e.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/))this._emit("error",new P.DiscoveryError("Not a valid user address or URL."));else{if(e.indexOf("@")<0&&!e.match(/^https?:\/\//)&&(e=`https://${e}`),A.cordova){if("string"!=typeof c.default.cordovaRedirectUri)return void this._emit("error",new P.DiscoveryError("Please supply a custom HTTPS redirect URI for your Cordova app"));if(!A.cordova.InAppBrowser)return void this._emit("error",new P.DiscoveryError("Please include the InAppBrowser Cordova plugin to enable OAuth"))}this.remote.configure({userAddress:e}),this._emit("connecting"),(0,b.default)(e).then((r=>{if(this._emit("authing"),r.userAddress=e,this.remote.configure(r),!this.remote.connected)if(r.authURL)if(void 0===t)this.authorize({authURL:r.authURL});else{if("string"!=typeof t)throw new Error("Supplied bearer token must be a string");(0,l.default)("Skipping authorization sequence and connecting with known token"),this.remote.configure({token:t})}else this.impliedauth()}),(()=>{this._emit("error",new P.DiscoveryError("No storage information found for this user address."))}))}}reconnect(){this.remote.configure({token:null}),"remotestorage"===this.backend?this.connect(this.remote.userAddress):this.remote.connect()}disconnect(){this.remote&&this.remote.configure({userAddress:null,href:null,storageApi:null,token:null,properties:null}),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")});const e=this._cleanups.length;let t=0;const r=()=>{t++,t>=e&&(this._init(),this._emit("disconnected"))};e>0?this._cleanups.forEach((e=>{const t=e(this);"object"==typeof t&&"function"==typeof t.then?t.then(r):r()})):r()}setBackend(e){this.backend=e,R&&(void 0!==e?localStorage.setItem("remotestorage:backend",e):localStorage.removeItem("remotestorage:backend"))}onChange(e,t){this._pathHandlers.change[e]||(this._pathHandlers.change[e]=[]),this._pathHandlers.change[e].push(t)}enableLog(){c.default.logging=!0}disableLog(){c.default.logging=!1}log(...e){l.default.apply(P,e)}setApiKeys(e){const t=[x.GOOGLE,x.DROPBOX];if("object"!=typeof e||!Object.keys(e).every((e=>t.includes(e))))return console.error("setApiKeys() was called with invalid arguments"),!1;Object.keys(e).forEach((t=>{const r=e[t];if(r){switch(t){case x.DROPBOX:this.apiKeys[x.DROPBOX]={appKey:r},void 0!==this.dropbox&&this.dropbox.clientId===r||m.default._rs_init(this);break;case x.GOOGLE:this.apiKeys[x.GOOGLE]={clientId:r},void 0!==this.googledrive&&this.googledrive.clientId===r||y.default._rs_init(this)}return!0}delete this.apiKeys[t]})),R&&localStorage.setItem("remotestorage:api-keys",JSON.stringify(this.apiKeys))}setCordovaRedirectUri(e){if("string"!=typeof e||!e.match(/http(s)?:\/\//))throw new Error("Cordova redirect URI must be a URI string");c.default.cordovaRedirectUri=e}_setGPD(e,t){function r(e){return function(...r){return e.apply(t,r).then(I.bind(this))}}this.get=r(e.get),this.put=r(e.put),this.delete=r(e.delete)}_pendingGPD(e){return(...t)=>{const r=Array.prototype.slice.call(t);return new Promise(((t,n)=>{this._pending.push({method:e,args:r,promise:{resolve:t,reject:n}})}))}}_processPending(){this._pending.forEach((e=>{try{this[e.method](...e.args).then(e.promise.resolve,e.promise.reject)}catch(t){e.promise.reject(t)}})),this._pending=[]}_bindChange(e){e.on("change",this._dispatchEvent.bind(this,"change"))}_dispatchEvent(e,t){Object.keys(this._pathHandlers[e]).forEach((r=>{const n=r.length;t.path.substr(0,n)===r&&this._pathHandlers[e][r].forEach((e=>{const n={};for(const e in t)n[e]=t[e];n.relativePath=t.path.replace(new RegExp("^"+r),"");try{e(n)}catch(e){console.error("'change' handler failed: ",e,e.stack),this._emit("error",e)}}))}))}scope(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.scope must be a string";return this.access.checkPathPermission(e,"r")||console.warn("WARNING: Please use remoteStorage.access.claim() to ask for access permissions first: https://remotestoragejs.readthedocs.io/en/latest/js-api/access.html#claim"),new f.default(this,e)}getSyncInterval(){return c.default.syncInterval}setSyncInterval(e){if(!T(e))throw e+" is not a valid sync interval";const t=c.default.syncInterval;c.default.syncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getBackgroundSyncInterval(){return c.default.backgroundSyncInterval}setBackgroundSyncInterval(e){if(!T(e))throw e+" is not a valid sync interval";const t=c.default.backgroundSyncInterval;c.default.backgroundSyncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getCurrentSyncInterval(){return c.default.isBackground?c.default.backgroundSyncInterval:c.default.syncInterval}getRequestTimeout(){return c.default.requestTimeout}setRequestTimeout(e){if("number"!=typeof e)throw e+" is not a valid request timeout";c.default.requestTimeout=e}syncCycle(){this.sync&&!this.sync.stopped&&(this.on("sync-done",(()=>{this.sync&&!this.sync.stopped&&(this._syncTimer&&(clearTimeout(this._syncTimer),this._syncTimer=void 0),this._syncTimer=setTimeout(this.sync.sync.bind(this.sync),this.getCurrentSyncInterval()))})),this.sync.sync())}startSync(){return c.default.cache?(this.sync.stopped=!1,this.syncStopped=!1,this.sync.sync()):(console.warn("Nothing to sync, because caching is disabled."),Promise.resolve())}stopSync(){clearTimeout(this._syncTimer),this._syncTimer=void 0,this.sync?this.sync.stopped=!0:this.syncStopped=!0}addModule(e){const t=e.name,r=e.builder;if(Object.defineProperty(this,t,{configurable:!0,get:function(){const e=this._loadModule(t,r);return Object.defineProperty(this,t,{value:e}),e}}),-1!==t.indexOf("-")){const e=t.replace(/\-[a-z]/g,(function(e){return e[1].toUpperCase()}));Object.defineProperty(this,e,{get:function(){return this[t]}})}}_loadModule(e,t){if(t)return t(new f.default(this,"/"+e+"/"),new f.default(this,"/public/"+e+"/")).exports;throw"Unknown module: "+e}}t.RemoteStorage=P,P.Authorize=h.default,P.SyncError=w.default,P.Unauthorized=_.default,P.DiscoveryError=b.default.DiscoveryError,P.util=E,Object.defineProperty(P.prototype,"access",{get:function(){const e=new d.default;return Object.defineProperty(this,"access",{value:e}),e},configurable:!0}),Object.defineProperty(P.prototype,"caching",{configurable:!0,get:function(){const e=new p.default;return Object.defineProperty(this,"caching",{value:e}),e}}),(0,u.applyMixins)(P,[g.EventHandling]),t.default=P},368:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayBufferView=void 0,t.retryAfterMs=function(e){const t=1e3*parseInt(e.getResponseHeader("Retry-After"));return t>=1e3?t:Math.max(1500,Math.min(6e4,Math.round(s.default.syncInterval/(2.9+.2*Math.random()))))},t.requestWithTimeout=function(e,r,i){return n(this,void 0,void 0,(function*(){return"function"==typeof fetch?function(e,t,r){return n(this,void 0,void 0,(function*(){const n="function"==typeof AbortController?new AbortController:null;let i;const a=new Promise(((e,t)=>{i=setTimeout((()=>{n&&n.abort(),t("timeout")}),s.default.requestTimeout)}));let c;const l={},u=fetch(t,{method:e,headers:r.headers,body:r.body,signal:n?n.signal:void 0}).then((e=>{switch((0,o.default)("[requests fetch]",e),e.headers.forEach(((e,t)=>{l[t.toUpperCase()]=e})),c={readyState:4,status:e.status,statusText:e.statusText,response:void 0,getResponseHeader:e=>l[e.toUpperCase()]||null,responseType:r.responseType,responseURL:t},r.responseType){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json();case void 0:case"":case"text":return e.text();default:throw new Error("responseType 'document' is not currently supported using fetch")}})).then((e=>(c.response=e,r.responseType&&"text"!==r.responseType||(c.responseText=e),c))).finally((()=>{clearTimeout(i)}));return Promise.race([u,a])}))}(e,r,i):"function"==typeof XMLHttpRequest?function(e,r,i){return n(this,void 0,void 0,(function*(){return new Promise(((n,a)=>{(0,o.default)("[requests XHR]",e,r);let c=!1;const l=setTimeout((()=>{c=!0,a("timeout")}),s.default.requestTimeout),u=new XMLHttpRequest;if(u.open(e,r,!0),i.responseType&&(u.responseType=i.responseType),i.headers)for(const e in i.headers)u.setRequestHeader(e,i.headers[e]);u.onload=()=>{c||(clearTimeout(l),n(u))},u.onerror=e=>{c||(clearTimeout(l),a(e))};let d=i.body;"object"==typeof d&&!(0,t.isArrayBufferView)(d)&&d instanceof ArrayBuffer&&(d=new Uint8Array(d)),u.send(d)}))}))}(e,r,i):Promise.reject("[Requests] You need to add a polyfill for fetch or XMLHttpRequest")}))};const o=i(r(3334)),s=i(r(7028));if("function"==typeof(r.g||window).ArrayBufferView)t.isArrayBufferView=function(e){return e&&e instanceof(r.g||window).ArrayBufferView};else{const e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];t.isArrayBufferView=function(t){for(let r=0;r<8;r++)if(t instanceof e[r])return!0;return!1}}},6941:function(e){"use strict";e.exports=class{constructor(e){this._itemsRev={},this._storage={},this._canPropagate=!1,this.defaultValue=e,this.activatePropagation()}get(e){e=e.toLowerCase();let t=this._storage[e];return void 0===t&&(t=this.defaultValue,this._storage[e]=t),t}set(e,t){return e=e.toLowerCase(),this._storage[e]===t||(this._storage[e]=t,t||delete this._itemsRev[e],this._updateParentFolderItemRev(e,t),this._canPropagate&&this._propagate(e)),t}delete(e){return this.set(e,null)}deactivatePropagation(){return this._canPropagate=!1,!0}activatePropagation(){return this._canPropagate||(this._generateFolderRev("/"),this._canPropagate=!0),!0}_hashCode(e){let t=0;if(0===e.length)return t;for(let r=0;r0&&(r=this._generateHash(e))}return this.set(e,r),r}}},6491:function(e){"use strict";class t extends Error{constructor(e){super();const t=new Error("Schema not found: "+e);return t.name="SchemaNotFound",t}}e.exports=t},6467:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=r(2452),s=r(4848),a=i(r(6424)),c=i(r(93)),l=r(7746),u=r(3684),d=i(r(7398)),h=i(r(8849)),f="remotestorage:solid";let p;class g extends u.RemoteBase{constructor(e){if(super(e),this.podURLs=null,this.online=!0,this.addEvents(["connected","not-connected","pod-not-selected"]),this.configStorage=new d.default(this),this.session=new o.Session({secureStorage:new o.InMemoryStorage,insecureStorage:this.configStorage},"any"),p=(0,l.localStorageAvailable)(),p){const e=(0,l.getJSONFromLocalStorage)(f);e&&this.configure(e)}}onConfigChanged(e){if(e){const t=JSON.parse(e);if(void 0!==t.clientSecret){let e=(0,l.getJSONFromLocalStorage)(f);return e||(e={}),e.href=this.authURL,e.properties={sessionProperties:t,podURL:this.selectedPodURL},this.sessionProperties=t,void localStorage.setItem(f,JSON.stringify(e))}}this.podURLs=null,localStorage.removeItem(f)}configure(e){if(void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.href&&(this.authURL=e.href),void 0!==e.properties){const t=e.properties;t?(void 0!==t.sessionProperties?this.sessionProperties=t.sessionProperties:this.sessionProperties=null,void 0!==t.podURL?this.selectedPodURL=t.podURL:this.selectedPodURL=null):(this.sessionProperties=null,this.selectedPodURL=null)}this.sessionProperties?(this.configStorage.setConfig(JSON.stringify(this.sessionProperties)),this.connected=this.session.info&&this.session.info.isLoggedIn,function(){p&&localStorage.setItem(f,JSON.stringify({userAddress:this.userAddress,href:this.authURL,properties:{sessionProperties:this.sessionProperties,podURL:this.selectedPodURL}}))}.apply(this)):function(){this.connected=!1,this.sessionProperties=null,this.podURLs=null,p&&localStorage.removeItem(f)}.apply(this)}setAuthURL(e){this.authURL=e}getPodURLs(){return this.podURLs}setPodURL(e){if(this.selectedPodURL!==e&&(this.selectedPodURL=e,this.session.info&&this.session.info.isLoggedIn))if(this.selectedPodURL){let e=(0,l.getJSONFromLocalStorage)(f);e||(e={}),e.userAddress=this.session.info.webId,e.href=this.authURL,e.properties={sessionProperties:this.sessionProperties,podURL:this.selectedPodURL},localStorage.setItem(f,JSON.stringify(e)),this.connected=!0,this._emit("connected")}else this.connected=!1,this.rs._emit("pod-not-selected")}getPodURL(){return this.selectedPodURL}connect(){this.rs.setBackend("solid"),this.authURL?this.session.login({oidcIssuer:this.authURL,redirectUrl:new URL("/",window.location.href).toString(),clientName:"Remote Storage"}):this.rs._emit("error",new Error("No authURL is configured."))}getSession(){return this.session.info&&this.session.info.isLoggedIn?this.session:null}getFileURL(e){return e.startsWith("/")&&(e=e.substring(1)),0===e.length&&(e="/"),this.selectedPodURL+e}get(e,t={}){const r=this.getFileURL(e);return"/"===e.slice(-1)?(0,s.getSolidDataset)(r,{fetch:this.session.fetch}).then((e=>{const t=(0,s.getContainedResourceUrlAll)(e).reduce(((t,n)=>{const i=n.substring(r.length);if("/"===i.slice(-1))t[i]={};else{const r=(0,s.getThing)(e,n);t[i]={"Content-Length":(0,s.getInteger)(r,"http://www.w3.org/ns/posix/stat#size"),"Last-Modified":(0,s.getDatetime)(r,"http://purl.org/dc/terms/modified").toUTCString()}}return t}),{});return Promise.resolve({statusCode:200,body:t,contentType:"application/json; charset=UTF-8"})})).catch((e=>e instanceof s.FetchError&&404===e.statusCode?Promise.resolve({statusCode:200,body:{},contentType:"application/json; charset=UTF-8"}):Promise.reject("Failed to get container: "+e.message))):(0,s.getFile)(r,{fetch:this.session.fetch}).then((e=>({statusCode:200,body:e,contentType:(0,s.getContentType)(e)}))).catch((e=>{const t=e.statusCode;return 401===t||403===t||404===t?{statusCode:t}:Promise.reject("Failed to get the file: "+e.message)}))}put(e,t,r,n={}){const i=this.getFileURL(e),o=this.session.fetch,a=function(){const e=function(e){if("object"==typeof e){if(e instanceof h.default)return e;if(e instanceof DataView)return new h.default([e],{type:"application/octet-stream"});if(e instanceof ArrayBuffer)return new h.default([new DataView(e)]);if(ArrayBuffer.isView(e))return new h.default([e],{type:"application/octet-stream"});if(e instanceof FormData)return new h.default([new URLSearchParams([JSON.parse(JSON.stringify(e.entries()))]).toString()],{type:"application/x-www-form-urlencoded"});if(e instanceof URLSearchParams)return new h.default([e.toString()],{type:"application/x-www-form-urlencoded"})}return"string"==typeof e?new h.default([e],{type:"plain/text"}):new h.default([JSON.stringify(e)],{type:"application/json"})}(t);return(0,s.overwriteFile)(i,e,{contentType:r,fetch:o}).then((e=>({statusCode:201}))).catch((e=>Promise.reject("PUT failed with status "+e.statusCode+" ("+e.message+")")))};return(0,s.getFile)(i,{fetch:o}).then((e=>n&&"*"===n.ifNoneMatch?{statusCode:412,revision:"conflict"}:a())).catch((e=>{const t=e.statusCode;return 404===t?a():Promise.reject("PUT failed with status "+t+" ("+e.message+")")}))}delete(e,t={}){const r=this.getFileURL(e);return(0,s.deleteFile)(r,{fetch:this.session.fetch}).then((()=>({statusCode:200}))).catch((e=>{const t=e.statusCode;return 404===t?{statusCode:200}:Promise.reject("DELETE failed with status "+t+" ("+e.message+")")}))}static _rs_init(e){const t=new g(e);var r;e.solid=t,"solid"===e.backend&&(e._origRemote=e.remote,e.remote=e.solid,(r=e)._origBaseClientGetItemURL||(r._origBaseClientGetItemURL=a.default.prototype.getItemURL,a.default.prototype.getItemURL=function(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.getItemURL must be a string";return this.storage.connected?(e.startsWith("/")&&(e=e.substring(1)),this.selectedPodURL+(0,l.cleanPath)(e)):void 0}),(()=>{n(this,void 0,void 0,(function*(){const r=t.session;if(yield r.handleIncomingRedirect(),r.info.isLoggedIn){const n=r.info.webId;t.userAddress=n,t.selectedPodURL?t._emit("connected"):(t.podURLs=yield(0,s.getPodUrlAll)(n,{fetch:fetch}),e._emit("pod-not-selected"))}else t.sessionProperties&&t.connect()}))})())}static _rs_supported(){return!0}static _rs_cleanup(e){var t;e.setBackend(void 0),e._origRemote&&(e.remote=e._origRemote,delete e._origRemote),(t=e)._origBaseClientGetItemURL&&(a.default.prototype.getItemURL=t._origBaseClientGetItemURL,delete t._origBaseClientGetItemURL)}}(0,l.applyMixins)(g,[c.default]),e.exports=g},7398:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});class n{get storage(){return window.localStorage}get(e){return r(this,void 0,void 0,(function*(){return this.storage.getItem(e)||void 0}))}set(e,t){return r(this,void 0,void 0,(function*(){this.storage.setItem(e,t)}))}delete(e){return r(this,void 0,void 0,(function*(){this.storage.removeItem(e)}))}}t.default=class{constructor(e){this.browserStorage=new n,this.observer=e}isConfigKey(e){return e.startsWith("solidClientAuthenticationUser")}setConfig(e){this.config=e}get(e){return r(this,void 0,void 0,(function*(){if(this.isConfigKey(e))return this.config;this.browserStorage.get(e)}))}set(e,t){return r(this,void 0,void 0,(function*(){if(this.isConfigKey(e)){if(this.config){const e=JSON.parse(this.config),r=JSON.parse(t),n=Object.assign(Object.assign({},e),r);this.config=JSON.stringify(n)}else this.config=t;this.observer.onConfigChanged(this.config)}else this.browserStorage.set(e,t)}))}delete(e){return r(this,void 0,void 0,(function*(){this.isConfigKey(e)?(this.config=void 0,this.observer.onConfigChanged(this.config)):this.browserStorage.delete(e)}))}}},6982:function(e){"use strict";class t extends Error{constructor(e){super(),this.name="SyncError",this.message="Sync failed: ","string"==typeof e?this.message+=e:(this.message+=e.message,this.stack=e.stack,this.originalError=e)}}e.exports=t},313:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Sync=void 0;const o=i(r(7028)),s=i(r(9451)),a=i(r(93)),c=i(r(3334)),l=i(r(3275)),u=i(r(6982)),d=i(r(5503)),h=r(7746);let f,p;function g(e,t,r){return{action:e,path:t,promise:r}}function y(e,t){return e.common.revision!==t&&(!e.remote||e.remote.revision!==t)}function m(e){return e.common&&e.common.revision}class v{constructor(e){this._finishedTasks=[],this.rs=e,this._tasks={},this._running={},this._timeStarted={},this.numThreads=10,this.rs.local.onDiff((e=>{this.addTask(e),this.doTasks()})),this.rs.caching.onActivate((e=>{this.addTask(e),this.doTasks()})),this.addEvents(["done","req-done"])}now(){return(new Date).getTime()}queueGetRequest(e){return new Promise(((t,r)=>{this.rs.remote.connected?this.rs.remote.online?(this.addTask(e,function(){this.rs.local.get(e).then((e=>t(e)))}.bind(this)),this.doTasks()):r("cannot fulfill maxAge requirement - remote is not online"):r("cannot fulfill maxAge requirement - remote is not connected")}))}corruptServerItemsMap(e,t){if("object"!=typeof e||Array.isArray(e))return!0;for(const r in e){const n=e[r];if("object"!=typeof n)return!0;if("string"!=typeof n.ETag)return!0;if((0,h.isFolder)(r)){if(-1!==r.substring(0,r.length-1).indexOf("/"))return!0}else{if(-1!==r.indexOf("/"))return!0;if(t){if("string"!=typeof n["Content-Type"])return!0;if("number"!=typeof n["Content-Length"])return!0}}}return!1}corruptItemsMap(e){if("object"!=typeof e||Array.isArray(e))return!0;for(const t in e)if("boolean"!=typeof e[t])return!0;return!1}corruptRevision(e){return"object"!=typeof e||Array.isArray(e)||e.revision&&"string"!=typeof e.revision||e.body&&"string"!=typeof e.body&&"object"!=typeof e.body||e.contentType&&"string"!=typeof e.contentType||e.contentLength&&"number"!=typeof e.contentLength||e.timestamp&&"number"!=typeof e.timestamp||e.itemsMap&&this.corruptItemsMap(e.itemsMap)}isCorrupt(e){return"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.path||this.corruptRevision(e.common)||e.local&&this.corruptRevision(e.local)||e.remote&&this.corruptRevision(e.remote)||e.push&&this.corruptRevision(e.push)}hasTasks(){return Object.getOwnPropertyNames(this._tasks).length>0}collectDiffTasks(){return n(this,void 0,void 0,(function*(){let e=0;return this.rs.local.forAllNodes((t=>{e>100||(this.isCorrupt(t)?((0,c.default)("[Sync] WARNING: corrupt node in local cache",t),"object"==typeof t&&t.path&&(this.addTask(t.path),e++)):(this.needsFetch(t)&&this.rs.access.checkPathPermission(t.path,"r")||(0,h.isDocument)(t.path)&&this.needsPush(t)&&this.rs.access.checkPathPermission(t.path,"rw"))&&(this.addTask(t.path),e++))})).then((()=>e)).catch((e=>{throw e}))}))}inConflict(e){return e.local&&e.remote&&(void 0!==e.remote.body||e.remote.itemsMap)}needsRefresh(e){return!!e.common&&(!e.common.timestamp||this.now()-e.common.timestamp>o.default.syncInterval)}needsFetch(e){return!!this.inConflict(e)||!(!e.common||void 0!==e.common.itemsMap||void 0!==e.common.body)||!(!e.remote||void 0!==e.remote.itemsMap||void 0!==e.remote.body)}needsPush(e){return!this.inConflict(e)&&(!(!e.local||e.push)||void 0)}needsRemotePut(e){return e.local&&e.local.body}needsRemoteDelete(e){return e.local&&!1===e.local.body}getParentPath(e){const t=e.match(/^(.*\/)([^\/]+\/?)$/);if(t)return t[1];throw new Error('Not a valid path: "'+e+'"')}deleteChildPathsFromTasks(){for(const e in this._tasks){const t=(0,h.pathsFromRoot)(e);for(let r=1;r{let t;if(this.needsRefresh(e)){try{t=this.getParentPath(e.path)}catch(e){}t&&this.rs.access.checkPathPermission(t,"r")?this.addTask(t):this.rs.access.checkPathPermission(e.path,"r")&&this.addTask(e.path)}})).then((()=>this.deleteChildPathsFromTasks())).catch((e=>{throw e}))}))}flush(e){for(const t in e)"FLUSH"===this.rs.caching.checkPath(t)&&e[t]&&!e[t].local&&((0,c.default)("[Sync] Flushing",t),e[t]=void 0);return e}doTask(e){return this.rs.local.getNodes([e]).then((t=>{const r=t[e];return void 0===r||function(e){return e.remote&&e.remote.revision&&!e.remote.itemsMap&&!e.remote.body}(r)?g("get",e,this.rs.remote.get(e)):this.needsRemotePut(r)?(r.push=(0,h.deepClone)(r.local),r.push.timestamp=this.now(),this.rs.local.setNodes(this.flush(t)).then((()=>{let t;return t=m(r)?{ifMatch:r.common.revision}:{ifNoneMatch:"*"},g("put",e,this.rs.remote.put(e,r.push.body,r.push.contentType,t))}))):this.needsRemoteDelete(r)?(r.push={body:!1,timestamp:this.now()},this.rs.local.setNodes(this.flush(t)).then((()=>m(r)?g("delete",e,this.rs.remote.delete(e,{ifMatch:r.common.revision})):g("get",e,this.rs.remote.get(e))))):m(r)?g("get",e,this.rs.remote.get(e,{ifNoneMatch:r.common.revision})):g("get",e,this.rs.remote.get(e))}))}autoMergeFolder(e){if(e.remote.itemsMap&&(e.common=e.remote,delete e.remote,e.common.itemsMap)){for(const t in e.common.itemsMap)e.local.itemsMap[t]||(e.local.itemsMap[t]=!1);(0,h.equal)(e.local.itemsMap,e.common.itemsMap)&&delete e.local}return e}autoMergeDocument(e){return function(e){return(!e.remote||!e.remote.revision||e.remote.revision===e.common.revision)&&(void 0===e.common.body&&!1===e.remote.body||e.remote.body===e.common.body&&e.remote.contentType===e.common.contentType)}(e)?delete(e=function(e){return e.remote&&!1===e.remote.body&&e.local&&!1===e.local.body&&delete e.local,e}(e)).remote:void 0!==e.remote.body&&((0,c.default)("[Sync] Emitting keep/revert"),this.rs.local._emitChange({origin:"conflict",path:e.path,oldValue:e.local.body,newValue:e.remote.body,lastCommonValue:e.common.body,oldContentType:e.local.contentType,newContentType:e.remote.contentType,lastCommonContentType:e.common.contentType}),e.remote.body?e.common=e.remote:e.common={},delete e.remote,delete e.local),e}autoMerge(e){if(e.remote){if(e.local)return(0,h.isFolder)(e.path)?this.autoMergeFolder(e):this.autoMergeDocument(e);if((0,h.isFolder)(e.path))void 0!==e.remote.itemsMap&&(e.common=e.remote,delete e.remote);else if(void 0!==e.remote.body){const t={origin:"remote",path:e.path,oldValue:!1===e.common.body?void 0:e.common.body,newValue:!1===e.remote.body?void 0:e.remote.body,oldContentType:e.common.contentType,newContentType:e.remote.contentType};if((t.oldValue||t.newValue)&&this.rs.local._emitChange(t),!e.remote.body)return;e.common=e.remote,delete e.remote}return e}e.common.body&&this.rs.local._emitChange({origin:"remote",path:e.path,oldValue:e.common.body,newValue:void 0,oldContentType:e.common.contentType,newContentType:void 0})}updateCommonTimestamp(e,t){return n(this,void 0,void 0,(function*(){return this.rs.local.getNodes([e]).then((r=>(r[e]&&r[e].common&&r[e].common.revision===t&&(r[e].common.timestamp=this.now()),this.rs.local.setNodes(this.flush(r)))))}))}markChildren(e,t,r,i){return n(this,void 0,void 0,(function*(){const n=[],o={},s={};for(const r in t)n.push(e+r),o[e+r]=t[r];for(const t in i)n.push(e+t);return this.rs.local.getNodes(n).then((t=>{let n,a;for(const c in t)if(a=t[c],o[c])a&&a.common?y(a,o[c].ETag)&&(r[c]=(0,h.deepClone)(a),r[c].remote={revision:o[c].ETag,timestamp:this.now()},r[c]=this.autoMerge(r[c])):(n=this.rs.caching.checkPath(c),"ALL"===n&&(r[c]={path:c,common:{timestamp:this.now()},remote:{revision:o[c].ETag,timestamp:this.now()}})),r[c]&&o[c]["Content-Type"]&&(r[c].remote.contentType=o[c]["Content-Type"]),r[c]&&o[c]["Content-Length"]&&(r[c].remote.contentLength=o[c]["Content-Length"]);else if(i[c.substring(e.length)]&&a&&a.common){if(a.common.itemsMap)for(const e in a.common.itemsMap)s[c+e]=!0;if(a.local&&a.local.itemsMap)for(const e in a.local.itemsMap)s[c+e]=!0;if(a.remote||(0,h.isFolder)(c))r[c]=void 0;else if(r[c]=this.autoMerge(a),void 0===r[c]){const t=this.getParentPath(c),n=r[t],i=c.substring(e.length);n&&n.local&&(delete n.local.itemsMap[i],(0,h.equal)(n.local.itemsMap,n.common.itemsMap)&&delete n.local)}}return this.deleteRemoteTrees(Object.keys(s),r).then((e=>this.rs.local.setNodes(this.flush(e))))}))}))}deleteRemoteTrees(e,t){return n(this,void 0,void 0,(function*(){return 0===e.length?Promise.resolve(t):this.rs.local.getNodes(e).then((e=>n(this,void 0,void 0,(function*(){const r={};function n(e,t){if(e&&e.itemsMap)for(const n in e.itemsMap)r[t+n]=!0}for(const r in e){const i=e[r];i&&((0,h.isFolder)(r)?(n(i.common,r),n(i.local,r)):i.common&&void 0!==typeof i.common.body&&(t[r]=(0,h.deepClone)(i),t[r].remote={body:!1,timestamp:this.now()},t[r]=this.autoMerge(t[r])))}return this.deleteRemoteTrees(Object.keys(r),t).then((e=>this.rs.local.setNodes(this.flush(e))))}))))}))}completeFetch(e,t,r,i){return n(this,void 0,void 0,(function*(){let n,o;const s=(0,h.pathsFromRoot)(e);return(0,h.isFolder)(e)?n=[e]:(o=s[1],n=[e,o]),this.rs.local.getNodes(n).then((n=>{let s,a,c=n[e];const l={};function u(e){if(e&&e.itemsMap)for(s in e.itemsMap)t[s]||(l[s]=!0)}if("object"==typeof c&&c.path===e&&"object"==typeof c.common||(c={path:e,common:{}},n[e]=c),c.remote={revision:i,timestamp:this.now()},(0,h.isFolder)(e))for(s in u(c.common),u(c.remote),c.remote.itemsMap={},t)c.remote.itemsMap[s]=!0;else c.remote.body=t,c.remote.contentType=r,a=n[o],a&&a.local&&a.local.itemsMap&&(s=e.substring(o.length),a.local.itemsMap[s]=!0,(0,h.equal)(a.local.itemsMap,a.common.itemsMap)&&delete a.local);return n[e]=this.autoMerge(c),{toBeSaved:n,missingChildren:l}}))}))}completePush(e,t,r,i){return n(this,void 0,void 0,(function*(){return this.rs.local.getNodes([e]).then((n=>{const o=n[e];if(!o.push)throw this.stopped=!0,new Error("completePush called but no push version!");return r?((0,c.default)("[Sync] We have a conflict"),o.remote&&o.remote.revision===i||(o.remote={revision:i||"conflict",timestamp:this.now()},delete o.push),n[e]=this.autoMerge(o)):(o.common={revision:i,timestamp:this.now()},"put"===t?(o.common.body=o.push.body,o.common.contentType=o.push.contentType,(0,h.equal)(o.local.body,o.push.body)&&o.local.contentType===o.push.contentType&&delete o.local,delete o.push):"delete"===t&&(!1===o.local.body?n[e]=void 0:delete o.push)),this.rs.local.setNodes(this.flush(n))}))}))}dealWithFailure(e){return n(this,void 0,void 0,(function*(){return this.rs.local.getNodes([e]).then((t=>{if(t[e])return delete t[e].push,this.rs.local.setNodes(this.flush(t))}))}))}interpretStatus(e){const t={statusCode:e,successful:void 0,conflict:void 0,unAuth:void 0,notFound:void 0,changed:void 0,networkProblems:void 0};if("string"==typeof e&&("offline"===e||"timeout"===e))return t.successful=!1,t.networkProblems=!0,t;if("number"==typeof e){const r=Math.floor(e/100);return t.successful=2===r||304===e||412===e||404===e,t.conflict=412===e,t.unAuth=401===e&&this.rs.remote.token!==l.default.IMPLIED_FAKE_TOKEN||402===e||403===e,t.notFound=404===e,t.changed=304!==e,t}}handleGetResponse(e,t,r,i,o){return n(this,void 0,void 0,(function*(){return t.notFound&&(r=!!(0,h.isFolder)(e)&&{}),t.changed?this.completeFetch(e,r,i,o).then((t=>(0,h.isFolder)(e)?this.corruptServerItemsMap(r)?((0,c.default)("[Sync] WARNING: Discarding corrupt folder description from server for "+e),!1):this.markChildren(e,r,t.toBeSaved,t.missingChildren).then((()=>!0)):this.rs.local.setNodes(this.flush(t.toBeSaved)).then((()=>!0)))):this.updateCommonTimestamp(e,o).then((()=>!0))}))}handleResponse(e,t,r){const n=this.interpretStatus(r.statusCode);if(n.successful){if("get"===t)return this.handleGetResponse(e,n,r.body,r.contentType,r.revision);if("put"===t||"delete"===t)return this.completePush(e,t,n.conflict,r.revision).then((function(){return!0}));throw new Error(`cannot handle response for unknown action ${t}`)}{let t;return t=n.unAuth?new d.default:n.networkProblems?new u.default("Network request failed."):new Error("HTTP response code "+n.statusCode+" received."),this.dealWithFailure(e).then((()=>{throw this.rs._emit("error",t),t}))}}finishTask(e,t=!0){if(void 0!==e.action){if(!(t&&((0,c.default)("[Sync] queue finished task:",e.path),this._finishedTasks.push(e),this._finishedTasks.length>1)))return(0,c.default)("[Sync] run task:",e.path),e.promise.then((t=>this.handleResponse(e.path,e.action,t)),(t=>((0,c.default)("[Sync] wireclient rejects its promise!",e.path,e.action,t),this.handleResponse(e.path,e.action,{statusCode:"offline"})))).then((t=>n(this,void 0,void 0,(function*(){if(this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.path],t&&this._tasks[e.path]){for(let t=0;t0?this.finishTask(this._finishedTasks[0],!1):yield this.collectTasks(!1).then((()=>{!this.hasTasks()||this.stopped?((0,c.default)("[Sync] Sync is done! Reschedule?",Object.getOwnPropertyNames(this._tasks).length,this.stopped),this.done||(this.done=!0,this.rs._emit("sync-done",{completed:!0}))):setTimeout((()=>{this.doTasks()}),10)}))}))),(t=>{(0,c.default)("[Sync] Error",t),this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.path],this.rs._emit("sync-req-done",{tasksRemaining:Object.keys(this._tasks).length}),this._finishedTasks.length>0?this.finishTask(this._finishedTasks[0],!1):this.done||(this.done=!0,this.rs._emit("sync-done",{completed:!1}))}));(0,c.default)("[Sync] delaying finished task:",e.path)}else delete this._running[e.path]}doTasks(){let e,t,r=0;e=this.rs.remote.connected?this.rs.remote.online?this.numThreads:1:0;const n=e-Object.getOwnPropertyNames(this._running).length;if(n<=0)return!0;for(t in this._tasks)if(!this._running[t]&&(this._timeStarted[t]=this.now(),this._running[t]=this.doTask(t),this._running[t].then(this.finishTask.bind(this)),r++,r>=n))return!0;return r>=n}collectTasks(e){return n(this,void 0,void 0,(function*(){return this.hasTasks()||this.stopped?Promise.resolve():this.collectDiffTasks().then((t=>t||!1===e?Promise.resolve():this.collectRefreshTasks()),(function(e){throw e}))}))}addTask(e,t){this._tasks[e]||(this._tasks[e]=[]),"function"==typeof t&&this._tasks[e].push(t)}sync(){return this.done=!1,this.doTasks()?Promise.resolve():this.collectTasks().then((()=>{try{this.doTasks()}catch(e){(0,c.default)("[Sync] doTasks error",e)}}),(function(e){throw(0,c.default)("[Sync] Sync error",e),new Error("Local cache unavailable")}))}static _rs_init(e){f=function(){(0,c.default)("[Sync] syncCycleCb calling syncCycle");const t=new s.default;t.isBrowser()&&function(e,t){function r(e){const r=t.getCurrentSyncInterval();o.default.isBackground=!e;const n=t.getCurrentSyncInterval();t._emit("sync-interval-change",{oldValue:r,newValue:n})}e.on("background",(()=>r(!1))),e.on("foreground",(()=>r(!0)))}(t,e),e.sync||(e.sync=new v(e),e.syncStopped&&((0,c.default)("[Sync] Instantiating sync stopped"),e.sync.stopped=!0,delete e.syncStopped)),(0,c.default)("[Sync] syncCycleCb calling syncCycle"),e.syncCycle()},p=function(){e.removeEventListener("connected",p),e.startSync()},e.on("ready",f),e.on("connected",p)}static _rs_cleanup(e){e.stopSync(),e.removeEventListener("ready",f),e.removeEventListener("connected",p),e.sync=void 0,delete e.sync}}t.Sync=v,(0,h.applyMixins)(v,[a.default]),t.default=v},1370:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};const i=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(r(3334));function o(e){return"dropbox"===this.backend&&!!e.match(/^\/public\/.*[^\/]$/)}const s={get:function(e,t){if(this.local){if(void 0===t)t="object"==typeof(r=this).remote&&r.remote.connected&&r.remote.online?2*r.getSyncInterval():((0,i.default)("Not setting default maxAge, because remote is offline or not connected"),!1);else if("number"!=typeof t&&!1!==t)return Promise.reject("Argument 'maxAge' must be 'false' or a number");return this.local.get(e,t,this.sync.queueGetRequest.bind(this.sync))}return this.remote.get(e);var r},put:function(e,t,r){return o.bind(this)(e)?s._wrapBusyDone.call(this,this.remote.put(e,t,r)):this.local?this.local.put(e,t,r):s._wrapBusyDone.call(this,this.remote.put(e,t,r))},delete:function(e){return this.local?this.local.delete(e):s._wrapBusyDone.call(this,this.remote.delete(e))},_wrapBusyDone:function(e){return n(this,void 0,void 0,(function*(){return this._emit("wire-busy"),e.then((e=>(this._emit("wire-done",{success:!0}),Promise.resolve(e))),(e=>(this._emit("wire-done",{success:!1}),Promise.reject(e))))}))}};e.exports=s},1613:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClientTypes=void 0;class r{constructor(){this.uris={},this.schemas={},this.aliases={}}declare(e,t,r,n){const i=e+"/"+t;if(n.extends){const t=n.extends.split("/"),r=1===t.length?e+"/"+t.shift():t.join("/"),o=this.uris[r];if(!o)throw"Type '"+i+"' tries to extend unknown schema '"+r+"'";n.extends=this.schemas[o]}this.uris[i]=r,this.aliases[r]=i,this.schemas[r]=n}resolveAlias(e){return this.uris[e]}getSchema(e){return this.schemas[e]}inScope(e){const t=e.length,r={};for(const n in this.uris)if(n.substr(0,t+1)===e+"/"){const e=this.uris[n];r[e]=this.schemas[e]}return r}}t.BaseClientTypes=r;const n=new r;t.default=n},5503:function(e){"use strict";class t extends Error{constructor(e,t={}){super(),this.name="Unauthorized",this.message=void 0===e?"App authorization expired or revoked.":e,void 0!==t.code&&(this.code=t.code),this.stack=(new Error).stack}}e.exports=t},7746:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))};function i(e,t){if("object"==typeof e&&!Array.isArray(e)&&null!==e)for(const r in e)if("object"==typeof e[r]&&null!==e[r])if("[object ArrayBuffer]"===e[r].toString()){t[r]=new ArrayBuffer(e[r].byteLength);const n=new Int8Array(e[r]);new Int8Array(t[r]).set(n)}else i(e[r],t[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.toBase64=t.getTextFromArrayBuffer=t.shouldBeTreatedAsBinary=t.getJSONFromLocalStorage=t.localStorageAvailable=t.pathsFromRoot=t.deepClone=t.equal=t.bindAll=t.cleanPath=t.baseName=t.isDocument=t.isFolder=t.containingFolder=t.extend=t.getGlobalContext=t.globalContext=t.logError=void 0,t.generateCodeVerifier=function(){return n(this,arguments,void 0,(function*(e=128){const t=new Uint8Array(e);crypto.getRandomValues(t);const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=Array.from(t).map((e=>r[e%66])),i=n.join(""),o=Uint8Array.from(n.map((e=>e.charCodeAt(0)))),s=(a=yield crypto.subtle.digest("SHA-256",o),btoa(String.fromCharCode.apply(null,new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""));var a;return crypto.getRandomValues(t),{codeVerifier:i,codeChallenge:s,state:Array.from(t).map((e=>r[e%66])).join("")}}))},t.applyMixins=function(e,t){t.forEach((t=>{Object.getOwnPropertyNames(t.prototype).forEach((r=>{Object.defineProperty(e.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r))}))}))},t.logError=e=>{"string"==typeof e?console.error(e):console.error(e.message,e.stack)},t.globalContext="undefined"!=typeof window?window:"object"==typeof self?self:r.g,t.getGlobalContext=()=>"undefined"!=typeof window?window:"object"==typeof self?self:r.g,t.extend=(...e)=>{const t=e[0];return Array.prototype.slice.call(e,1).forEach((function(e){for(const r in e)t[r]=e[r]})),t},t.containingFolder=e=>{if(""===e)return"/";if(!e)throw"Path not given!";return e.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},t.isFolder=e=>"/"===e.slice(-1),t.isDocument=e=>!(0,t.isFolder)(e),t.baseName=e=>{const r=e.split("/");return(0,t.isFolder)(e)?r[r.length-2]+"/":r[r.length-1]},t.cleanPath=e=>e.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27"),t.bindAll=e=>{for(const t in this)"function"==typeof e[t]&&(e[t]=e[t].bind(e))},t.equal=(e,r,n=[])=>{let i;if(typeof e!=typeof r)return!1;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return e===r;if("function"==typeof e)return e.toString()===r.toString();if(e instanceof ArrayBuffer&&r instanceof ArrayBuffer&&(e=new Uint8Array(e),r=new Uint8Array(r)),e instanceof Array){if(e.length!==r.length)return!1;for(let i=0,o=e.length;i=0)continue;o=n.slice(),o.push(r[i])}if(!(0,t.equal)(e[i],r[i],o))return!1}}return!0},t.deepClone=e=>{if(void 0!==e){const t=JSON.parse(JSON.stringify(e));return i(e,t),t}},t.pathsFromRoot=e=>{const t=[e],r=e.replace(/\/$/,"").split("/");for(;r.length>1;)r.pop(),t.push(r.join("/")+"/");return t},t.localStorageAvailable=()=>{const e=(0,t.getGlobalContext)();if(!("localStorage"in e))return!1;try{return e.localStorage.setItem("rs-check","1"),e.localStorage.removeItem("rs-check"),!0}catch(e){return!1}},t.getJSONFromLocalStorage=e=>{const r=(0,t.getGlobalContext)();try{return JSON.parse(r.localStorage.getItem(e))}catch(e){}},t.shouldBeTreatedAsBinary=(e,t)=>!!(t&&t.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\uFFFD]/.test(e)),t.getTextFromArrayBuffer=(e,r)=>new Promise((n=>{if("undefined"==typeof Blob||"undefined"==typeof FileReader){const t=Buffer.from(e);n(t.toString(r))}else{let i;const o=t.globalContext;if(o.BlobBuilder=o.BlobBuilder||o.WebKitBlobBuilder,void 0!==o.BlobBuilder){const t=new o.BlobBuilder;t.append(e),i=t.getBlob()}else i=new Blob([e]);const s=new FileReader;"function"==typeof s.addEventListener?s.addEventListener("loadend",(function(e){n(e.target.result)})):s.onloadend=function(e){n(e.target.result)},s.readAsText(i,r)}})),t.toBase64=e=>{const r=(0,t.getGlobalContext)();return"btoa"in r?r.btoa(e):Buffer.from(e).toString("base64")}},600:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const o=i(r(3275)),s=i(r(93)),a=i(r(5503)),c=i(r(3334)),l=r(7746),u=r(368),d=r(3684);let h;const f="remotestorage:wireclient",p={"draft-dejong-remotestorage-00":2,"draft-dejong-remotestorage-01":3,"draft-dejong-remotestorage-02":4,"https://www.w3.org/community/rww/wiki/read-write-web-00#simple":1};class g extends d.RemoteBase{constructor(e){if(super(e),this._revisionCache={},h=(0,l.localStorageAvailable)(),this.addEvents(["connected","not-connected"]),h){const e=function(){const e=(0,l.getJSONFromLocalStorage)(f)||{},{userAddress:t,href:r,storageApi:n,token:i,properties:o}=e;return{userAddress:t,href:r,storageApi:n,token:i,properties:o}}();e&&setTimeout((()=>{this.configure(e)}),0)}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}get storageType(){if(this.storageApi){const e=this.storageApi.match(/draft-dejong-(remotestorage-\d\d)/);return e?e[1]:"2012.04"}}_request(e,t,r,i,s,d,h){return n(this,void 0,void 0,(function*(){if(this.isForbiddenRequestMethod(e,t))return Promise.reject(`Don't use ${e} on directories!`);let n;return r!==o.default.IMPLIED_FAKE_TOKEN&&(i.Authorization="Bearer "+r),this.rs._emit("wire-busy",{method:e,isFolder:(0,l.isFolder)(t)}),(0,u.requestWithTimeout)(e,t,{body:s,headers:i,responseType:"arraybuffer"}).then((r=>{if(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,l.isFolder)(t),success:!0}),i=r.status,[401,403,404,412].indexOf(i)>=0)return(0,c.default)("[WireClient] Error response status",r.status),n=d?this.stripQuotes(r.getResponseHeader("ETag")):void 0,401===r.status&&this.rs._emit("error",new a.default),Promise.resolve({statusCode:r.status,revision:n});if(function(e){return[201,204,304].indexOf(e)>=0}(r.status)||200===r.status&&"GET"!==e)return n=this.stripQuotes(r.getResponseHeader("ETag")),(0,c.default)("[WireClient] Successful request",n),Promise.resolve({statusCode:r.status,revision:n});{const e=r.getResponseHeader("Content-Type");n=d?this.stripQuotes(r.getResponseHeader("ETag")):200===r.status?h:void 0;const t=function(e){let t,r="utf-8";return e&&(t=e.match(/charset=(.+)$/),t&&(r=t[1])),r}(e);return(0,l.shouldBeTreatedAsBinary)(r.response,e)?((0,c.default)("[WireClient] Successful request with unknown or binary mime-type",n),Promise.resolve({statusCode:r.status,body:r.response,contentType:e,revision:n})):(0,l.getTextFromArrayBuffer)(r.response,t).then((t=>((0,c.default)("[WireClient] Successful request",n),Promise.resolve({statusCode:r.status,body:t,contentType:e,revision:n}))))}var i}),(r=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,l.isFolder)(t),success:!1}),Promise.reject(r))))}))}configure(e){if("object"!=typeof e)throw new Error("WireClient configure settings parameter should be an object");if(void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.href&&(this.href=e.href),void 0!==e.storageApi&&(this.storageApi=e.storageApi),void 0!==e.token&&(this.token=e.token),void 0!==e.properties&&(this.properties=e.properties),"string"==typeof this.storageApi){const e=p[this.storageApi]||5;this.supportsRevs=e>=2}this.href&&this.token?(this.connected=!0,this.online=!0,this._emit("connected")):this.connected=!1,h&&(localStorage[f]=JSON.stringify({userAddress:this.userAddress,href:this.href,storageApi:this.storageApi,token:this.token,properties:this.properties}))}get(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const r={};return this.supportsRevs&&t.ifNoneMatch&&(r["If-None-Match"]=this.addQuotes(t.ifNoneMatch)),this._request("GET",this.href+(0,l.cleanPath)(e),this.token,r,void 0,this.supportsRevs,this._revisionCache[e]).then((t=>{if(!(0,l.isFolder)(e))return Promise.resolve(t);let r={};if(void 0!==t.body)try{t.body=JSON.parse(t.body)}catch(t){return Promise.reject("Folder description at "+this.href+(0,l.cleanPath)(e)+" is not JSON")}if(200===t.statusCode&&"object"==typeof t.body){if(0===Object.keys(t.body).length)t.statusCode=404;else if("http://remotestorage.io/spec/folder-description"===(n=t.body)["@context"]&&"object"==typeof n.items){for(const r in t.body.items)this._revisionCache[e+r]=t.body.items[r].ETag;r=t.body.items}else Object.keys(t.body).forEach((n=>{this._revisionCache[e+n]=t.body[n],r[n]={ETag:t.body[n]}}));return t.body=r,Promise.resolve(t)}return Promise.resolve(t);var n}))}put(e,t,r,n={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");!r.match(/charset=/)&&(t instanceof ArrayBuffer||(0,u.isArrayBufferView)(t))&&(r+="; charset=binary");const i={"Content-Type":r};return this.supportsRevs&&(n.ifMatch&&(i["If-Match"]=this.addQuotes(n.ifMatch)),n.ifNoneMatch&&(i["If-None-Match"]=this.addQuotes(n.ifNoneMatch))),this._request("PUT",this.href+(0,l.cleanPath)(e),this.token,i,t,this.supportsRevs)}delete(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");t||(t={});const r={};return this.supportsRevs&&t.ifMatch&&(r["If-Match"]=this.addQuotes(t.ifMatch)),this._request("DELETE",this.href+(0,l.cleanPath)(e),this.token,r,void 0,this.supportsRevs)}static _rs_init(e){e.remote=new g(e),e.remote.online=!0}static _rs_supported(){return"function"==typeof fetch||"function"==typeof XMLHttpRequest}static _rs_cleanup(){h&&delete localStorage[f]}}(0,l.applyMixins)(g,[s.default]),e.exports=g},439:function(e,t){var r,n;r=function(){var e,t,r,n;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=(r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(i){if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError("Object.keys called on non-object");var o=[];for(var s in i)e.call(i,s)&&o.push(s);if(t)for(var a=0;a>>0;if(0===r)return-1;var n=0;if(arguments.length>1&&((n=Number(arguments[1]))!=n?n=0:0!==n&&n!==1/0&&n!==-1/0&&(n=(n>0||-1)*Math.floor(Math.abs(n)))),n>=r)return-1;for(var i=n>=0?n:Math.max(r-Math.abs(n),0);i0&&(t+=u.suffices["*"]&&r||",",u.suffices["*"]&&c&&(t+=u.name+"=")),t+=a?encodeURIComponent(d[f]).replace(/!/g,"%21"):s(d[f])}else if("object"==typeof d){c&&!u.suffices["*"]&&(t+=u.name+"=");var p=!0;for(var g in d)p||(t+=u.suffices["*"]&&r||","),p=!1,t+=a?encodeURIComponent(g).replace(/!/g,"%21"):s(g),t+=u.suffices["*"]?"=":",",t+=a?encodeURIComponent(d[g]).replace(/!/g,"%21"):s(d[g])}else c&&(t+=u.name,l&&""===d||(t+="=")),null!=u.truncate&&(d=d.substring(0,u.truncate)),t+=a?encodeURIComponent(d).replace(/!/g,"%21"):s(d)}return t};return w.varNames=u,{prefix:n,substitution:w}}function c(e){if(!(this instanceof c))return new c(e);for(var t=e.split("{"),r=[t.shift()],n=[],i=[],o=[];t.length>0;){var s=t.shift(),l=s.split("}")[0],u=s.substring(l.length+1),d=a(l);i.push(d.substitution),n.push(d.prefix),r.push(u),o=o.concat(d.substitution.varNames)}this.fill=function(e){for(var t=r[0],n=0;n0&&"/"===t.charAt(e.length-1)||"#"===r.charAt(0)||"?"===r.charAt(0))return!0}return!1}(t,e.id)&&void 0===this.schemas[e.id]&&(this.schemas[e.id]=e),e)if("enum"!==n)if("object"==typeof e[n])this.searchSchemas(e[n],t);else if("$ref"===n){var i=g(e[n]);i&&void 0===this.schemas[i]&&void 0===this.missingMap[i]&&(this.missingMap[i]=i)}},l.prototype.addSchema=function(e,t){if("string"!=typeof e||void 0===t){if("object"!=typeof e||"string"!=typeof e.id)return;e=(t=e).id}e===g(e)+"#"&&(e=g(e)),this.schemas[e]=t,delete this.missingMap[e],y(t,e),this.searchSchemas(t,e)},l.prototype.getSchemaMap=function(){var e={};for(var t in this.schemas)e[t]=this.schemas[t];return e},l.prototype.getSchemaUris=function(e){var t=[];for(var r in this.schemas)e&&!e.test(r)||t.push(r);return t},l.prototype.getMissingUris=function(e){var t=[];for(var r in this.missingMap)e&&!e.test(r)||t.push(r);return t},l.prototype.dropSchemas=function(){this.schemas={},this.reset()},l.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},l.prototype.validateAll=function(e,t,r,n,i){var o;if(!(t=this.resolveRefs(t)))return null;if(t instanceof S)return this.errors.push(t),t;var s,a=this.errors.length,c=null,l=null;if(this.checkRecursive&&e&&"object"==typeof e){if(o=!this.scanned.length,e[this.validatedSchemasKey]){var u=e[this.validatedSchemasKey].indexOf(t);if(-1!==u)return this.errors=this.errors.concat(e[this.validationErrorsKey][u]),null}if(Object.isFrozen(e)&&-1!==(s=this.scannedFrozen.indexOf(e))){var d=this.scannedFrozenSchemas[s].indexOf(t);if(-1!==d)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[s][d]),null}if(this.scanned.push(e),Object.isFrozen(e))-1===s&&(s=this.scannedFrozen.length,this.scannedFrozen.push(e),this.scannedFrozenSchemas.push([])),c=this.scannedFrozenSchemas[s].length,this.scannedFrozenSchemas[s][c]=t,this.scannedFrozenValidationErrors[s][c]=[];else{if(!e[this.validatedSchemasKey])try{Object.defineProperty(e,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(e,this.validationErrorsKey,{value:[],configurable:!0})}catch(t){e[this.validatedSchemasKey]=[],e[this.validationErrorsKey]=[]}l=e[this.validatedSchemasKey].length,e[this.validatedSchemasKey][l]=t,e[this.validationErrorsKey][l]=[]}}var h=this.errors.length,f=this.validateBasic(e,t,i)||this.validateNumeric(e,t,i)||this.validateString(e,t,i)||this.validateArray(e,t,i)||this.validateObject(e,t,i)||this.validateCombinations(e,t,i)||this.validateHypermedia(e,t,i)||this.validateFormat(e,t,i)||this.validateDefinedKeywords(e,t,i)||null;if(o){for(;this.scanned.length;)delete this.scanned.pop()[this.validatedSchemasKey];this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(f||h!==this.errors.length)for(;r&&r.length||n&&n.length;){var p=r&&r.length?""+r.pop():null,g=n&&n.length?""+n.pop():null;f&&(f=f.prefixWith(p,g)),this.prefixErrors(h,p,g)}return null!==c?this.scannedFrozenValidationErrors[s][c]=this.errors.slice(a):null!==l&&(e[this.validationErrorsKey][l]=this.errors.slice(a)),this.handleError(f)},l.prototype.validateFormat=function(e,t){if("string"!=typeof t.format||!this.formatValidators[t.format])return null;var r=this.formatValidators[t.format].call(null,e,t);return"string"==typeof r||"number"==typeof r?this.createError(v.FORMAT_CUSTOM,{message:r},"","/format",null,e,t):r&&"object"==typeof r?this.createError(v.FORMAT_CUSTOM,{message:r.message||"?"},r.dataPath||"",r.schemaPath||"/format",null,e,t):null},l.prototype.validateDefinedKeywords=function(e,t,r){for(var n in this.definedKeywords)if(void 0!==t[n])for(var i=this.definedKeywords[n],o=0;o=d&&nt.maximum)return this.createError(v.NUMBER_MAXIMUM,{value:e,maximum:t.maximum},"","/maximum",null,e,t);if(t.exclusiveMaximum&&e===t.maximum)return this.createError(v.NUMBER_MAXIMUM_EXCLUSIVE,{value:e,maximum:t.maximum},"","/exclusiveMaximum",null,e,t)}return null},l.prototype.validateNaN=function(e,t){return"number"!=typeof e?null:!0===isNaN(e)||e===1/0||e===-1/0?this.createError(v.NUMBER_NOT_A_NUMBER,{value:e},"","/type",null,e,t):null},l.prototype.validateString=function(e,t,r){return this.validateStringLength(e,t,r)||this.validateStringPattern(e,t,r)||null},l.prototype.validateStringLength=function(e,t){return"string"!=typeof e?null:void 0!==t.minLength&&e.lengtht.maxLength?this.createError(v.STRING_LENGTH_LONG,{length:e.length,maximum:t.maxLength},"","/maxLength",null,e,t):null},l.prototype.validateStringPattern=function(e,t){if("string"!=typeof e||"string"!=typeof t.pattern&&!(t.pattern instanceof RegExp))return null;var r;if(t.pattern instanceof RegExp)r=t.pattern;else{var n,i="",o=t.pattern.match(/^\/(.+)\/([img]*)$/);o?(n=o[1],i=o[2]):n=t.pattern,r=new RegExp(n,i)}return r.test(e)?null:this.createError(v.STRING_PATTERN,{pattern:t.pattern},"","/pattern",null,e,t)},l.prototype.validateArray=function(e,t,r){return Array.isArray(e)&&(this.validateArrayLength(e,t,r)||this.validateArrayUniqueItems(e,t,r)||this.validateArrayItems(e,t,r))||null},l.prototype.validateArrayLength=function(e,t){var r;return void 0!==t.minItems&&e.lengtht.maxItems&&(r=this.createError(v.ARRAY_LENGTH_LONG,{length:e.length,maximum:t.maxItems},"","/maxItems",null,e,t),this.handleError(r))?r:null},l.prototype.validateArrayUniqueItems=function(e,t){if(t.uniqueItems)for(var r=0;rt.maxProperties&&(r=this.createError(v.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:n.length,maximum:t.maxProperties},"","/maxProperties",null,e,t),this.handleError(r))?r:null},l.prototype.validateObjectRequiredProperties=function(e,t){if(void 0!==t.required)for(var r=0;r 10000");if(void 0!==v[e])throw new Error("Error already defined: "+e+" as "+v[e]);if(void 0!==b[t])throw new Error("Error code already used: "+b[t]+" as "+t);for(var n in v[e]=t,b[t]=e,_[e]=_[t]=r,E){var i=E[n];i[e]&&(i[t]=i[t]||i[e])}},reset:function(){i.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:y,resolveUrl:p,getDocumentUri:g,errorCodes:v};return o.language(t||"en"),o}();return A.addLanguage("en-gb",_),A.tv4=A,A},void 0===(n=r.apply(t,[]))||(e.exports=n)},2831:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return c.default}});var n=h(r(3518)),i=h(r(4948)),o=h(r(5073)),s=h(r(7186)),a=h(r(4808)),c=h(r(7775)),l=h(r(7037)),u=h(r(9910)),d=h(r(6792));function h(e){return e&&e.__esModule?e:{default:e}}},2311:function(e,t){"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,o,s){return n((a=n(n(t,e),n(i,s)))<<(c=o)|a>>>32-c,r);var a,c}function o(e,t,r,n,o,s,a){return i(t&r|~t&n,e,t,o,s,a)}function s(e,t,r,n,o,s,a){return i(t&n|r&~n,e,t,o,s,a)}function a(e,t,r,n,o,s,a){return i(t^r^n,e,t,o,s,a)}function c(e,t,r,n,o,s,a){return i(r^(t|~n),e,t,o,s,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let r=0;r>5]>>>i%32&255,o=parseInt(n.charAt(r>>>4&15)+n.charAt(15&r),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}},7656:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i},2858:function(e,t){"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(n)};const n=new Uint8Array(16)},9042:function(e,t){"use strict";function r(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function n(e,t){return e<>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let r=0;r>>0;d=u,u=l,l=n(c,30)>>>0,c=s,s=a}i[0]=i[0]+s>>>0,i[1]=i[1]+c>>>0,i[2]=i[2]+l>>>0,i[3]=i[3]+u>>>0,i[4]=i[4]+d>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}},9910:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.unsafeStringify=s;var n,i=(n=r(7037))&&n.__esModule?n:{default:n};const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));function s(e,t=0){return o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]}t.default=function(e,t=0){const r=s(e,t);if(!(0,i.default)(r))throw TypeError("Stringified UUID is invalid");return r}},3518:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(2858))&&n.__esModule?n:{default:n},o=r(9910);let s,a,c=0,l=0;t.default=function(e,t,r){let n=t&&r||0;const u=t||new Array(16);let d=(e=e||{}).node||s,h=void 0!==e.clockseq?e.clockseq:a;if(null==d||null==h){const t=e.random||(e.rng||i.default)();null==d&&(d=s=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==h&&(h=a=16383&(t[6]<<8|t[7]))}let f=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:l+1;const g=f-c+(p-l)/1e4;if(g<0&&void 0===e.clockseq&&(h=h+1&16383),(g<0||f>c)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=f,l=p,a=h,f+=122192928e5;const y=(1e4*(268435455&f)+p)%4294967296;u[n++]=y>>>24&255,u[n++]=y>>>16&255,u[n++]=y>>>8&255,u[n++]=255&y;const m=f/4294967296*1e4&268435455;u[n++]=m>>>8&255,u[n++]=255&m,u[n++]=m>>>24&15|16,u[n++]=m>>>16&255,u[n++]=h>>>8|128,u[n++]=255&h;for(let e=0;e<6;++e)u[n+e]=d[e];return t||(0,o.unsafeStringify)(u)}},4948:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=o(r(9025)),i=o(r(2311));function o(e){return e&&e.__esModule?e:{default:e}}var s=(0,n.default)("v3",48,i.default);t.default=s},9025:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0,t.default=function(e,t,r){function n(e,n,s,a){var c;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r=301&&o.status<=302?function(e){return"string"==typeof e&&"https"===e.split("://")[0]}(o.getResponseHeader("Location"))?c():t(s({message:"no redirect URL found",url:e,status:o.status})):t(s({message:"error during request",url:e,status:o.status}))}function c(){o.onreadystatechange=function(){4===o.readyState&&a()},o.onload=function(){a()},o.ontimeout=function(){return t(s({message:"request timed out",url:e,status:o.status}))},o.open("GET",e,!0),o.timeout=n.config.request_timeout,o.setRequestHeader("Accept","application/jrd+json, application/json"),o.send()}return c()},a.prototype.__isValidJSON=function(e){try{JSON.parse(e)}catch(e){return!1}return!0},a.prototype.__isLocalhost=function(e){return/^localhost(\.localdomain)?(\:[0-9]+)?$/.test(e)},a.prototype.__processJRD=function(e,t,n,o){var a=JSON.parse(t);if("object"!=typeof a||"object"!=typeof a.links)return void 0!==a.error?n(s({message:a.error,request:e})):n(s({message:"unknown response from server",request:e}));var c=a.links;Array.isArray(c)||(c=[]);var l={object:a,json:t,idx:{}};l.idx.properties={name:void 0},l.idx.links=JSON.parse(JSON.stringify(i)),c.map((function(e,t){if(r.hasOwnProperty(e.rel)&&l.idx.links[r[e.rel]]){var n={};Object.keys(e).map((function(t,r){n[t]=e[t]})),l.idx.links[r[e.rel]].push(n)}}));var u=JSON.parse(t).properties;for(var d in u)u.hasOwnProperty(d)&&"http://packetizer.com/ns/name"===d&&(l.idx.properties.name=u[d]);return o(l)},a.prototype.lookup=function(e,t){if("string"!=typeof e)throw new Error("first parameter must be a user address");if("function"!=typeof t)throw new Error("second parameter must be a callback");var r=this,n="";n=e.indexOf("://")>-1?e.replace(/ /g,"").split("/")[2]:e.replace(/ /g,"").split("@")[1];var i=0,s="https";function a(){var t="";return e.split("://")[1]||(t="acct:"),s+"://"+n+"/.well-known/"+o[i]+"?resource="+t+e}function c(e){if(r.config.uri_fallback&&"webfist.org"!==n&&i!==o.length-1)return i+=1,l();if(!r.config.tls_only&&"https"===s)return i=0,s="http",l();if(!r.config.webfist_fallback||"webfist.org"===n)return t(e);i=0,s="http",n="webfist.org";var c=a();r.__fetchJRD(c,t,(function(e){r.__processJRD(c,e,t,(function(e){"object"==typeof e.idx.links.webfist&&"string"==typeof e.idx.links.webfist[0].href&&r.__fetchJRD(e.idx.links.webfist[0].href,t,(function(e){r.__processJRD(c,e,t,(function(e){return t(null,t)}))}))}))}))}function l(){var e=a();r.__fetchJRD(e,c,(function(n){r.__processJRD(e,n,t,(function(e){t(null,e)}))}))}return r.__isLocalhost(n)&&(s="http"),setTimeout(l,0)},a.prototype.lookupLink=function(e,t,r){if(!i.hasOwnProperty(t))return r("unsupported rel "+t);this.lookup(e,(function(e,n){var i=n.idx.links[t];return e?r(e):0===i.length?r('no links found with rel="'+t+'"'):r(null,i[0])}))},void 0===(n=function(){return a}.apply(t,[]))||(e.exports=n)}()},4317:function(e){e.exports=XMLHttpRequest},6438:function(e,t,r){"use strict";r.r(t),r.d(t,{CompactEncrypt:function(){return ee},CompactSign:function(){return te.T},EmbeddedJWK:function(){return he},EncryptJWT:function(){return ae},FlattenedEncrypt:function(){return K},FlattenedSign:function(){return re.n},GeneralEncrypt:function(){return G},GeneralSign:function(){return ie},SignJWT:function(){return oe.P},UnsecuredJWT:function(){return we},base64url:function(){return n},calculateJwkThumbprint:function(){return ue},calculateJwkThumbprintUri:function(){return de},compactDecrypt:function(){return B},compactVerify:function(){return q.B},createLocalJWKSet:function(){return me},createRemoteJWKSet:function(){return be},cryptoRuntime:function(){return xe},decodeJwt:function(){return Ae},decodeProtectedHeader:function(){return Ee},errors:function(){return s},exportJWK:function(){return W.JU},exportPKCS8:function(){return W.Yp},exportSPKI:function(){return W.Y5},flattenedDecrypt:function(){return M},flattenedVerify:function(){return z.Z},generalDecrypt:function(){return H},generalVerify:function(){return Y},generateKeyPair:function(){return Re.T},generateSecret:function(){return Te},importJWK:function(){return F.Og},importPKCS8:function(){return F.Lf},importSPKI:function(){return F.jU},importX509:function(){return F.Mh},jwtDecrypt:function(){return Z},jwtVerify:function(){return Q.V}});var n={};r.r(n),r.d(n,{decode:function(){return Se},encode:function(){return _e}});var i=r(1436),o=r(9095),s=r(7493),a=r(8057);function c(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new s.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}var l=e=>(0,a.A)(new Uint8Array(c(e)>>3)),u=(e,t)=>{if(t.length<<3!==c(e))throw new s.JWEInvalid("Invalid Initialization Vector length")},d=(e,t)=>{const r=e.byteLength<<3;if(r!==t)throw new s.JWEInvalid(`Invalid Content Encryption Key length. Expected ${t} bits, got ${r} bits`)},h=r(7991),f=r(2698),p=r(1575),g=r(5994),y=async(e,t,r,n,i,a)=>{if(!((0,h.R)(t)||t instanceof Uint8Array))throw new TypeError((0,p.A)(t,...g.g,"Uint8Array"));switch(u(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return t instanceof Uint8Array&&d(t,parseInt(e.slice(-3),10)),async function(e,t,r,n,i,a){if(!(t instanceof Uint8Array))throw new TypeError((0,p.A)(t,"Uint8Array"));const c=parseInt(e.slice(1,4),10),l=await h.A.subtle.importKey("raw",t.subarray(c>>3),"AES-CBC",!1,["decrypt"]),u=await h.A.subtle.importKey("raw",t.subarray(0,c>>3),{hash:"SHA-"+(c<<1),name:"HMAC"},!1,["sign"]),d=(0,o.xW)(a,n,r,(0,o.mx)(a.length<<3)),f=new Uint8Array((await h.A.subtle.sign("HMAC",u,d)).slice(0,c>>3));let g,y;try{g=((e,t)=>{if(!(e instanceof Uint8Array))throw new TypeError("First argument must be a buffer");if(!(t instanceof Uint8Array))throw new TypeError("Second argument must be a buffer");if(e.length!==t.length)throw new TypeError("Input buffers must have the same length");const r=e.length;let n=0,i=-1;for(;++i{throw new s.JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `inflateRaw` decrypt option to provide Inflate Raw implementation.')},v=async()=>{throw new s.JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `deflateRaw` encrypt option to provide Deflate Raw implementation.')};var b=r(9874),w=r(149),_=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]];function S(e,t){if(e.algorithm.length!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function E(e,t,r){if((0,h.R)(e))return(0,f.$)(e,t,r),e;if(e instanceof Uint8Array)return h.A.subtle.importKey("raw",e,"AES-KW",!0,[r]);throw new TypeError((0,p.A)(e,...g.g,"Uint8Array"))}const A=async(e,t,r)=>{const n=await E(t,e,"wrapKey");S(n,e);const i=await h.A.subtle.importKey("raw",r,..._);return new Uint8Array(await h.A.subtle.wrapKey("raw",i,n,"AES-KW"))},R=async(e,t,r)=>{const n=await E(t,e,"unwrapKey");S(n,e);const i=await h.A.subtle.unwrapKey("raw",r,n,"AES-KW",..._);return new Uint8Array(await h.A.subtle.exportKey("raw",i))};async function I(e,t,r,n,i=new Uint8Array(0),s=new Uint8Array(0)){if(!(0,h.R)(e))throw new TypeError((0,p.A)(e,...g.g));if((0,f.$)(e,"ECDH"),!(0,h.R)(t))throw new TypeError((0,p.A)(t,...g.g));(0,f.$)(t,"ECDH","deriveBits");const a=(0,o.xW)((0,o.Kp)(o.Rd.encode(r)),(0,o.Kp)(i),(0,o.Kp)(s),(0,o.VS)(n));let c;c="X25519"===e.algorithm.name?256:"X448"===e.algorithm.name?448:Math.ceil(parseInt(e.algorithm.namedCurve.substr(-3),10)/8)<<3;const l=new Uint8Array(await h.A.subtle.deriveBits({name:e.algorithm.name,public:e},t,c));return(0,o.yI)(l,n,a)}function T(e){if(!(0,h.R)(e))throw new TypeError((0,p.A)(e,...g.g));return["P-256","P-384","P-521"].includes(e.algorithm.namedCurve)||"X25519"===e.algorithm.name||"X448"===e.algorithm.name}async function x(e,t,r,n){!function(e){if(!(e instanceof Uint8Array)||e.length<8)throw new s.JWEInvalid("PBES2 Salt Input must be 8 or more octets")}(e);const i=(0,o.MT)(t,e),a=parseInt(t.slice(13,16),10),c={hash:`SHA-${t.slice(8,11)}`,iterations:r,name:"PBKDF2",salt:i},l={length:a,name:"AES-KW"},u=await function(e,t){if(e instanceof Uint8Array)return h.A.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]);if((0,h.R)(e))return(0,f.$)(e,t,"deriveBits","deriveKey"),e;throw new TypeError((0,p.A)(e,...g.g,"Uint8Array"))}(n,t);if(u.usages.includes("deriveBits"))return new Uint8Array(await h.A.subtle.deriveBits(c,u,a));if(u.usages.includes("deriveKey"))return h.A.subtle.deriveKey(c,u,l,!1,["wrapKey","unwrapKey"]);throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}function P(e){switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new s.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}var C=r(4495);function k(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new s.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}var O=e=>(0,a.A)(new Uint8Array(k(e)>>3)),F=r(8136),N=r(8858),D=async(e,t,r,n,i)=>{if(!((0,h.R)(r)||r instanceof Uint8Array))throw new TypeError((0,p.A)(r,...g.g,"Uint8Array"));switch(u(e,n),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return r instanceof Uint8Array&&d(r,parseInt(e.slice(-3),10)),async function(e,t,r,n,i){if(!(r instanceof Uint8Array))throw new TypeError((0,p.A)(r,"Uint8Array"));const s=parseInt(e.slice(1,4),10),a=await h.A.subtle.importKey("raw",r.subarray(s>>3),"AES-CBC",!1,["encrypt"]),c=await h.A.subtle.importKey("raw",r.subarray(0,s>>3),{hash:"SHA-"+(s<<1),name:"HMAC"},!1,["sign"]),l=new Uint8Array(await h.A.subtle.encrypt({iv:n,name:"AES-CBC"},a,t)),u=(0,o.xW)(i,n,l,(0,o.mx)(i.length<<3));return{ciphertext:l,tag:new Uint8Array((await h.A.subtle.sign("HMAC",c,u)).slice(0,s>>3))}}(e,t,r,n,i);case"A128GCM":case"A192GCM":case"A256GCM":return r instanceof Uint8Array&&d(r,parseInt(e.slice(1,4),10)),async function(e,t,r,n,i){let o;r instanceof Uint8Array?o=await h.A.subtle.importKey("raw",r,"AES-GCM",!1,["encrypt"]):((0,f.$)(r,e,"encrypt"),o=r);const s=new Uint8Array(await h.A.subtle.encrypt({additionalData:i,iv:n,name:"AES-GCM",tagLength:128},o,t)),a=s.slice(-16);return{ciphertext:s.slice(0,-16),tag:a}}(e,t,r,n,i);default:throw new s.JOSENotSupported("Unsupported JWE Content Encryption Algorithm")}},L=async function(e,t,r,n,o){switch((0,N.A)(e,t,"decrypt"),e){case"dir":if(void 0!==r)throw new s.JWEInvalid("Encountered unexpected JWE Encrypted Key");return t;case"ECDH-ES":if(void 0!==r)throw new s.JWEInvalid("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!(0,w.A)(n.epk))throw new s.JWEInvalid('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!T(t))throw new s.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const o=await(0,F.Og)(n.epk,e);let a,c;if(void 0!==n.apu){if("string"!=typeof n.apu)throw new s.JWEInvalid('JOSE Header "apu" (Agreement PartyUInfo) invalid');try{a=(0,i.D4)(n.apu)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the apu")}}if(void 0!==n.apv){if("string"!=typeof n.apv)throw new s.JWEInvalid('JOSE Header "apv" (Agreement PartyVInfo) invalid');try{c=(0,i.D4)(n.apv)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the apv")}}const l=await I(o,t,"ECDH-ES"===e?n.enc:e,"ECDH-ES"===e?k(n.enc):parseInt(e.slice(-5,-2),10),a,c);if("ECDH-ES"===e)return l;if(void 0===r)throw new s.JWEInvalid("JWE Encrypted Key missing");return R(e.slice(-6),l,r)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===r)throw new s.JWEInvalid("JWE Encrypted Key missing");return(async(e,t,r)=>{if(!(0,h.R)(t))throw new TypeError((0,p.A)(t,...g.g));if((0,f.$)(t,e,"decrypt","unwrapKey"),(0,C.A)(e,t),t.usages.includes("decrypt"))return new Uint8Array(await h.A.subtle.decrypt(P(e),t,r));if(t.usages.includes("unwrapKey")){const n=await h.A.subtle.unwrapKey("raw",r,t,P(e),..._);return new Uint8Array(await h.A.subtle.exportKey("raw",n))}throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation')})(e,t,r);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{if(void 0===r)throw new s.JWEInvalid("JWE Encrypted Key missing");if("number"!=typeof n.p2c)throw new s.JWEInvalid('JOSE Header "p2c" (PBES2 Count) missing or invalid');const a=(null==o?void 0:o.maxPBES2Count)||1e4;if(n.p2c>a)throw new s.JWEInvalid('JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds');if("string"!=typeof n.p2s)throw new s.JWEInvalid('JOSE Header "p2s" (PBES2 Salt) missing or invalid');let c;try{c=(0,i.D4)(n.p2s)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the p2s")}return(async(e,t,r,n,i)=>{const o=await x(i,e,n,t);return R(e.slice(-6),o,r)})(e,t,r,n.p2c,c)}case"A128KW":case"A192KW":case"A256KW":if(void 0===r)throw new s.JWEInvalid("JWE Encrypted Key missing");return R(e,t,r);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{if(void 0===r)throw new s.JWEInvalid("JWE Encrypted Key missing");if("string"!=typeof n.iv)throw new s.JWEInvalid('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof n.tag)throw new s.JWEInvalid('JOSE Header "tag" (Authentication Tag) missing or invalid');let o,a;try{o=(0,i.D4)(n.iv)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the iv")}try{a=(0,i.D4)(n.tag)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the tag")}return async function(e,t,r,n,i){const o=e.slice(0,7);return y(o,t,r,n,i,new Uint8Array(0))}(e,t,r,o,a)}default:throw new s.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}},U=r(2168),j=r(4618);async function M(e,t,r){var n;if(!(0,w.A)(e))throw new s.JWEInvalid("Flattened JWE must be an object");if(void 0===e.protected&&void 0===e.header&&void 0===e.unprotected)throw new s.JWEInvalid("JOSE Header missing");if("string"!=typeof e.iv)throw new s.JWEInvalid("JWE Initialization Vector missing or incorrect type");if("string"!=typeof e.ciphertext)throw new s.JWEInvalid("JWE Ciphertext missing or incorrect type");if("string"!=typeof e.tag)throw new s.JWEInvalid("JWE Authentication Tag missing or incorrect type");if(void 0!==e.protected&&"string"!=typeof e.protected)throw new s.JWEInvalid("JWE Protected Header incorrect type");if(void 0!==e.encrypted_key&&"string"!=typeof e.encrypted_key)throw new s.JWEInvalid("JWE Encrypted Key incorrect type");if(void 0!==e.aad&&"string"!=typeof e.aad)throw new s.JWEInvalid("JWE AAD incorrect type");if(void 0!==e.header&&!(0,w.A)(e.header))throw new s.JWEInvalid("JWE Shared Unprotected Header incorrect type");if(void 0!==e.unprotected&&!(0,w.A)(e.unprotected))throw new s.JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");let a;if(e.protected)try{const t=(0,i.D4)(e.protected);a=JSON.parse(o.D0.decode(t))}catch(e){throw new s.JWEInvalid("JWE Protected Header is invalid")}if(!(0,b.A)(a,e.header,e.unprotected))throw new s.JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const c={...a,...e.header,...e.unprotected};if((0,U.A)(s.JWEInvalid,new Map,null==r?void 0:r.crit,a,c),void 0!==c.zip){if(!a||!a.zip)throw new s.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==c.zip)throw new s.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:l,enc:u}=c;if("string"!=typeof l||!l)throw new s.JWEInvalid("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof u||!u)throw new s.JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");const d=r&&(0,j.A)("keyManagementAlgorithms",r.keyManagementAlgorithms),h=r&&(0,j.A)("contentEncryptionAlgorithms",r.contentEncryptionAlgorithms);if(d&&!d.has(l))throw new s.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(h&&!h.has(u))throw new s.JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter not allowed');let f;if(void 0!==e.encrypted_key)try{f=(0,i.D4)(e.encrypted_key)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the encrypted_key")}let p,g,v,_=!1;"function"==typeof t&&(t=await t(a,e),_=!0);try{p=await L(l,t,f,c,r)}catch(e){if(e instanceof TypeError||e instanceof s.JWEInvalid||e instanceof s.JOSENotSupported)throw e;p=O(u)}try{g=(0,i.D4)(e.iv)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the iv")}try{v=(0,i.D4)(e.tag)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the tag")}const S=o.Rd.encode(null!==(n=e.protected)&&void 0!==n?n:"");let E,A;E=void 0!==e.aad?(0,o.xW)(S,o.Rd.encode("."),o.Rd.encode(e.aad)):S;try{A=(0,i.D4)(e.ciphertext)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the ciphertext")}let R=await y(u,p,A,g,v,E);"DEF"===c.zip&&(R=await((null==r?void 0:r.inflateRaw)||m)(R));const I={plaintext:R};if(void 0!==e.protected&&(I.protectedHeader=a),void 0!==e.aad)try{I.additionalAuthenticatedData=(0,i.D4)(e.aad)}catch(e){throw new s.JWEInvalid("Failed to base64url decode the aad")}return void 0!==e.unprotected&&(I.sharedUnprotectedHeader=e.unprotected),void 0!==e.header&&(I.unprotectedHeader=e.header),_?{...I,key:t}:I}async function B(e,t,r){if(e instanceof Uint8Array&&(e=o.D0.decode(e)),"string"!=typeof e)throw new s.JWEInvalid("Compact JWE must be a string or Uint8Array");const{0:n,1:i,2:a,3:c,4:l,length:u}=e.split(".");if(5!==u)throw new s.JWEInvalid("Invalid Compact JWE");const d=await M({ciphertext:c,iv:a||void 0,protected:n||void 0,tag:l||void 0,encrypted_key:i||void 0},t,r),h={plaintext:d.plaintext,protectedHeader:d.protectedHeader};return"function"==typeof t?{...h,key:d.key}:h}async function H(e,t,r){if(!(0,w.A)(e))throw new s.JWEInvalid("General JWE must be an object");if(!Array.isArray(e.recipients)||!e.recipients.every(w.A))throw new s.JWEInvalid("JWE Recipients missing or incorrect type");if(!e.recipients.length)throw new s.JWEInvalid("JWE Recipients has no members");for(const n of e.recipients)try{return await M({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:n.encrypted_key,header:n.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,r)}catch(e){}throw new s.JWEDecryptionFailed}var W=r(5130),$=async function(e,t,r,n,o={}){let c,u,d;switch((0,N.A)(e,r,"encrypt"),e){case"dir":d=r;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!T(r))throw new s.JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:a,apv:l}=o;let{epk:f}=o;f||(f=(await async function(e){if(!(0,h.R)(e))throw new TypeError((0,p.A)(e,...g.g));return h.A.subtle.generateKey(e.algorithm,!0,["deriveBits"])}(r)).privateKey);const{x:y,y:m,crv:v,kty:b}=await(0,W.JU)(f),w=await I(r,f,"ECDH-ES"===e?t:e,"ECDH-ES"===e?k(t):parseInt(e.slice(-5,-2),10),a,l);if(u={epk:{x:y,crv:v,kty:b}},"EC"===b&&(u.epk.y=m),a&&(u.apu=(0,i.lF)(a)),l&&(u.apv=(0,i.lF)(l)),"ECDH-ES"===e){d=w;break}d=n||O(t);const _=e.slice(-6);c=await A(_,w,d);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":d=n||O(t),c=await(async(e,t,r)=>{if(!(0,h.R)(t))throw new TypeError((0,p.A)(t,...g.g));if((0,f.$)(t,e,"encrypt","wrapKey"),(0,C.A)(e,t),t.usages.includes("encrypt"))return new Uint8Array(await h.A.subtle.encrypt(P(e),t,r));if(t.usages.includes("wrapKey")){const n=await h.A.subtle.importKey("raw",r,..._);return new Uint8Array(await h.A.subtle.wrapKey("raw",n,t,P(e)))}throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')})(e,r,d);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{d=n||O(t);const{p2c:s,p2s:l}=o;({encryptedKey:c,...u}=await(async(e,t,r,n=2048,o=(0,a.A)(new Uint8Array(16)))=>{const s=await x(o,e,n,t);return{encryptedKey:await A(e.slice(-6),s,r),p2c:n,p2s:(0,i.lF)(o)}})(e,r,d,s,l));break}case"A128KW":case"A192KW":case"A256KW":d=n||O(t),c=await A(e,r,d);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{d=n||O(t);const{iv:s}=o;({encryptedKey:c,...u}=await async function(e,t,r,n){const o=e.slice(0,7);n||(n=l(o));const{ciphertext:s,tag:a}=await D(o,r,t,n,new Uint8Array(0));return{encryptedKey:s,iv:(0,i.lF)(n),tag:(0,i.lF)(a)}}(e,r,d,s));break}default:throw new s.JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:d,encryptedKey:c,parameters:u}};const V=Symbol();class K{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=e,this}setInitializationVector(e){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=e,this}async encrypt(e,t){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new s.JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!(0,b.A)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new s.JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,U.A)(s.JWEInvalid,new Map,null==t?void 0:t.crit,this._protectedHeader,r),void 0!==r.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new s.JWEInvalid('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==r.zip)throw new s.JOSENotSupported('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:n,enc:a}=r;if("string"!=typeof n||!n)throw new s.JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof a||!a)throw new s.JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let c,u,d,h,f,p,g;if("dir"===n){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===n&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let r;({cek:u,encryptedKey:c,parameters:r}=await $(n,a,e,this._cek,this._keyManagementParameters)),r&&(t&&V in t?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...r}:this.setUnprotectedHeader(r):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...r}:this.setProtectedHeader(r))}if(this._iv||(this._iv=l(a)),h=this._protectedHeader?o.Rd.encode((0,i.lF)(JSON.stringify(this._protectedHeader))):o.Rd.encode(""),this._aad?(f=(0,i.lF)(this._aad),d=(0,o.xW)(h,o.Rd.encode("."),o.Rd.encode(f))):d=h,"DEF"===r.zip){const e=await((null==t?void 0:t.deflateRaw)||v)(this._plaintext);({ciphertext:p,tag:g}=await D(a,e,u,this._iv,d))}else({ciphertext:p,tag:g}=await D(a,this._plaintext,u,this._iv,d));const y={ciphertext:(0,i.lF)(p),iv:(0,i.lF)(this._iv),tag:(0,i.lF)(g)};return c&&(y.encrypted_key=(0,i.lF)(c)),f&&(y.aad=f),this._protectedHeader&&(y.protected=o.D0.decode(h)),this._sharedUnprotectedHeader&&(y.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(y.header=this._unprotectedHeader),y}}class J{constructor(e,t,r){this.parent=e,this.key=t,this.options=r}setUnprotectedHeader(e){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}}class G{constructor(e){this._recipients=[],this._plaintext=e}addRecipient(e,t){const r=new J(this,e,{crit:null==t?void 0:t.crit});return this._recipients.push(r),r}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(e){var t,r,n;if(!this._recipients.length)throw new s.JWEInvalid("at least one recipient must be added");if(e={deflateRaw:null==e?void 0:e.deflateRaw},1===this._recipients.length){const[t]=this._recipients,r=await new K(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(t.unprotectedHeader).encrypt(t.key,{...t.options,...e});let n={ciphertext:r.ciphertext,iv:r.iv,recipients:[{}],tag:r.tag};return r.aad&&(n.aad=r.aad),r.protected&&(n.protected=r.protected),r.unprotected&&(n.unprotected=r.unprotected),r.encrypted_key&&(n.recipients[0].encrypted_key=r.encrypted_key),r.header&&(n.recipients[0].header=r.header),n}let o;for(let e=0;e{if("string"!=typeof e||!e)throw new s.JWKInvalid(`${t} missing or invalid`)};async function ue(e,t){if(!(0,w.A)(e))throw new TypeError("JWK must be an object");if(null!=t||(t="sha256"),"sha256"!==t&&"sha384"!==t&&"sha512"!==t)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let r;switch(e.kty){case"EC":le(e.crv,'"crv" (Curve) Parameter'),le(e.x,'"x" (X Coordinate) Parameter'),le(e.y,'"y" (Y Coordinate) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case"OKP":le(e.crv,'"crv" (Subtype of Key Pair) Parameter'),le(e.x,'"x" (Public Key) Parameter'),r={crv:e.crv,kty:e.kty,x:e.x};break;case"RSA":le(e.e,'"e" (Exponent) Parameter'),le(e.n,'"n" (Modulus) Parameter'),r={e:e.e,kty:e.kty,n:e.n};break;case"oct":le(e.k,'"k" (Key Value) Parameter'),r={k:e.k,kty:e.kty};break;default:throw new s.JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported')}const n=o.Rd.encode(JSON.stringify(r));return(0,i.lF)(await(0,ce.A)(t,n))}async function de(e,t){null!=t||(t="sha256");const r=await ue(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${r}`}async function he(e,t){const r={...e,...null==t?void 0:t.header};if(!(0,w.A)(r.jwk))throw new s.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const n=await(0,F.Og)({...r.jwk,ext:!0},r.alg,!0);if(n instanceof Uint8Array||"public"!==n.type)throw new s.JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');return n}function fe(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(pe)}function pe(e){return(0,w.A)(e)}class ge{constructor(e){if(this._cached=new WeakMap,!fe(e))throw new s.JWKSInvalid("JSON Web Key Set malformed");var t;this._jwks=(t=e,"function"==typeof structuredClone?structuredClone(t):JSON.parse(JSON.stringify(t)))}async getKey(e,t){const{alg:r,kid:n}={...e,...null==t?void 0:t.header},i=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new s.JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set')}}(r),o=this._jwks.keys.filter((e=>{let t=i===e.kty;if(t&&"string"==typeof n&&(t=n===e.kid),t&&"string"==typeof e.alg&&(t=r===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t&&"EdDSA"===r&&(t="Ed25519"===e.crv||"Ed448"===e.crv),t)switch(r){case"ES256":t="P-256"===e.crv;break;case"ES256K":t="secp256k1"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv}return t})),{0:a,length:c}=o;if(0===c)throw new s.JWKSNoMatchingKey;if(1!==c){const e=new s.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(const e of o)try{yield await ye(t,e,r)}catch(e){continue}},e}return ye(this._cached,a,r)}}async function ye(e,t,r){const n=e.get(t)||e.set(t,{}).get(t);if(void 0===n[r]){const e=await(0,F.Og)({...t,ext:!0},r);if(e instanceof Uint8Array||"public"!==e.type)throw new s.JWKSInvalid("JSON Web Key Set members must be public keys");n[r]=e}return n[r]}function me(e){const t=new ge(e);return async function(e,r){return t.getKey(e,r)}}class ve extends ge{constructor(e,t){if(super({keys:[]}),this._jwks=void 0,!(e instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(e.href),this._options={agent:null==t?void 0:t.agent,headers:null==t?void 0:t.headers},this._timeoutDuration="number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3,this._cooldownDuration="number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now(){let n,i,o=!1;"function"==typeof AbortController&&(n=new AbortController,i=setTimeout((()=>{o=!0,n.abort()}),t));const a=await fetch(e.href,{signal:n?n.signal:void 0,redirect:"manual",headers:r.headers}).catch((e=>{if(o)throw new s.JWKSTimeout;throw e}));if(void 0!==i&&clearTimeout(i),200!==a.status)throw new s.JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await a.json()}catch(e){throw new s.JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON")}})(this._url,this._timeoutDuration,this._options).then((e=>{if(!fe(e))throw new s.JWKSInvalid("JSON Web Key Set malformed");this._jwks={keys:e.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0})).catch((e=>{throw this._pendingFetch=void 0,e}))),await this._pendingFetch}}function be(e,t){const r=new ve(e,t);return async function(e,t){return r.getKey(e,t)}}class we extends se.G{encode(){return`${i.lF(JSON.stringify({alg:"none"}))}.${i.lF(JSON.stringify(this._payload))}.`}static decode(e,t){if("string"!=typeof e)throw new s.JWTInvalid("Unsecured JWT must be a string");const{0:r,1:n,2:a,length:c}=e.split(".");if(3!==c||""!==a)throw new s.JWTInvalid("Invalid Unsecured JWT");let l;try{if(l=JSON.parse(o.D0.decode(i.D4(r))),"none"!==l.alg)throw new Error}catch(e){throw new s.JWTInvalid("Invalid Unsecured JWT")}return{payload:(0,X.A)(l,i.D4(n),t),header:l}}}const _e=i.lF,Se=i.D4;function Ee(e){let t;if("string"==typeof e){const r=e.split(".");3!==r.length&&5!==r.length||([t]=r)}else if("object"==typeof e&&e){if(!("protected"in e))throw new TypeError("Token does not contain a Protected Header");t=e.protected}try{if("string"!=typeof t||!t)throw new Error;const e=JSON.parse(o.D0.decode(Se(t)));if(!(0,w.A)(e))throw new Error;return e}catch(e){throw new TypeError("Invalid Token or Protected Header formatting")}}function Ae(e){if("string"!=typeof e)throw new s.JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:r}=e.split(".");if(5===r)throw new s.JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");if(3!==r)throw new s.JWTInvalid("Invalid JWT");if(!t)throw new s.JWTInvalid("JWTs must contain a payload");let n,i;try{n=Se(t)}catch(e){throw new s.JWTInvalid("Failed to base64url decode the payload")}try{i=JSON.parse(o.D0.decode(n))}catch(e){throw new s.JWTInvalid("Failed to parse the decoded payload as JSON")}if(!(0,w.A)(i))throw new s.JWTInvalid("Invalid JWT Claims Set");return i}var Re=r(7307),Ie=r(8793);async function Te(e,t){return(0,Ie.K)(e,t)}var xe="WebCryptoAPI"},2609:function(e,t,r){"use strict";r.d(t,{T:function(){return i}});var n=r(5550);class i{constructor(e){this._flattened=new n.n(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){const r=await this._flattened.sign(e,t);if(void 0===r.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${r.protected}.${r.payload}.${r.signature}`}}},5609:function(e,t,r){"use strict";r.d(t,{B:function(){return s}});var n=r(6711),i=r(7493),o=r(9095);async function s(e,t,r){if(e instanceof Uint8Array&&(e=o.D0.decode(e)),"string"!=typeof e)throw new i.JWSInvalid("Compact JWS must be a string or Uint8Array");const{0:s,1:a,2:c,length:l}=e.split(".");if(3!==l)throw new i.JWSInvalid("Invalid Compact JWS");const u=await(0,n.Z)({payload:a,protected:s,signature:c},t,r),d={payload:u.payload,protectedHeader:u.protectedHeader};return"function"==typeof t?{...d,key:u.key}:d}},5550:function(e,t,r){"use strict";r.d(t,{n:function(){return f}});var n=r(1436),i=r(1020),o=r(7991),s=r(4495),a=r(676),c=r(9874),l=r(7493),u=r(9095),d=r(8858),h=r(2168);class f{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new l.JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!(0,c.A)(this._protectedHeader,this._unprotectedHeader))throw new l.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const r={...this._protectedHeader,...this._unprotectedHeader};let f=!0;if((0,h.A)(l.JWSInvalid,new Map([["b64",!0]]),null==t?void 0:t.crit,this._protectedHeader,r).has("b64")&&(f=this._protectedHeader.b64,"boolean"!=typeof f))throw new l.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:p}=r;if("string"!=typeof p||!p)throw new l.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');(0,d.A)(p,e,"sign");let g,y=this._payload;f&&(y=u.Rd.encode((0,n.lF)(y))),g=this._protectedHeader?u.Rd.encode((0,n.lF)(JSON.stringify(this._protectedHeader))):u.Rd.encode("");const m=(0,u.xW)(g,u.Rd.encode("."),y),v=await(async(e,t,r)=>{const n=await(0,a.A)(e,t,"sign");(0,s.A)(e,n);const c=await o.A.subtle.sign((0,i.A)(e,n.algorithm),n,r);return new Uint8Array(c)})(p,e,m),b={signature:(0,n.lF)(v),payload:""};return f&&(b.payload=u.D0.decode(y)),this._unprotectedHeader&&(b.header=this._unprotectedHeader),this._protectedHeader&&(b.protected=u.D0.decode(g)),b}}},6711:function(e,t,r){"use strict";r.d(t,{Z:function(){return y}});var n=r(1436),i=r(1020),o=r(7991),s=r(4495),a=r(676),c=async(e,t,r,n)=>{const c=await(0,a.A)(e,t,"verify");(0,s.A)(e,c);const l=(0,i.A)(e,c.algorithm);try{return await o.A.subtle.verify(l,c,r,n)}catch(e){return!1}},l=r(7493),u=r(9095),d=r(9874),h=r(149),f=r(8858),p=r(2168),g=r(4618);async function y(e,t,r){var i;if(!(0,h.A)(e))throw new l.JWSInvalid("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new l.JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new l.JWSInvalid("JWS Protected Header incorrect type");if(void 0===e.payload)throw new l.JWSInvalid("JWS Payload missing");if("string"!=typeof e.signature)throw new l.JWSInvalid("JWS Signature missing or incorrect type");if(void 0!==e.header&&!(0,h.A)(e.header))throw new l.JWSInvalid("JWS Unprotected Header incorrect type");let o={};if(e.protected)try{const t=(0,n.D4)(e.protected);o=JSON.parse(u.D0.decode(t))}catch(e){throw new l.JWSInvalid("JWS Protected Header is invalid")}if(!(0,d.A)(o,e.header))throw new l.JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const s={...o,...e.header};let a=!0;if((0,p.A)(l.JWSInvalid,new Map([["b64",!0]]),null==r?void 0:r.crit,o,s).has("b64")&&(a=o.b64,"boolean"!=typeof a))throw new l.JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:y}=s;if("string"!=typeof y||!y)throw new l.JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');const m=r&&(0,g.A)("algorithms",r.algorithms);if(m&&!m.has(y))throw new l.JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');if(a){if("string"!=typeof e.payload)throw new l.JWSInvalid("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new l.JWSInvalid("JWS Payload must be a string or an Uint8Array instance");let v=!1;"function"==typeof t&&(t=await t(o,e),v=!0),(0,f.A)(y,t,"verify");const b=(0,u.xW)(u.Rd.encode(null!==(i=e.protected)&&void 0!==i?i:""),u.Rd.encode("."),"string"==typeof e.payload?u.Rd.encode(e.payload):e.payload);let w,_;try{w=(0,n.D4)(e.signature)}catch(e){throw new l.JWSInvalid("Failed to base64url decode the signature")}if(!await c(y,t,w,b))throw new l.JWSSignatureVerificationFailed;if(a)try{_=(0,n.D4)(e.payload)}catch(e){throw new l.JWSInvalid("Failed to base64url decode the payload")}else _="string"==typeof e.payload?u.Rd.encode(e.payload):e.payload;const S={payload:_};return void 0!==e.protected&&(S.protectedHeader=o),void 0!==e.header&&(S.unprotectedHeader=e.header),v?{...S,key:t}:S}},3085:function(e,t,r){"use strict";r.d(t,{G:function(){return s}});var n=r(2222),i=r(149),o=r(6957);class s{constructor(e){if(!(0,i.A)(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return this._payload="number"==typeof e?{...this._payload,nbf:e}:{...this._payload,nbf:(0,n.A)(new Date)+(0,o.A)(e)},this}setExpirationTime(e){return this._payload="number"==typeof e?{...this._payload,exp:e}:{...this._payload,exp:(0,n.A)(new Date)+(0,o.A)(e)},this}setIssuedAt(e){return this._payload=void 0===e?{...this._payload,iat:(0,n.A)(new Date)}:{...this._payload,iat:e},this}}},7248:function(e,t,r){"use strict";r.d(t,{P:function(){return a}});var n=r(2609),i=r(7493),o=r(9095),s=r(3085);class a extends s.G{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){var r;const s=new n.T(o.Rd.encode(JSON.stringify(this._payload)));if(s.setProtectedHeader(this._protectedHeader),Array.isArray(null===(r=this._protectedHeader)||void 0===r?void 0:r.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new i.JWTInvalid("JWTs MUST NOT use unencoded payload");return s.sign(e,t)}}},9380:function(e,t,r){"use strict";r.d(t,{V:function(){return s}});var n=r(5609),i=r(9803),o=r(7493);async function s(e,t,r){var s;const a=await(0,n.B)(e,t,r);if((null===(s=a.protectedHeader.crit)||void 0===s?void 0:s.includes("b64"))&&!1===a.protectedHeader.b64)throw new o.JWTInvalid("JWTs MUST NOT use unencoded payload");const c={payload:(0,i.A)(a.protectedHeader,a.payload,r),protectedHeader:a.protectedHeader};return"function"==typeof t?{...c,key:a.key}:c}},5130:function(e,t,r){"use strict";r.d(t,{JU:function(){return d},Yp:function(){return u},Y5:function(){return l}});var n=r(5141),i=r(7991),o=r(1575),s=r(1436),a=r(5994),c=async e=>{if(e instanceof Uint8Array)return{kty:"oct",k:(0,s.lF)(e)};if(!(0,i.R)(e))throw new TypeError((0,o.A)(e,...a.g,"Uint8Array"));if(!e.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");const{ext:t,key_ops:r,alg:n,use:c,...l}=await i.A.subtle.exportKey("jwk",e);return l};async function l(e){return(0,n.Nj)(e)}async function u(e){return(0,n.Jq)(e)}async function d(e){return c(e)}},7307:function(e,t,r){"use strict";r.d(t,{T:function(){return i}});var n=r(8793);async function i(e,t){return(0,n.T)(e,t)}},8136:function(e,t,r){"use strict";r.d(t,{Og:function(){return h},Lf:function(){return d},jU:function(){return l},Mh:function(){return u}});var n=r(1436),i=r(5141),o=r(7991),s=r(7493),a=async e=>{var t,r;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:i,keyUsages:a}=function(e){let t,r;switch(e.kty){case"oct":switch(e.alg){case"HS256":case"HS384":case"HS512":t={name:"HMAC",hash:`SHA-${e.alg.slice(-3)}`},r=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":throw new s.JOSENotSupported(`${e.alg} keys cannot be imported as CryptoKey instances`);case"A128GCM":case"A192GCM":case"A256GCM":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":t={name:"AES-GCM"},r=["encrypt","decrypt"];break;case"A128KW":case"A192KW":case"A256KW":t={name:"AES-KW"},r=["wrapKey","unwrapKey"];break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":t={name:"PBKDF2"},r=["deriveBits"];break;default:throw new s.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new s.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},r=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},r=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new s.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"EdDSA":t={name:e.crv},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new s.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new s.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}(e),c=[i,null!==(t=e.ext)&&void 0!==t&&t,null!==(r=e.key_ops)&&void 0!==r?r:a];if("PBKDF2"===i.name)return o.A.subtle.importKey("raw",(0,n.D4)(e.k),...c);const l={...e};return delete l.alg,delete l.use,o.A.subtle.importKey("jwk",l,...c)},c=r(149);async function l(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return(0,i.sc)(e,t,r)}async function u(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');return(0,i.zp)(e,t,r)}async function d(e,t,r){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return(0,i.IG)(e,t,r)}async function h(e,t,r){var i;if(!(0,c.A)(e))throw new TypeError("JWK must be an object");switch(t||(t=e.alg),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=r||(r=!0!==e.ext),r?a({...e,alg:t,ext:null!==(i=e.ext)&&void 0!==i&&i}):(0,n.D4)(e.k);case"RSA":if(void 0!==e.oth)throw new s.JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return a({...e,alg:t});default:throw new s.JOSENotSupported('Unsupported "kty" (Key Type) Parameter value')}}},9095:function(e,t,r){"use strict";r.d(t,{D0:function(){return o},Kp:function(){return h},MT:function(){return c},Rd:function(){return i},VS:function(){return d},mx:function(){return u},xW:function(){return a},yI:function(){return f}});var n=r(610);const i=new TextEncoder,o=new TextDecoder,s=2**32;function a(...e){const t=e.reduce(((e,{length:t})=>e+t),0),r=new Uint8Array(t);let n=0;return e.forEach((e=>{r.set(e,n),n+=e.length})),r}function c(e,t){return a(i.encode(e),new Uint8Array([0]),t)}function l(e,t,r){if(t<0||t>=s)throw new RangeError(`value must be >= 0 and <= ${s-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],r)}function u(e){const t=Math.floor(e/s),r=e%s,n=new Uint8Array(8);return l(n,t,0),l(n,r,4),n}function d(e){const t=new Uint8Array(4);return l(t,e),t}function h(e){return a(d(e.length),e)}async function f(e,t,r){const i=Math.ceil((t>>3)/32),o=new Uint8Array(32*i);for(let t=0;t>3)}},8858:function(e,t,r){"use strict";var n=r(1575),i=r(5994);t.A=(e,t,r)=>{e.startsWith("HS")||"dir"===e||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?((e,t)=>{if(!(t instanceof Uint8Array)){if(!(0,i.A)(t))throw new TypeError((0,n.t)(e,t,...i.g,"Uint8Array"));if("secret"!==t.type)throw new TypeError(`${i.g.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}})(e,t):((e,t,r)=>{if(!(0,i.A)(t))throw new TypeError((0,n.t)(e,t,...i.g));if("secret"===t.type)throw new TypeError(`${i.g.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===r&&"public"===t.type)throw new TypeError(`${i.g.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===r&&"public"===t.type)throw new TypeError(`${i.g.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===r&&"private"===t.type)throw new TypeError(`${i.g.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===r&&"private"===t.type)throw new TypeError(`${i.g.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)})(e,t,r)}},2698:function(e,t,r){"use strict";function n(e,t="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function i(e,t){return e.name===t}function o(e){return parseInt(e.name.slice(4),10)}function s(e,t){if(t.length&&!t.some((t=>e.usages.includes(t)))){let e="CryptoKey does not support this operation, its usages must include ";if(t.length>2){const r=t.pop();e+=`one of ${t.join(", ")}, or ${r}.`}else 2===t.length?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw new TypeError(e)}}function a(e,t,...r){switch(t){case"HS256":case"HS384":case"HS512":{if(!i(e.algorithm,"HMAC"))throw n("HMAC");const r=parseInt(t.slice(2),10);if(o(e.algorithm.hash)!==r)throw n(`SHA-${r}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!i(e.algorithm,"RSASSA-PKCS1-v1_5"))throw n("RSASSA-PKCS1-v1_5");const r=parseInt(t.slice(2),10);if(o(e.algorithm.hash)!==r)throw n(`SHA-${r}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!i(e.algorithm,"RSA-PSS"))throw n("RSA-PSS");const r=parseInt(t.slice(2),10);if(o(e.algorithm.hash)!==r)throw n(`SHA-${r}`,"algorithm.hash");break}case"EdDSA":if("Ed25519"!==e.algorithm.name&&"Ed448"!==e.algorithm.name)throw n("Ed25519 or Ed448");break;case"ES256":case"ES384":case"ES512":{if(!i(e.algorithm,"ECDSA"))throw n("ECDSA");const r=function(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(t);if(e.algorithm.namedCurve!==r)throw n(r,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}s(e,r)}function c(e,t,...r){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!i(e.algorithm,"AES-GCM"))throw n("AES-GCM");const r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw n(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!i(e.algorithm,"AES-KW"))throw n("AES-KW");const r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw n(r,"algorithm.length");break}case"ECDH":switch(e.algorithm.name){case"ECDH":case"X25519":case"X448":break;default:throw n("ECDH, X25519, or X448")}break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!i(e.algorithm,"PBKDF2"))throw n("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!i(e.algorithm,"RSA-OAEP"))throw n("RSA-OAEP");const r=parseInt(t.slice(9),10)||1;if(o(e.algorithm.hash)!==r)throw n(`SHA-${r}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}s(e,r)}r.d(t,{$:function(){return c},Y:function(){return a}})},2222:function(e,t){"use strict";t.A=e=>Math.floor(e.getTime()/1e3)},1575:function(e,t,r){"use strict";function n(e,t,...r){if(r.length>2){const t=r.pop();e+=`one of type ${r.join(", ")}, or ${t}.`}else 2===r.length?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return null==t?e+=` Received ${t}`:"function"==typeof t&&t.name?e+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor&&t.constructor.name&&(e+=` Received an instance of ${t.constructor.name}`),e}function i(e,t,...r){return n(`Key for the ${e} algorithm must be `,t,...r)}r.d(t,{t:function(){return i}}),t.A=(e,...t)=>n("Key must be ",e,...t)},9874:function(e,t){"use strict";t.A=(...e)=>{const t=e.filter(Boolean);if(0===t.length||1===t.length)return!0;let r;for(const e of t){const t=Object.keys(e);if(r&&0!==r.size)for(const e of t){if(r.has(e))return!1;r.add(e)}else r=new Set(t)}return!0}},149:function(e,t,r){"use strict";function n(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let r=e;for(;null!==Object.getPrototypeOf(r);)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}r.d(t,{A:function(){return n}})},9803:function(e,t,r){"use strict";var n=r(7493),i=r(9095),o=r(2222),s=r(6957),a=r(149);const c=e=>e.toLowerCase().replace(/^application\//,"");t.A=(e,t,r={})=>{const{typ:l}=r;if(l&&("string"!=typeof e.typ||c(e.typ)!==c(l)))throw new n.JWTClaimValidationFailed('unexpected "typ" JWT header value',"typ","check_failed");let u;try{u=JSON.parse(i.D0.decode(t))}catch(e){}if(!(0,a.A)(u))throw new n.JWTInvalid("JWT Claims Set must be a top-level JSON object");const{requiredClaims:d=[],issuer:h,subject:f,audience:p,maxTokenAge:g}=r;void 0!==g&&d.push("iat"),void 0!==p&&d.push("aud"),void 0!==f&&d.push("sub"),void 0!==h&&d.push("iss");for(const e of new Set(d.reverse()))if(!(e in u))throw new n.JWTClaimValidationFailed(`missing required "${e}" claim`,e,"missing");if(h&&!(Array.isArray(h)?h:[h]).includes(u.iss))throw new n.JWTClaimValidationFailed('unexpected "iss" claim value',"iss","check_failed");if(f&&u.sub!==f)throw new n.JWTClaimValidationFailed('unexpected "sub" claim value',"sub","check_failed");if(p&&(m="string"==typeof p?[p]:p,!("string"==typeof(y=u.aud)?m.includes(y):Array.isArray(y)&&m.some(Set.prototype.has.bind(new Set(y))))))throw new n.JWTClaimValidationFailed('unexpected "aud" claim value',"aud","check_failed");var y,m;let v;switch(typeof r.clockTolerance){case"string":v=(0,s.A)(r.clockTolerance);break;case"number":v=r.clockTolerance;break;case"undefined":v=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:b}=r,w=(0,o.A)(b||new Date);if((void 0!==u.iat||g)&&"number"!=typeof u.iat)throw new n.JWTClaimValidationFailed('"iat" claim must be a number',"iat","invalid");if(void 0!==u.nbf){if("number"!=typeof u.nbf)throw new n.JWTClaimValidationFailed('"nbf" claim must be a number',"nbf","invalid");if(u.nbf>w+v)throw new n.JWTClaimValidationFailed('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==u.exp){if("number"!=typeof u.exp)throw new n.JWTClaimValidationFailed('"exp" claim must be a number',"exp","invalid");if(u.exp<=w-v)throw new n.JWTExpired('"exp" claim timestamp check failed',"exp","check_failed")}if(g){const e=w-u.iat;if(e-v>("number"==typeof g?g:(0,s.A)(g)))throw new n.JWTExpired('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(e<0-v)throw new n.JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return u}},6957:function(e,t){"use strict";const r=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;t.A=e=>{const t=r.exec(e);if(!t)throw new TypeError("Invalid time period format");const n=parseFloat(t[1]);switch(t[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(n);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*n);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*n);case"day":case"days":case"d":return Math.round(86400*n);case"week":case"weeks":case"w":return Math.round(604800*n);default:return Math.round(31557600*n)}}},4618:function(e,t){"use strict";t.A=(e,t)=>{if(void 0!==t&&(!Array.isArray(t)||t.some((e=>"string"!=typeof e))))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}},2168:function(e,t,r){"use strict";var n=r(7493);t.A=function(e,t,r,i,o){if(void 0!==o.crit&&void 0===i.crit)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!i||void 0===i.crit)return new Set;if(!Array.isArray(i.crit)||0===i.crit.length||i.crit.some((e=>"string"!=typeof e||0===e.length)))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s;s=void 0!==r?new Map([...Object.entries(r),...t.entries()]):t;for(const t of i.crit){if(!s.has(t))throw new n.JOSENotSupported(`Extension Header Parameter "${t}" is not recognized`);if(void 0===o[t])throw new e(`Extension Header Parameter "${t}" is missing`);if(s.get(t)&&void 0===i[t])throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(i.crit)}},5141:function(e,t,r){"use strict";r.d(t,{IG:function(){return g},sc:function(){return y},zp:function(){return b},Jq:function(){return d},Nj:function(){return u}});var n=r(7991),i=r(1575),o=r(1436),s=(e,t)=>`-----BEGIN ${t}-----\n${(e.match(/.{1,64}/g)||[]).join("\n")}\n-----END ${t}-----`,a=r(7493),c=r(5994);const l=async(e,t,r)=>{if(!(0,n.R)(r))throw new TypeError((0,i.A)(r,...c.g));if(!r.extractable)throw new TypeError("CryptoKey is not extractable");if(r.type!==e)throw new TypeError(`key is not a ${e} key`);return s((0,o.WG)(new Uint8Array(await n.A.subtle.exportKey(t,r))),`${e.toUpperCase()} KEY`)},u=e=>l("public","spki",e),d=e=>l("private","pkcs8",e),h=(e,t,r=0)=>{0===r&&(t.unshift(t.length),t.unshift(6));let n=e.indexOf(t[0],r);if(-1===n)return!1;const i=e.subarray(n,n+t.length);return i.length===t.length&&(i.every(((e,r)=>e===t[r]))||h(e,t,n+1))},f=e=>{switch(!0){case h(e,[42,134,72,206,61,3,1,7]):return"P-256";case h(e,[43,129,4,0,34]):return"P-384";case h(e,[43,129,4,0,35]):return"P-521";case h(e,[43,101,110]):return"X25519";case h(e,[43,101,111]):return"X448";case h(e,[43,101,112]):return"Ed25519";case h(e,[43,101,113]):return"Ed448";default:throw new a.JOSENotSupported("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},p=async(e,t,r,i,o)=>{var s;let c,l;const u=new Uint8Array(atob(r.replace(e,"")).split("").map((e=>e.charCodeAt(0)))),d="spki"===t;switch(i){case"PS256":case"PS384":case"PS512":c={name:"RSA-PSS",hash:`SHA-${i.slice(-3)}`},l=d?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":c={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${i.slice(-3)}`},l=d?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":c={name:"RSA-OAEP",hash:`SHA-${parseInt(i.slice(-3),10)||1}`},l=d?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":c={name:"ECDSA",namedCurve:"P-256"},l=d?["verify"]:["sign"];break;case"ES384":c={name:"ECDSA",namedCurve:"P-384"},l=d?["verify"]:["sign"];break;case"ES512":c={name:"ECDSA",namedCurve:"P-521"},l=d?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{const e=f(u);c=e.startsWith("P-")?{name:"ECDH",namedCurve:e}:{name:e},l=d?[]:["deriveBits"];break}case"EdDSA":c={name:f(u)},l=d?["verify"]:["sign"];break;default:throw new a.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value')}return n.A.subtle.importKey(t,u,c,null!==(s=null==o?void 0:o.extractable)&&void 0!==s&&s,l)},g=(e,t,r)=>p(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",e,t,r),y=(e,t,r)=>p(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",e,t,r);function m(e){let t=[],r=0;for(;r=128;)r=128*r+e[t]-128,t++;r=128*r+e[t]-128,t++}let n=0;if(e[t]<128)n=e[t],t++;else{if(128===n){for(n=0;0!==e[t+n]||0!==e[t+n+1];){if(n>e.byteLength)throw new TypeError("invalid indefinite form length");n++}const r=t+n+2;return{byteLength:r,contents:e.subarray(t,t+n),raw:e.subarray(0,r)}}{let r=127&e[t];t++,n=0;for(let i=0;i{let n;try{n=function(e){const t=e.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g,""),r=(0,o.y4)(t);return s(function(e){const t=m(m(v(e).contents)[0].contents);return(0,o.WG)(t[160===t[0].raw[0]?6:5].raw)}(r),"PUBLIC KEY")}(e)}catch(e){throw new TypeError("Failed to parse the X.509 certificate",{cause:e})}return y(n,t,r)}},1436:function(e,t,r){"use strict";r.d(t,{D4:function(){return a},WG:function(){return i},lF:function(){return o},y4:function(){return s}});var n=r(9095);const i=e=>{let t=e;"string"==typeof t&&(t=n.Rd.encode(t));const r=[];for(let e=0;ei(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),s=e=>{const t=atob(e),r=new Uint8Array(t.length);for(let e=0;e{let t=e;t instanceof Uint8Array&&(t=n.D0.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return s(t)}catch(e){throw new TypeError("The input to be decoded is not correctly encoded.")}}},4495:function(e,t){"use strict";t.A=(e,t)=>{if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:r}=t.algorithm;if("number"!=typeof r||r<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}},610:function(e,t,r){"use strict";var n=r(7991);t.A=async(e,t)=>{const r=`SHA-${e.slice(-3)}`;return new Uint8Array(await n.A.subtle.digest(r,t))}},8793:function(e,t,r){"use strict";r.d(t,{K:function(){return s},T:function(){return c}});var n=r(7991),i=r(7493),o=r(8057);async function s(e,t){var r;let s,a,c;switch(e){case"HS256":case"HS384":case"HS512":s=parseInt(e.slice(-3),10),a={name:"HMAC",hash:`SHA-${s}`,length:s},c=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return s=parseInt(e.slice(-3),10),(0,o.A)(new Uint8Array(s>>3));case"A128KW":case"A192KW":case"A256KW":s=parseInt(e.slice(1,4),10),a={name:"AES-KW",length:s},c=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":s=parseInt(e.slice(1,4),10),a={name:"AES-GCM",length:s},c=["encrypt","decrypt"];break;default:throw new i.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return n.A.subtle.generateKey(a,null!==(r=null==t?void 0:t.extractable)&&void 0!==r&&r,c)}function a(e){var t;const r=null!==(t=null==e?void 0:e.modulusLength)&&void 0!==t?t:2048;if("number"!=typeof r||r<2048)throw new i.JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return r}async function c(e,t){var r,o,s;let c,l;switch(e){case"PS256":case"PS384":case"PS512":c={name:"RSA-PSS",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:a(t)},l=["sign","verify"];break;case"RS256":case"RS384":case"RS512":c={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:a(t)},l=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":c={name:"RSA-OAEP",hash:`SHA-${parseInt(e.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:a(t)},l=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":c={name:"ECDSA",namedCurve:"P-256"},l=["sign","verify"];break;case"ES384":c={name:"ECDSA",namedCurve:"P-384"},l=["sign","verify"];break;case"ES512":c={name:"ECDSA",namedCurve:"P-521"},l=["sign","verify"];break;case"EdDSA":l=["sign","verify"];const n=null!==(r=null==t?void 0:t.crv)&&void 0!==r?r:"Ed25519";switch(n){case"Ed25519":case"Ed448":c={name:n};break;default:throw new i.JOSENotSupported("Invalid or unsupported crv option provided")}break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{l=["deriveKey","deriveBits"];const e=null!==(o=null==t?void 0:t.crv)&&void 0!==o?o:"P-256";switch(e){case"P-256":case"P-384":case"P-521":c={name:"ECDH",namedCurve:e};break;case"X25519":case"X448":c={name:e};break;default:throw new i.JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448")}break}default:throw new i.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return n.A.subtle.generateKey(c,null!==(s=null==t?void 0:t.extractable)&&void 0!==s&&s,l)}},676:function(e,t,r){"use strict";r.d(t,{A:function(){return a}});var n=r(7991),i=r(2698),o=r(1575),s=r(5994);function a(e,t,r){if((0,n.R)(t))return(0,i.Y)(t,e,r),t;if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError((0,o.A)(t,...s.g));return n.A.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}throw new TypeError((0,o.A)(t,...s.g,"Uint8Array"))}},5994:function(e,t,r){"use strict";r.d(t,{g:function(){return i}});var n=r(7991);t.A=e=>(0,n.R)(e);const i=["CryptoKey"]},8057:function(e,t,r){"use strict";var n=r(7991);t.A=n.A.getRandomValues.bind(n.A)},1020:function(e,t,r){"use strict";r.d(t,{A:function(){return i}});var n=r(7493);function i(e,t){const r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"EdDSA":return{name:t.name};default:throw new n.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}},7991:function(e,t,r){"use strict";r.d(t,{R:function(){return n}}),t.A=crypto;const n=e=>e instanceof CryptoKey},7493:function(e,t,r){"use strict";r.r(t),r.d(t,{JOSEAlgNotAllowed:function(){return s},JOSEError:function(){return n},JOSENotSupported:function(){return a},JWEDecompressionFailed:function(){return l},JWEDecryptionFailed:function(){return c},JWEInvalid:function(){return u},JWKInvalid:function(){return f},JWKSInvalid:function(){return p},JWKSMultipleMatchingKeys:function(){return y},JWKSNoMatchingKey:function(){return g},JWKSTimeout:function(){return m},JWSInvalid:function(){return d},JWSSignatureVerificationFailed:function(){return v},JWTClaimValidationFailed:function(){return i},JWTExpired:function(){return o},JWTInvalid:function(){return h}});class n extends Error{static get code(){return"ERR_JOSE_GENERIC"}constructor(e){var t;super(e),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,this.constructor)}}class i extends n{static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=t,this.reason=r}}class o extends n{static get code(){return"ERR_JWT_EXPIRED"}constructor(e,t="unspecified",r="unspecified"){super(e),this.code="ERR_JWT_EXPIRED",this.claim=t,this.reason=r}}class s extends n{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}}class a extends n{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}}class c extends n{constructor(){super(...arguments),this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}}class l extends n{constructor(){super(...arguments),this.code="ERR_JWE_DECOMPRESSION_FAILED",this.message="decompression operation failed"}static get code(){return"ERR_JWE_DECOMPRESSION_FAILED"}}class u extends n{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}}class d extends n{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}}class h extends n{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}}class f extends n{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}}class p extends n{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}}class g extends n{constructor(){super(...arguments),this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}}class y extends n{constructor(){super(...arguments),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}Symbol.asyncIterator;class m extends n{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}}class v extends n{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r(423);return n.default}()})); //# sourceMappingURL=remotestorage.js.map \ No newline at end of file diff --git a/release/remotestorage.js.LICENSE.txt b/release/remotestorage.js.LICENSE.txt index 3f829b401..fc8ee9926 100644 --- a/release/remotestorage.js.LICENSE.txt +++ b/release/remotestorage.js.LICENSE.txt @@ -1,3 +1,17 @@ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + /*! * webfinger.js * http://github.com/silverbucket/webfinger.js @@ -15,4 +29,19 @@ * */ +/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib + */ + +/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ + */ + +/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval + */ + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ + +/*! queue-microtask. MIT License. Feross Aboukhadijeh */ + /*! remotestorage.js 2.0.0-beta.7, https://remotestorage.io, MIT licensed */ + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ diff --git a/release/remotestorage.js.map b/release/remotestorage.js.map index a7dc386fa..934374537 100644 --- a/release/remotestorage.js.map +++ b/release/remotestorage.js.map @@ -1,5 +1 @@ -<<<<<<< HEAD -{"version":3,"file":"remotestorage.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;ACVA,MAAM,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B,8BAA8B;AAC9B,sBAAsB,+CAA+C;;AAErE;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA,2BAA2B;AAC3B;AACA;AACA;;AAEA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,OAAO;AAC5C;AACA;AACA;AACA,sBAAsB,2BAA2B,IAAI;AACrD,OAAO,qBAAqB,4BAA4B,IAAI;AAC5D,OAAO,qBAAqB,iCAAiC;AAC7D,OAAO,qBAAqB,kCAAkC;AAC9D,OAAO,qBAAqB,2BAA2B;AACvD,OAAO,qBAAqB,0BAA0B;AACtD,OAAO,qBAAqB,sBAAsB;AAClD,OAAO,qBAAqB,uBAAuB;AACnD,OAAO,qBAAqB,qBAAqB;AACjD,OAAO,qBAAqB;AAC5B;AACA;AACA;AACA,OAAO,qBAAqB,mBAAmB,uBAAuB;AACtE,OAAO;AACP,qCAAqC;AACrC,gDAAgD;AAChD,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA,KAAK,mCAAmC;AACxC,qBAAqB;AACrB;AACA;AACA;AACA,wBAAwB,0BAA0B;AAClD;AACA;;AAEA;AACA;AACA;AACA,QAAQ,mDAAmD;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D,0BAA0B,8BAA8B;AACxD,wEAAwE;AACxE;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,KAAK,mCAAmC;AACxC;AACA,sBAAsB,0BAA0B;AAChD,OAAO,qBAAqB,mCAAmC;AAC/D,OAAO,qBAAqB,sCAAsC;AAClE,OAAO,qBAAqB,kCAAkC;AAC9D,OAAO,qBAAqB,kCAAkC;AAC9D,OAAO,qBAAqB,gCAAgC;AAC5D,OAAO,qBAAqB,wCAAwC;AACpE,OAAO,qBAAqB,4BAA4B;AACxD,OAAO,qBAAqB,mBAAmB;AAC/C,OAAO;AACP;AACA;AACA,KAAK,oHAAoH;AACzH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F;AAC/F;AACA;AACA,YAAY,0FAA0F;AACtG;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK,iCAAiC;AACtC,gCAAgC;AAChC,aAAa;AACb,KAAK,iCAAiC;AACtC,gCAAgC;AAChC,aAAa;AACb,KAAK,iCAAiC;AACtC,gCAAgC,qBAAqB,0BAA0B;AAC/E,aAAa;AACb,KAAK,kCAAkC;AACvC,gCAAgC;AAChC,aAAa;AACb,KAAK,kCAAkC;AACvC,gCAAgC;AAChC,aAAa;AACb,KAAK,kCAAkC;AACvC,gCAAgC;AAChC,aAAa;AACb,KAAK,kCAAkC;AACvC,gCAAgC,qBAAqB,4BAA4B;AACjF,aAAa;AACb,KAAK,iCAAiC;AACtC,gCAAgC;AAChC,aAAa;AACb,KAAK,iCAAiC;AACtC,gCAAgC;AAChC,aAAa;AACb,KAAK,iCAAiC;AACtC,gCAAgC,qBAAqB,0BAA0B;AAC/E,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kDAAkD;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,QAAQ;AACR;AACA;AACA,KAAK;AACL;AACA;AACA,QAAQ;AACR;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH,2BAA2B;AAC3B,WAAW;AACX,GAAG;AACH;AACA,iCAAiC,YAAY;AAC7C,uCAAuC;;AAEvC,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzauE;AACoH;AACgD;AAChL;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0FAA0F,8EAA8E,iBAAiB,0EAA0E;AACnQ;AACA;AACA,4FAA4F,yBAAyB,eAAe,0EAA0E;AAC9M;AACA;AACA;AACA,2DAA2D,oBAAoB,IAAI,0EAA0E;AAC7J;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F,6BAA6B;AAC3H;AACA;AACA;AACA;AACA,0FAA0F,4CAA4C,2BAA2B;AACjK;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oFAAmB,gDAAgD,kFAAqB;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+E,yBAAyB,EAAE,6BAA6B,IAAI,8BAA8B;AACzK;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,cAAc,0BAA0B,eAAe;AAC9F;AACA;AACA,wCAAwC,cAAc;AACtD;AACA;AACA;AACA;AACA,kBAAkB,8EAAiB,mCAAmC,oBAAoB,GAAG;AAC7F,mBAAmB,gCAAgC;AACnD,iBAAiB,EAAE,sCAAsC,wBAAwB,QAAQ;AACzF;AACA;AACA;AACA;AACA,kBAAkB,iFAAoB;AACtC;AACA;AACA,kBAAkB,iFAAoB;AACtC;AACA;AACA,kBAAkB,iFAAoB;AACtC;AACA;AACA,kBAAkB,iFAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0GAA0G,yBAAyB;AACnI;AACA;AACA;AACA,yHAAyH,yBAAyB;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,oFAAmB;AAC3C,6BAA6B,iFAAgB;AAC7C;AACA;AACA;AACA,yCAAyC,QAAQ,gBAAgB,GAAG,oBAAoB,GAAG;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,8DAAO;AAC1C;AACA;AACA,wBAAwB,yFAAwB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2DAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yFAAwB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,YAAY,KAAK,IAAI;AACxG;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,2EAAc;AAC7B;AACA;AACA;AACA;AACA,wBAAwB,iFAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,QAAQ,gBAAgB,GAAG,oBAAoB,GAAG;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,8DAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,eAAe;AACvE;AACA;AACA,wBAAwB,yFAAwB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mFAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,kBAAkB;AAC9C;AACA;AACA;AACA;AACA,cAAc,kBAAkB,EAAE;AAClC;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA,uBAAuB,2DAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,qCAAqC,qEAAoB,GAAG;AAC5D;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEmH;;;;;;;;;;;ACtdnH,iBAAiB,GAAG,IAAiD,oBAAoB,KAAK,aAAiI,CAAC,kBAAkB,mBAAmB,SAAS,cAAc,4BAA4B,YAAY,qBAAqB,2DAA2D,uCAAuC,qCAAqC,oBAAoB,EAAE,iBAAiB,4FAA4F,eAAe,wCAAwC,SAAS,EAAE,mBAAmB,8BAA8B,qDAAqD,0BAA0B,6CAA6C,sBAAsB,6DAA6D,YAAY,eAAe,SAAS,iBAAiB,mCAAmC,iBAAiB,cAAc,UAAU,sBAAsB,mBAAmB,iDAAiD,kBAAkB,kBAAkB,aAAa,sCAAsC,SAAS,EAAE,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,GAAG,OAAO,oBAAoB,oBAAoB,oBAAoB,sBAAsB,mBAAmB,kBAAkB,aAAa,iBAAiB,8EAA8E,SAAS,4BAA4B,QAAQ,sBAAsB,SAAS,0CAA0C,IAAI,sBAAsB,gCAAgC,qBAAqB,SAAS,0CAA0C,IAAI,sBAAsB,+BAA+B,qBAAqB,SAAS,0CAA0C,IAAI,sBAAsB,+BAA+B,sBAAsB,SAAS,0CAA0C,IAAI,sBAAsB,gCAAgC,YAAY,4BAA4B,UAAU,EAAE,6BAA6B,UAAU,EAAE,4BAA4B,UAAU,EAAE,4BAA4B,UAAU,EAAE,6BAA6B,UAAU,EAAE,6BAA6B,SAAS,mBAAmB,sDAAsD,KAAK,EAAE,8BAA8B,SAAS,mBAAmB,4GAA4G,KAAK,KAAK,YAAY,iBAAiB,aAAa,sCAAsC,SAAS,EAAE,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,GAAG,OAAO,wBAAwB,gBAAgB,+BAA+B,6BAA6B,oBAAoB,GAAG,gBAAgB,wBAAwB,6BAA6B,cAAc,+BAA+B,6BAA6B,oBAAoB,GAAG,cAAc,wBAAwB,GAAG,aAAa,oBAAoB,aAAa,iBAAiB,8EAA8E,SAAS,+BAA+B,KAAK,mCAAmC,IAAI,YAAY,gCAAgC,uBAAuB,EAAE,oCAAoC,uDAAuD,EAAE,sCAAsC,yDAAyD,EAAE,sCAAsC,4DAA4D,EAAE,6BAA6B,gBAAgB,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,2BAA2B,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,iBAAiB,gBAAgB,8EAA8E,yCAAyC,6BAA6B,cAAc,2EAA2E,kHAAkH,uEAAuE,iDAAiD,iCAAiC,mCAAmC,sCAAsC,WAAW,0TAA0T,0DAA0D,mCAAmC,4CAA4C,2BAA2B,qLAAqL,oCAAoC,2CAA2C,mDAAmD,2DAA2D,8CAA8C,sDAAsD,2CAA2C,iEAAiE,qDAAqD,gDAAgD,4DAA4D,gDAAgD,4DAA4D,gDAAgD,2DAA2D,0CAA0C,gDAAgD,gDAAgD,8DAA8D,uGAAuG,wFAAwF,wHAAwH,mJAAmJ,YAAY,GAAG,yCAAyC,WAAW,2NAA2N,sHAAsH,6LAA6L,8DAA8D,GAAG,GAAG,OAAO,mCAAmC,4TAA4T,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,sBAAsB,kBAAkB,wBAAwB,aAAa,iBAAiB,8EAA8E,SAAS,yCAAyC,yHAAyH,kCAAkC,mIAAmI,wCAAwC,uBAAuB,0EAA0E,cAAc,2BAA2B,YAAY,yLAAyL,yDAAyD,wBAAwB,SAAS,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,oBAAoB,4BAA4B,0BAA0B,WAAW,QAAQ,0BAA0B,0IAA0I,EAAE,iBAAiB,aAAa,sCAAsC,SAAS,8BAA8B,8EAA8E,gBAAgB,aAAa,oGAAoG,cAAc,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,wCAAwC,gBAAgB,8EAA8E,wFAAwF,gCAAgC,aAAa,+DAA+D,q0BAAq0B,0CAA0C,IAAI,isBAAisB,yEAAyE,6CAA6C,yCAAyC,OAAO,iCAAiC,uBAAuB,mBAAmB,iKAAiK,mBAAmB,EAAE,qCAAqC,4BAA4B,EAAE,qCAAqC,4BAA4B,EAAE,6BAA6B,oBAAoB,EAAE,oCAAoC,2BAA2B,EAAE,gDAAgD,uCAAuC,EAAE,6CAA6C,oCAAoC,EAAE,8BAA8B,qBAAqB,EAAE,+BAA+B,sBAAsB,EAAE,+BAA+B,sBAAsB,EAAE,kCAAkC,yBAAyB,EAAE,kCAAkC,yBAAyB,EAAE,gCAAgC,uBAAuB,EAAE,qCAAqC,4BAA4B,EAAE,iCAAiC,uBAAuB,mBAAmB,iKAAiK,mBAAmB,EAAE,mCAAmC,wOAAwO,EAAE,gCAAgC,sBAAsB,mBAAmB,kBAAkB,EAAE,oCAAoC,0BAA0B,mBAAmB,sBAAsB,EAAE,mCAAmC,yBAAyB,mBAAmB,qBAAqB,EAAE,4CAA4C,mCAAmC,EAAE,oCAAoC,2BAA2B,EAAE,qCAAqC,4BAA4B,EAAE,iCAAiC,wBAAwB,EAAE,yCAAyC,gCAAgC,EAAE,mCAAmC,0BAA0B,EAAE,kCAAkC,yBAAyB,EAAE,iCAAiC,wBAAwB,EAAE,uCAAuC,8BAA8B,EAAE,wCAAwC,8BAA8B,mBAAmB,6FAA6F,EAAE,wCAAwC,8BAA8B,mBAAmB,6FAA6F,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,gCAAgC,kBAAkB,gBAAgB,8EAA8E,kCAAkC,aAAa,+DAA+D,kFAAkF,uCAAuC,uCAAuC,6GAA6G,+BAA+B,2DAA2D,6BAA6B,0BAA0B,kCAAkC,8DAA8D,6BAA6B,oDAAoD,qCAAqC,+CAA+C,iBAAiB,qBAAqB,KAAK,yBAAyB,mEAAmE,0BAA0B,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,uBAAuB,kBAAkB,gBAAgB,8EAA8E,yBAAyB,aAAa,iNAAiN,qNAAqN,2CAA2C,WAAW,+EAA+E,8EAA8E,4BAA4B,gBAAgB,sCAAsC,oBAAoB,+FAA+F,0CAA0C,MAAM,0BAA0B,4BAA4B,GAAG,mDAAmD,SAAS,0CAA0C,SAAS,4FAA4F,+DAA+D,8CAA8C,sBAAsB,4EAA4E,8IAA8I,GAAG,wCAAwC,WAAW,gFAAgF,+EAA+E,4BAA4B,iBAAiB,sBAAsB,oBAAoB,gGAAgG,kFAAkF,4BAA4B,OAAO,iCAAiC,iHAAiH,SAAS,4FAA4F,yCAAyC,KAAK,MAAM,gEAAgE,4BAA4B,OAAO,0CAA0C,SAAS,4FAA4F,gEAAgE,sBAAsB,8EAA8E,SAAS,gBAAgB,WAAW,mFAAmF,kJAAkJ,GAAG,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,yBAAyB,0BAA0B,2BAA2B,cAAc,yVAAyV,mBAAmB,8EAA8E,oFAAoF,0FAA0F,gGAAgG,kGAAkG,kFAAkF,0FAA0F,gCAAgC,8DAA8D,+JAA+J,gcAAgc,OAAO,wIAAwI,8DAA8D,sDAAsD,WAAW,8BAA8B,4CAA4C,qBAAqB,MAAM,yBAAyB,4CAA4C,kBAAkB,MAAM,wBAAwB,4CAA4C,iBAAiB,MAAM,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,iBAAiB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,0BAA0B,0BAA0B,WAAW,QAAQ,gBAAgB,8EAA8E,mBAAmB,aAAa,+DAA+D,8CAA8C,yIAAyI,gDAAgD,4DAA4D,8EAA8E,EAAE,mCAAmC,mEAAmE,mCAAmC,uBAAuB,wCAAwC,iDAAiD,6BAA6B,WAAW,6BAA6B,SAAS,SAAS,6BAA6B,2FAA2F,SAAS,mFAAmF,+EAA+E,uFAAuF,aAAa,KAAK,WAAW,KAAK,MAAM,KAAK,+FAA+F,GAAG,OAAO,0BAA0B,iBAAiB,EAAE,4BAA4B,mBAAmB,EAAE,+BAA+B,sBAAsB,EAAE,oCAAoC,2BAA2B,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,sBAAsB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,uEAAuE,gBAAgB,8EAA8E,wBAAwB,aAAa,gEAAgE,wGAAwG,oDAAoD,sEAAsE,yTAAyT,8CAA8C,+BAA+B,uXAAuX,+BAA+B,yLAAyL,iFAAiF,2BAA2B,kUAAkU,YAAY,0EAA0E,SAAS,GAAG,GAAG,qDAAqD,8DAA8D,kDAAkD,0KAA0K,6IAA6I,sBAAsB,uCAAuC,oCAAoC,kJAAkJ,OAAO,qDAAqD,GAAG,mDAAmD,WAAW,8GAA8G,2BAA2B,mFAAmF,+DAA+D,GAAG,+CAA+C,sEAAsE,wHAAwH,wMAAwM,sIAAsI,gFAAgF,4BAA4B,6FAA6F,YAAY,sJAAsJ,GAAG,sDAAsD,8DAA8D,mDAAmD,+BAA+B,8OAA8O,wBAAwB,EAAE,cAAc,sBAAsB,uCAAuC,8BAA8B,mJAAmJ,OAAO,+CAA+C,GAAG,oDAAoD,WAAW,gHAAgH,2BAA2B,uFAAuF,yIAAyI,kCAAkC,GAAG,2CAA2C,8HAA8H,OAAO,mCAAmC,iCAAiC,EAAE,kCAAkC,gCAAgC,EAAE,wCAAwC,sCAAsC,EAAE,gCAAgC,uBAAuB,EAAE,uCAAuC,8BAA8B,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,uBAAuB,yBAAyB,gBAAgB,8EAA8E,yBAAyB,cAAc,sJAAsJ,gGAAgG,qFAAqF,6CAA6C,uEAAuE,mBAAmB,8NAA8N,+EAA+E,ySAAyS,yHAAyH,oEAAoE,GAAG,olBAAolB,+CAA+C,uEAAuE,mBAAmB,8JAA8J,+EAA+E,yOAAyO,iIAAiI,4EAA4E,GAAG,oQAAoQ,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,yBAAyB,WAAW,gBAAgB,8EAA8E,gBAAgB,4FAA4F,uDAAuD,4BAA4B,aAAa,+DAA+D,2EAA2E,yFAAyF,gCAAgC,0GAA0G,uBAAuB,2HAA2H,0CAA0C,aAAa,mDAAmD,sEAAsE,QAAQ,QAAQ,iBAAiB,aAAa,sCAAsC,SAAS,uBAAuB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,wCAAwC,0BAA0B,WAAW,QAAQ,gBAAgB,8EAA8E,gBAAgB,4FAA4F,uDAAuD,0BAA0B,aAAa,+DAA+D,8JAA8J,UAAU,wCAAwC,oKAAoK,sDAAsD,+CAA+C,kJAAkJ,uBAAuB,2HAA2H,0CAA0C,aAAa,mDAAmD,sEAAsE,+CAA+C,kEAAkE,0WAA0W,EAAE,mCAAmC,yEAAyE,OAAO,6BAA6B,oBAAoB,EAAE,iCAAiC,wBAAwB,EAAE,iCAAiC,wBAAwB,EAAE,oCAAoC,2BAA2B,EAAE,qCAAqC,4BAA4B,EAAE,sCAAsC,6BAA6B,EAAE,qCAAqC,4BAA4B,EAAE,qCAAqC,4BAA4B,EAAE,6BAA6B,oBAAoB,EAAE,wCAAwC,+BAA+B,EAAE,oCAAoC,2BAA2B,KAAK,UAAU,iBAAiB,aAAa,sCAAsC,SAAS,yBAAyB,qFAAqF,qEAAqE,aAAa,iEAAiE,uEAAuE,GAAG,aAAa,iEAAiE,6CAA6C,GAAG,oBAAoB,iBAAiB,aAAa,sCAAsC,SAAS,gBAAgB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,UAAU,kBAAkB,cAAc,oIAAoI,iBAAiB,8EAA8E,oKAAoK,gDAAgD,2DAA2D,oNAAoN,EAAE,mCAAmC,kEAAkE,OAAO,kCAAkC,oBAAoB,+BAA+B,0BAA0B,mBAAmB,kBAAkB,4BAA4B,+BAA+B,sBAAsB,EAAE,+BAA+B,sBAAsB,2BAA2B,EAAE,8BAA8B,mCAAmC,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,6BAA6B,mBAAmB,gBAAgB,8EAA8E,+BAA+B,aAAa,+DAA+D,2NAA2N,6GAA6G,sCAAsC,0CAA0C,mBAAmB,2FAA2F,kDAAkD,sHAAsH,+IAA+I,UAAU,wGAAwG,0EAA0E,iCAAiC,qJAAqJ,kDAAkD,wCAAwC,qDAAqD,2CAA2C,iDAAiD,uCAAuC,oDAAoD,0CAA0C,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,iBAAiB,WAAW,mBAAmB,cAAc,iBAAiB,8EAA8E,yCAAyC,4CAA4C,wBAAwB,yCAAyC,6CAA6C,aAAa,GAAG,kCAAkC,gCAAgC,iDAAiD,YAAY,yBAAyB,KAAK,MAAM,2CAA2C,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,0BAA0B,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,yBAAyB,gBAAgB,8EAA8E,4BAA4B,cAAc,iKAAiK,4HAA4H,8PAA8P,yGAAyG,OAAO,+BAA+B,0BAA0B,oBAAoB,cAAc,sBAAsB,6EAA6E,GAAG,sBAAsB,kEAAkE,IAAI,wCAAwC,6BAA6B,mXAAmX,MAAM,wEAAwE,0EAA0E,+HAA+H,+BAA+B,GAAG,wFAAwF,sBAAsB,kFAAkF,IAAI,gCAAgC,WAAW,sNAAsN,gFAAgF,OAAO,+BAA+B,0BAA0B,oBAAoB,cAAc,sBAAsB,wEAAwE,GAAG,OAAO,oCAAoC,WAAW,yDAAyD,SAAS,2LAA2L,qKAAqK,4TAA4T,0IAA0I,uEAAuE,sBAAsB,yFAAyF,kFAAkF,GAAG,OAAO,iCAAiC,mCAAmC,EAAE,wCAAwC,0CAA0C,EAAE,kCAAkC,iCAAiC,EAAE,6CAA6C,4CAA4C,EAAE,gDAAgD,+CAA+C,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,8BAA8B,WAAW,gBAAgB,8EAA8E,gCAAgC,oBAAoB,iEAAiE,mGAAmG,uCAAuC,6PAA6P,qCAAqC,WAAW,gCAAgC,2BAA2B,IAAI,+IAA+I,GAAG,oCAAoC,4ZAA4Z,iCAAiC,WAAW,4BAA4B,0EAA0E,mBAAmB,uFAAuF,sDAAsD,+BAA+B,kIAAkI,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,iCAAiC,yBAAyB,gBAAgB,8EAA8E,uCAAuC,mCAAmC,cAAc,gKAAgK,yHAAyH,wFAAwF,0CAA0C,mFAAmF,2GAA2G,sHAAsH,uEAAuE,MAAM,yDAAyD,wDAAwD,4BAA4B,uHAAuH,GAAG,2CAA2C,WAAW,kCAAkC,gCAAgC,qCAAqC,iJAAiJ,sBAAsB,gFAAgF,yCAAyC,iNAAiN,GAAG,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,8BAA8B,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,UAAU,gCAAgC,cAAc,WAAW,iBAAiB,8EAA8E,kDAAkD,yBAAyB,yNAAyN,0DAA0D,qIAAqI,2BAA2B,GAAG,oCAAoC,aAAa,8DAA8D,6DAA6D,6FAA6F,scAAsc,oCAAoC,oBAAoB,8CAA8C,qDAAqD,UAAU,EAAE,yCAAyC,eAAe,oCAAoC,kHAAkH,kCAAkC,0DAA0D,gCAAgC,gBAAgB,mCAAmC,yPAAyP,OAAO,+BAA+B,sBAAsB,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,EAAE,+HAA+H,WAAW,kgBAAkgB,qBAAqB,iBAAiB,aAAa,sCAAsC,SAAS,EAAE,0BAA0B,aAAa,iBAAiB,8EAA8E,SAAS,6CAA6C,yCAAyC,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,6BAA6B,8EAA8E,gBAAgB,aAAa,oGAAoG,8CAA8C,gBAAgB,8EAA8E,iEAAiE,+BAA+B,cAAc,qSAAqS,2HAA2H,kKAAkK,0DAA0D,WAAW,gHAAgH,yHAAyH,yHAAyH,mFAAmF,GAAG,GAAG,GAAG,qDAAqD,4YAA4Y,kDAAkD,uJAAuJ,uJAAuJ,uJAAuJ,6BAA6B,+PAA+P,0CAA0C,6BAA6B,+PAA+P,0CAA0C,u6BAAu6B,4CAA4C,WAAW,sBAAsB,qVAAqV,udAAud,GAAG,uEAAuE,kGAAkG,0BAA0B,0CAA0C,sBAAsB,IAAI,gBAAgB,WAAW,0BAA0B,YAAY,WAAW,KAAK,WAAW,+LAA+L,SAAS,iDAAiD,2EAA2E,sBAAsB,IAAI,oEAAoE,YAAY,8KAA8K,6CAA6C,0dAA0d,0CAA0C,cAAc,2HAA2H,qJAAqJ,yBAAyB,qPAAqP,GAAG,wDAAwD,WAAW,2DAA2D,0CAA0C,4FAA4F,oFAAoF,+EAA+E,0VAA0V,GAAG,GAAG,GAAG,4DAA4D,WAAW,oDAAoD,iCAAiC,GAAG,gDAAgD,WAAW,gEAAgE,mBAAmB,yJAAyJ,yEAAyE,aAAa,6BAA6B,iBAAiB,MAAM,KAAK,wQAAwQ,OAAO,0BAA0B,GAAG,+DAA+D,WAAW,sDAAsD,8FAA8F,GAAG,8CAA8C,WAAW,uIAAuI,0CAA0C,kPAAkP,qIAAqI,+LAA+L,0CAA0C,uEAAuE,oGAAoG,kQAAkQ,GAAG,GAAG,yIAAyI,0CAA0C,WAAW,8BAA8B,kCAAkC,KAAK,sGAAsG,OAAO,kHAAkH,iBAAiB,+FAA+F,gDAAgD,yKAAyK,+JAA+J,kIAAkI,0CAA0C,gKAAgK,mBAAmB,sJAAsJ,oBAAoB,0IAA0I,+KAA+K,4DAA4D,wJAAwJ,gEAAgE,iRAAiR,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,2BAA2B,gCAAgC,gBAAgB,8EAA8E,6BAA6B,cAAc,0NAA0N,oGAAoG,uJAAuJ,2CAA2C,WAAW,uEAAuE,uHAAuH,qEAAqE,GAAG,gHAAgH,6CAA6C,WAAW,IAAI,8CAA8C,kKAAkK,4BAA4B,yCAAyC,6CAA6C,MAAM,2CAA2C,MAAM,4DAA4D,2BAA2B,kIAAkI,wJAAwJ,wEAAwE,aAAa,6BAA6B,iBAAiB,MAAM,KAAK,uQAAuQ,OAAO,8LAA8L,oDAAoD,sEAAsE,kHAAkH,6FAA6F,GAAG,GAAG,GAAG,SAAS,8GAA8G,0CAA0C,WAAW,8BAA8B,kCAAkC,KAAK,oGAAoG,OAAO,gHAAgH,iBAAiB,6FAA6F,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,qFAAqF,YAAY,6MAA6M,iBAAiB,aAAa,aAAa,sCAAsC,SAAS,EAAE,oGAAoG,gBAAgB,aAAa,oGAAoG,IAAI,aAAa,KAAK,qBAAqB,QAAQ,qBAAqB,cAAc,OAAO,qBAAqB,iBAAiB,YAAY,kEAAkE,oCAAoC,qCAAqC,qBAAqB,oBAAoB,mCAAmC,oBAAoB,qBAAqB,mDAAmD,yDAAyD,oBAAoB,0CAA0C,2BAA2B,qBAAqB,sDAAsD,wBAAwB,6BAA6B,sBAAsB,wDAAwD,gCAAgC,IAAI,KAAK,8BAA8B,4BAA4B,aAAa,IAAI,yBAAyB,6BAA6B,oBAAoB,iCAAiC,oDAAoD,oBAAoB,yBAAyB,qCAAqC,sBAAsB,iBAAiB,IAAI,qCAAqC,wBAAwB,YAAY,UAAU,wBAAwB,wCAAwC,IAAI,KAAK,8BAA8B,yDAAyD,kBAAkB,qBAAqB,4BAA4B,IAAI,oDAAoD,0BAA0B,aAAa,wBAAwB,wCAAwC,IAAI,KAAK,8BAA8B,+BAA+B,kBAAkB,qBAAqB,4BAA4B,IAAI,8CAA8C,wBAAwB,WAAW,wBAAwB,IAAI,kDAAkD,SAAS,yCAAyC,qBAAqB,iDAAiD,sCAAsC,mBAAmB,yCAAyC,uBAAuB,qFAAqF,wBAAwB,yIAAyI,MAAM,YAAY,IAAI,+BAA+B,oBAAoB,cAAc,uBAAuB,oBAAoB,yBAAyB,oCAAoC,kBAAkB,qBAAqB,kCAAkC,yCAAyC,oBAAoB,mCAAmC,sBAAsB,4CAA4C,wBAAwB,6CAA6C,0CAA0C,qBAAqB,kCAAkC,iCAAiC,qBAAqB,0CAA0C,aAAa,IAAI,aAAa,yCAAyC,WAAW,iBAAiB,qBAAqB,wBAAwB,wBAAwB,qBAAqB,sDAAsD,oBAAoB,yCAAyC,IAAI,KAAK,WAAW,6BAA6B,iCAAiC,oBAAoB,0EAA0E,IAAI,sBAAsB,UAAU,EAAE,cAAc,0BAA0B,cAAc,wBAAwB,uCAAuC,eAAe,YAAY,IAAI,kHAAkH,eAAe,qCAAqC,uBAAuB,WAAW,WAAW,kBAAkB,qBAAqB,2BAA2B,gDAAgD,qBAAqB,IAAI,YAAY,yEAAyE,8BAA8B,qBAAqB,2EAA2E,eAAe,gFAAgF,8BAA8B,SAAS,KAAK,EAAE,MAAM,GAAG,IAAI,wBAAwB,KAAK,eAAe,KAAK,QAAQ,KAAK,6DAA6D,SAAS,qBAAqB,sBAAsB,kCAAkC,iCAAiC,uFAAuF,KAAK,KAAK,sBAAsB,KAAK,uBAAuB,gGAAgG,4KAA4K,gHAAgH,0BAA0B,+DAA+D,+IAA+I,oBAAoB,yBAAyB,qCAAqC,EAAE,gEAAgE,kBAAkB,aAAa,mCAAmC,0/DAA0/D,KAAK,aAAa,qBAAqB,sBAAsB,sSAAsS,iCAAiC,+RAA+R,KAAK,KAAK,WAAW,qDAAqD,KAAK,+DAA+D,4MAA4M,gGAAgG,iBAAiB,qCAAqC,uIAAuI,wWAAwW,wUAAwU,0BAA0B,+DAA+D,8JAA8J,oBAAoB,yBAAyB,oCAAoC,cAAc,kEAAkE,cAAc,gFAAgF,sBAAsB,sSAAsS,0BAA0B,+BAA+B,yBAAyB,EAAE,gEAAgE;AACrlgF;AACA;AACA,2EAA2E,cAAc,aAAa,QAAQ,cAAc,wEAAwE,oKAAoK,eAAe,QAAQ,SAAS,cAAc,mBAAmB,QAAQ,6BAA6B,uKAAuK,4BAA4B,cAAc,yBAAyB,QAAQ,aAAa,6CAA6C,SAAS,kBAAkB,6HAA6H,aAAa,mBAAmB,iFAAiF,0BAA0B,OAAO,EAAE,8CAA8C,+FAA+F,SAAS,qEAAqE,KAAK,OAAO,EAAE,yBAAyB,2CAA2C,SAAS,+CAA+C,0BAA0B,OAAO,EAAE,8CAA8C,sEAAsE,SAAS,oEAAoE,wEAAwE,oBAAoB,4BAA4B,KAAK,aAAa,6BAA6B,KAAK,aAAa,6BAA6B,KAAK,aAAa,cAAc,uDAAuD,gBAAgB,yBAAyB,oBAAoB,cAAc,UAAU,sBAAsB,cAAc,UAAU,oIAAoI,cAAc,SAAS,cAAc,gHAAgH,gBAAgB,WAAW,gBAAgB,WAAW,gBAAgB,WAAW,gBAAgB,YAAY,cAAc,iBAAiB,QAAQ,4HAA4H,cAAc,YAAY,KAAK,YAAY,SAAS,cAAc,cAAc,SAAS,cAAc,0FAA0F,kCAAkC,qDAAqD,kCAAkC,SAAS,kCAAkC,0BAA0B,qCAAqC,iCAAiC,mCAAmC,6BAA6B,mCAAmC,UAAU,iHAAiH,kCAAkC,UAAU,oCAAoC,kCAAkC,KAAK,cAAc,YAAY,YAAY,WAAW,KAAK,kFAAkF,mDAAmD,WAAW,qBAAqB,4EAA4E,qCAAqC,iCAAiC,oCAAoC,6BAA6B,mCAAmC,mBAAmB,KAAK,iBAAiB,sBAAsB,oCAAoC,uEAAuE,yCAAyC,MAAM,aAAa,iBAAiB,mBAAmB,iBAAiB,kBAAkB,KAAK,wCAAwC,IAAI,kBAAkB,4BAA4B,OAAO,EAAE,2BAA2B,+LAA+L,oHAAoH,iCAAiC,yBAAyB,4BAA4B,UAAU,wCAAwC,MAAM,eAAe,KAAK,mBAAmB,UAAU,KAAK,WAAW,wBAAwB,wCAAwC,YAAY,SAAS,mBAAmB,oCAAoC,uCAAuC,qFAAqF,eAAe,KAAK,2CAA2C,UAAU,KAAK,WAAW,2CAA2C,uCAAuC,WAAW,4BAA4B,mBAAmB,KAAK,uCAAuC,gBAAgB,cAAc,SAAS,+CAA+C,4DAA4D,oCAAoC,uCAAuC,IAAI,8CAA8C,eAAe,WAAW,SAAS,yCAAyC,UAAU,KAAK,cAAc,MAAM,sCAAsC,OAAO,mEAAmE,yCAAyC,iCAAiC,cAAc,OAAO,QAAQ,QAAQ,MAAM,oCAAoC,+CAA+C,qCAAqC,iCAAiC,OAAO,QAAQ,QAAQ,QAAQ,KAAK,6BAA6B,oFAAoF,0DAA0D,yCAAyC,cAAc,cAAc,iBAAiB,sEAAsE,iBAAiB,+CAA+C,gEAAgE,mBAAmB,SAAS,mHAAmH,oGAAoG,MAAM,YAAY,KAAK,OAAO,EAAE,wDAAwD,iEAAiE,SAAS,cAAc,kHAAkH,oCAAoC,qBAAqB,cAAc,qBAAqB,UAAU,+HAA+H,kCAAkC,sCAAsC,kCAAkC,kCAAkC,2CAA2C,gBAAgB,OAAO,2CAA2C,KAAK,QAAQ,QAAQ,mBAAmB,qCAAqC,gDAAgD,MAAM,aAAa,iBAAiB,iBAAiB,kBAAkB,KAAK,+BAA+B,IAAI,0DAA0D,yDAAyD,KAAK,oIAAoI,eAAe,kCAAkC,UAAU,8BAA8B,+BAA+B,mCAAmC,sCAAsC,iBAAiB,iBAAiB,aAAa,qCAAqC,KAAK,OAAO,iCAAiC,SAAS,qCAAqC,uEAAuE,gCAAgC,UAAU,qFAAqF,wCAAwC,MAAM,2DAA2D,wGAAwG,kBAAkB,oCAAoC,cAAc,oCAAoC,8CAA8C,kCAAkC,UAAU,oCAAoC,mCAAmC,SAAS,mCAAmC,sLAAsL,uBAAuB,4BAA4B,uBAAuB,uBAAuB,mBAAmB,sCAAsC,iCAAiC,oCAAoC,8BAA8B;AAC/6S;AACA;AACA,cAAc,mCAAmC,qCAAqC,gDAAgD,oCAAoC,yDAAyD,gEAAgE,yBAAyB,aAAa,8DAA8D,kCAAkC,wCAAwC,gCAAgC,6DAA6D,WAAW,KAAK,aAAa,kHAAkH,qFAAqF,2CAA2C,6CAA6C,iIAAiI,yBAAyB,gFAAgF,KAAK,sBAAsB,mFAAmF,0CAA0C,+BAA+B,QAAQ,IAAI,yBAAyB,eAAe,sBAAsB,SAAS,sBAAsB,WAAW,KAAK,yBAAyB,MAAM,mBAAmB,QAAQ,4BAA4B,wCAAwC,yBAAyB,+BAA+B,oCAAoC,uCAAuC,IAAI,8CAA8C,eAAe,WAAW,SAAS,yCAAyC,UAAU,KAAK,cAAc,MAAM,sCAAsC,OAAO,mEAAmE,sCAAsC,kEAAkE,yCAAyC,SAAS,KAAK,UAAU,kBAAkB,eAAe,iBAAiB,6DAA6D,gDAAgD,+BAA+B,gBAAgB,IAAI,UAAU,iBAAiB,IAAI,6CAA6C,sBAAsB,IAAI,8BAA8B,UAAU,gDAAgD,IAAI,uBAAuB,UAAU,OAAO,QAAQ,2BAA2B,MAAM,qDAAqD,2BAA2B,mCAAmC,iBAAiB,iCAAiC,gCAAgC,wBAAwB,KAAK,sBAAsB,SAAS,wCAAwC,iDAAiD,iBAAiB,sBAAsB,oCAAoC,kBAAkB,IAAI,KAAK,mDAAmD,uBAAuB,6CAA6C,YAAY,yBAAyB,yDAAyD,+BAA+B,SAAS;AACjuG;AACA;AACA,cAAc,UAAU,wBAAwB,oCAAoC,aAAa,oCAAoC,sBAAsB,KAAK,4BAA4B,sBAAsB,mDAAmD,qCAAqC,wCAAwC,sCAAsC,wCAAwC,kCAAkC,wDAAwD,uCAAuC,yBAAyB,YAAY,gCAAgC,2FAA2F,KAAK,iMAAiM,SAAS,mCAAmC,4BAA4B,gCAAgC,kCAAkC,gCAAgC,kCAAkC,gCAAgC,UAAU,+BAA+B,+BAA+B,UAAU,+BAA+B,gCAAgC,UAAU,+BAA+B,mCAAmC,UAAU,+BAA+B,+BAA+B,kBAAkB,SAAS,0BAA0B,gCAAgC,sCAAsC,UAAU,oDAAoD,uCAAuC,UAAU,oDAAoD,2CAA2C,YAAY,SAAS,8CAA8C,kCAAkC,oCAAoC,iCAAiC,SAAS,oBAAoB,SAAS,oCAAoC,4BAA4B,qDAAqD,mCAAmC,2BAA2B,qCAAqC,2BAA2B,oCAAoC,2BAA2B,gCAAgC,UAAU,yBAAyB,qCAAqC,UAAU,yBAAyB,qCAAqC,UAAU,8BAA8B,mCAAmC,UAAU,iCAAiC,sCAAsC,UAAU,iCAAiC,+CAA+C,gBAAgB,2CAA2C,qCAAqC,+BAA+B,iBAAiB,8EAA8E,qCAAqC,6BAA6B,UAAU,oBAAoB,KAAK,sCAAsC,2BAA2B,gBAAgB,KAAK,EAAE,oFAAoF,SAAS,WAAW,oDAAoD,KAAK,KAAK,IAAI,gCAAgC,iDAAiD,KAAK,qBAAqB,mDAAmD,mBAAmB,uCAAuC,iBAAiB,iDAAiD,+DAA+D,cAAc,EAAE,KAAK,WAAW,qIAAqI,KAAK,WAAW,qIAAqI,0GAA0G,0HAA0H,gCAAgC,yBAAyB,gCAAgC,uEAAuE,qBAAqB,QAAQ,QAAQ,gDAAgD,gBAAgB,sDAAsD,aAAa,uKAAuK,8BAA8B,4CAA4C,mBAAmB,kCAAkC,QAAQ,YAAY,4BAA4B,SAAS,uBAAuB,QAAQ,YAAY,EAAE,sBAAsB,kBAAkB,YAAY,kBAAkB,IAAI,0BAA0B,wBAAwB,kCAAkC,UAAU,0BAA0B,kCAAkC,UAAU,QAAQ,MAAM,gBAAgB,YAAY,MAAM,gFAAgF,kBAAkB,iCAAiC,MAAM,0JAA0J;AAC11K;AACA,iBAAiB,eAAe,8FAA8F,uBAAuB,aAAa,OAAO,2EAA2E,4BAA4B,uBAAuB,0BAA0B,gCAAgC,MAAM,qBAAqB,iDAAiD,2BAA2B,SAAS,aAAa,qCAAqC,KAAK,OAAO,oEAAoE,UAAU,cAAc,aAAa,0BAA0B,cAAc,kBAAkB,aAAa,cAAc,KAAK,iBAAiB;AACnuB;AACA;AACA,iBAAiB,kBAAkB,mBAAmB,iBAAiB,WAAW,iHAAiH,SAAS,cAAc;AAC1N;AACA;AACA,iBAAiB,kBAAkB,qBAAqB,qEAAqE,mBAAmB,0GAA0G,sCAAsC,MAAM,QAAQ,WAAW,cAAc,sCAAsC,kCAAkC,yCAAyC,2EAA2E,KAAK,6EAA6E,uCAAuC,qCAAqC,sBAAsB,iDAAiD,iCAAiC,UAAU,EAAE,wBAAwB,qHAAqH,SAAS,6BAA6B,IAAI,EAAE,WAAW,QAAQ,gBAAgB,YAAY,kCAAkC,4BAA4B,uBAAuB,uBAAuB,uBAAuB,qBAAqB,+BAA+B,6CAA6C,0BAA0B,sDAAsD,sGAAsG,8BAA8B,mDAAmD,WAAW,QAAQ,mBAAmB,aAAa,mCAAmC,sBAAsB,4BAA4B,QAAQ,WAAW,0CAA0C,6BAA6B,QAAQ,WAAW,iCAAiC,0BAA0B,gCAAgC,uBAAuB,uBAAuB,uBAAuB,qBAAqB,+BAA+B,4DAA4D,uDAAuD,yCAAyC,cAAc,mCAAmC,kDAAkD,iCAAiC,+DAA+D,sCAAsC,oEAAoE,sCAAsC,oEAAoE,mCAAmC,kDAAkD,oCAAoC,uFAAuF,iCAAiC,2JAA2J,iCAAiC,2JAA2J,oCAAoC,6TAA6T,uCAAuC,gGAAgG,mCAAmC,wDAAwD,iCAAiC,8BAA8B,8BAA8B,gNAAgN,kFAAkF,6bAA6b,sFAAsF,kCAAkC,iCAAiC,qEAAqE,+KAA+K,yDAAyD,gTAAgT,sFAAsF,sCAAsC,iCAAiC,iDAAiD,8JAA8J,sBAAsB,IAAI,KAAK,YAAY,mBAAmB,qCAAqC,sBAAsB,IAAI,KAAK,YAAY,mBAAmB,kCAAkC,SAAS,6CAA6C,MAAM,8DAA8D,iDAAiD,KAAK,6FAA6F,SAAS,iCAAiC,cAAc,iCAAiC,cAAc,iCAAiC,cAAc,oCAAoC,2EAA2E,wCAAwC,qBAAqB,4CAA4C,wBAAwB,4CAA4C,mCAAmC,4BAA4B,0BAA0B,4EAA4E,sFAAsF,qBAAqB;AAC/pN;AACA;AACA,sCAAsC,yDAAyD,qCAAqC,sBAAsB,8BAA8B,oCAAoC,UAAU,WAAW,cAAc,SAAS,qEAAqE,mFAAmF,6BAA6B,KAAK,yDAAyD,0BAA0B,0BAA0B,yDAAyD,gCAAgC,cAAc,qFAAqF,yDAAyD,gCAAgC,8BAA8B,8BAA8B,sFAAsF,0JAA0J,8BAA8B,iCAAiC,iCAAiC,qEAAqE,+PAA+P,8BAA8B,qCAAqC,iCAAiC,iDAAiD,0DAA0D,sBAAsB,IAAI,KAAK,YAAY,mBAAmB,uCAAuC,SAAS,mCAAmC,4OAA4O,mBAAmB,kCAAkC,8FAA8F,kCAAkC,wBAAwB,8DAA8D,8DAA8D,wGAAwG,wGAAwG,mEAAmE,yFAAyF;AACrxF;AACA;AACA,kBAAkB,yCAAyC,GAAG,8IAA8I,EAAE,6CAA6C,EAAE,YAAY,8DAA8D,kBAAkB,kDAAkD,6CAA6C,qBAAqB,iCAAiC,EAAE,UAAU,0BAA0B,+BAA+B,IAAI,KAAK,MAAM,+BAA+B,0CAA0C,MAAM,2FAA2F,0BAA0B,OAAO,MAAM,WAAW,gBAAgB,MAAM,qDAAqD,MAAM,kBAAkB,MAAM,2CAA2C,MAAM,6CAA6C,MAAM,2CAA2C,MAAM,2CAA2C,WAAW,MAAM,oBAAoB,MAAM,gCAAgC,OAAO,iCAAiC,MAAM,kBAAkB,WAAW,gDAAgD,WAAW,sCAAsC,aAAa,wCAAwC,wBAAwB,OAAO,gBAAgB,qBAAqB,EAAE,KAAK,KAAK,UAAU,GAAG,8BAA8B,wCAAwC,kCAAkC,kCAAkC,qBAAqB,kCAAkC,gDAAgD,qBAAqB,0EAA0E,KAAK,yBAAyB,sCAAsC,iBAAiB,IAAI,WAAW,8DAA8D,SAAS,wCAAwC,eAAe,4BAA4B,2YAA2Y,sCAAsC,qBAAqB,kEAAkE,WAAW,2LAA2L,gCAAgC,+BAA+B,kCAAkC,kCAAkC,gCAAgC,+BAA+B,gCAAgC,mCAAmC,kCAAkC,kCAAkC,kCAAkC,kCAAkC,mCAAmC,mCAAmC,kCAAkC,kCAAkC,gCAAgC,aAAa,wBAAwB,WAAW,KAAK,cAAc,UAAU,cAAc,QAAQ,EAAE,aAAa,oBAAoB,WAAW,KAAK,UAAU,UAAU,cAAc,QAAQ,EAAE,aAAa,WAAW,sEAAsE,cAAc,cAAc,6BAA6B,EAAE,iBAAiB,gCAAgC,0CAA0C,0CAA0C,iFAAiF,WAAW,MAAM,oEAAoE,4EAA4E,SAAS,0CAA0C,oBAAoB,qBAAqB,gCAAgC,iBAAiB,kDAAkD,YAAY,iBAAiB,IAAI,WAAW,MAAM,QAAQ,aAAa,MAAM,oBAAoB,6CAA6C,UAAU,yDAAyD,2DAA2D,sBAAsB,YAAY,WAAW,eAAe,SAAS,gCAAgC,uDAAuD,mFAAmF,oGAAoG,wCAAwC,2CAA2C,iBAAiB,6EAA6E,6BAA6B,+BAA+B,gLAAgL,6BAA6B,oCAAoC,kCAAkC,SAAS,6BAA6B,cAAc,4DAA4D,uCAAuC,4DAA4D,0BAA0B,cAAc,4BAA4B,4EAA4E,+BAA+B,wDAAwD,kCAAkC,eAAe,kIAAkI,sFAAsF,0DAA0D,gCAAgC,4CAA4C,mBAAmB,iCAAiC,0EAA0E,4BAA4B,+IAA+I,WAAW,0BAA0B,SAAS,qBAAqB,mCAAmC,aAAa,gCAAgC,yDAAyD,2BAA2B,cAAc,4BAA4B,yDAAyD,2CAA2C,0CAA0C,kBAAkB,kCAAkC,gBAAgB,0FAA0F,4DAA4D,sCAAsC,mDAAmD,mCAAmC,yDAAyD,iFAAiF,qFAAqF,mGAAmG,0EAA0E,mGAAmG,4FAA4F,+BAA+B,0BAA0B,wBAAwB,8BAA8B,UAAU,kCAAkC,eAAe,wLAAwL,4EAA4E,+BAA+B,wCAAwC,6BAA6B,oHAAoH,4CAA4C,6CAA6C,4DAA4D,YAAY,8CAA8C,oCAAoC,yCAAyC,YAAY,YAAY,KAAK,WAAW,SAAS,QAAQ,aAAa,MAAM,iDAAiD,4BAA4B,kDAAkD,oCAAoC,iBAAiB,WAAW,0BAA0B,0BAA0B,gCAAgC,2BAA2B,IAAI,YAAY,SAAS,kCAAkC,eAAe,wQAAwQ,gFAAgF,+BAA+B,wCAAwC,wBAAwB,wEAAwE,iFAAiF,gFAAgF,gFAAgF,wGAAwG,wDAAwD,oCAAoC,oBAAoB,oBAAoB,qBAAqB,gCAAgC,iBAAiB,qDAAqD,YAAY,iBAAiB,IAAI,WAAW,MAAM,QAAQ,aAAa,MAAM,oBAAoB,6CAA6C,UAAU,IAAI,qCAAqC,iEAAiE,sBAAsB,YAAY,WAAW,eAAe,SAAS,SAAS,aAAa,IAAI,uDAAuD,wDAAwD,+BAA+B,mCAAmC,uEAAuE,0BAA0B,oCAAoC,0EAA0E,kCAAkC,eAAe,6BAA6B,iLAAiL,gCAAgC,sFAAsF,sGAAsG,4FAA4F,+BAA+B,0BAA0B,wBAAwB,8BAA8B,UAAU,kCAAkC,eAAe,uIAAuI,gFAAgF,uEAAuE,0FAA0F,0EAA0E,+FAA+F,4EAA4E,+FAA+F,0EAA0E,yFAAyF,sEAAsE,yFAAyF,sEAAsE,yFAAyF,sEAAsE,mFAAmF,+FAA+F,yGAAyG,kCAAkC,oIAAoI,uFAAuF,GAAG,wGAAwG,uFAAuF,0HAA0H,yHAAyH,kCAAkC,oJAAoJ,uFAAuF,GAAG,4IAA4I,wFAAwF,sGAAsG,iBAAiB,wBAAwB,KAAK,qCAAqC,0BAA0B,kFAAkF,kHAAkH,wBAAwB,wBAAwB,KAAK,wBAAwB,0BAA0B,6DAA6D,oEAAoE,sFAAsF,0DAA0D,cAAc,mGAAmG,6OAA6O,kCAAkC,eAAe,6BAA6B,+aAA+a,6BAA6B,gDAAgD,iCAAiC,eAAe,wBAAwB,WAAW,yBAAyB,SAAS,eAAe,iBAAiB,WAAW,iCAAiC,SAAS,eAAe,iBAAiB,WAAW,KAAK,wBAAwB,4BAA4B,SAAS,eAAe,iBAAiB,eAAe,2EAA2E,eAAe,iGAAiG,eAAe,yCAAyC,eAAe,gBAAgB,eAAe,iBAAiB,eAAe,iCAAiC,eAAe,iBAAiB,aAAa,wDAAwD,SAAS,eAAe,iBAAiB,WAAW,oDAAoD,SAAS,eAAe,YAAY,eAAe,wBAAwB,GAAG,cAAc,+BAA+B,eAAe,6CAA6C,iBAAiB,sEAAsE,iBAAiB,iEAAiE,4NAA4N,eAAe,0BAA0B,mBAAmB,EAAE,IAAI,EAAE,uTAAuT,mCAAmC,eAAe,oBAAoB,eAAe,0BAA0B,eAAe,gCAAgC,eAAe,+BAA+B,uCAAuC,8CAA8C,eAAe,2DAA2D,uBAAuB,YAAY,IAAI,iCAAiC,kBAAkB,eAAe,0BAA0B,GAAG,wCAAwC,uCAAuC,IAAI,QAAQ,IAAI,qDAAqD,2CAA2C,GAAG,IAAI,iCAAiC,SAAS,QAAQ,WAAW,mCAAmC,wCAAwC,eAAe,4BAA4B,uCAAuC,GAAG,YAAY,2CAA2C,IAAI,+HAA+H,SAAS,SAAS,eAAe,kBAAkB,EAAE,uBAAuB,4DAA4D,4CAA4C,QAAQ,eAAe,iEAAiE,2BAA2B,eAAe,uEAAuE,YAAY,eAAe,yCAAyC,WAAW,uDAAuD,SAAS,eAAe,yEAAyE,eAAe,sDAAsD,0BAA0B,iCAAiC,gCAAgC,gCAAgC,uBAAuB,uBAAuB,gCAAgC,2BAA2B,MAAM,iGAAiG,0BAA0B,uBAAuB,uBAAuB,uBAAuB,yCAAyC,uBAAuB,yBAAyB,+CAA+C,6BAA6B,+CAA+C,oCAAoC,0CAA0C,8BAA8B,oBAAoB,0EAA0E,YAAY,KAAK,EAAE,wBAAwB,wCAAwC,SAAS,mCAAmC,8BAA8B,mCAAmC,aAAa,iIAAiI,qCAAqC,aAAa,yDAAyD,iCAAiC,gBAAgB,WAAW,KAAK,uBAAuB,6HAA6H,uBAAuB,SAAS,mCAAmC,mCAAmC,4CAA4C,qCAAqC,qCAAqC,+BAA+B,mCAAmC,aAAa,kGAAkG,qCAAqC,aAAa,4GAA4G,2BAA2B,gBAAgB,IAAI,oBAAoB,6BAA6B,mBAAmB,2CAA2C,IAAI,oBAAoB,2CAA2C,gEAAgE,4DAA4D,SAAS,UAAU,IAAI,SAAS,UAAU,2BAA2B,kBAAkB,IAAI,0CAA0C,sBAAsB,IAAI,0CAA0C,wDAAwD,+BAA+B,aAAa,yCAAyC,cAAc,QAAQ,WAAW,sHAAsH,kBAAkB,2CAA2C,SAAS,aAAa,eAAe,SAAS,UAAU,+BAA+B,kBAAkB,IAAI,uBAAuB,iBAAiB,mCAAmC,gBAAgB,SAAS,UAAU,8BAA8B,kBAAkB,IAAI,wBAAwB,SAAS,UAAU,4BAA4B,sBAAsB,yDAAyD,uCAAuC,wDAAwD,+BAA+B,aAAa,yCAAyC,cAAc,QAAQ,WAAW,oHAAoH,kBAAkB,2CAA2C,2BAA2B,+CAA+C,uDAAuD,sBAAsB,+FAA+F,gBAAgB,oBAAoB,uCAAuC,2BAA2B,yFAAyF,kDAAkD,YAAY,aAAa,6BAA6B,oCAAoC,oCAAoC,kCAAkC,YAAY,SAAS,mBAAmB,kCAAkC,0BAA0B,oCAAoC,6BAA6B,YAAY,qGAAqG,gFAAgF,wDAAwD,oDAAoD,yDAAyD,uDAAuD,mDAAmD,+CAA+C,uDAAuD,sDAAsD,mDAAmD,YAAY,8CAA8C,IAAI,iBAAiB,QAAQ,iGAAiG,uBAAuB,oCAAoC,oBAAoB,YAAY,WAAW,0BAA0B,SAAS,YAAY,YAAY,aAAa,QAAQ,WAAW,0BAA0B,SAAS,gCAAgC,WAAW,cAAc,iCAAiC,WAAW,0BAA0B,SAAS,SAAS,oBAAoB,oBAAoB,0BAA0B,2GAA2G,uCAAuC,+BAA+B,QAAQ,kBAAkB,IAAI,iBAAiB,SAAS,SAAS,kCAAkC,IAAI,iHAAiH,SAAS,UAAU,0BAA0B,SAAS,0BAA0B,oDAAoD,uCAAuC,uCAAuC,SAAS,eAAe,wDAAwD,gFAAgF,8DAA8D,uEAAuE,sBAAsB,+DAA+D,oDAAoD,oFAAoF,4GAA4G,oBAAoB,aAAa,qBAAqB,gGAAgG,sBAAsB,uDAAuD,WAAW,KAAK,0DAA0D,sFAAsF,wBAAwB,cAAc,uDAAuD,6BAA6B,sBAAsB,+BAA+B,wCAAwC,6BAA6B,qDAAqD,+CAA+C,+BAA+B,+CAA+C,iCAAiC,qBAAqB,+BAA+B,qCAAqC,uCAAuC,oDAAoD,kCAAkC,aAAa,qCAAqC,2DAA2D,IAAI,oBAAoB,wCAAwC,8DAA8D,2CAA2C,wDAAwD,wCAAwC,oDAAoD,kCAAkC,iDAAiD,mCAAmC,oCAAoC,EAAE,iBAAiB,EAAE,eAAe,GAAG,cAAc,GAAG,KAAK,yBAAyB,yEAAyE,iBAAiB,qBAAqB,gLAAgL,8BAA8B,8CAA8C,gCAAgC,qBAAqB,uWAAuW,uBAAuB,slCAAslC,iCAAiC,+IAA+I,qCAAqC,uFAAuF,gCAAgC,6CAA6C,uCAAuC,qEAAqE,yDAAyD,IAAI,aAAa,aAAa,+BAA+B,oCAAoC,MAAM,kBAAkB,4BAA4B,oCAAoC,MAAM,eAAe,uBAAuB,iCAAiC,yBAAyB,mCAAmC,4BAA4B,gCAAgC,yBAAyB,mCAAmC,4BAA4B,gCAAgC,wBAAwB,kFAAkF,gCAAgC,oCAAoC,0BAA0B,kBAAkB,sCAAsC,oCAAoC,gCAAgC,kBAAkB,uFAAuF,mBAAmB,yDAAyD,wDAAwD,wDAAwD,gDAAgD,iCAAiC,oFAAoF,uDAAuD,uDAAuD,yDAAyD,yBAAyB,EAAE,mDAAmD,gCAAgC,0DAA0D,qBAAqB,2CAA2C,iBAAiB,oBAAoB,6DAA6D,qCAAqC,qCAAqC,kMAAkM,IAAI,6DAA6D,SAAS,wDAAwD,8BAA8B,kBAAkB,4BAA4B,yBAAyB,kBAAkB,wBAAwB,8CAA8C,+BAA+B,0CAA0C,4BAA4B,wCAAwC,yCAAyC,IAAI,6BAA6B,SAAS,wDAAwD,8BAA8B,kBAAkB,4BAA4B,+BAA+B,kBAAkB,wBAAwB,yBAAyB,kCAAkC,+BAA+B,0CAA0C,4BAA4B,yCAAyC,+BAA+B,0FAA0F,4BAA4B,uFAAuF,wBAAwB,iFAAiF,+BAA+B,0FAA0F,4BAA4B,uFAAuF,mLAAmL,yDAAyD,oEAAoE,mDAAmD,yDAAyD,+DAA+D,uBAAuB,qCAAqC,oEAAoE,2BAA2B,qCAAqC,uIAAuI,uEAAuE,kBAAkB,qFAAqF,IAAI,kDAAkD,yCAAyC,SAAS,4DAA4D,8BAA8B,mBAAmB,4BAA4B,yBAAyB,mBAAmB,yBAAyB,+CAA+C,gCAAgC,2CAA2C,6BAA6B,0CAA0C,+BAA+B,wEAAwE,4BAA4B,qEAAqE,yBAAyB,+DAA+D,gCAAgC,wEAAwE,6BAA6B,qEAAqE,8BAA8B,uBAAuB,QAAQ,8FAA8F,gGAAgG,OAAO,mBAAmB,4FAA4F,QAAQ,6LAA6L,6BAA6B,+NAA+N,iCAAiC,WAAW,gCAAgC,2CAA2C,8JAA8J,4CAA4C,gCAAgC,IAAI,WAAW,WAAW,sCAAsC,yFAAyF,mFAAmF,IAAI,qCAAqC,mBAAmB,EAAE,SAAS,iFAAiF,wBAAwB,WAAW,IAAI,yCAAyC,SAAS,sBAAsB,oDAAoD,KAAK,0CAA0C,mCAAmC,+BAA+B,wBAAwB,4BAA4B,qBAAqB,sBAAsB,uKAAuK,yCAAyC,4JAA4J,uIAAuI,yGAAyG,KAAK,8GAA8G,0DAA0D,kBAAkB,6BAA6B,wCAAwC,0BAA0B,qCAAqC,yBAAyB,uKAAuK,yCAAyC,4JAA4J,mHAAmH,8HAA8H,0HAA0H,oEAAoE,yBAAyB,yEAAyE,+BAA+B,2EAA2E,4BAA4B,wEAAwE,sBAAsB,gEAAgE,6BAA6B,2EAA2E,0BAA0B,wEAAwE,yBAAyB,yEAAyE,yWAAyW,qFAAqF,IAAI,yBAAyB,aAAa,SAAS,iDAAiD,+BAA+B,0CAA0C,gCAAgC,+CAA+C,iCAAiC,gDAAgD,gCAAgC,+CAA+C,4DAA4D,oDAAoD,0CAA0C,iCAAiC,+CAA+C,iCAAiC,gDAAgD,gCAAgC,+CAA+C,4DAA4D,oDAAoD,mDAAmD,oBAAoB,uFAAuF,uBAAuB,uEAAuE,4DAA4D,8BAA8B,kBAAkB,iWAAiW,+BAA+B,8CAA8C,8BAA8B,0HAA0H,gFAAgF,gEAAgE,gCAAgC,sFAAsF,mCAAmC,mCAAmC,kCAAkC,kCAAkC,mCAAmC,qBAAqB,iFAAiF,6BAA6B,2DAA2D,SAAS,6CAA6C,wCAAwC,qBAAqB,2IAA2I,oCAAoC,yRAAyR,yDAAyD,uBAAuB,sCAAsC,sCAAsC,4BAA4B,sFAAsF,GAAG,sFAAsF,8BAA8B,4DAA4D,+BAA+B,yBAAyB,uDAAuD,GAAG,sFAAsF,8BAA8B,4DAA4D,8BAA8B,0CAA0C,0CAA0C,gCAAgC,IAAI,2BAA2B,YAAY,+FAA+F,+BAA+B,SAAS,UAAU,6BAA6B,UAAU,4BAA4B,uBAAuB,YAAY,KAAK,2FAA2F,YAAY,uBAAuB,KAAK,oGAAoG,sCAAsC,iCAAiC,+BAA+B,kCAAkC,wCAAwC,oDAAoD,oDAAoD,oEAAoE,+EAA+E,iCAAiC,yDAAyD,6HAA6H,2BAA2B,MAAM,iEAAiE,gFAAgF,8BAA8B,yFAAyF,8BAA8B,oBAAoB,2DAA2D,kCAAkC,uDAAuD,cAAc,0CAA0C,sBAAsB,OAAO,sGAAsG,qCAAqC,qDAAqD,UAAU,IAAI,0CAA0C,IAAI,wBAAwB,WAAW,SAAS,4DAA4D,6EAA6E,qGAAqG,qCAAqC,iDAAiD,UAAU,IAAI,4DAA4D,IAAI,4BAA4B,WAAW,SAAS,sDAAsD,qFAAqF,qGAAqG,qCAAqC,iDAAiD,QAAQ,IAAI,wDAAwD,SAAS,+CAA+C,mFAAmF,2DAA2D,sCAAsC,iDAAiD,QAAQ,IAAI,8CAA8C,SAAS,0DAA0D,mFAAmF,2DAA2D,wPAAwP,yCAAyC,4CAA4C,OAAO,iCAAiC,gDAAgD,kCAAkC,kGAAkG,aAAa,oEAAoE,kBAAkB,qEAAqE,qEAAqE,OAAO,mBAAmB,gDAAgD,wDAAwD,4NAA4N,0DAA0D,WAAW,gDAAgD,+EAA+E,oDAAoD,8CAA8C,iDAAiD,gCAAgC,6CAA6C,gDAAgD,kCAAkC,SAAS,sBAAsB,SAAS,EAAE,0BAA0B,YAAY,kBAAkB,qCAAqC,wYAAwY,+BAA+B,8CAA8C,yCAAyC,QAAQ,MAAM,cAAc,mBAAmB,2BAA2B,QAAQ,qDAAqD,sCAAsC,+CAA+C,QAAQ,oFAAoF,yFAAyF,YAAY,WAAW,eAAe,qyIAAqyI,kBAAkB,wBAAwB,sBAAsB,uBAAuB,wEAAwE,8BAA8B,qBAAqB,KAAK,EAAE,8BAA8B,qBAAqB,sBAAsB,uBAAuB,oFAAoF,KAAK,kCAAkC,iCAAiC,IAAI,eAAe,kCAAkC,gBAAgB,kCAAkC,gBAAgB,kCAAkC,iBAAiB,uBAAuB,4BAA4B,yBAAyB,4BAA4B,mBAAmB,YAAY,uBAAuB,sBAAsB,yBAAyB,sBAAsB,mBAAmB,iBAAiB,QAAQ,+DAA+D,iCAAiC,kEAAkE,iBAAiB,aAAa,0GAA0G,4BAA4B,iBAAiB,6BAA6B,gCAAgC,SAAS,qBAAqB,6GAA6G,EAAE,0BAA0B,6GAA6G,SAAS,yFAAyF,uBAAuB,qDAAqD,4BAA4B,OAAO,4CAA4C,YAAY,wDAAwD,gBAAgB,mCAAmC,kBAAkB,oCAAoC,qEAAqE,kBAAkB,yDAAyD,SAAS,6GAA6G,sCAAsC,gCAAgC,8BAA8B,4BAA4B,0BAA0B,4BAA4B,wBAAwB,0CAA0C,iGAAiG,GAAG,2DAA2D,wCAAwC,sCAAsC,UAAU,sFAAsF,uBAAuB,gBAAgB,wFAAwF,oFAAoF,gBAAgB,0FAA0F,gBAAgB,4FAA4F,qEAAqE,iEAAiE,gBAAgB,4FAA4F,qFAAqF,gBAAgB,4FAA4F,uBAAuB,gBAAgB,IAAI,4BAA4B,SAAS,mDAAmD,SAAS,0CAA0C,mEAAmE,uBAAuB,EAAE,8BAA8B,wDAAwD,+GAA+G,2CAA2C,4FAA4F,KAAK,EAAE,8BAA8B,6CAA6C,uDAAuD,8CAA8C,yCAAyC,qCAAqC,eAAe,sFAAsF,aAAa,6EAA6E,mFAAmF,gBAAgB,wEAAwE,mFAAmF,qJAAqJ,oCAAoC,8CAA8C,0BAA0B,8CAA8C,8CAA8C,0CAA0C,2CAA2C,uDAAuD,KAAK,mFAAmF,sBAAsB,iCAAiC,yCAAyC,sCAAsC,qCAAqC,iDAAiD,KAAK,6EAA6E,sBAAsB,iCAAiC,uCAAuC,uCAAuC,sEAAsE,aAAa,8DAA8D,yEAAyE,uFAAuF,uBAAuB,mCAAmC,qCAAqC,cAAc,UAAU,qFAAqF,WAAW,+EAA+E,aAAa,uEAAuE,kFAAkF,wGAAwG,kNAAkN,qCAAqC,GAAG,0BAA0B,8FAA8F,uCAAuC,uCAAuC,uCAAuC,+DAA+D,uBAAuB,EAAE,gDAAgD,sBAAsB,EAAE,iGAAiG,uNAAuN,oHAAoH,qHAAqH,0HAA0H,wGAAwG,uOAAuO,iHAAiH,2EAA2E,gBAAgB,YAAY,8FAA8F,8BAA8B,2EAA2E,YAAY,YAAY,8FAA8F,uCAAuC,oDAAoD,mBAAmB,eAAe,yDAAyD,qDAAqD,KAAK,kGAAkG,gCAAgC,SAAS,+DAA+D,wDAAwD,sDAAsD,sKAAsK,sCAAsC,yBAAyB,sCAAsC,yEAAyE,6BAA6B,mCAAmC,yEAAyE,qHAAqH,0FAA0F,wEAAwE,wBAAwB,mCAAmC,iFAAiF,yEAAyE,yCAAyC,iCAAiC,wEAAwE,oGAAoG,sGAAsG,gBAAgB,mCAAmC,4DAA4D,yEAAyE,MAAM,oHAAoH,0FAA0F,0FAA0F,0CAA0C,kCAAkC,aAAa,QAAQ,4DAA4D,mDAAmD,0DAA0D,8BAA8B,YAAY,mCAAmC,QAAQ,uBAAuB,8BAA8B,QAAQ,mHAAmH,QAAQ,iEAAiE,8BAA8B,yCAAyC,iCAAiC,gJAAgJ,cAAc,UAAU,MAAM,MAAM,EAAE,KAAK,YAAY,EAAE,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,EAAE,cAAc,UAAU,MAAM,MAAM,EAAE,QAAQ,iBAAiB,EAAE,cAAc,KAAK,kBAAkB,EAAE,EAAE,cAAc,QAAQ,sBAAsB,EAAE,EAAE,EAAE,cAAc,UAAU,MAAM,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,EAAE,uLAAuL,wIAAwI,qFAAqF,aAAa,iBAAiB,8CAA8C,0DAA0D,wIAAwI,mFAAmF,2BAA2B,4FAA4F,mFAAmF,uBAAuB,2FAA2F,mFAAmF,uBAAuB,4FAA4F,sBAAsB,aAAa,cAAc,MAAM,MAAM,KAAK,mBAAmB,EAAE,MAAM,MAAM,KAAK,oBAAoB,EAAE,MAAM,QAAQ,kBAAkB,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,KAAK,qBAAqB,EAAE,QAAQ,0BAA0B,EAAE,EAAE,EAAE,EAAE,QAAQ,kBAAkB,EAAE,kBAAkB,mBAAmB,4EAA4E,yBAAyB,kDAAkD,KAAK,UAAU,+JAA+J,2DAA2D,2BAA2B,KAAK,MAAM,MAAM,EAAE,MAAM,KAAK,sBAAsB,EAAE,QAAQ,EAAE,EAAE,QAAQ,OAAO,EAAE,kBAAkB,oFAAoF,8DAA8D,SAAS,MAAM,MAAM,EAAE,QAAQ,iBAAiB,EAAE,cAAc,QAAQ,sBAAsB,EAAE,EAAE,uBAAuB,MAAM,MAAM,EAAE,MAAM,KAAK,oBAAoB,EAAE,KAAK,kBAAkB,EAAE,EAAE,QAAQ,OAAO,EAAE,kBAAkB,oFAAoF,8DAA8D,SAAS,WAAW,uBAAuB,MAAM,MAAM,EAAE,MAAM,KAAK,YAAY,EAAE,MAAM,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,EAAE,EAAE,QAAQ,OAAO,EAAE,kBAAkB,oFAAoF,iDAAiD,iCAAiC,kCAAkC,8BAA8B,iCAAiC,wBAAwB,gDAAgD,4BAA4B,wCAAwC,KAAK,kEAAkE,aAAa,yDAAyD,qEAAqE,gBAAgB,yDAAyD,iCAAiC,yBAAyB,cAAc,6DAA6D,2EAA2E,wCAAwC,8BAA8B,SAAS,0QAA0Q,sGAAsG,8CAA8C,+GAA+G,4BAA4B,wEAAwE,6CAA6C,MAAM,+GAA+G,wBAAwB,oDAAoD,4CAA4C,6CAA6C,2BAA2B,kDAAkD,iKAAiK,8CAA8C,sDAAsD,sDAAsD,2DAA2D,6CAA6C,8CAA8C,2DAA2D,6CAA6C,0CAA0C,+DAA+D,IAAI,gLAAgL,SAAS,0DAA0D,mCAAmC,6CAA6C,kBAAkB,yEAAyE,yBAAyB,qHAAqH,4BAA4B,oBAAoB,6CAA6C,SAAS,+DAA+D,sGAAsG,kCAAkC,2BAA2B,8CAA8C,QAAQ,4EAA4E,6BAA6B,iBAAiB,gCAAgC,IAAI,WAAW,WAAW,mBAAmB,iBAAiB,WAAW,iHAAiH,SAAS,eAAe,4CAA4C,kDAAkD,gDAAgD,SAAS,eAAe,+MAA+M,IAAI,mDAAmD,UAAU,eAAe,oDAAoD,2FAA2F,yDAAyD,0BAA0B,wBAAwB,0BAA0B,uDAAuD,qCAAqC,wCAAwC,oCAAoC,gCAAgC,4CAA4C,0BAA0B,0CAA0C,6CAA6C,oCAAoC,0BAA0B,2BAA2B,6CAA6C,8BAA8B,6CAA6C,iCAAiC,4BAA4B,4BAA4B,8CAA8C,+BAA+B,6CAA6C,kCAAkC,6BAA6B,8BAA8B,yCAAyC,0DAA0D,6BAA6B,yCAAyC,0DAA0D,iCAAiC,0DAA0D,iCAAiC,6CAA6C,wCAAwC,6BAA6B,gCAAgC,8BAA8B,yDAAyD,2CAA2C,6BAA6B,0CAA0C,sCAAsC,iCAAiC,kCAAkC,0HAA0H,MAAM,EAAE,4CAA4C,2BAA2B,UAAU,eAAe,wCAAwC,+BAA+B,KAAK,QAAQ,4BAA4B,qEAAqE,8CAA8C,wBAAwB,YAAY,WAAW,KAAK,OAAO,YAAY,KAAK,kFAAkF,sBAAsB,qCAAqC,6BAA6B,wBAAwB,6EAA6E,WAAW,gCAAgC,2CAA2C,2BAA2B,0CAA0C,qBAAqB,kCAAkC,OAAO,4BAA4B,0CAA0C,qCAAqC,oCAAoC,+BAA+B,6BAA6B,yCAAyC,mCAAmC,2BAA2B,kCAAkC,qBAAqB,kCAAkC,OAAO,oBAAoB,4EAA4E,oCAAoC,eAAe,kCAAkC,uBAAuB,qBAAqB,8EAA8E,6DAA6D,0GAA0G,uCAAuC,oDAAoD,WAAW,oDAAoD,mBAAmB,+CAA+C,2BAA2B,8CAA8C,qBAAqB,kCAAkC,OAAO,gCAAgC,mBAAmB,aAAa,cAAc,MAAM,GAAG,iDAAiD,2BAA2B,gDAAgD,qBAAqB,kCAAkC,OAAO,kCAAkC,mBAAmB,qBAAqB,WAAW,KAAK,uBAAuB,qBAAqB,cAAc,YAAY,0CAA0C,iBAAiB,iBAAiB,cAAc,EAAE,SAAS,sCAAsC,2BAA2B,qCAAqC,qBAAqB,kCAAkC,OAAO,gCAAgC,mBAAmB,qBAAqB,WAAW,+BAA+B,SAAS,uCAAuC,qCAAqC,uBAAuB,qCAAqC,mBAAmB,qBAAqB,WAAW,yBAAyB,SAAS,yCAAyC,2BAA2B,wCAAwC,qBAAqB,kCAAkC,OAAO,mCAAmC,4DAA4D,wCAAwC,2BAA2B,uCAAuC,qBAAqB,kCAAkC,OAAO,kCAAkC,4DAA4D,kCAAkC,0BAA0B,WAAW,KAAK,qCAAqC,sBAAsB,SAAS,iCAAiC,qCAAqC,eAAe,SAAS,UAAU,MAAM,UAAU,MAAM,UAAU,SAAS,UAAU,uBAAuB,QAAQ,uCAAuC,8CAA8C,uBAAuB,sDAAsD,WAAW,yOAAyO,SAAS,gDAAgD,2BAA2B,+CAA+C,qBAAqB,kCAAkC,OAAO,0CAA0C,mBAAmB,qBAAqB,WAAW,KAAK,gBAAgB,2CAA2C,SAAS,uCAAuC,YAAY,cAAc,WAAW,KAAK,mCAAmC,qDAAqD,SAAS,2CAA2C,YAAY,cAAc,WAAW,KAAK,mCAAmC,0CAA0C,SAAS,gDAAgD,+CAA+C,uBAAuB,6CAA6C,WAAW,QAAQ,wCAAwC,UAAU,UAAU,SAAS,+BAA+B,6CAA6C,uBAAuB,WAAW,oBAAoB,0BAA0B,WAAW,KAAK,4DAA4D,0FAA0F,SAAS,8CAA8C,2BAA2B,6CAA6C,qBAAqB,kCAAkC,OAAO,wCAAwC,mBAAmB,qBAAqB,WAAW,KAAK,kDAAkD,uCAAuC,OAAO,EAAE,KAAK,+DAA+D,cAAc,WAAW,GAAG,SAAS,8CAA8C,2BAA2B,6CAA6C,qBAAqB,kCAAkC,OAAO,wCAAwC,mBAAmB,qBAAqB,WAAW,KAAK,+CAA+C,gBAAgB,SAAS,uCAAuC,QAAQ,mBAAmB,iBAAiB,sBAAsB,UAAU,WAAW,qBAAqB,WAAW,KAAK,iDAAiD,iBAAiB,SAAS,yCAAyC,QAAQ,mBAAmB,2BAA2B,sBAAsB,YAAY,gCAAgC,sBAAsB,gCAAgC,SAAS,gCAAgC,YAAY,cAAc,WAAW,KAAK,gBAAgB,wDAAwD,SAAS,iCAAiC,SAAS,eAAe,2CAA2C,mCAAmC,oCAAoC,OAAO,qBAAqB,wDAAwD,WAAW,GAAG,yCAAyC,oCAAoC,OAAO,qBAAqB,8EAA8E,yCAAyC,oCAAoC,OAAO,qBAAqB,mBAAmB,aAAa,iBAAiB,sCAAsC,OAAO,uBAAuB,4BAA4B,yCAAyC,2BAA2B,wCAAwC,qBAAqB,kCAAkC,OAAO,0BAA0B,mBAAmB,aAAa,eAAe,yCAAyC,2BAA2B,eAAe,gBAAgB,wDAAwD,SAAS,kCAAkC,wBAAwB,WAAW,uBAAuB,WAAW,iBAAiB,QAAQ,WAAW,KAAK,qCAAqC,qDAAqD,aAAa,yBAAyB,qCAAqC,cAAc,WAAW,qBAAqB,cAAc,qBAAqB,4BAA4B,uBAAuB,8BAA8B,+BAA+B,OAAO,kCAAkC,mCAAmC,0BAA0B,WAAW,mCAAmC,SAAS,yBAAyB,0BAA0B,WAAW,gDAAgD,SAAS,sCAAsC,OAAO,6BAA6B,+EAA+E,2HAA2H,8BAA8B,uBAAuB,8BAA8B,6BAA6B,IAAI,yCAAyC,WAAW,0BAA0B,SAAS,6CAA6C,8BAA8B,mTAAmT,mCAAmC,2EAA2E,0BAA0B,WAAW,KAAK,sCAAsC,mBAAmB,SAAS,8BAA8B,oBAAoB,8EAA8E,8BAA8B,mCAAmC,8BAA8B,uxBAAuxB,OAAO,kBAAkB,4BAA4B,4BAA4B,YAAY,WAAW,mCAAmC,YAAY,wCAAwC,8CAA8C,gDAAgD,WAAW,gFAAgF,WAAW,KAAK,WAAW,wBAAwB,qCAAqC,4CAA4C,gDAAgD,WAAW,mCAAmC,yCAAyC,4CAA4C,gDAAgD,WAAW,2CAA2C,+BAA+B,6BAA6B,qBAAqB,0BAA0B,qBAAqB,0BAA0B,wBAAwB,aAAa,wBAAwB,aAAa,yBAAyB,0BAA0B,+CAA+C,EAAE,UAAU,iBAAiB,2BAA2B,WAAW,KAAK,WAAW,uEAAuE,iBAAiB,KAAK,iBAAiB,6CAA6C,SAAS,iBAAiB,2BAA2B,WAAW,KAAK,WAAW,IAAI,qEAAqE,UAAU,IAAI,qFAAqF,WAAW,SAAS,iBAAiB,2BAA2B,WAAW,KAAK,WAAW,0GAA0G,UAAU,qiBAAqiB,0BAA0B,YAAY,WAAW,KAAK,8CAA8C,kBAAkB,SAAS,iFAAiF,oCAAoC,wBAAwB,+EAA+E,kEAAkE,4FAA4F,sCAAsC,0CAA0C,+CAA+C,KAAK,8EAA8E,2EAA2E,6EAA6E,yEAAyE,0EAA0E,0IAA0I,oHAAoH,gCAAgC,oBAAoB,sCAAsC,IAAI,qCAAqC,gDAAgD,2EAA2E,6DAA6D,sCAAsC,oBAAoB,mCAAmC,QAAQ,6DAA6D,qDAAqD,iFAAiF,oCAAoC,0BAA0B,uBAAuB,oDAAoD,4CAA4C,SAAS,kFAAkF,6CAA6C,QAAQ,UAAU,YAAY,wEAAwE,QAAQ,WAAW,0CAA0C,uBAAuB,iBAAiB,IAAI,4BAA4B,gFAAgF,mCAAmC,2DAA2D,oCAAoC,4BAA4B,oCAAoC,4BAA4B,iCAAiC,wBAAwB,WAAW,2BAA2B,sCAAsC,IAAI,kDAAkD,sDAAsD,eAAe,6CAA6C,6DAA6D,wBAAwB,KAAK,eAAe,0CAA0C,oBAAoB,mCAAmC,QAAQ,iEAAiE,yDAAyD,sDAAsD,oCAAoC,mCAAmC,4DAA4D,0BAA0B,uBAAuB,oDAAoD,4CAA4C,qCAAqC,QAAQ,WAAW,eAAe,KAAK,WAAW,cAAc,wEAAwE,wGAAwG,0EAA0E,4BAA4B,QAAQ,WAAW,0CAA0C,SAAS,cAAc,QAAQ,IAAI,6DAA6D,qDAAqD,yFAAyF,uFAAuF,kBAAkB,aAAa,eAAe,4BAA4B,0BAA0B,2EAA2E,8CAA8C,WAAW,yCAAyC,4BAA4B,4BAA4B,cAAc,oCAAoC,kBAAkB,gGAAgG,yBAAyB,+BAA+B,kDAAkD,uDAAuD,wCAAwC,aAAa,yCAAyC,wCAAwC,aAAa,yCAAyC,8CAA8C,6BAA6B,mMAAmM,gMAAgM,qCAAqC,wBAAwB,kCAAkC,4BAA4B,iEAAiE,6CAA6C,0EAA0E,mCAAmC,oBAAoB,4GAA4G,uBAAuB,mDAAmD,oBAAoB,iIAAiI,qCAAqC,yHAAyH,iHAAiH,uFAAuF,uDAAuD,OAAO,0OAA0O,WAAW,+DAA+D,qBAAqB,2BAA2B,0BAA0B,4DAA4D,aAAa,6BAA6B,EAAE,gCAAgC,oCAAoC,UAAU,MAAM,+BAA+B,eAAe,wCAAwC,KAAK,MAAM,uBAAuB,MAAM,0CAA0C,mBAAmB,mCAAmC,yFAAyF,uBAAuB,mBAAmB,yBAAyB,2DAA2D,2DAA2D,uMAAuM,gEAAgE,gKAAgK,2EAA2E,WAAW,mEAAmE,uDAAuD,0BAA0B,iEAAiE,aAAa,aAAa,EAAE,wCAAwC,+BAA+B,aAAa,IAAI,0BAA0B,SAAS,SAAS,gBAAgB,MAAM,yCAAyC,gBAAgB,MAAM,yCAAyC,8BAA8B,8BAA8B,yFAAyF,sTAAsT,sCAAsC,wIAAwI,2BAA2B,4DAA4D,4BAA4B,iEAAiE,iEAAiE,kEAAkE,4BAA4B,qDAAqD,yBAAyB,qaAAqa,wCAAwC,yBAAyB,qBAAqB,qDAAqD,sCAAsC,YAAY,WAAW,2BAA2B,SAAS,kCAAkC,qBAAqB,qDAAqD,sCAAsC,YAAY,WAAW,wBAAwB,SAAS,2BAA2B,8QAA8Q,6CAA6C,WAAW,IAAI,+FAA+F,SAAS,UAAU,2CAA2C,WAAW,IAAI,oFAAoF,SAAS,aAAa,wDAAwD,yCAAyC,0EAA0E,YAAY,yCAAyC,6FAA6F,QAAQ,EAAE,kBAAkB,qFAAqF,8DAA8D,EAAE,sBAAsB,iHAAiH,sFAAsF,EAAE,uBAAuB,oEAAoE,0CAA0C,EAAE,YAAY,8CAA8C,kBAAkB,gCAAgC,4CAA4C,uBAAuB,oCAAoC,oCAAoC,uCAAuC,uCAAuC,6BAA6B,0CAA0C,8BAA8B,oCAAoC,aAAa,kCAAkC,uBAAuB,8CAA8C,qCAAqC,yCAAyC,sBAAsB,4NAA4N,iEAAiE,sBAAsB,UAAU,qBAAqB,SAAS,2BAA2B,eAAe,+BAA+B,mBAAmB,qBAAqB,SAAS,wBAAwB,6JAA6J,gBAAgB,0BAA0B,oBAAoB,0BAA0B,oBAAoB,oIAAoI,oBAAoB,4BAA4B,oCAAoC,yKAAyK,iDAAiD,mEAAmE,4DAA4D,aAAa,+CAA+C,SAAS,mCAAmC,mCAAmC,eAAe,mDAAmD,SAAS,4DAA4D,uBAAuB,iCAAiC,2BAA2B,MAAM,yDAAyD,mBAAmB,2BAA2B,4LAA4L,6BAA6B,8DAA8D,cAAc,uGAAuG,6BAA6B,6CAA6C,6DAA6D,QAAQ,mBAAmB,wBAAwB,SAAS,IAAI,YAAY,IAAI,KAAK,+CAA+C,SAAS,SAAS,SAAS,4DAA4D,kCAAkC,gCAAgC,6DAA6D,kDAAkD,+EAA+E,IAAI,yCAAyC,kBAAkB,gDAAgD,sCAAsC,YAAY,SAAS,2CAA2C,8BAA8B,eAAe,gCAAgC,YAAY,IAAI,iDAAiD,+BAA+B,WAAW,iBAAiB,YAAY,eAAe,UAAU,cAAc,SAAS,eAAe,UAAU,0BAA0B,iBAAiB,aAAa;AAC/gzG;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,aAAa,mDAAmD,gBAAgB,4DAA4D,+GAA+G,kBAAkB,mEAAmE,uBAAuB,2GAA2G,iBAAiB,qBAAqB,oBAAoB,mFAAmF,oFAAoF,sFAAsF,2EAA2E,gGAAgG,2DAA2D,SAAS,+CAA+C,uCAAuC,sFAAsF,uCAAuC,wBAAwB,SAAS,wBAAwB,kBAAkB,oBAAoB,gDAAgD,MAAM,iIAAiI,YAAY,yBAAyB,mDAAmD,0GAA0G,MAAM,cAAc,8EAA8E,oEAAoE,gBAAgB,+DAA+D,IAAI,WAAW,SAAS,gBAAgB,iCAAiC,SAAS,YAAY,IAAI,mBAAmB,SAAS,cAAc,oHAAoH,WAAW,gBAAgB,iCAAiC,iJAAiJ,6BAA6B,eAAe,kBAAkB,cAAc,WAAW,+CAA+C,sDAAsD,+DAA+D,uBAAuB,gCAAgC,gCAAgC,6BAA6B,kBAAkB,SAAS,mDAAmD,8DAA8D,+BAA+B,mBAAmB,WAAW,6BAA6B,0CAA0C,+BAA+B,6CAA6C,gCAAgC,uEAAuE,yDAAyD,6BAA6B,kBAAkB,WAAW,iBAAiB,sBAAsB,yBAAyB,4JAA4J,cAAc,aAAa,aAAa,eAAe,IAAI,yFAAyF,kNAAkN,4DAA4D,sBAAsB,gCAAgC,mGAAmG,mCAAmC,mBAAmB,gBAAgB,sCAAsC,MAAM,SAAS,QAAQ,IAAI,mCAAmC,sCAAsC,0BAA0B,4BAA4B,KAAK,KAAK,iBAAiB,IAAI,0BAA0B,KAAK,MAAM,cAAc,SAAS,oBAAoB,eAAe,iBAAiB,6BAA6B,eAAe,oDAAoD,eAAe,YAAY,IAAI,KAAK,mCAAmC,qBAAqB,SAAS,SAAS,oBAAoB,gCAAgC,oBAAoB,uBAAuB,iBAAiB,WAAW,gCAAgC,SAAS,WAAW,oBAAoB,kBAAkB,oBAAoB,qBAAqB,oBAAoB,yBAAyB,uBAAuB,wBAAwB,yDAAyD,SAAS,sBAAsB,kBAAkB,4EAA4E,kBAAkB,uBAAuB,iBAAiB,IAAI,EAAE,sDAAsD,oBAAoB,oBAAoB,MAAM,4DAA4D,MAAM,mHAAmH,MAAM,6IAA6I,mGAAmG,qBAAqB,eAAe,mDAAmD,aAAa,KAAK,IAAI,sDAAsD,SAAS,IAAI,sCAAsC,aAAa,mBAAmB,gHAAgH,IAAI,wBAAwB,oBAAoB,8CAA8C,WAAW,6EAA6E,SAAS,UAAU,2DAA2D,iCAAiC,wBAAwB,qBAAqB,sMAAsM,2BAA2B,2BAA2B,2BAA2B,6FAA6F,aAAa,2BAA2B,iBAAiB,+BAA+B,iBAAiB,0BAA0B,+BAA+B,2BAA2B,mFAAmF,kBAAkB,kDAAkD,IAAI,oBAAoB,cAAc,MAAM,sBAAsB,4BAA4B,gCAAgC,iJAAiJ,kBAAkB,0BAA0B,4EAA4E,kCAAkC,MAAM,0BAA0B,WAAW,mBAAmB,2BAA2B,QAAQ,WAAW,KAAK,WAAW,qFAAqF,wBAAwB,SAAS,yEAAyE,kBAAkB,4EAA4E,YAAY,IAAI,mBAAmB,YAAY,iCAAiC,kBAAkB,4EAA4E,YAAY,IAAI,mCAAmC,YAAY,iCAAiC,kBAAkB,4EAA4E,YAAY,IAAI,mEAAmE,YAAY,mCAAmC,oBAAoB,yEAAyE,kCAAkC,mEAAmE,uCAAuC,kCAAkC,+BAA+B,2DAA2D,EAAE,4DAA4D,2CAA2C,mEAAmE,+KAA+K,uBAAuB,iBAAiB,iBAAiB,qBAAqB,qGAAqG,IAAI,oBAAoB,cAAc,MAAM,sBAAsB,wCAAwC,+BAA+B,uCAAuC,wBAAwB,2CAA2C,wBAAwB,uCAAuC,yCAAyC,6DAA6D,KAAK,2GAA2G,8DAA8D,oBAAoB,iIAAiI,cAAc,cAAc,WAAW,+BAA+B,4CAA4C,iCAAiC,+CAA+C,kCAAkC,yEAAyE,yDAAyD,6BAA6B,iCAAiC,OAAO,mEAAmE,WAAW,kBAAkB,SAAS,uBAAuB,YAAY,IAAI,qCAAqC,SAAS,kBAAkB,SAAS,uBAAuB,YAAY,IAAI,iCAAiC,SAAS,kBAAkB,eAAe,uCAAuC,iBAAiB,IAAI,eAAe,SAAS,kBAAkB,gCAAgC,WAAW,6CAA6C,SAAS,kBAAkB,0DAA0D,uEAAuE,wBAAwB,qFAAqF,sEAAsE,2DAA2D,oBAAoB,mBAAmB,qCAAqC,IAAI,8CAA8C,oBAAoB,wBAAwB,qCAAqC,IAAI,+BAA+B,wBAAwB,2DAA2D,kDAAkD,sBAAsB,+CAA+C,sBAAsB,+CAA+C,kCAAkC,oBAAoB,wKAAwK,KAAK,UAAU,kBAAkB,YAAY,IAAI,mBAAmB,SAAS,0CAA0C,gCAAgC,0BAA0B,gBAAgB,gBAAgB,SAAS,0CAA0C,gCAAgC,0BAA0B,cAAc,kBAAkB,SAAS,uCAAuC,qCAAqC,0CAA0C,kDAAkD,0CAA0C,kDAAkD,0CAA0C,qFAAqF,0CAA0C,qFAAqF,yCAAyC,gCAAgC,0BAA0B,gBAAgB,gBAAgB,2CAA2C,yCAAyC,gCAAgC,8BAA8B,cAAc,kBAAkB,2CAA2C,sCAAsC,oEAAoE,yCAAyC,sBAAsB,2BAA2B,8BAA8B,yCAAyC,sBAAsB,2BAA2B,8BAA8B,yCAAyC,8EAA8E,yCAAyC,8EAA8E,yCAAyC,oDAAoD,yCAAyC,oDAAoD,0CAA0C,oDAAoD,0CAA0C,oDAAoD,6CAA6C,sDAAsD,YAAY,kBAAkB,gBAAgB,mBAAmB,WAAW,6CAA6C,sDAAsD,cAAc,oBAAoB,iBAAiB,mBAAmB,WAAW,0CAA0C,mGAAmG,6CAA6C,mHAAmH,6CAA6C,mHAAmH,6CAA6C,0JAA0J,6CAA6C,0JAA0J,4CAA4C,iBAAiB,wBAAwB,qBAAqB,gBAAgB,kBAAkB,gBAAgB,6DAA6D,WAAW,4CAA4C,iBAAiB,wBAAwB,qBAAqB,kBAAkB,oBAAoB,iBAAiB,6DAA6D,WAAW,yCAAyC,uHAAuH,4CAA4C,wHAAwH,4CAA4C,wHAAwH,4CAA4C,oKAAoK,4CAA4C,4LAA4L,4CAA4C,wBAAwB,4CAA4C,wBAAwB,6CAA6C,wBAAwB,6CAA6C,wBAAwB,sCAAsC,wGAAwG,0CAA0C,yDAAyD,yEAAyE,uDAAuD,gEAAgE,YAAY,gCAAgC,KAAK,qBAAqB,8CAA8C,IAAI,qBAAqB,6DAA6D,SAAS,sCAAsC,uBAAuB,oGAAoG,sBAAsB,aAAa,mFAAmF,oFAAoF,iCAAiC,gFAAgF,oBAAoB,MAAM,6EAA6E,IAAI,cAAc,KAAK,0DAA0D,QAAQ,MAAM,qBAAqB,aAAa,2BAA2B,cAAc,8CAA8C,gBAAgB,MAAM,SAAS,mCAAmC,IAAI,KAAK,uCAAuC,OAAO,YAAY,+BAA+B,SAAS,YAAY,+BAA+B,SAAS,IAAI,SAAS,YAAY,mCAAmC,SAAS,8BAA8B,uCAAuC,iBAAiB,kBAAkB,UAAU,gBAAgB,kBAAkB,0BAA0B,iBAAiB,kBAAkB,uCAAuC,KAAK,sDAAsD,kBAAkB,qDAAqD,SAAS,cAAc,mCAAmC,oBAAoB,kDAAkD,qCAAqC,KAAK,cAAc,QAAQ,SAAS,KAAK,oBAAoB,YAAY,mCAAmC,gBAAgB,UAAU,mBAAmB,eAAe,MAAM,aAAa,YAAY,GAAG,IAAI,mCAAmC,SAAS,oCAAoC,YAAY,iBAAiB,aAAa,2BAA2B,yBAAyB,mBAAmB,6BAA6B,uDAAuD,mBAAmB,yBAAyB,QAAQ,IAAI,kJAAkJ,sEAAsE,+GAA+G,SAAS,+BAA+B,kDAAkD,IAAI,gCAAgC,0HAA0H,mBAAmB,wJAAwJ,IAAI,mCAAmC,cAAc,eAAe,2EAA2E,qBAAqB,sCAAsC,kBAAkB,qBAAqB,IAAI,iHAAiH,kBAAkB,gDAAgD;AAC/2pB;AACA,2BAA2B,qEAAqE,mCAAmC,IAAI,0BAA0B,8BAA8B,IAAI,0BAA0B,eAAe,KAAK,mCAAmC,sBAAsB,iCAAiC,+BAA+B,4HAA4H,mRAAmR,KAAK,+BAA+B,kBAAkB,IAAI,+BAA+B,iBAAiB,eAAe,QAAQ,UAAU,qCAAqC,mCAAmC,iBAAiB,aAAa,sCAAsC,SAAS,0BAA0B,8FAA8F,kBAAkB,aAAa,iBAAiB,8EAA8E,SAAS,gCAAgC,iCAAiC,IAAI,qBAAqB,OAAO,yCAAyC,SAAS,gBAAgB,yCAAyC,oCAAoC,IAAI,2CAA2C,KAAK,8JAA8J,kBAAkB,+BAA+B,KAAK,2HAA2H,yJAAyJ,cAAc,qCAAqC,SAAS,6EAA6E,iDAAiD,yCAAyC,4BAA4B,oIAAoI,qJAAqJ,8HAA8H,uMAAuM,sJAAsJ,OAAO,gBAAgB,8HAA8H,6IAA6I,oJAAoJ,8HAA8H,wIAAwI,0BAA0B,0CAA0C,8DAA8D,IAAI,0JAA0J,SAAS,8FAA8F,GAAG,8BAA8B,IAAI,8BAA8B,SAAS,gBAAgB,gCAAgC,IAAI,YAAY,SAAS,gBAAgB,GAAG,IAAI,WAAW,oBAAoB,iBAAiB,aAAa,sCAAsC,SAAS,0BAA0B,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,UAAU,gBAAgB,8EAA8E,4BAA4B,cAAc,iEAAiE,UAAU,yCAAyC,2TAA2T,aAAa,kCAAkC,oBAAoB,+BAA+B,0BAA0B,mBAAmB,kBAAkB,4BAA4B,+BAA+B,sBAAsB,EAAE,+BAA+B,sBAAsB,2BAA2B,EAAE,8BAA8B,mCAAmC,EAAE,uCAAuC,0DAA0D,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,0BAA0B,yBAAyB,+BAA+B,0GAA0G,mBAAmB,8EAA8E,qFAAqF,iKAAiK,sBAAsB,mGAAmG,YAAY,iBAAiB,aAAa,sCAAsC,SAAS,2BAA2B,WAAW,gCAAgC,iBAAiB,8EAA8E,SAAS,2CAA2C,6GAA6G,iBAAiB,aAAa,sCAAsC,SAAS,8BAA8B,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,UAAU,gCAAgC,aAAa,iBAAiB,8EAA8E,uBAAuB,yCAAyC,iEAAiE,qCAAqC,4DAA4D,sCAAsC,oEAAoE,+BAA+B,iDAAiD,OAAO,8BAA8B,sDAAsD,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,uBAAuB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,wFAAwF,gBAAgB,8EAA8E,gBAAgB,4FAA4F,uDAAuD,0BAA0B,aAAa,+DAA+D,qXAAqX,+EAA+E,6BAA6B,gdAAgd,uBAAuB,2HAA2H,0CAA0C,aAAa,mDAAmD,sEAAsE,uCAAuC,WAAW,0CAA0C,qJAAqJ,GAAG,qCAAqC,WAAW,6CAA6C,mFAAmF,GAAG,yCAAyC,gEAAgE,mBAAmB,yBAAyB,OAAO,6CAA6C,uEAAuE,qDAAqD,GAAG,kDAAkD,yEAAyE,uLAAuL,GAAG,sCAAsC,gEAAgE,mBAAmB,yBAAyB,mFAAmF,kFAAkF,+JAA+J,oBAAoB,kLAAkL,6KAA6K,+CAA+C,sEAAsE,sLAAsL,sBAAsB,uBAAuB,GAAG,uCAAuC,uEAAuE,yBAAyB,uCAAuC,wXAAwX,GAAG,2CAA2C,uEAAuE,mEAAmE,wDAAwD,MAAM,wBAAwB,wGAAwG,8PAA8P,2BAA2B,GAAG,GAAG,YAAY,iTAAiT,GAAG,mEAAmE,WAAW,2DAA2D,mDAAmD,8GAA8G,+gCAA+gC,GAAG,GAAG,GAAG,8CAA8C,+DAA+D,iFAAiF,2FAA2F,2FAA2F,oBAAoB,wKAAwK,gJAAgJ,gDAAgD,uEAAuE,wLAAwL,GAAG,0CAA0C,WAAW,yDAAyD,cAAc,WAAW,yNAAyN,GAAG,6CAA6C,WAAW,0DAA0D,2BAA2B,gLAAgL,GAAG,6CAA6C,uEAAuE,mBAAmB,yBAAyB,oFAAoF,4MAA4M,2FAA2F,oBAAoB,wDAAwD,8MAA8M,mEAAmE,oEAAoE,sBAAsB,qSAAqS,+BAA+B,QAAQ,GAAG,sJAAsJ,qCAAqC,uEAAuE,kDAAkD,6BAA6B,GAAG,0CAA0C,uEAAuE,sCAAsC,uHAAuH,6GAA6G,sBAAsB,gIAAgI,GAAG,GAAG,sCAAsC,uEAAuE,uDAAuD,2DAA2D,oBAAoB,kBAAkB,kNAAkN,sFAAsF,uCAAuC,8EAA8E,GAAG,GAAG,6CAA6C,2CAA2C,0IAA0I,8BAA8B,0CAA0C,gEAAgE,mBAAmB,yBAAyB,yEAAyE,kCAAkC,OAAO,6CAA6C,wEAAwE,sDAAsD,GAAG,mDAAmD,0EAA0E,uEAAuE,GAAG,uCAAuC,gEAAgE,mBAAmB,yBAAyB,uHAAuH,sGAAsG,wCAAwC,+JAA+J,mBAAmB,mDAAmD,GAAG,kDAAkD,8CAA8C,+DAA+D,2DAA2D,GAAG,sCAAsC,uEAAuE,mDAAmD,4BAA4B,GAAG,wCAAwC,+DAA+D,mFAAmF,sCAAsC,6GAA6G,mLAAmL,qCAAqC,8IAA8I,oIAAoI,0HAA0H,GAAG,GAAG,GAAG,sBAAsB,iIAAiI,GAAG,GAAG,uCAAuC,wDAAwD,sEAAsE,GAAG,4CAA4C,WAAW,0CAA0C,iDAAiD,0NAA0N,4EAA4E,GAAG,GAAG,oBAAoB,+EAA+E,GAAG,6CAA6C,WAAW,MAAM,uCAAuC,8DAA8D,4DAA4D,oHAAoH,GAAG,GAAG,2BAA2B,wDAAwD,yGAAyG,SAAS,GAAG,yDAAyD,kFAAkF,SAAS,uBAAuB,2CAA2C,iCAAiC,0CAA0C,gCAAgC,oCAAoC,iEAAiE,0KAA0K,GAAG,qCAAqC,MAAM,mDAAmD,0BAA0B,iDAAiD,oGAAoG,OAAO,0CAA0C,wCAAwC,EAAE,uCAAuC,qCAAqC,EAAE,wCAAwC,sCAAsC,EAAE,kCAAkC,gCAAgC,EAAE,8BAA8B,qBAAqB,EAAE,qCAAqC,mEAAmE,KAAK,eAAe,iBAAiB,aAAa,sCAAsC,SAAS,+BAA+B,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,8DAA8D,gBAAgB,8EAA8E,gBAAgB,4FAA4F,uDAAuD,kCAAkC,aAAa,+DAA+D,mzBAAmzB,8BAA8B,IAAI,UAAU,wCAAwC,wtBAAwtB,uBAAuB,2HAA2H,0CAA0C,aAAa,mDAAmD,sEAAsE,YAAY,0CAA0C,iCAAiC,EAAE,sDAAsD,6CAA6C,EAAE,2CAA2C,kCAAkC,EAAE,yCAAyC,gCAAgC,EAAE,2CAA2C,kCAAkC,EAAE,4CAA4C,mCAAmC,EAAE,4CAA4C,mCAAmC,EAAE,gDAAgD,uCAAuC,EAAE,mDAAmD,0CAA0C,EAAE,2DAA2D,kDAAkD,EAAE,sCAAsC,6BAA6B,EAAE,+CAA+C,sCAAsC,EAAE,4CAA4C,mCAAmC,EAAE,+CAA+C,sCAAsC,EAAE,kDAAkD,yCAAyC,EAAE,kDAAkD,yCAAyC,EAAE,yCAAyC,gCAAgC,EAAE,sCAAsC,6BAA6B,EAAE,uCAAuC,8BAA8B,EAAE,iCAAiC,wBAAwB,KAAK,uBAAuB,iBAAiB,aAAa,sCAAsC,SAAS,6BAA6B,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,UAAU,+BAA+B,aAAa,iBAAiB,8EAA8E,SAAS,wCAAwC,6BAA6B,oCAAoC,0NAA0N,OAAO,2BAA2B,6BAA6B,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,0BAA0B,mBAAmB,4BAA4B,aAAa,iBAAiB,8EAA8E,SAAS,yCAAyC,2BAA2B,0BAA0B,wCAAwC,uCAAuC,IAAI,2DAA2D,SAAS,0BAA0B,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,uBAAuB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,iBAAiB,yBAAyB,cAAc,WAAW,iBAAiB,8EAA8E,kDAAkD,yBAAyB,GAAG,2HAA2H,EAAE,uMAAuM,0CAA0C,mYAAmY,oCAAoC,4GAA4G,kCAAkC,gFAAgF,gCAAgC,kBAAkB,oCAAoC,2NAA2N,+CAA+C,qEAAqE,uCAAuC,+EAA+E,MAAM,iHAAiH,kCAAkC,kBAAkB,8BAA8B,yCAAyC,YAAY,kDAAkD,+JAA+J,6EAA6E,4FAA4F,OAAO,+BAA+B,sBAAsB,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,2BAA2B,mBAAmB,6BAA6B,aAAa,iBAAiB,8EAA8E,SAAS,yCAAyC,4BAA4B,0BAA0B,oCAAoC,wCAAwC,IAAI,wDAAwD,SAAS,0BAA0B,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,wBAAwB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,UAAU,0BAA0B,cAAc,WAAW,iBAAiB,8EAA8E,kDAAkD,yBAAyB,yUAAyU,0CAA0C,aAAa,kCAAkC,0IAA0I,oCAAoC,oBAAoB,oCAAoC,oGAAoG,kCAAkC,0DAA0D,gCAAgC,gBAAgB,mCAAmC,mQAAmQ,mCAAmC,0EAA0E,oCAAoC,2MAA2M,aAAa,iBAAiB,MAAM,8CAA8C,8BAA8B,kNAAkN,OAAO,+BAA+B,sBAAsB,EAAE,+BAA+B,6CAA6C,KAAK,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,6BAA6B,2BAA2B,gCAAgC,cAAc,iBAAiB,8EAA8E,SAAS,sBAAsB,4FAA4F,uDAAuD,sBAAsB,6SAA6S,uBAAuB,2HAA2H,0CAA0C,aAAa,mDAAmD,sEAAsE,qCAAqC,iEAAiE,iGAAiG,iCAAiC,iGAAiG,yCAAyC,+BAA+B,4CAA4C,kCAAkC,2CAA2C,iCAAiC,8CAA8C,oCAAoC,+CAA+C,qCAAqC,kDAAkD,wCAAwC,kDAAkD,kGAAkG,2CAA2C,iCAAiC,8CAA8C,oCAAoC,6CAA6C,+EAA+E,4CAA4C,kCAAkC,+CAA+C,qCAAqC,8CAA8C,iFAAiF,iDAAiD,uCAAuC,oDAAoD,0CAA0C,mDAAmD,2FAA2F,GAAG,sBAAsB,iBAAiB,aAAa,sCAAsC,SAAS,iBAAiB,iBAAiB,gBAAgB,YAAY,WAAW,KAAK,WAAW,+GAA+G,uBAAuB,wCAAwC,yBAAyB,gBAAgB,8EAA8E,gBAAgB,4FAA4F,uDAAuD,oBAAoB,cAAc,4IAA4I,UAAU,6BAA6B,2CAA2C,sBAAsB,GAAG,uBAAuB,2HAA2H,0CAA0C,aAAa,mDAAmD,sEAAsE,qCAAqC,0BAA0B,iBAAiB,2KAA2K,KAAK,gGAAgG,QAAQ,uFAAuF,iCAAiC,kIAAkI,oCAAoC,gCAAgC,6BAA6B,8GAA8G,OAAO,2BAA2B,kCAAkC,EAAE,kCAAkC,yBAAyB,KAAK,UAAU,iBAAiB,aAAa,sCAAsC,SAAS,8BAA8B,WAAW,gCAAgC,cAAc,iBAAiB,8EAA8E,6BAA6B,sCAAsC,8KAA8K,sBAAsB,uEAAuE,IAAI,+BAA+B,2GAA2G,yCAAyC,WAAW,mDAAmD,kFAAkF,eAAe,qIAAqI,GAAG,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,iCAAiC,YAAY,mCAAmC,aAAa,iBAAiB,8EAA8E,SAAS,yCAAyC,kCAAkC,0BAA0B,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,kCAAkC,YAAY,oCAAoC,aAAa,iBAAiB,8EAA8E,SAAS,yCAAyC,mCAAmC,kCAAkC,0BAA0B,GAAG,GAAG,iBAAiB,aAAa,sCAAsC,SAAS,EAAE,mBAAmB,GAAG;;;;;;;;;;;AChCjz2C;;AAEb,2BAA2B,mBAAO,CAAC,qGAAiC;AACpE,WAAW,mBAAO,CAAC,gEAAM;AACzB,mBAAmB,mBAAO,CAAC,+CAAQ;AACnC,oBAAoB,mBAAO,CAAC,wFAAyB;AACrD,qBAAqB,mBAAO,CAAC,6FAAyB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,aAAa;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4IAA4I,wBAAwB;AACpK;AACA;AACA,6IAA6I,wBAAwB;AACrK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL,wBAAwB,0BAA0B;AAClD,gCAAgC,iCAAiC;AACjE,gCAAgC,iCAAiC;AACjE,6BAA6B,8BAA8B;AAC3D,4BAA4B,6BAA6B;AACzD,+BAA+B,gCAAgC;AAC/D;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL,gCAAgC,iCAAiC;AACjE,6BAA6B,8BAA8B;AAC3D,wBAAwB,0BAA0B;AAClD,6BAA6B,+BAA+B;AAC5D,gCAAgC,iCAAiC;AACjE,4BAA4B,6BAA6B;AACzD,kCAAkC,mCAAmC;AACrE,mCAAmC,oCAAoC;AACvE,uCAAuC,uCAAuC;AAC9E,wCAAwC,wCAAwC;AAChF;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,kBAAkB,kCAAkC,YAAY;AAClI;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,eAAe;AAClF,mEAAmE,cAAc;AACjF;AACA;AACA;AACA;AACA,+CAA+C,UAAU;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,YAAY,8DAA8D,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,YAAY,8DAA8D,EAAE;AAC5G;AACA;AACA;AACA;AACA,sEAAsE,YAAY;AAClF;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,gBAAgB,4EAA4E;AAC5F;AACA;AACA,+DAA+D,IAAI,sEAAsE,oBAAoB;AAC7J;AACA;AACA,6DAA6D,iBAAiB;AAC9E;AACA;AACA,4DAA4D,iBAAiB;AAC7E;AACA,8DAA8D,4BAA4B;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,mDAAmD,WAAW;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS,IAAI,cAAc;AAC3B;AACA;AACA,4DAA4D,gBAAgB;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,4DAA4D,MAAM;AAClE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,YAAY,8DAA8D,EAAE;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,WAAW;AAC7E;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA,4CAA4C,UAAU;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,mDAAmD;AAClF,2BAA2B,mDAAmD;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,eAAe;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,sBAAsB;AACpD;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,4IAA4I,iCAAiC;AAC7K;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,mBAAmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,oCAAoC;AACnE;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,oBAAoB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,kFAAkF;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,8BAA8B;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B;AACA,qCAAqC,YAAY,GAAG,YAAY,GAAG,aAAa;AAChF,IAAI,6BAA6B,GAAG,eAAe,KAAK,eAAe;AACvE,4BAA4B,cAAc;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,qBAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,8BAA8B;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,2BAA2B;AAC/B;AACA;AACA;AACA;AACA;AACA;;AAEA,sDAAqD;AACrD;AACA,qBAAqB;AACrB,CAAC,EAAC;AACF,0CAAyC;AACzC;AACA,qBAAqB;AACrB,CAAC,EAAC;AACF,mDAAkD;AAClD;AACA,qBAAqB;AACrB,CAAC,EAAC;AACF,uDAAsD;AACtD;AACA,qBAAqB;AACrB,CAAC,EAAC;AACF,eAAe;AACf,cAAc;AACd,aAAa;AACb,+CAA+C;AAC/C,yBAAyB;AACzB,8BAA8B;AAC9B,aAAa;AACb,cAAc;AACd,eAAe;AACf,gBAAgB;AAChB,wBAAwB;AACxB;;;;;;;;;;;;ACzhDa;;AAEb,aAAa,mBAAO,CAAC,+CAAQ;AAC7B,qBAAqB,mBAAO,CAAC,6FAAyB;AACtD,WAAW,mBAAO,CAAC,uDAAM;AACzB,WAAW,mBAAO,CAAC,gEAAM;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,aAAa,KAAK,KAAK;AACtD;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,YAAY;AACZ;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,sBAAsB,wCAAwC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,UAAU,QAAQ,QAAQ,KAAK,qBAAqB,EAAE,wBAAwB;AACnI;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,UAAU,QAAQ,QAAQ,KAAK,UAAU;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B;AAC3C;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,sDAAsD,QAAQ;AAC9D;AACA;AACA;AACA;AACA;AACA,qCAAqC,yBAAyB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,YAAY,iCAAiC,EAAE;AAClI;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mDAAmD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,eAAe;AAC9D,+CAA+C,cAAc;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gEAAgE;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kCAAkC;AACzE;AACA;AACA,6BAA6B,sBAAsB;AACnD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,2DAA2D,mBAAmB;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG,UAAU,KAAK,EAAE;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,cAAc,IAAI,QAAQ;AAC/E;AACA;AACA,qDAAqD,OAAO,IAAI,QAAQ;AACxE;AACA;AACA,qDAAqD,YAAY,IAAI,QAAQ;AAC7E;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,OAAO,QAAQ,+BAA+B,yDAAyD,OAAO;AAC5J;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,IAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,IAAI,cAAc,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,wBAAwB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,cAAc;AACnF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,oCAAoC;AACpC;AACA;AACA,YAAY,wBAAwB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,UAAU;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,UAAU;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,8DAA8D;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA,4CAA4C;AAC5C;;AAEA,wBAAwB;AACxB,gDAAgD;AAChD,4BAA4B;AAC5B,0BAA0B;AAC1B,sBAAsB;AACtB,cAAc;AACd,4BAA4B;AAC5B,wBAAwB;AACxB,+BAA+B;AAC/B,uBAAuB;AACvB,4BAA4B;AAC5B,2BAA2B;AAC3B,yBAAyB;AACzB,6BAA6B;AAC7B,yCAAyC;AACzC,qCAAqC;AACrC,8BAA8B;AAC9B,sBAAsB;AACtB,iCAAiC;AACjC,0BAA0B;AAC1B,2BAA2B;AAC3B,+BAA+B;AAC/B,yBAAyB;AACzB,aAAa;AACb,wBAAwB;AACxB,2BAA2B;AAC3B,iBAAiB;AACjB,2BAA2B;AAC3B,wBAAwB;AACxB,kCAAkC;AAClC,iCAAiC;AACjC,gCAAgC;AAChC,0BAA0B;AAC1B,4BAA4B;AAC5B,0BAA0B;AAC1B,kCAAkC;AAClC,mCAAmC;AACnC,mBAAmB;AACnB,0BAA0B;AAC1B,0BAA0B;AAC1B,gCAAgC;AAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACh/CsC;AACmB;AACwB;AACvD;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,gDAAY;AACpD;AACA,+BAA+B,aAAa,KAAK,KAAK;AACtD;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd,YAAY;AACZ;AACA,wBAAwB,0BAA0B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,sBAAsB,wCAAwC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,wBAAwB;AACxB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,0DAAK;AACpC;AACA,qDAAqD,UAAU,QAAQ,QAAQ,KAAK,qBAAqB,EAAE,wBAAwB;AACnI;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,UAAU,QAAQ,QAAQ,KAAK,UAAU;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,2BAA2B,QAAQ,+CAAS,gBAAgB,+CAAS;AACrF;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,sDAAsD,QAAQ;AAC9D;AACA;AACA;AACA;AACA;AACA,qCAAqC,yBAAyB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,YAAY,iCAAiC,EAAE;AAClI;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mDAAmD;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gDAAE;AACrB,4BAA4B,0DAAK;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,eAAe;AAC9D,+CAA+C,cAAc;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,gEAAgE;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kCAAkC;AACzE;AACA;AACA,6BAA6B,sBAAsB;AACnD;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,0DAAK;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,2DAA2D,mBAAmB;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG,UAAU,KAAK,EAAE;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,cAAc,IAAI,QAAQ;AAC/E;AACA;AACA,qDAAqD,OAAO,IAAI,QAAQ;AACxE;AACA;AACA,qDAAqD,YAAY,IAAI,QAAQ;AAC7E;AACA;AACA;AACA;AACA,6CAA6C,+CAAS;AACtD,SAAS,IAAI,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,OAAO,QAAQ,+BAA+B,yDAAyD,OAAO;AAC5J;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,IAAI;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,IAAI,cAAc,OAAO;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,wBAAwB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,WAAW;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,cAAc;AACnF;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yCAAO;AACtB;AACA;AACA,aAAa,gDAAE;AACf,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,oCAAoC;AACpC;AACA;AACA,YAAY,wBAAwB,QAAQ,qDAAe;AAC3D;AACA;AACA,yBAAyB,+CAAS;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,4DAAO;AAC/B;AACA,yCAAyC,UAAU;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,4DAAO;AAC/B;AACA,2CAA2C,UAAU;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,8DAA8D;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA,4CAA4C;AAC5C;;AAEg4B;AACh4B;;;;;;;;;;;;ACt8Ca;;AAEb,4BAA4B,mBAAO,CAAC,gFAAyB;AAC7D,0BAA0B,mBAAO,CAAC,4EAAuB;AACzD,qBAAqB,mBAAO,CAAC,6FAAyB;AACtD,iBAAiB,mBAAO,CAAC,qEAAkB;AAC3C,SAAS,mBAAO,CAAC,0CAAI;AACrB,uBAAuB,mBAAO,CAAC,oEAAmB;AAClD,yBAAyB,mBAAO,CAAC,8DAAgB;AACjD,WAAW,mBAAO,CAAC,gEAAM;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+HAA+H;AAC/H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,aAAa;AACxE;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,oEAAoE;AACpH;AACA;AACA;AACA;AACA;AACA,+CAA+C,gBAAgB;AAC/D;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,8CAA8C,oEAAoE;AAClH;AACA;AACA;AACA,sDAAsD,mCAAmC;AACzF;AACA;AACA;AACA,0EAA0E,aAAa,aAAa,gBAAgB,KAAK,oBAAoB;AAC7I;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,sBAAsB,EAAE,cAAc;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,gBAAgB;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,kBAAkB;AACvD;AACA;AACA,oCAAoC,kBAAkB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mCAAmC;AACrD;AACA;AACA;AACA,sBAAsB,kBAAkB;AACxC,sBAAsB,kBAAkB;AACxC;AACA,gCAAgC,eAAe,GAAG;AAClD,sBAAsB,2BAA2B;AACjD,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA,cAAc,sBAAsB,WAAW,eAAe,GAAG,wBAAwB,aAAa,iBAAiB,GAAG,wBAAwB,aAAa,iBAAiB,EAAE,wBAAwB,kBAAkB,OAAO,EAAE,qBAAqB;AAC1P;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,GAAG;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,GAAG;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,KAAK,GAAG,+BAA+B,GAAG,6BAA6B,EAAE,SAAS;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,GAAG;AACb;AACA;AACA;AACA;AACA;AACA,4BAA4B,GAAG;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,eAAe;AAC9C,gCAAgC,gBAAgB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,oBAAoB;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,sBAAsB;AACxF;AACA;AACA,eAAe,mBAAmB;AAClC;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,wBAAwB;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kFAAkF;AAClF;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E;AAC3E;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,wCAAwC,qBAAqB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,wBAAwB;AAC9F;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK,IAAI;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,wBAAwB;AAC9F;AACA,2CAA2C,mBAAmB;AAC9D;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,6EAA6E;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,2BAA2B,yCAAyC;AACpE;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;AACA;AACA,mCAAmC,sFAAsF;AACzH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,yEAAyE;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,yEAAyE;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,yCAAyC,IAAI;AACzD,mCAAmC,oDAAoD;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,cAAc;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAC9H;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,sDAAsD,IAAI,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,UAAU,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAC9I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,cAAc,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AACvJ;AACA;AACA;AACA;AACA;AACA,sCAAsC,qCAAqC;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gJAAgJ;AAChJ;AACA,+CAA+C,4BAA4B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA,wKAAwK,YAAY;AACpL,0BAA0B,KAAK;AAC/B;AACA;AACA,6KAA6K,YAAY;AACzL,0BAA0B,KAAK;AAC/B;AACA;AACA,yKAAyK,YAAY;AACrL,0BAA0B,KAAK;AAC/B;AACA;AACA,yKAAyK,YAAY;AACrL,0BAA0B,KAAK;AAC/B;AACA,2BAA2B,YAAY,KAAK,gBAAgB;AAC5D;AACA,2BAA2B,YAAY;AACvC;AACA,2BAA2B,YAAY,+BAA+B,qBAAqB;AAC3F;AACA;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA,mBAAmB,aAAa;AAChC;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,8BAA8B;AAChE,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,2BAA2B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iMAAiM,sBAAsB;AACvN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,yBAAyB;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,yBAAyB;AACtD,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iCAAiC;AACjC;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oEAAoE,4BAA4B;AAChG;AACA;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,UAAU;AACxD;AACA;AACA,0BAA0B,IAAI,IAAI,iCAAiC;AACnE,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF,MAAM;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,MAAM;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAoF,MAAM;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB;AACvB,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA,8DAA8D,aAAa,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAC3J;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oFAAoF,2BAA2B;AAC/G;AACA,yCAAyC;AACzC;AACA;AACA,4CAA4C,2BAA2B,wBAAwB,SAAS,uEAAuE,gCAAgC;AAC/M;AACA;AACA;AACA;AACA,6BAA6B,kBAAkB,GAAG;AAClD;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,8EAA8E,2BAA2B,uBAAuB,YAAY,KAAK,MAAM;AACvJ,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qGAAqG;AACrG;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA,0DAA0D,IAAI,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAC9I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,EAAE,4GAA4G;AACtI;AACA;AACA,wBAAwB,EAAE,4GAA4G;AACtI;AACA;AACA;AACA,iBAAiB,iBAAiB,EAAE,gBAAgB;AACpD;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,aAAa,GAAG;AACtC,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,mFAAmF;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E,0CAA0C;AACtH,+EAA+E,6CAA6C;AAC5H,yDAAyD,IAAI,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB,OAAO,YAAY;AAChK;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,8BAA8B;AAC5D;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,kBAAkB;AACjE;AACA,8DAA8D,IAAI,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAClJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,IAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mBAAmB,GAAG;AAC5C,SAAS;AACT,KAAK;AACL;AACA;AACA,6CAA6C,eAAe,gBAAgB,IAAI,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAChK;AACA;AACA;AACA;AACA,8BAA8B,8BAA8B;AAC5D;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,aAAa,GAAG;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,0EAA0E,aAAa,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AACvK,6EAA6E,qCAAqC;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB,GAAG;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iFAAiF,aAAa,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAC9K;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,IAAI;AACzE;AACA;AACA;AACA;AACA;AACA,+CAA+C,kBAAkB;AACjE;AACA,2DAA2D,IAAI,aAAa,gBAAgB,KAAK,oBAAoB,IAAI,sBAAsB;AAC/I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,mCAAmC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,oBAAoB;AAChC,SAAS,kBAAkB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,oCAAoC;AACzE;AACA;AACA;AACA,IAAI,kCAAkC,OAAO,kCAAkC;AAC/E;AACA,SAAS,kCAAkC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,2BAA2B;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,uBAAuB;AAChE;AACA,6CAA6C,iDAAiD;AAC9F;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,2BAA2B;AACrE,iFAAiF,2BAA2B;AAC5G;AACA,sDAAsD,2BAA2B;AACjF;AACA;AACA,6CAA6C,SAAS;AACtD;AACA;AACA,gDAAgD,YAAY;AAC5D,oBAAoB,UAAU;AAC9B,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA,8BAA8B,MAAM,IAAI,wCAAwC;AAChF,iBAAiB;AACjB;AACA;AACA;AACA;AACA,8BAA8B,MAAM,IAAI,sCAAsC;AAC9E,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,eAAe;AAC5B,wEAAwE,eAAe;AACvF,eAAe,gBAAgB,IAAI,eAAe;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,6BAA6B;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,YAAY,GAAG,2BAA2B;AAC3D;AACA,+BAA+B;AAC/B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ,GAAG,4BAA4B;AACxD;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,iBAAiB,QAAQ,GAAG,4BAA4B;AACxD;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,8GAA8G,aAAa;AAC3H;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,uDAAuD,WAAW,aAAa,sBAAsB,KAAK,0BAA0B;AACpI;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kCAAkC,eAAe;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gGAAgG,QAAQ,2HAA2H;AACnO;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,6EAA6E;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,IAAI,0DAA0D;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,YAAY;AACxB,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,mBAAmB;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,6BAA6B,+CAA+C,0BAA0B;AACxH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA4F,uBAAuB,GAAG;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gEAAgE,uBAAuB,aAAa,gBAAgB,KAAK,oBAAoB;AAC7I;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,aAAa;AACnC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,6BAA6B,4BAA4B,MAAM;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,QAAQ,uBAAuB,qBAAqB,EAAE,wBAAwB;AACnH;AACA;AACA;AACA;AACA,gCAAgC,QAAQ,0CAA0C,6BAA6B;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,QAAQ,YAAY,EAAE;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,uEAAuE,MAAM;AAC7E;AACA;AACA;AACA,oEAAoE,mBAAmB,uBAAuB,MAAM;AACpH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,+JAA+J,kBAAkB;AACjL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,0CAA0C;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,cAAc;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,uBAAuB;AAClF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAiB;AAC9C,KAAK;AACL;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F,aAAa;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F,aAAa;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,8BAA8B;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA,uBAAuB,iCAAiC;AACxD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,8BAA8B;AAC3D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,gBAAgB;AAChD;AACA;AACA;AACA;AACA,qGAAqG,iBAAiB;AACtH;AACA;AACA;AACA;AACA;AACA,oCAAoC,4BAA4B;AAChE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,gBAAgB;AAC1E;AACA;AACA,kCAAkC,kBAAkB,GAAG,uBAAuB;AAC9E,mCAAmC,kBAAkB,GAAG,wBAAwB;AAChF,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,wHAAwH,wBAAwB;AAChJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,kBAAkB,GAAG,uBAAuB;AAC9E;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB,GAAG,wBAAwB;AAChF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,gBAAgB;AAClD;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB,kCAAkC,eAAe;AACjD;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,KAAK;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,4BAA4B;AAC5D;AACA;AACA;AACA;AACA,gCAAgC,4BAA4B;AAC5D;AACA;AACA;AACA;AACA,gCAAgC,6BAA6B;AAC7D;AACA;AACA;AACA,wCAAwC,kBAAkB;AAC1D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,gBAAgB;AACpD;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB,oCAAoC,eAAe;AACnD;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,OAAO;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,OAAO;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,cAAc;AAC/C,2BAA2B,2CAA2C;AACtE,6BAA6B,+CAA+C;AAC5E,4BAA4B,6CAA6C;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,wBAAwB;AACjD;AACA;AACA;AACA,yBAAyB,wBAAwB;AACjD;AACA;AACA;AACA,yBAAyB,yBAAyB;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,SAAS;AACT,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,wBAAwB;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,gBAAgB;AACrD;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB,qCAAqC,eAAe;AACpD;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,QAAQ;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gCAAgC,sBAAsB,cAAc,GAAG,MAAM,GAAG;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oGAAoG,MAAM;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oGAAoG,MAAM;AAC1G;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gZAAgZ;AAChZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,2BAA2B;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gZAAgZ;AAChZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,2BAA2B;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0YAA0Y;AAC1Y;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,2BAA2B;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,sCAAsC,sBAAsB,cAAc,GAAG,MAAM,GAAG;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gZAAgZ;AAChZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,2BAA2B;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0YAA0Y;AAC1Y;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,2BAA2B;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC;AACA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK,KAAK;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,gBAAgB;AACvE,oFAAoF,cAAc;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kKAAkK,iBAAiB;AACnL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,YAAY;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,YAAY;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,YAAY;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,yDAAyD;;AAEjE,kBAAkB;AAClB,wBAAwB;AACxB,0BAA0B;AAC1B,cAAc;AACd,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,iBAAiB;AACjB,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,kBAAkB;AAClB,eAAe;AACf,mBAAmB;AACnB,kBAAkB;AAClB,kBAAkB;AAClB,cAAc;AACd,oBAAoB;AACpB,kBAAkB;AAClB,4BAA4B;AAC5B,4BAA4B;AAC5B,oBAAoB;AACpB,iCAAiC;AACjC,wBAAwB;AACxB,yBAAyB;AACzB,2BAA2B;AAC3B,eAAe;AACf,eAAe;AACf,cAAc;AACd,aAAa;AACb,aAAa;AACb,kBAAkB;AAClB,2BAA2B;AAC3B,iBAAiB;AACjB,gCAAgC;AAChC,yBAAyB;AACzB,kCAAkC;AAClC,0BAA0B;AAC1B,mBAAmB;AACnB,oBAAoB;AACpB,uBAAuB;AACvB,kBAAkB;AAClB,0BAA0B;AAC1B,wBAAwB;AACxB,sBAAsB;AACtB,yBAAyB;AACzB,6BAA6B;AAC7B,gCAAgC;AAChC,8BAA8B;AAC9B,iCAAiC;AACjC,+BAA+B;AAC/B,kBAAkB;AAClB,qBAAqB;AACrB,kCAAkC;AAClC,sBAAsB;AACtB,eAAe;AACf,kBAAkB;AAClB,mBAAmB;AACnB,sBAAsB;AACtB,kBAAkB;AAClB,qBAAqB;AACrB,0BAA0B;AAC1B,sBAAsB;AACtB,eAAe;AACf,sBAAsB;AACtB,sBAAsB;AACtB,yBAAyB;AACzB,6BAA6B;AAC7B,gCAAgC;AAChC,8BAA8B;AAC9B,iCAAiC;AACjC,kBAAkB;AAClB,qBAAqB;AACrB,cAAc;AACd,iBAAiB;AACjB,uBAAuB;AACvB,+BAA+B;AAC/B,kBAAkB;AAClB,qBAAqB;AACrB,oBAAoB;AACpB,uBAAuB;AACvB,mBAAmB;AACnB,oBAAoB;AACpB,wBAAwB;AACxB,qBAAqB;AACrB,yBAAyB;AACzB,sBAAsB;AACtB,uBAAuB;AACvB,8BAA8B;AAC9B,+BAA+B;AAC/B,sBAAsB;AACtB,uBAAuB;AACvB,8BAA8B;AAC9B,uBAAuB;AACvB,8BAA8B;AAC9B,oBAAoB;AACpB,oBAAoB;AACpB,4BAA4B;AAC5B,wBAAwB;AACxB,2BAA2B;AAC3B,yBAAyB;AACzB,4BAA4B;AAC5B,2BAA2B;AAC3B,8BAA8B;AAC9B,eAAe;AACf,kBAAkB;AAClB,gBAAgB;AAChB,mBAAmB;AACnB,eAAe;AACf,kBAAkB;AAClB,uBAAuB;AACvB,cAAc;AACd,iBAAiB;AACjB,uBAAuB;AACvB,yBAAyB;AACzB,wBAAwB;AACxB,cAAc;AACd,sBAAsB;AACtB,sBAAsB;AACtB,uBAAuB;AACvB,6BAA6B;AAC7B,mBAAmB;AACnB,kBAAkB;AAClB,iBAAiB;AACjB,eAAe;AACf,oBAAoB;AACpB,yBAAyB;AACzB,sBAAsB;AACtB,oBAAoB;AACpB,4BAA4B;AAC5B,qBAAqB;AACrB,qBAAqB;AACrB,iBAAiB;AACjB,qBAAqB;AACrB,kBAAkB;AAClB,sBAAsB;AACtB,qBAAqB;AACrB,qBAAqB;AACrB,iBAAiB;AACjB,qBAAqB;AACrB,uBAAuB;AACvB,2BAA2B;AAC3B,4BAA4B;AAC5B,8BAA8B;AAC9B,mBAAmB;AACnB,kBAAkB;AAClB,iBAAiB;AACjB,8BAA8B;AAC9B,8BAA8B;AAC9B,kBAAkB;AAClB,2BAA2B;AAC3B,0BAA0B;AAC1B,mCAAmC;AACnC,6BAA6B;AAC7B,8BAA8B;AAC9B,kBAAkB;AAClB,eAAe;AACf,mBAAmB;AACnB,kBAAkB;AAClB,6BAA6B;AAC7B,8BAA8B;AAC9B,kBAAkB;AAClB,cAAc;AACd,kBAAkB;AAClB,oBAAoB;AACpB,sBAAsB;AACtB,8BAA8B;AAC9B,+BAA+B;AAC/B,yBAAyB;AACzB,2BAA2B;AAC3B,eAAe;AACf,gBAAgB;AAChB,eAAe;AACf,cAAc;AACd,8BAA8B;AAC9B,4BAA4B;AAC5B,uBAAuB;AACvB,sBAAsB;AACtB,uBAAuB;AACvB,oCAAoC;;;;;;;;;;;;ACr8evB;;AAEb,8CAA6C,EAAE,aAAa,EAAC;;AAE7D;AACA,QAAQ,oCAAoC;;AAE5C,eAAe;AACf,eAAe;AACf,gBAAgB;AAChB,kBAAe;AACf,aAAa;;;;;;;;;;;;;;;;;;;;ACXb;AACA,QAAQ,oCAAoC;;AAE0B;;;;;;;;;;;ACHtE,oBAAoB,mBAAO,CAAC,iFAAsB;;AAElD;;;;;;;;;;;ACFA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;;;;;;;;;;ACdA,kBAAkB,mBAAO,CAAC,yEAAgB;AAC1C,qBAAqB,mBAAO,CAAC,+EAAmB;AAChD,oBAAoB,mBAAO,CAAC,uEAAe;AAC3C,gBAAgB,mBAAO,CAAC,qEAAc;AACtC,kBAAkB,mBAAO,CAAC,yEAAgB;AAC1C,aAAa,mBAAO,CAAC,+DAAW;AAChC,iBAAiB,mBAAO,CAAC,uEAAe;;AAExC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;;;;;ACjEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;ACTA,kBAAkB,mBAAO,CAAC,yEAAgB;;AAE1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;;;;;;;;;;AC3BA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;;;;;;;;;;ACZA,qBAAqB,mBAAO,CAAC,+EAAmB;;AAEhD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;AC1BA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;;;;;;;;;;ACZA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,sCAAsC,kBAAkB;AACxD;;AAEA;;;;;;;;;;;ACrCA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,WAAW;;AAE7B;AACA,iBAAiB,WAAW;;AAE5B;AACA;;AAEA;AACA;AACA,mBAAmB,WAAW,IAAI,cAAc;AAChD;;AAEA,iBAAiB,WAAW,GAAG,0DAA0D,oBAAoB,OAAO;;AAEpH;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,qBAAqB;;AAErF,kBAAkB,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;;AAEzD;AACA,8CAA8C,cAAc;AAC5D;AACA;;AAEA;;AAEA;AACA,uDAAuD,2BAA2B;AAClF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C,YAAY,gBAAgB;AACtE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,0CAA0C;AAC1C;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,qDAAqD;AACrD,qDAAqD;AACrD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC;AAChC;AACA;;AAEA;;AAEA,gCAAgC;AAChC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;AAChC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,mBAAmB;AAC/C;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC;AAChC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,oCAAoC;AACpC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,UAAU;AACV;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,cAAc,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ;AAC9D;AACA;;AAEA;;;;;;;;;;;ACjcA,YAAY,mBAAO,CAAC,oEAAmB;AACvC,oBAAoB,mBAAO,CAAC,mEAAe;;AAE3C;AACA;AACA;;AAEA,iCAAiC,SAAS;;;;;;;;;;;;ACP1C;AACY;;AAEZ;AACA,QAAQ,+BAA+B;AACvC;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B,yBAAsB;;;;;;;;;;;;ACZV;;AAEZ,kBAAkB;AAClB,mBAAmB;AACnB,qBAAqB;;AAErB;AACA;AACA;;AAEA;AACA,mCAAmC,SAAS;AAC5C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA2C,UAAU;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACrJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe;AACf;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA,CAAC,GAAG,EAAC;;;;;;;;;;;;ACnGL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEY;;AAEZ,eAAe,mBAAO,CAAC,oDAAW;AAClC,gBAAgB,mBAAO,CAAC,gDAAS;AACjC;AACA;AACA;AACA;;AAEA,cAAc;AACd,kBAAkB;AAClB,yBAAyB;;AAEzB;AACA,kBAAkB;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,YAAY;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;;AAEA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iDAAiD,EAAE;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,SAAS;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB,eAAe;AACxC;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,yBAAyB,QAAQ;AACjC;AACA,sBAAsB,eAAe;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB,sBAAsB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB;AACnB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;;AAEP;AACA,qBAAqB,WAAW,GAAG,IAAI;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,gBAAgB,WAAW,GAAG,IAAI,KAAK,aAAa;AACpD;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;;AAEA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,KAAK,mDAAmD,cAAc;AACzF,GAAG;AACH;AACA;AACA,+BAA+B,IAAI;AACnC;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,MAAM,aAAa,SAAS;AACtD;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA,SAAS,gBAAgB;AACzB,cAAc,oBAAoB,EAAE,IAAI;AACxC;AACA,YAAY,gBAAgB,EAAE,IAAI;AAClC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,GAAG,SAAS,GAAG,KAAK,qBAAqB,EAAE,EAAE;AACpE,QAAQ;AACR,yBAAyB,GAAG,KAAK,yBAAyB,EAAE,EAAE;AAC9D,mBAAmB,yBAAyB,EAAE,EAAE;AAChD;AACA,MAAM;AACN,oBAAoB,IAAI,EAAE,GAAG,SAAS,IAAI,EAAE,EAAE;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,0CAA0C,cAAc,SAAS,OAAO;AACxE;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,YAAY;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,gBAAgB;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc,YAAY;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;ACzjEA;AACA;AACa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,UAAU;AACb;;;;;;;;;;;ACzBA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD,UAAU;AACV;AACA,UAAU;AACV,8EAA8E;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,qBAAqB;AACnD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,uCAAuC,0BAA0B;AACjE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,0BAA0B,eAAe;AACxE;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iDAAiD,aAAa;;AAE9D;;AAEA,CAAC,IAAI;AACL,CAAC;;;;;;;;;;;;ACnhBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB;;AAEnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,sBAAsB;AACxC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,eAAe;AACf;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;;AAEA,kCAAkC,QAAQ;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,QAAQ;AACR;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;;AAEA;AACA,SAAS,yBAAyB;AAClC;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,8DAA8D,YAAY;AAC1E;AACA,8DAA8D,YAAY;AAC1E;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,qCAAqC,YAAY;AACjD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;;;;;;;;;;;;AChfY;;AAEZ;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,8BAA8B;;AAE9B;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;;AAEA,eAAe,OAAO;AACtB;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;;AAEA;AACA;;AAEA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,eAAe;AACf;AACA;;AAEA;;AAEA;;AAEA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,UAAU,6BAA6B;AACvC;AACA;AACA,UAAU;AACV;AACA;AACA,UAAU;AACV;AACA;AACA,QAAQ;AACR,+BAA+B;AAC/B;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,wCAAwC;AACxC,iBAAiB,uBAAuB;AACxC;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA,yBAAyB;AACzB,OAAO;AACP;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY;AACZ;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,IAAI;AACJ;AACA,0BAA0B,EAAE;AAC5B,IAAI;AACJ;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,eAAe;AAC1B,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA,KAAK,WAAW;AAChB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,0CAA0C;AAC1C;AACA;AACA;AACA,0BAA0B;;AAE1B;AACA;;AAEA;;AAEA;;AAEA;;;;;;;;;;;ACvZA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS,WAAW;;AAEpB;AACA;AACA;AACA,SAAS,WAAW;;AAEpB;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA,SAAS,WAAW;;AAEpB;AACA;AACA,SAAS,UAAU;;AAEnB;AACA;;;;;;;;;;;;ACpFa;AACb;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,aAAa,mBAAO,CAAC,sFAAqB;AAC1C,aAAa,mBAAO,CAAC,gFAAkB;AACvC,aAAa,mBAAO,CAAC,kGAA2B;AAChD,aAAa,mBAAO,CAAC,0FAAuB;AAC5C,aAAa,mBAAO,CAAC,sFAAqB;AAC1C,aAAa,mBAAO,CAAC,0GAA+B;AACpD,aAAa,mBAAO,CAAC,oEAAY;AACjC;;;;;;;;;;;ACvBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qBAAqB;AACrB,mBAAO,CAAC,iFAAsB;AAC9B,mCAAmC,mBAAO,CAAC,kFAA0B;AACrE,qBAAqB,mBAAO,CAAC,4EAAc;AAC3C,8BAA8B,mBAAO,CAAC,8FAAuB;AAC7D,kCAAkC,mBAAO,CAAC,sGAA2B;AACrE,eAAe,mBAAO,CAAC,gEAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA,oGAAoG,sBAAsB;AAC1H;AACA;AACA;AACA,oHAAoH,sBAAsB;AAC1I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA,qGAAqG,sBAAsB;AAC3H;AACA;AACA;AACA,+GAA+G,sBAAsB;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,gBAAgB,6BAA6B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0HAA0H,kBAAkB;AAC5I;AACA,yEAAyE,YAAY,0BAA0B;AAC/G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,eAAe,SAAS;AACxB;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK,KAAK,yBAAyB;AACnD;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAK,KAAK,yBAAyB;AACnD;AACA;AACA;AACA;AACA,kGAAkG,IAAI,MAAM,yBAAyB;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,sBAAsB,qCAAqC;AAC3I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,sBAAsB,cAAc;AACpH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,sBAAsB,uBAAuB;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,eAAe,eAAe;AAC9B;AACA,yBAAyB,uCAAuC;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,YAAY,wBAAwB;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,YAAY,gBAAgB,+BAA+B;AAC5H;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,YAAY,wBAAwB;AACrG;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,eAAe,QAAQ;AACvB;AACA,oCAAoC,gBAAgB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,mBAAmB,oBAAoB;AACpH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,mBAAmB,iBAAiB;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,eAAe,6BAA6B;AAC5C,eAAe,gBAAgB;AAC/B,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA,sEAAsE,wBAAwB,oBAAoB;AAClH;AACA;AACA;AACA,qGAAqG,KAAK,OAAO,mEAAmE,KAAK,iEAAiE;AAC1P;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,eAAe,eAAe;AAC9B;AACA,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0FAA0F,IAAI,MAAM,6BAA6B;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F,MAAM;AACpG;AACA;AACA;AACA;AACA,6FAA6F,aAAa;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mGAAmG,MAAM;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sGAAsG,MAAM;AAC5G;AACA;AACA,oGAAoG,MAAM;AAC1G;AACA;AACA;AACA;AACA;AACA,sGAAsG,IAAI,MAAM;AAChH,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,IAAI,MAAM;AAC5H,kDAAkD;AAClD;AACA;AACA;AACA,8GAA8G,IAAI,MAAM,MAAM;AAC9H;AACA;AACA,mHAAmH,IAAI,MAAM,MAAM;AACnI;AACA;AACA;AACA;AACA;AACA;AACA,gGAAgG,IAAI,MAAM,sBAAsB;AAChI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0HAA0H,IAAI,MAAM,sBAAsB;AAC1J;AACA;AACA;AACA,0HAA0H,IAAI,MAAM,sBAAsB;AAC1J;AACA;AACA;AACA,+HAA+H,IAAI,MAAM,sBAAsB;AAC/J;AACA;AACA;AACA,wHAAwH,IAAI,MAAM,sBAAsB;AACxJ;AACA;AACA,8HAA8H,IAAI,MAAM;AACxI,8DAA8D;AAC9D;AACA;AACA;AACA;AACA,2IAA2I,IAAI,MAAM,YAAY;AACjK;AACA;AACA,4HAA4H,0BAA0B;AACtJ;AACA;AACA;AACA;AACA;AACA,8HAA8H,IAAI,MAAM,YAAY;AACpJ;AACA;AACA;AACA;AACA,iIAAiI,IAAI;AACrI,GAAG,YAAY,SAAS,aAAa;AACrC;AACA;AACA,2HAA2H,IAAI;AAC/H;AACA;AACA;AACA;AACA;AACA;AACA,8GAA8G,IAAI,MAAM,yBAAyB;AACjJ,sBAAsB,sCAAsC;AAC5D;AACA;AACA;AACA;AACA,2JAA2J,IAAI;AAC/J;AACA;AACA,8GAA8G,IAAI,MAAM,eAAe;AACvI,iBAAiB,kCAAkC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wHAAwH,IAAI,MAAM,sBAAsB;AACxJ;AACA;AACA,6GAA6G,IAAI,MAAM,sBAAsB;AAC7I;AACA;AACA;AACA;AACA,0HAA0H,IAAI,MAAM,sBAAsB;AAC1J;AACA;AACA;AACA;AACA,oHAAoH,IAAI,MAAM,sBAAsB;AACpJ;AACA;AACA;AACA;AACA;AACA,2FAA2F,IAAI,MAAM,MAAM;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,WAAW;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,eAAe,eAAe;AAC9B,gBAAgB,6BAA6B;AAC7C,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gFAAgF,cAAc,uBAAuB,iBAAiB;AACtI;AACA,8FAA8F,cAAc,sHAAsH;AAClO;AACA;AACA;AACA;AACA;AACA,iEAAiE,YAAY,+EAA+E,cAAc,oGAAoG;AAC9Q,8CAA8C;AAC9C;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA,wBAAwB;AACxB,gBAAgB,wJAAwJ;AACxK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oHAAoH,cAAc,mFAAmF,qBAAqB,oBAAoB,GAAG;AACjQ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,6FAA6F,cAAc,sMAAsM,qBAAqB,wBAAwB,oBAAoB;AAClX;AACA;AACA;AACA,aAAa,6FAA6F;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,gBAAgB;AACvE;AACA;AACA;AACA,yCAAyC,uCAAuC;AAChF,oDAAoD,gBAAgB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,gBAAgB;AAC5D;AACA;AACA;AACA;AACA,wHAAwH,QAAQ;AAChI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+EAA+E,IAAI,IAAI,UAAU;AACjG;AACA;AACA;AACA,uFAAuF,IAAI;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;;;;;;;;;;ACrwBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB,GAAG,kBAAkB;AACxC;AACA;AACA;AACA;AACA,+CAA+C,kBAAkB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,wCAAwC,mBAAmB,KAAK;AACjE;;;;;;;;;;;AChFa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,2BAA2B;AAC3B,mBAAO,CAAC,iFAAsB;AAC9B,qBAAqB,mBAAO,CAAC,4EAAc;AAC3C,2BAA2B,mBAAO,CAAC,qEAAkB;AACrD,mCAAmC,mBAAO,CAAC,kFAA0B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D,uBAAuB,+BAA+B,GAAG;AACvH;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,oFAAoF,UAAU;AAC9F;AACA;AACA;AACA,mEAAmE,gBAAgB;AACnF;AACA;AACA;AACA,2BAA2B;AAC3B;;;;;;;;;;;AC1Da;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D;;;;;;;;;;;ACFa;AACb;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D;;;;;;;;;;;ACHa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,4BAA4B,GAAG,+BAA+B;AAC9D,mCAAmC,mBAAO,CAAC,kFAA0B;AACrE,qBAAqB,mBAAO,CAAC,4EAAc;AAC3C,eAAe,mBAAO,CAAC,gEAAQ;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB;AACA,eAAe,gBAAgB;AAC/B,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4FAA4F,KAAK,gBAAgB,MAAM;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8FAA8F,KAAK,MAAM,6BAA6B;AACtI;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;;;;;;;;;;;AC5Ka;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,YAAY;AACZ;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,6BAA6B;AAC5C,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,6BAA6B;AAC5C,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;;;;;;;;;;AC7Pa;AACb;AACA;AACA;AACA;AACA,eAAe,oCAAoC;AACnD;AACA;AACA,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,aAAa,mBAAO,CAAC,sFAAoB;AACzC;;;;;;;;;;;ACjBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,gBAAgB,QAAQ,2BAA2B;AACjG;AACA;AACA;AACA,gEAAgE,mBAAmB;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;;;;;;;;;;;AC5Ca;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB;AACpB;AACA,eAAe,mBAAO,CAAC,wEAAmB;AAC1C,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,0BAA0B,mBAAO,CAAC,gHAAiB;AACnD,iCAAiC,mBAAO,CAAC,gIAAuC;AAChF,gCAAgC,mBAAO,CAAC,8HAAsC;AAC9E,sCAAsC,mBAAO,CAAC,0IAA4C;AAC1F,gCAAgC,mBAAO,CAAC,8HAAsC;AAC9E,qCAAqC,mBAAO,CAAC,wJAAmD;AAChG,mCAAmC,mBAAO,CAAC,oJAAiD;AAC5F,gCAAgC,mBAAO,CAAC,8IAA8C;AACtF,sCAAsC,mBAAO,CAAC,0JAAoD;AAClG,kCAAkC,mBAAO,CAAC,kJAAgD;AAC1F,kCAAkC,mBAAO,CAAC,kJAAgD;AAC1F,6CAA6C,mBAAO,CAAC,wKAA2D;AAChH,mCAAmC,mBAAO,CAAC,oJAAiD;AAC5F,yBAAyB,mBAAO,CAAC,sFAAkB;AACnD,eAAe,mBAAO,CAAC,kEAAQ;AAC/B,2BAA2B,mBAAO,CAAC,qEAAkB;AACrD,wCAAwC,mBAAO,CAAC,8JAAsD;AACtG;AACA,kEAAkE,iBAAiB;AACnF;AACA;AACA;AACA,gBAAgB,0BAA0B;AAC1C;AACA;AACA,kFAAkF,cAAc;AAChG,sCAAsC,uEAAuE;AAC7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+FAA+F,UAAU;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,2GAA2G,WAAW,KAAK,QAAQ;AACnI;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,gDAAgD;AAChD;AACA,8BAA8B,wBAAwB;AACtD;AACA;AACA;AACA,eAAe,qBAAqB;AACpC,gBAAgB,YAAY;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D,0BAA0B;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,qBAAqB;AAC3D;AACA,eAAe,OAAO;AACtB;AACA,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,2EAA2E;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF,MAAM;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kFAAkF,qBAAqB;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,qBAAqB;AACnD,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,gBAAgB,UAAU,mCAAmC,GAAG;AAChE;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,8BAA8B;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA,4BAA4B,OAAO;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sKAAsK;AACtK;AACA,qCAAqC,4DAA4D;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,0BAA0B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;;;;;;;;;;;ACjea;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,sBAAsB;AACtB,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,qBAAqB,mBAAO,CAAC,oGAAsC;AACnE,sBAAsB,mBAAO,CAAC,gFAAe;AAC7C,uBAAuB,mBAAO,CAAC,kFAAgB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,uFAAuF;AAChK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oHAAoH,iDAAiD,IAAI;AACzK;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,yBAAyB;AACxC,eAAe,SAAS;AACxB,gBAAgB,kCAAkC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA;AACA;AACA;AACA;AACA,kFAAkF,cAAc,iCAAiC,0BAA0B;AAC3J;AACA;AACA;AACA,iFAAiF,eAAe,+BAA+B,0BAA0B;AACzJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB,eAAe,QAAQ;AACvB,gBAAgB,kCAAkC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,kCAAkC;AAC1E;AACA;AACA;AACA;AACA;AACA,qEAAqE;AACrE;AACA,iDAAiD;AACjD;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,mBAAmB;AAChC;AACA;AACA,gBAAgB,UAAU,iDAAiD,GAAG;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2EAA2E;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA,gDAAgD,8CAA8C;AAC9F,eAAe,QAAQ;AACvB,iBAAiB,iBAAiB,cAAc,iBAAiB,IAAI;AACrE,sEAAsE,8CAA8C;AACpH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,8CAA8C;AAC9F,eAAe,QAAQ;AACvB,iBAAiB,iBAAiB,cAAc,iBAAiB,IAAI;AACrE,sEAAsE,8CAA8C;AACpH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,uCAAuC;AACvF,eAAe,QAAQ;AACvB,kBAAkB,eAAe,uCAAuC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,sBAAsB;AACtB;;;;;;;;;;;AC3Va;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,YAAY;AACZ,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,2BAA2B,mBAAO,CAAC,kEAAkB;AACrD,gCAAgC,mBAAO,CAAC,8HAAsC;AAC9E;AACA,yBAAyB,mBAAO,CAAC,qEAAc;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA,kEAAkE,cAAc;AAChF;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yGAAyG,GAAG;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB;AACA,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,gBAAgB,qBAAqB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA,oCAAoC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qGAAqG,IAAI,eAAe,sBAAsB;AAC9I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4HAA4H,oBAAoB;AAChJ;AACA;AACA;AACA,wHAAwH,2BAA2B;AACnJ;AACA;AACA;AACA;AACA,qJAAqJ,oBAAoB;AACzK;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yHAAyH,oBAAoB;AAC7I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4IAA4I;AAC5I,kDAAkD;AAClD;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA,mIAAmI,sBAAsB;AACzJ;AACA;AACA;AACA,mFAAmF;AACnF;AACA,oIAAoI,sBAAsB;AAC1J;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA,2HAA2H,0BAA0B;AACrJ;AACA;AACA;AACA,wGAAwG,0BAA0B;AAClI;AACA;AACA,gGAAgG,kBAAkB,KAAK,UAAU;AACjI;AACA;AACA;AACA;AACA,wGAAwG;AACxG;AACA;AACA;AACA;AACA,kIAAkI,IAAI;AACtI;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mIAAmI,IAAI;AACvI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mGAAmG,MAAM;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iGAAiG,KAAK;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+GAA+G,SAAS;AACxH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iFAAiF,IAAI;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,yBAAyB;AACxC;AACA,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,SAAS;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe,WAAW;AAC1B,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,yBAAyB;AACxC,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,WAAW;AAC1B,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4GAA4G,SAAS,GAAG,UAAU;AAClI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,SAAS;AACxB,eAAe,yBAAyB;AACxC;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mBAAmB;AACnC,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,yBAAyB;AACxC;AACA,gBAAgB,SAAS,iBAAiB,GAAG;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB,SAAS;AACzB;AACA;AACA,4BAA4B,QAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,gBAAgB,QAAQ;AACxB;AACA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA,uGAAuG,cAAc;AACrH;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,oCAAoC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,OAAO;AACvC,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yGAAyG,IAAI;AAC7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;;;;;;;;;;AC54Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD;AACxD;AACA;AACA;AACA,kCAAkC;AAClC;;;;;;;;;;;ACpDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,gCAAgC,mBAAO,CAAC,+HAAuC;AAC/E,eAAe,mBAAO,CAAC,mEAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mHAAmH,iBAAiB;AACpI;AACA;AACA,wGAAwG,iBAAiB;AACzH;AACA;AACA;AACA;AACA;AACA,qKAAqK,MAAM;AAC3K;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA,6BAA6B;AAC7B;;;;;;;;;;;ACtEa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,2CAA2C;AAC1F;AACA;AACA;AACA,qGAAqG,sBAAsB;AAC3H;AACA,sBAAsB;AACtB;AACA;AACA,oDAAoD;AACpD;AACA;AACA,gCAAgC;AAChC;;;;;;;;;;;AC/Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,4BAA4B;AAC5B,gCAAgC,mBAAO,CAAC,+HAAuC;AAC/E,eAAe,mBAAO,CAAC,mEAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;AACA;AACA,uFAAuF;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA,4BAA4B;AAC5B;;;;;;;;;;;AC7Da;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,8BAA8B;AAC9B,eAAe,mBAAO,CAAC,mEAAS;AAChC,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAO;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAA+D;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;;;;;;;;;;AC/Ha;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,qCAAqC,mBAAO,CAAC,iJAAgD;AAC7F,gCAAgC,mBAAO,CAAC,uIAA2C;AACnF,mCAAmC,mBAAO,CAAC,6IAA8C;AACzF,+BAA+B,mBAAO,CAAC,qIAA0C;AACjF,eAAe,mBAAO,CAAC,mEAAS;AAChC;AACA;AACA,oBAAoB,wBAAwB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iBAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB,UAAU,aAAa,4BAA4B,oCAAoC;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,cAAc;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,QAAQ;AACxC,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;;;;;;;;;;AC5La;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;;;;;;;;;;;ACzBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,eAAe,mBAAO,CAAC,mEAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B,eAAe,MAAM;AACrB,eAAe,OAAO;AACtB,eAAe,QAAQ;AACvB,eAAe,MAAM;AACrB,eAAe,MAAM;AACrB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,gBAAgB,eAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2GAA2G,yDAAyD;AACpK;AACA;AACA;AACA,wCAAwC,wCAAwC;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sIAAsI,uCAAuC;AAC7K;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA,+DAA+D,QAAQ;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sFAAsF,wCAAwC;AAC9H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gIAAgI,IAAI;AACpI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;;;;;;;;;;AC/Ka;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;;;;;;;;;;;ACxBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,qCAAqC;AACrC,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+GAA+G,sBAAsB;AACrI;AACA;AACA;AACA;AACA,qCAAqC;AACrC;;;;;;;;;;;ACrBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,kCAAkC;AAClC,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;;;;;;;;;;;ACpCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;;;;;ACjBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,6BAA6B;AAC7B,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uIAAuI,aAAa;AACpJ;AACA;AACA;AACA,sGAAsG,MAAM;AAC5G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8IAA8I,gBAAgB;AAC9J;AACA;AACA;AACA,yGAAyG;AACzG,uDAAuD,SAAS,MAAM;AACtE;AACA;AACA;AACA;AACA;AACA;AACA,kIAAkI,MAAM;AACxI;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;;;;;;;;;;;ACzDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mCAAmC;AACnC,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wGAAwG,MAAM;AAC9G;AACA;AACA;AACA,uHAAuH,sBAAsB;AAC7I;AACA;AACA,sHAAsH,sBAAsB;AAC5I;AACA;AACA;AACA;AACA,mCAAmC;AACnC;;;;;;;;;;;AC3Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,+BAA+B;AAC/B,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8GAA8G,IAAI,MAAM,MAAM;AAC9H;AACA;AACA,iHAAiH,IAAI;AACrH;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;;;;;;;;;;;ACvBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,+BAA+B;AAC/B,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D,eAAe,mBAAO,CAAC,sEAAY;AACnC,gCAAgC,mBAAO,CAAC,kHAA0B;AAClE,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wGAAwG,QAAQ;AAChH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6GAA6G,wBAAwB,sEAAsE;AAC3M;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;;;;;;;;;;;AC7Ea;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,0CAA0C;AAC1C,gCAAgC,mBAAO,CAAC,4EAAuB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2GAA2G,IAAI,gBAAgB,MAAM;AACrI;AACA;AACA;AACA,mEAAmE,IAAI,gBAAgB,MAAM;AAC7F;AACA;AACA;AACA;AACA;AACA,gBAAgB,oFAAoF;AACpG;AACA,kBAAkB,sFAAsF;AACxG;AACA;AACA;AACA,0CAA0C;AAC1C;;;;;;;;;;;ACpDa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gCAAgC;AAChC,8BAA8B,mBAAO,CAAC,qHAAuB;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;;;;;;;;;;;ACrCY;;AAEZ,QAAQ,gBAAgB,EAAE,mBAAO,CAAC,2HAAwB;AAC1D,QAAQ,oBAAoB,EAAE,mBAAO,CAAC,iHAAmB;AACzD,QAAQ,sDAAsD,EAAE,mBAAO,CAAC,kHAAS;AACjF,YAAY,mBAAO,CAAC,kIAAiB;AACrC,QAAQ,uBAAuB;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,IAAI;AACJ,2CAA2C,qJAA2C;AACtF;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACnDY;;AAEZ,QAAQ,2EAA2E,EAAE,mBAAO,CAAC,2HAAwB;AACrH,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,QAAQ,UAAU,EAAE,mBAAO,CAAC,6GAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,GAAG;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;AC5JY;;AAEZ,QAAQ,WAAW,EAAE,mBAAO,CAAC,wHAAY;AACzC,eAAe,mBAAO,CAAC,oHAAU;AACjC,QAAQ,YAAY,EAAE,mBAAO,CAAC,sHAAW;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,kHAAS;AACrB;AACA;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,iHAAmB;AAC/B,YAAY,mBAAO,CAAC,kIAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,EAAE;AACnD;AACA;AACA,iDAAiD,EAAE;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjMY;;AAEZ;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;;AAEA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,EAAE,EAAE,mBAAO,CAAC,iHAAmB;AAC/B,QAAQ,SAAS,EAAE,mBAAO,CAAC,2HAAwB;AACnD,QAAQ,yDAAyD,EAAE,mBAAO,CAAC,kHAAS;AACpF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEY;;AAEZ;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,2HAAwB;AACpC;AACA,iBAAiB,mBAAO,CAAC,wHAAY;AACrC,iBAAiB,mBAAO,CAAC,wHAAY;AACrC;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mBAAO,CAAC,0HAAa;AACrC;AACA;AACA;;;;;;;;;;;AC9IA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;;AAEA,CAAC;AACD,qBAAqB,mBAAO,CAAC,8CAAQ;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,kHAAS;AACrB,YAAY,mBAAO,CAAC,kIAAiB;AACrC;AACA;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,iHAAmB;AAC/B,QAAQ,YAAY,EAAE,mBAAO,CAAC,sHAAW;AACzC,eAAe,mBAAO,CAAC,oHAAU;AACjC,iBAAiB,mBAAO,CAAC,wHAAY;AACrC,iBAAiB,mBAAO,CAAC,wHAAY;AACrC,QAAQ,wBAAwB,EAAE,mBAAO,CAAC,6GAAiB;AAC3D,aAAa,mBAAO,CAAC,gHAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,2GAA2C;AACjG,QAAQ,wBAAwB,EAAE,mBAAO,CAAC,2HAAwB;;AAElE;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,YAAY,+BAA+B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,qBAAqB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS,GAAG,mBAAmB;AAC/B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACzXA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;;AAEA,CAAC;AACD,QAAQ,oBAAoB,EAAE,mBAAO,CAAC,iHAAmB;AACzD,QAAQ,mDAAmD;AAC3D,QAAQ,qBAAqB,EAAE,mBAAO,CAAC,6GAAiB;AACxD,QAAQ,yEAAyE,EAAE,mBAAO,CAAC,qHAAe;AAC1G,QAAQ,+CAA+C,EAAE,mBAAO,CAAC,2HAAwB;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,kHAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,MAAM;AACN,6CAA6C,qJAA2C;AACxF;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,MAAM;AACN,6CAA6C,qJAA2C;AACxF;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA,uBAAuB;;;;;;;;;;;;AC3RX;;AAEZ;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;;AAEA,QAAQ,4DAA4D,EAAE,mBAAO,CAAC,2HAAwB;AACtG,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,QAAQ,+CAA+C,EAAE,8IAAkC;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjGY;;AAEZ,QAAQ,qCAAqC,EAAE,mBAAO,CAAC,2HAAwB;AAC/E,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,+CAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACxFY;;AAEZ,sDAAsD,2GAA2C;AACjG;AACA,WAAW,iFAAiF;AAC5F;AACA,EAAE,EAAE,mBAAO,CAAC,iHAAmB;AAC/B,QAAQ,uDAAuD,EAAE,mBAAO,CAAC,qHAAe;AACxF,qBAAqB,yJAAwC;AAC7D,+BAA+B,yJAAwC;AACvE,QAAQ,WAAW,EAAE,mBAAO,CAAC,kIAAiB;AAC9C,sBAAsB,mBAAO,CAAC,sHAAW;AACzC,QAAQ,2BAA2B,EAAE,mBAAO,CAAC,wIAAoB;AACjE,QAAQ,2BAA2B,EAAE,mBAAO,CAAC,kHAAS;AACtD,QAAQ,YAAY,EAAE,mBAAO,CAAC,6GAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,2HAAwB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,mJAAyC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACxcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEY;;AAEZ,QAAQ,uBAAuB,EAAE,mBAAO,CAAC,2HAAwB;AACjE;AACA,kBAAkB,mBAAO,CAAC,0HAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtCA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;;AAEA,CAAC;AACD,QAAQ,4DAA4D,EAAE,mBAAO,CAAC,2HAAwB;AACtG,YAAY,mBAAO,CAAC,kIAAiB;AACrC,QAAQ,OAAO,EAAE,mBAAO,CAAC,6GAAiB;AAC1C,oBAAoB,mBAAO,CAAC,sHAAW;AACvC,eAAe,mBAAO,CAAC,oHAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,EAAE,EAAE,mBAAO,CAAC,iHAAmB;AAC/B,QAAQ,wCAAwC,EAAE,mBAAO,CAAC,qHAAe;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,kHAAS;AACrB,sDAAsD,2GAA2C;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,mBAAO,CAAC,wHAAY;AACnC;AACA;AACA;AACA,wDAAwD,KAAK;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,uDAAuD,KAAK;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,qJAA2C;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,2EAA2E,MAAM;AACjF;AACA,QAAQ;AACR;AACA;AACA,wBAAwB,mBAAO,CAAC,8HAAe;AAC/C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,WAAW;AACX,UAAU;AACV;AACA;AACA;AACA;AACA,WAAW;AACX,UAAU;AACV;AACA;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,KAAK;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtdA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,2HAAwB;AACpC;AACA;AACA,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,+CAAQ;AAC7C,QAAQ,0BAA0B,EAAE,mBAAO,CAAC,oHAAU;AACtD,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,wIAAoB;AACvD,YAAY,mBAAO,CAAC,kIAAiB;AACrC,YAAY,6IAAmC;AAC/C;AACA,CAAC;AACD,mBAAmB,mBAAO,CAAC,8HAAe;AAC1C,oBAAoB,mBAAO,CAAC,sHAAW;AACvC,QAAQ,4CAA4C,EAAE,mBAAO,CAAC,kHAAS;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,EAAE,EAAE,mBAAO,CAAC,iHAAmB;AAC/B,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,qHAAe;AAClD;AACA,QAAQ,gBAAgB,EAAE,mBAAO,CAAC,gHAAgB;AAClD,aAAa,mBAAO,CAAC,gHAAQ;AAC7B;AACA;AACA;AACA,QAAQ,iBAAiB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,mBAAO,CAAC,oHAAU;;AAEpF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,mBAAO,CAAC,oHAAU;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;;ACvwCY;;AAEZ,QAAQ,6BAA6B,EAAE,mBAAO,CAAC,2HAAwB;AACvE,QAAQ,kBAAkB,EAAE,mBAAO,CAAC,qHAAe;AACnD,QAAQ,wBAAwB,EAAE,8IAAkC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,UAAU;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,aAAa;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEY;;AAEZ,QAAQ,+BAA+B,EAAE,mBAAO,CAAC,2HAAwB;AACzE;AACA,QAAQ,6BAA6B,EAAE,8IAAkC;AACzE,eAAe,mBAAO,CAAC,oHAAU;AACjC,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,kHAAS;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACnLY;;AAEZ,QAAQ,iDAAiD,EAAE,mBAAO,CAAC,2HAAwB;;AAE3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACxUA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,2HAAwB;AACpC;AACA;AACA,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,+CAAQ;AAC7C,eAAe,kJAA0B;AACzC,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,oBAAoB,mBAAO,CAAC,sHAAW;AACvC,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,wIAAoB;AACvD,QAAQ,4CAA4C,EAAE,mBAAO,CAAC,kHAAS;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,8IAAkC;AACtC,QAAQ,iBAAiB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,mBAAO,CAAC,oHAAU;;AAEpF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,mBAAO,CAAC,oHAAU;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,0BAA0B,0BAA0B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B;AAC/D;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU,sCAAsC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,qBAAqB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,cAAc,4BAA4B;AAC1C;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,8BAA8B;AACpD;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AChzBA;;AAEY;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,wHAAqB;AACjC;AACA;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,8GAAgB;AAC5B,QAAQ,oBAAoB,EAAE,mBAAO,CAAC,0GAAc;AACpD,QAAQ,qCAAqC,EAAE,uIAA6B;AAC5E;;AAEA;AACA,WAAW,GAAG;AACd,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA,WAAW,GAAG;AACd,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA,yEAAyE,KAAK,QAAQ,IAAI;AAC1F,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,KAAK,QAAQ,IAAI;AAC5D;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,gBAAgB;AAC3B,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,KAAK,QAAQ,IAAI;AAC5D;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,IAAI,OAAO,EAAE,yCAAyC,EAAE,oBAAoB,IAAI,OAAO;AACpH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,KAAK;AAChB;;AAEA,WAAW,eAAe;AAC1B;AACA;AACA;AACA,mEAAmE,EAAE;AACrE;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,iBAAiB;AAC5B;AACA;AACA;;AAEA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,qBAAqB;AAChC;AACA;AACA,kBAAkB,kBAAkB;AACpC,gCAAgC,KAAK,GAAG,EAAE;AAC1C;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,sBAAsB;AACjC;AACA;AACA,kBAAkB,kBAAkB;AACpC,iCAAiC,KAAK,GAAG,EAAE;AAC3C;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,0BAA0B;AACrC;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA,2BAA2B,KAAK,GAAG,EAAE;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA,2FAA2F,OAAO;AAClG;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB;;AAEA,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,kBAAkB;AAC7B;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,uBAAuB;AAClC;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,mBAAmB;AAC9B;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,KAAK;AAChB;AACA;AACA;AACA,8CAA8C,+BAA+B;AAC7E;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C,MAAM,gBAAgB;;AAElE;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,aAAa;AACzE;AACA;AACA;;AAEA;AACA,WAAW,KAAK;AAChB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,aAAa;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjhBY;;AAEZ,qBAAqB,mBAAO,CAAC,oGAAW;AACxC,iBAAiB,mBAAO,CAAC,sHAAoB;AAC7C;AACA;;AAEA;AACA,kCAAkC;AAClC,4BAA4B;AAC5B,0BAA0B;AAC1B,wBAAwB;AACxB,yBAAyB;AACzB,uBAAuB;AACvB,uBAAuB;AACvB,qBAAqB;AACrB,wBAAwB;AACxB,0BAA0B;AAC1B,6BAA6B;AAC7B,uBAAuB;AACvB,sBAAsB;AACtB,sBAAsB;AACtB,uBAAuB;AACvB,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,qBAAqB;;AAErB;AACA,yBAAsB;;;;;;;;;;;;AClCV;;AAEZ,QAAQ,wDAAwD,EAAE,mBAAO,CAAC,oGAAQ;;AAElF;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS,gBAAgB;AACzB,cAAc,oBAAoB,EAAE,IAAI;AACxC;AACA,YAAY,gBAAgB,EAAE,IAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM,iCAAiC,YAAY,sCAAsC,WAAW;AACnH;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM,iCAAiC,YAAY,sCAAsC,eAAe;AACrH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW,GAAG,KAAK,KAAK,aAAa;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,WAAW,GAAG,KAAK,KAAK,aAAa;AACvD,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB,MAAM;AACN,iBAAiB,KAAK,IAAI,8CAA8C;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,SAAS;AACrC;AACA;AACA,gCAAgC,UAAU,KAAK,SAAS;AACxD;AACA;AACA;AACA,gCAAgC,iBAAiB,OAAO,KAAK;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,aAAa;AAChD;AACA;AACA,mCAAmC,cAAc,KAAK,aAAa;AACnE;AACA;AACA;AACA,mCAAmC,qBAAqB,OAAO,KAAK;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA,yBAAyB,UAAU,KAAK,SAAS;AACjD;AACA;AACA;AACA,yBAAyB,iBAAiB,OAAO,KAAK;AACtD;AACA;AACA;AACA,2BAA2B,OAAO;AAClC,MAAM;AACN,oCAAoC,YAAY;AAChD,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,wBAAwB;AACpE,QAAQ;AACR;AACA;AACA,SAAS;AACT,6BAA6B,UAAU;AACvC;AACA,MAAM;AACN;AACA;AACA,OAAO;AACP;AACA,uBAAuB,uBAAuB;AAC9C;AACA,gCAAgC,eAAe,GAAG,UAAU;AAC5D;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM,GAAG,KAAK,IAAI,OAAO,aAAa,UAAU;AAClE,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,uBAAuB;AAChD,kBAAkB,aAAa;AAC/B,uBAAuB,OAAO,2BAA2B,KAAK,0BAA0B,KAAK;AAC7F,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,EAAE;AAClE;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA,sBAAsB,SAAS,MAAM,SAAS;AAC9C;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB,QAAQ,MAAM;AACtD;AACA;AACA;AACA,cAAc,KAAK;AACnB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,4BAA4B,IAAI,gCAAgC,MAAM,aAAa,SAAS;AAC5F,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACpVY;;AAEZ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;;;;;AC1GY;;AAEZ,qBAAqB,mBAAO,CAAC,8CAAQ;AACrC,QAAQ,wCAAwC,EAAE,mBAAO,CAAC,kHAAe;AACzE,8CAA8C,uGAAuC;AACrF,sDAAsD,2GAA2C;AACjG,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gEAAgE,cAAc;AAC9E;AACA;AACA,oBAAoB,mBAAmB;AACvC,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,kBAAkB,QAAQ;AAC1B,QAAQ;AACR;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,MAAM;AAC7B,YAAY,oDAAoD;AAChE,wBAAwB,MAAM;AAC9B;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA,IAAI,uFAAkC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;;;;;;;;;;;ACvM/B;;AAEA,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD,QAAQ,iDAAiD,EAAE,mBAAO,CAAC,uHAAoB;AACvF;AACA,eAAe;AACf,EAAE,EAAE,mBAAO,CAAC,yGAAa;AACzB,QAAQ,sDAAsD,EAAE,mBAAO,CAAC,2IAA8B;AACtG;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,6GAAe;AAC3B,gBAAgB,mBAAO,CAAC,uIAA4B;AACpD,QAAQ,mDAAmD,EAAE,mBAAO,CAAC,mIAA0B;AAC/F,QAAQ,WAAW,EAAE,mBAAO,CAAC,yIAA6B;AAC1D,QAAQ,YAAY,EAAE,mBAAO,CAAC,uIAA4B;AAC1D,YAAY,mBAAO,CAAC,mJAAkC;AACtD;AACA,iBAAiB,mBAAO,CAAC,qHAAmB;AAC5C,cAAc,mBAAO,CAAC,mIAA0B;AAChD,gBAAgB,kLAA4D;AAC5E;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAO,CAAC,yIAA6B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,kBAAkB,mBAAO,CAAC,yIAA6B;AACvD,gBAAgB,mBAAO,CAAC,qIAA2B;AACnD,mBAAmB,mBAAO,CAAC,2IAA8B;AACzD,qBAAqB,mBAAO,CAAC,+IAAgC;AAC7D;AACA,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,yJAAqC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC5IY;;AAEZ,QAAQ,6BAA6B,EAAE,mBAAO,CAAC,wHAAqB;AACpE,QAAQ,wCAAwC,EAAE,mBAAO,CAAC,oIAA2B;AACrF,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,0IAA8B;AACnE,QAAQ,WAAW,EAAE,mBAAO,CAAC,oJAAmC;AAChE,mBAAO,CAAC,8GAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;;;;;;;;;;AC1CA;AACA;AACA,aAAa,mBAAO,CAAC,8CAAQ;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE,cAAc;AAChB;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA,aAAa,2HAA6B;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,sCAAsC,sCAAsC;AACzG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;ACvSY;;AAEZ,QAAQ,gBAAgB,EAAE,mBAAO,CAAC,sGAAwB;AAC1D,QAAQ,oBAAoB,EAAE,mBAAO,CAAC,4FAAmB;AACzD,QAAQ,sDAAsD,EAAE,mBAAO,CAAC,6FAAS;AACjF,YAAY,mBAAO,CAAC,6GAAiB;AACrC,QAAQ,uBAAuB;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,IAAI;AACJ,2CAA2C,gIAA2C;AACtF;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACnDY;;AAEZ,QAAQ,2EAA2E,EAAE,mBAAO,CAAC,sGAAwB;AACrH,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,QAAQ,UAAU,EAAE,mBAAO,CAAC,wFAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,GAAG;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;;;;;;;;;;AC5JY;;AAEZ,QAAQ,WAAW,EAAE,mBAAO,CAAC,mGAAY;AACzC,eAAe,mBAAO,CAAC,+FAAU;AACjC,QAAQ,YAAY,EAAE,mBAAO,CAAC,iGAAW;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,6FAAS;AACrB;AACA;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,4FAAmB;AAC/B,YAAY,mBAAO,CAAC,6GAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,EAAE;AACnD;AACA;AACA,iDAAiD,EAAE;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjMY;;AAEZ;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;;AAEA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA,EAAE,EAAE,mBAAO,CAAC,4FAAmB;AAC/B,QAAQ,SAAS,EAAE,mBAAO,CAAC,sGAAwB;AACnD,QAAQ,yDAAyD,EAAE,mBAAO,CAAC,6FAAS;AACpF;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjSA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEY;;AAEZ;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,sGAAwB;AACpC;AACA,iBAAiB,mBAAO,CAAC,mGAAY;AACrC,iBAAiB,mBAAO,CAAC,mGAAY;AACrC;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mBAAO,CAAC,qGAAa;AACrC;AACA;AACA;;;;;;;;;;;AC9IA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;;AAEA,CAAC;AACD,qBAAqB,mBAAO,CAAC,8CAAQ;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,6FAAS;AACrB,YAAY,mBAAO,CAAC,6GAAiB;AACrC;AACA;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,4FAAmB;AAC/B,QAAQ,YAAY,EAAE,mBAAO,CAAC,iGAAW;AACzC,eAAe,mBAAO,CAAC,+FAAU;AACjC,iBAAiB,mBAAO,CAAC,mGAAY;AACrC,iBAAiB,mBAAO,CAAC,mGAAY;AACrC,QAAQ,wBAAwB,EAAE,mBAAO,CAAC,wFAAiB;AAC3D,aAAa,mBAAO,CAAC,2FAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,2GAA2C;AACjG,QAAQ,wBAAwB,EAAE,mBAAO,CAAC,sGAAwB;;AAElE;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,YAAY,+BAA+B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,WAAW;AACX,SAAS;AACT;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,qBAAqB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAmB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,SAAS,GAAG,mBAAmB;AAC/B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACzXA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;;AAEA,CAAC;AACD,QAAQ,oBAAoB,EAAE,mBAAO,CAAC,4FAAmB;AACzD,QAAQ,mDAAmD;AAC3D,QAAQ,qBAAqB,EAAE,mBAAO,CAAC,wFAAiB;AACxD,QAAQ,yEAAyE,EAAE,mBAAO,CAAC,gGAAe;AAC1G,QAAQ,+CAA+C,EAAE,mBAAO,CAAC,sGAAwB;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,6FAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,MAAM;AACN,6CAA6C,gIAA2C;AACxF;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,MAAM;AACN,6CAA6C,gIAA2C;AACxF;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA,uBAAuB;;;;;;;;;;;;AC3RX;;AAEZ;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;;AAEA,QAAQ,4DAA4D,EAAE,mBAAO,CAAC,sGAAwB;AACtG,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,QAAQ,+CAA+C,EAAE,yHAAkC;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,YAAY;AACZ;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjGY;;AAEZ,QAAQ,qCAAqC,EAAE,mBAAO,CAAC,sGAAwB;AAC/E,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,+CAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACxFY;;AAEZ,sDAAsD,2GAA2C;AACjG;AACA,WAAW,iFAAiF;AAC5F;AACA,EAAE,EAAE,mBAAO,CAAC,4FAAmB;AAC/B,QAAQ,uDAAuD,EAAE,mBAAO,CAAC,gGAAe;AACxF,qBAAqB,oIAAwC;AAC7D,+BAA+B,oIAAwC;AACvE,QAAQ,WAAW,EAAE,mBAAO,CAAC,6GAAiB;AAC9C,sBAAsB,mBAAO,CAAC,iGAAW;AACzC,QAAQ,2BAA2B,EAAE,mBAAO,CAAC,mHAAoB;AACjE,QAAQ,2BAA2B,EAAE,mBAAO,CAAC,6FAAS;AACtD,QAAQ,YAAY,EAAE,mBAAO,CAAC,wFAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,sGAAwB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,8HAAyC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,uCAAuC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACxcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEY;;AAEZ,QAAQ,uBAAuB,EAAE,mBAAO,CAAC,sGAAwB;AACjE;AACA,kBAAkB,mBAAO,CAAC,qGAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtCA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;;AAEA,CAAC;AACD,QAAQ,4DAA4D,EAAE,mBAAO,CAAC,sGAAwB;AACtG,YAAY,mBAAO,CAAC,6GAAiB;AACrC,QAAQ,OAAO,EAAE,mBAAO,CAAC,wFAAiB;AAC1C,oBAAoB,mBAAO,CAAC,iGAAW;AACvC,eAAe,mBAAO,CAAC,+FAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,EAAE,EAAE,mBAAO,CAAC,4FAAmB;AAC/B,QAAQ,wCAAwC,EAAE,mBAAO,CAAC,gGAAe;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,6FAAS;AACrB,sDAAsD,2GAA2C;AACjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,mBAAO,CAAC,mGAAY;AACnC;AACA;AACA;AACA,wDAAwD,KAAK;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,uDAAuD,KAAK;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,gIAA2C;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,oBAAoB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,2EAA2E,MAAM;AACjF;AACA,QAAQ;AACR;AACA;AACA,wBAAwB,mBAAO,CAAC,yGAAe;AAC/C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,WAAW;AACX,UAAU;AACV;AACA;AACA;AACA;AACA,WAAW;AACX,UAAU;AACV;AACA;AACA;AACA,gBAAgB,mBAAmB;AACnC;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,KAAK;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACtdA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,sGAAwB;AACpC;AACA;AACA,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,+CAAQ;AAC7C,QAAQ,0BAA0B,EAAE,mBAAO,CAAC,+FAAU;AACtD,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,mHAAoB;AACvD,YAAY,mBAAO,CAAC,6GAAiB;AACrC,YAAY,wHAAmC;AAC/C;AACA,CAAC;AACD,mBAAmB,mBAAO,CAAC,yGAAe;AAC1C,oBAAoB,mBAAO,CAAC,iGAAW;AACvC,QAAQ,4CAA4C,EAAE,mBAAO,CAAC,6FAAS;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,EAAE,EAAE,mBAAO,CAAC,4FAAmB;AAC/B,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,gGAAe;AAClD;AACA,QAAQ,gBAAgB,EAAE,mBAAO,CAAC,2FAAgB;AAClD,aAAa,mBAAO,CAAC,2FAAQ;AAC7B;AACA;AACA;AACA,QAAQ,iBAAiB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,mBAAO,CAAC,+FAAU;;AAEpF;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,mBAAO,CAAC,+FAAU;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,uBAAuB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;;;;;;;;;;;ACvwCY;;AAEZ,QAAQ,6BAA6B,EAAE,mBAAO,CAAC,sGAAwB;AACvE,QAAQ,kBAAkB,EAAE,mBAAO,CAAC,gGAAe;AACnD,QAAQ,wBAAwB,EAAE,yHAAkC;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,UAAU;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,aAAa;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEY;;AAEZ,QAAQ,+BAA+B,EAAE,mBAAO,CAAC,sGAAwB;AACzE;AACA,QAAQ,6BAA6B,EAAE,yHAAkC;AACzE,eAAe,mBAAO,CAAC,+FAAU;AACjC,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,6FAAS;AAC9C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACnLY;;AAEZ,QAAQ,iDAAiD,EAAE,mBAAO,CAAC,sGAAwB;;AAE3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACxUA;;AAEA,gBAAgB,mBAAO,CAAC,mDAAU;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,sGAAwB;AACpC;AACA;AACA,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,+CAAQ;AAC7C,eAAe,6HAA0B;AACzC,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;AACnC,oBAAoB,mBAAO,CAAC,iGAAW;AACvC,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,mHAAoB;AACvD,QAAQ,4CAA4C,EAAE,mBAAO,CAAC,6FAAS;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,yHAAkC;AACtC,QAAQ,iBAAiB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,mBAAO,CAAC,+FAAU;;AAEpF;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,mBAAO,CAAC,+FAAU;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,0BAA0B,0BAA0B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,oCAAoC,2BAA2B;AAC/D;AACA,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU,sCAAsC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,qBAAqB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA,cAAc,4BAA4B;AAC1C;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,8BAA8B;AACpD;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,8BAA8B;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AChzBA;;AAEY;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,EAAE,mBAAO,CAAC,mGAAqB;AACjC;AACA;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,yFAAgB;AAC5B,QAAQ,oBAAoB,EAAE,mBAAO,CAAC,qFAAc;AACpD,QAAQ,qCAAqC,EAAE,kHAA6B;AAC5E;;AAEA;AACA,WAAW,GAAG;AACd,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA,WAAW,GAAG;AACd,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA,yEAAyE,KAAK,QAAQ,IAAI;AAC1F,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,KAAK,QAAQ,IAAI;AAC5D;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,gBAAgB;AAC3B,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,KAAK,QAAQ,IAAI;AAC5D;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,IAAI,OAAO,EAAE,yCAAyC,EAAE,oBAAoB,IAAI,OAAO;AACpH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,KAAK;AAChB;;AAEA,WAAW,eAAe;AAC1B;AACA;AACA;AACA,mEAAmE,EAAE;AACrE;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,iBAAiB;AAC5B;AACA;AACA;;AAEA;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA,WAAW,oBAAoB;AAC/B;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,eAAe;AAC1B;AACA;AACA;AACA;AACA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,qBAAqB;AAChC;AACA;AACA,kBAAkB,kBAAkB;AACpC,gCAAgC,KAAK,GAAG,EAAE;AAC1C;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,sBAAsB;AACjC;AACA;AACA,kBAAkB,kBAAkB;AACpC,iCAAiC,KAAK,GAAG,EAAE;AAC3C;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,0BAA0B;AACrC;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA,2BAA2B,KAAK,GAAG,EAAE;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,gBAAgB;AAC3B;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA,2FAA2F,OAAO;AAClG;AACA;;AAEA;AACA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB;;AAEA,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,kBAAkB;AAC7B;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,uBAAuB;AAClC;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,aAAa;AACb;;AAEA,WAAW,mBAAmB;AAC9B;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,GAAG;AACd,WAAW,QAAQ;AACnB,WAAW,KAAK;AAChB;AACA;AACA;AACA,8CAA8C,+BAA+B;AAC7E;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C,MAAM,gBAAgB;;AAElE;AACA,WAAW,KAAK;AAChB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,aAAa;AACzE;AACA;AACA;;AAEA;AACA,WAAW,KAAK;AAChB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,aAAa;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACjhBY;;AAEZ,qBAAqB,mBAAO,CAAC,+EAAW;AACxC,iBAAiB,mBAAO,CAAC,iGAAoB;AAC7C;AACA;;AAEA;AACA,kCAAkC;AAClC,4BAA4B;AAC5B,0BAA0B;AAC1B,wBAAwB;AACxB,yBAAyB;AACzB,uBAAuB;AACvB,uBAAuB;AACvB,qBAAqB;AACrB,wBAAwB;AACxB,0BAA0B;AAC1B,6BAA6B;AAC7B,uBAAuB;AACvB,sBAAsB;AACtB,sBAAsB;AACtB,uBAAuB;AACvB,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,qBAAqB;;AAErB;AACA,yBAAsB;;;;;;;;;;;;AClCV;;AAEZ,QAAQ,wDAAwD,EAAE,mBAAO,CAAC,+EAAQ;;AAElF;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS,gBAAgB;AACzB,cAAc,oBAAoB,EAAE,IAAI;AACxC;AACA,YAAY,gBAAgB,EAAE,IAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAM,iCAAiC,YAAY,sCAAsC,WAAW;AACnH;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,MAAM,iCAAiC,YAAY,sCAAsC,eAAe;AACrH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW,GAAG,KAAK,KAAK,aAAa;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,WAAW,GAAG,KAAK,KAAK,aAAa;AACvD,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB,MAAM;AACN,iBAAiB,KAAK,IAAI,8CAA8C;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,SAAS;AACrC;AACA;AACA,gCAAgC,UAAU,KAAK,SAAS;AACxD;AACA;AACA;AACA,gCAAgC,iBAAiB,OAAO,KAAK;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,aAAa;AAChD;AACA;AACA,mCAAmC,cAAc,KAAK,aAAa;AACnE;AACA;AACA;AACA,mCAAmC,qBAAqB,OAAO,KAAK;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,SAAS;AAC3B;AACA;AACA,yBAAyB,UAAU,KAAK,SAAS;AACjD;AACA;AACA;AACA,yBAAyB,iBAAiB,OAAO,KAAK;AACtD;AACA;AACA;AACA,2BAA2B,OAAO;AAClC,MAAM;AACN,oCAAoC,YAAY;AAChD,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,wBAAwB;AACpE,QAAQ;AACR;AACA;AACA,SAAS;AACT,6BAA6B,UAAU;AACvC;AACA,MAAM;AACN;AACA;AACA,OAAO;AACP;AACA,uBAAuB,uBAAuB;AAC9C;AACA,gCAAgC,eAAe,GAAG,UAAU;AAC5D;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,MAAM,GAAG,KAAK,IAAI,OAAO,aAAa,UAAU;AAClE,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,uBAAuB;AAChD,kBAAkB,aAAa;AAC/B,uBAAuB,OAAO,2BAA2B,KAAK,0BAA0B,KAAK;AAC7F,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,EAAE;AAClE;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA;AACA,sBAAsB,SAAS,MAAM,SAAS;AAC9C;AACA;AACA;AACA;AACA,wBAAwB,gBAAgB,QAAQ,MAAM;AACtD;AACA;AACA;AACA,cAAc,KAAK;AACnB,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,4BAA4B,IAAI,gCAAgC,MAAM,aAAa,SAAS;AAC5F,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACpVY;;AAEZ;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;;;;;;;;;AC1GY;;AAEZ,qBAAqB,mBAAO,CAAC,8CAAQ;AACrC,QAAQ,wCAAwC,EAAE,mBAAO,CAAC,6FAAe;AACzE,8CAA8C,uGAAuC;AACrF,sDAAsD,2GAA2C;AACjG,gEAAgE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gEAAgE,cAAc;AAC9E;AACA;AACA,oBAAoB,mBAAmB;AACvC,wBAAwB,gBAAgB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,kBAAkB,QAAQ;AAC1B,QAAQ;AACR;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,MAAM;AAC7B,YAAY,oDAAoD;AAChE,wBAAwB,MAAM;AAC9B;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA,IAAI,uFAAkC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;;;;;;;;;;;ACvM/B;;AAEA,QAAQ,SAAS,EAAE,mBAAO,CAAC,8CAAQ;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;AACD,QAAQ,iDAAiD,EAAE,mBAAO,CAAC,kGAAoB;AACvF;AACA,eAAe;AACf,EAAE,EAAE,mBAAO,CAAC,oFAAa;AACzB,QAAQ,sDAAsD,EAAE,mBAAO,CAAC,sHAA8B;AACtG;AACA,WAAW;AACX,EAAE,EAAE,mBAAO,CAAC,wFAAe;AAC3B,gBAAgB,mBAAO,CAAC,kHAA4B;AACpD,QAAQ,mDAAmD,EAAE,mBAAO,CAAC,8GAA0B;AAC/F,QAAQ,WAAW,EAAE,mBAAO,CAAC,oHAA6B;AAC1D,QAAQ,YAAY,EAAE,mBAAO,CAAC,kHAA4B;AAC1D,YAAY,mBAAO,CAAC,8HAAkC;AACtD;AACA,iBAAiB,mBAAO,CAAC,gGAAmB;AAC5C,cAAc,mBAAO,CAAC,8GAA0B;AAChD,gBAAgB,6JAA4D;AAC5E;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAO,CAAC,oHAA6B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,kBAAkB,mBAAO,CAAC,oHAA6B;AACvD,gBAAgB,mBAAO,CAAC,gHAA2B;AACnD,mBAAmB,mBAAO,CAAC,sHAA8B;AACzD,qBAAqB,mBAAO,CAAC,0HAAgC;AAC7D;AACA,QAAQ,iBAAiB,EAAE,mBAAO,CAAC,oIAAqC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC5IY;;AAEZ,QAAQ,6BAA6B,EAAE,mBAAO,CAAC,mGAAqB;AACpE,QAAQ,wCAAwC,EAAE,mBAAO,CAAC,+GAA2B;AACrF,QAAQ,mBAAmB,EAAE,mBAAO,CAAC,qHAA8B;AACnE,QAAQ,WAAW,EAAE,mBAAO,CAAC,+HAAmC;AAChE,mBAAO,CAAC,yFAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;;;;;;;;;;AC1CA;AACA;AACA,aAAa,mBAAO,CAAC,8CAAQ;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA,EAAE,cAAc;AAChB;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA,aAAa,sGAA6B;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,sCAAsC,sCAAsC;AACzG;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;ACvSA;AACA;AACA;;AAEA,+DAAe;AACf;AACA,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,gBAAgB,IAAI;AACpB,GAAG;AACH;AACA,mBAAmB,IAAI;AACvB,mBAAmB,IAAI;AACvB,mBAAmB,IAAI;AACvB,mBAAmB,IAAI;AACvB,mBAAmB,IAAI;AACvB,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA,gBAAgB,KAAK;AACrB,gBAAgB,KAAK;AACrB,GAAG;AACH;AACA,gBAAgB,KAAK;AACrB,GAAG;AACH,CAAC,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7BF;AACA;;AAEgC;AACU;AAC1C,QAAQ,WAAW,EAAE,6CAAU;;AAE/B;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe,WAAW,EAAC;;AAE3B;AACO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0DAA0D;AAC1D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mDAAmD;AACrE;AACA;AACA;;AAEA;AACO;AACP;AACA,eAAe,KAAK;AACpB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,cAAc,KAAK;AACnB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,WAAW;AAC9C,kCAAkC,WAAW;AAC7C;AACA,kCAAkC,WAAW;AAC7C,wBAAwB,cAAc;AACtC,kEAAkE,oBAAoB,QAAQ;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,uDAAc;AACvB;AACA;AACA;AACA,mDAAmD,cAAc;AACjE;AACA;;;AAGA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC0B;;AAE1B;AACO;AACP,uDAAuD,2BAA2B;AAClF;;AAEA;AACO;AACP,uDAAuD,2BAA2B;AAClF;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,oBAAoB;AACzD;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,MAAM,IAAI,iCAAiC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,MAAM;AAC1B,oBAAoB,MAAM,KAAK,SAAS;AACxC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACnYA;AACgC;AACa;;AAE7C,QAAQ,MAAM,EAAE,6CAAU;;AAE1B;AACA,wCAAwC,EAAE,kBAAkB,EAAE;AAC9D;AACA;AACA;AACA;AACA,sDAAsD,KAAK;AAC3D;AACA;AACA,0CAA0C,EAAE;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACe;AACf;AACA;AACA;AACA,8BAA8B,uBAAuB,8BAA8B;AACnF,+CAA+C,EAAE,mBAAmB,iCAAiC;AACrG,2DAA2D;AAC3D;AACA;AACA;AACA,0kBAA0kB,EAAE,UAAU,mNAAmN,EAAE,UAAU,+MAA+M,EAAE,UAAU,iCAAiC,cAAc,EAAE;AACjkC,6YAA6Y,cAAc,EAAE;AAC7Z,0ZAA0Z,YAAY,EAAE;AACxa,+EAA+E,YAAY,EAAE;AAC7F,2CAA2C,WAAW,EAAE;AACxD;AACA;AACA,8CAA8C,EAAE;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0DAA0D,OAAO;AACjE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,qBAAqB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,OAAO;AAClE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,gEAAgE,UAAU;AAC1E;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA,gDAAgD;AAChD,oBAAoB;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,OAAO;AACzE;AACA;;AAEA;AACA;AACA;AACA,2CAA2C;AAC3C,2CAA2C;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA,uCAAuC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA,yCAAyC,MAAM,YAAY,WAAW;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,sDAAc;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACxgBA;AACgC;AACY;AACZ;;AAEhC;;AAEA;AACe;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,uCAAuC,gDAAO,GAAG,gCAAgC;AACjF;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,kBAAkB;AAC7D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,WAAW;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,aAAa;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,WAAW;AAC/D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA,yCAAyC,KAAK;AAC9C;AACA;AACA,WAAW;AACX;AACA;AACA,sDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B;AAC5B;;AAEA;AACA;AACA,yBAAyB;AACzB,mDAAmD,WAAW;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB;AACzB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,WAAW;AACX;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA,QAAQ;AACR,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,gBAAgB;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8CAA8C;AAC9C,WAAW;AACX;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA,4DAA4D,gBAAgB;AAC5E;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2DAA2D,aAAa;AACxE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,WAAW;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,gBAAgB;AACnE;AACA;AACA;;AAEA;AACA;AACA;AACA,gDAAgD,WAAW;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,SAAS,UAAU,WAAW;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,OAAO,GAAG,kBAAkB;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,kBAAkB;AACrE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,6CAAU;AAC1C,gCAAgC,6CAAU;AAC1C,gCAAgC,6CAAU;AAC1C,gCAAgC,6CAAU;AAC1C,gCAAgC,6CAAU;AAC1C;AACA,mBAAmB,6CAAU;AAC7B,mBAAmB,6CAAU;AAC7B,mBAAmB,6CAAU;AAC7B;AACA;AACA;AACA,oCAAoC,sDAAa;;;;;;;;;;;;;;;;;;;;;ACnjCjD;AACiF;AACtC;AACX;AACU;;AAE1C;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuC,sDAAa;;AAEpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0DAAU;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,uDAAc;AAC3C,0BAA0B,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE;AAC/D;AACA,qBAAqB,wDAAQ;AAC7B;;AAEA;AACA;AACA;AACA,UAAU,uCAAuC,GAAG,yCAAyC,GAAG,sCAAsC;AACtI,QAAQ,uDAAc,wBAAwB,qCAAqC;AACnF,OAAO;AACP,QAAQ,wDAAQ;;AAEhB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,qDAAqD;AACrD,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;;AAEpB;AACA,wCAAwC;AACxC;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,mBAAmB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;AACxC;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,wDAAQ;;AAEpB;AACA;AACA;AACA;AACA,0CAA0C,YAAY,gBAAgB;AACtE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS,mDAAmD;AAC5D;AACA;;AAEA;AACA;AACA,gCAAgC,qBAAqB;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,wDAAQ;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;;AAEA;AACA;AACA,gCAAgC,wBAAwB;AACxD;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,qDAAQ,GAAG,kBAAkB;;AAEpD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,wDAAQ;;AAE7B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,wDAAQ;;AAE7B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4BAA4B,kBAAkB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,wDAAQ;;AAE7B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,kBAAkB;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,wDAAQ;;AAE7B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB,wDAAQ;;AAE7B;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,kBAAkB;AAC5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,kCAAkC,cAAc;AAChD;AACA;AACA;AACA;AACA;AACA,WAAW,aAAa,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,uCAAuC,IAAI;AAC5D,sBAAsB;AACtB;AACA,wCAAwC,mBAAmB,YAAY,EAAE,QAAQ,KAAK;;AAEtF;AACA,sCAAsC,6CAAU,WAAW,6CAAU;AACrE;AACA;AACA,oCAAoC;AACpC,kCAAkC;AAClC,kCAAkC;AAClC,kCAAkC;AAClC,oCAAoC;;AAEpC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,uCAAuC;AAC/D;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,6CAAU;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C,6CAAU;AACtD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,UAAU;AACnC;AACA;AACA;;AAEA,aAAa,cAAc;AAC3B,aAAa,cAAc;AAC3B,wBAAwB,sCAAsC;AAC9D;AACA;AACA;AACA;AACA,4CAA4C,6CAAU;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,UAAU;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2CAA2C,qDAAQ;AACnD;AACA,YAAY,kBAAkB;AAC9B,0BAA0B,4CAA4C;AACtE;;AAEA;AACA;AACA,cAAc,6CAA6C;AAC3D,sDAAsD,2BAA2B;AACjF;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACt0BA;AACkC;AACU;;AAE5C;AACe,6BAA6B,sDAAS;AACrD;AACA,YAAY,qBAAqB;AACjC;;AAEA;AACA,uBAAuB,iDAAQ;AAC/B;AACA;AACA;AACA;AACA,wCAAwC;AACxC,wCAAwC;AACxC;AACA,OAAO;AACP,KAAK;AACL;AACA,yBAAyB,gEAAgE;AACzF;AACA,yBAAyB;AACzB;;AAEA;AACA,mDAAmD,eAAe;AAClE,4BAA4B,SAAS;AACrC;;AAEA;AACA;AACA,kCAAkC,oBAAoB;AACtD,oCAAoC,aAAa;AACjD,kCAAkC,4BAA4B;AAC9D;AACA;AACA;;;;;;;;;;;;;;;;;;;ACvCA;AAC4C;AACV;;AAElC;AACe,6BAA6B,sDAAS;AACrD;AACA,YAAY,4CAA4C;;AAExD;AACA,sCAAsC,iDAAQ;AAC9C,6CAA6C,iBAAiB,yBAAyB;AACvF,yBAAyB,iBAAiB,yBAAyB;AACnE,KAAK;;AAEL;AACA,kDAAkD;AAClD,4BAA4B;AAC5B;;AAEA;AACA;AACA,kCAAkC,mBAAmB;AACrD,gCAAgC,aAAa;AAC7C,mCAAmC,4BAA4B;AAC/D,2CAA2C,sCAAsC;AACjF;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;AC5BA;;AAE4C;;AAE5C;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP;AACA;;AAEA;AACO;AACP,oBAAoB,sBAAsB;AAC1C;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,uBAAuB,sDAAa;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,OAAO;AAChD;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACjEA;AACgC;AACiC;AACvB;;AAE1C,qBAAqB,sDAAa;;AAElC,QAAQ,WAAW,EAAE,6CAAU;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,6BAA6B,gDAAI;AACjC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACe;AACf;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uCAAuC,iBAAiB,iBAAiB;AACzE,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,aAAa,EAAE,4CAA4C;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uFAAuF;AACvF,0DAA0D,gCAAgC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA,wBAAwB;AACxB,0EAA0E;AAC1E,iDAAiD;AACjD;AACA,4BAA4B;AAC5B;AACA,uBAAuB;AACvB,kEAAkE;AAClE,wEAAwE;AACxE,+CAA+C;AAC/C;AACA,oBAAoB;AACpB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,eAAe,8BAA8B;AAC7C,+CAA+C;AAC/C;AACA,aAAa,EAAE,2BAA2B,+BAA+B,cAAc;AACvF;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,aAAa;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,IAAI;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB,MAAM,IAAI,iBAAiB;;AAE5C;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,MAAM,KAAK,yCAAyC;AACnE;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,mCAAmC;AACnD;AACA,oCAAoC;AACpC,wCAAwC;AACxC,iCAAiC;AACjC,MAAM,uDAAc,mBAAmB,8BAA8B,EAAE;AACvE;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA,6BAA6B,QAAQ,GAAG,IAAI;AAC5C;AACA;AACA;AACA;AACA;AACA,iCAAiC,UAAU;AAC3C;AACA;AACA;AACA,4CAA4C,WAAW;AACvD,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,sCAAsC;AAC1D,oCAAoC,sCAAsC;AAC1E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,wCAAwC;AAC/E,oEAAoE;AACpE;AACA;AACA;AACA;AACA,sBAAsB,YAAY;AAClC;AACA;AACA;AACA,2BAA2B,iCAAiC;AAC5D;AACA;AACA,yBAAyB,OAAO;AAChC,8DAA8D;AAC9D,uDAAuD;AACvD;AACA;AACA;AACA,mCAAmC,SAAS;AAC5C;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,YAAY;AAChC;AACA,kCAAkC,mBAAmB;AACrD;;AAEA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;;AAEA;AACA,mDAAmD,yCAAyC;AAC5F;AACA,YAAY;AACZ,sBAAsB;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9Y8B;AACE;AACA;AACF;AACc;AACA;AACX;;AAgBR;;AAEzB;AAuBE;;AAEF;AACA,+DAAe;AACf,OAAO;AACP,QAAQ;AACR,QAAQ;AACR,OAAO;AACP,cAAc;AACd,cAAc;AACd,MAAM;;AAEN,aAAa;;AAEb,MAAM;AACN,WAAW;AACX,SAAS;AACT,WAAW;AACX,UAAU;AACV,cAAc;AACd,MAAM;AACN,QAAQ;;AAER,YAAY;AACZ,UAAU;AACV,CAAC,EAAC;;;;;;;;;;;ACxEF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,sBAAsB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sCAAsC;;AAEtC;AACA;AACA;;AAEA,4BAA4B;AAC5B;AACA;AACA;AACA,6BAA6B;;;;;;;;;;;ACvL7B;AACA;;AAEA;AACA,iEAAiE,qBAAM;AACvE;AACA;AACA;AACA,qCAAqC,WAAW;;;;;;;;;;;;ACRnC;AACb;AACA;AACA,mCAAmC,oCAAoC,gBAAgB;AACvF,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,aAAa,mBAAO,CAAC,yEAAiB;AACtC,aAAa,mBAAO,CAAC,6EAAmB;AACxC,aAAa,mBAAO,CAAC,+EAAoB;AACzC,aAAa,mBAAO,CAAC,qEAAe;AACpC,aAAa,mBAAO,CAAC,yEAAiB;AACtC,aAAa,mBAAO,CAAC,+DAAY;AACjC,aAAa,mBAAO,CAAC,uEAAgB;AACrC;;;;;;;;;;;ACnBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;;;;;;;;;;AChBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,mBAAmB;AACnB,oBAAoB,mBAAO,CAAC,qEAAa;AACzC,uBAAuB,mBAAO,CAAC,2EAAgB;AAC/C,kBAAkB,mBAAO,CAAC,iEAAW;AACrC,oBAAoB,mBAAO,CAAC,qEAAa;AACzC,eAAe,mBAAO,CAAC,2DAAQ;AAC/B,mBAAmB,mBAAO,CAAC,mEAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gEAAgE,qBAAqB;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,qBAAqB,EAAE,wBAAwB;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB;AACnB;;;;;;;;;;;ACzHa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;;;;;;;;;;;ACnBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,eAAe;AACf,oBAAoB,mBAAO,CAAC,qEAAa;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;;;;;;;;;;;AChCa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;;;;;;;;;;AChBa;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;;;;;;;;;;AC1Ba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;;;;;;;;;;;AChBa;AACb;AACA;AACA,mCAAmC,oCAAoC,gBAAgB;AACvF,CAAC;AACD;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,8CAA6C,EAAE,aAAa,EAAC;AAC7D,aAAa,mBAAO,CAAC,6EAAe;AACpC;;;;;;;;;;;ACba;AACb,8CAA6C,EAAE,aAAa,EAAC;AAC7D,+BAA+B,GAAG,yBAAyB,GAAG,eAAe;AAC7E;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,QAAQ,eAAe,YAAY;AACzF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,YAAY;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,QAAQ,eAAe,YAAY;AACrF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;;;;;;;;;;;;;;AC9MA;;;;;GAKG;AACH,MAAa,MAAM;IAKjB,4CAA4C;IAC5C,MAAM,CAAC,QAAQ;QACb,OAAO;IACT,CAAC;IAED;QACE,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,MAAM;QACR,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAChD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/B,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAC/D,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAE,KAAkB,EAAE,IAAgB;QACzC,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnF,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAE,KAAkB;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAGD;;;;;OAKG;IACH,MAAM,CAAE,KAAkB;QACxB,MAAM,QAAQ,GAAiB,EAAE,CAAC;QAClC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACrC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;QACvB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,IAAmB,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,eAAe,CAAE,KAAkB,EAAE,IAAgB;QACnD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,UAAU,IAAI,CAAC,IAAI,KAAK,GAAG,IAAI,UAAU,KAAK,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;OAOG;IACH,mBAAmB,CAAE,IAAY,EAAE,IAAgB;QACjD,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,iCAAiC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAgB,CAAC;QACvD,OAAO,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;OAEG;IACK,cAAc,CAAE,IAAI;QAC1B,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QACxE,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5C,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAE,QAAqB;QAC7C,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;YACjD,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC;YAC1C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED;;OAEG;IACK,sBAAsB,CAAE,KAAiB;QAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3C,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACnC,OAAO,EAAE,CAAC;YACZ,CAAC;iBAAM,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC;gBACzD,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAE,IAAY;QAC1B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF;AApLD,wBAoLC;AAED,qBAAe,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzMtB,gFAAwB;AAExB,kEAAwE;AACxE,6HAAqD;AAErD,8EAAgD;AAuChD,gEAAgE;AAChE,IAAI,gBAA8B,CAAC;AAEnC,SAAS,aAAa,CAAE,GAAY;IAClC,sFAAsF;IACtF,2BAA2B;IAC3B,MAAM,QAAQ,GAAG,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC;IAErD,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,YAAY,EAAE,CAAC;QAC1D,UAAU,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC1B,CAAC;IAED,MAAM,OAAO,GAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC;QAAC,OAAO,UAAU,CAAC;IAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,GAAC,CAAC,CAAC,CAAC;IAClD,wEAAwE;IACxE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAAC,OAAO,UAAU,CAAC;IAAC,CAAC;IAEtD,OAAO,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,UAAS,MAAM,EAAE,GAAG;QACvD,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE1B,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;YACpD,gDAAgD;YAChD,IAAI,UAAU,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;iBAC5C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;iBACb,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAE3C,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;YAEtD,2BAA2B;YAC3B,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,gBAAgB,GAAG,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC;YAEhF,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC;YAC/B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,UAAU,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,aAAa,CAAE,OAAyB;IAC/C,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9C,IAAI,CAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,CAAC;IAED,IAAI,CAAE,OAAO,CAAC,aAAa,EAAE,CAAC;QAC5B,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC;IAClC,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAErC,iEAAiE;IACjE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9E,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEpD,KAAK,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,mBAAmB,CAAC,EAAE,CAAC;QAC7G,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,KAAK,EAAE,CAAC;YACV,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC;AAED,MAAa,SAAS;IAGpB;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAE,aAA4B,EAAE,OAAyB;QACvE,iBAAG,EAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,CAAC,aAAa,CAAE,CAAC;QAE7L,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC;QACzG,CAAC;QAED,2BAA2B;QAC3B,uFAAuF;QACvF,IAAI,CAAC,gCAAqB,GAAE,IAAI,aAAa,CAAC,OAAO,KAAK,eAAe,EAAE,CAAC;YAC1E,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YAExE,MAAM,aAAa,GAAG;gBACpB,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,WAAW;gBAC7C,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI;gBAC/B,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,UAAU;gBAC3C,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,UAAU;aAC5C,CAAC;YAEF,OAAO,CAAC,WAAW,IAAI,cAAc,GAAG,mBAAQ,EAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC;QAClF,CAAC;QAED,MAAM,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;QAEnC,oFAAoF;QACpF,8BAA8B;QAC9B,IAAI,oBAAa,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,SAAS;iBACN,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,WAAW,EAAE,mDAAmD,CAAC;iBACzF,IAAI,CAAC,CAAC,UAAsB,EAAE,EAAE;gBAC/B,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;YACL,OAAO;QACT,CAAC;QAED,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,iEAAiE;IACjE,MAAM,CAAO,kBAAkB,CAAE,EAAiB,EAAE,MAAc,EAAE,YAAoB;;;YACtF,MAAM,MAAM,CAAC,SAAS,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;YACvD,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC;gBACrC,UAAU,EAAE,eAAe;gBAC3B,SAAS,EAAE,MAAM,CAAC,QAAQ;gBAC1B,aAAa,EAAE,YAAY;aAC5B,CAAC,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,iCAAkB,EAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE;gBAC7D,OAAO,EAAE,EAAC,cAAc,EAAE,mCAAmC,EAAC;gBAC9D,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;gBAC3B,YAAY,EAAE,MAAM;aACrB,CAAC,CAAC;YACH,IAAI,IAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;gBACxB,iBAAG,EAAC,qCAAqC,SAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,UAAU,UAAU,CAAC,CAAC;gBAC9E,MAAM,QAAQ,GAAG;oBACf,KAAK,EAAE,SAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,YAAY;oBAClC,SAAS,EAAE,SAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,UAAU;iBACrC,CAAC;gBACF,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACnB,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBACnC,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CAAC,4CAA4C,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAC9E,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,CAAC,SAAS,CAAC,EAAC,YAAY,EAAE,IAAI,EAAC,CAAC,CAAC;gBAC7C,MAAM,IAAI,4BAAiB,CAAC,yBAAyB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;KAAA;IA+CD;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAE,QAA2B;QAC7C,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC;QACpC,CAAC;aAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACxC,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,MAAM,mBAAmB,GAAG,QAAQ,CAAC;QACvC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,OAAO,OAAM,CAAC,QAAQ,CAAC,KAAK,WAAW,CAAC;IAC1C,CAAC;IA+GD,MAAM,CAAC,WAAW,CAAE,aAA4B;QAC9C,aAAa,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;IACzE,CAAC;;AA3PH,8BA4PC;AA3PQ,4BAAkB,GAAG,KAAK,CAAC;AA2ElC;;;;GAIG;AACI,qBAAW,GAAG;IACnB,OAAO,QAAQ,CAAC,QAAQ,CAAC;AAC3B,CAAC,CAAC;AAEF;;GAEG;AACI,oBAAU,GAAG,UAAU,GAAW,EAAE,WAAmB,EAAE,OAAe;IAC7E,OAAO,IAAI,OAAO,CAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAE7D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAE/C,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,EAAE,CAAC;YACnC,MAAM,CAAC,iCAAiC,CAAC,CAAC;YAAC,OAAO;QACpD,CAAC;QAED,SAAS,UAAU;YACjB,MAAM,CAAC,4BAA4B,CAAC,CAAC;QACvC,CAAC;QAED,SAAS,eAAe,CAAE,KAAwB;YAChD,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YAErD,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YAClD,SAAS,CAAC,KAAK,EAAE,CAAC;YAElB,MAAM,UAAU,GAAe,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAExD,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChB,MAAM,CAAC,qBAAqB,CAAC,CAAC;gBAAC,OAAO;YACxC,CAAC;YAED,OAAO,CAAC,UAAU,CAAC,CAAC;QACtB,CAAC;QAED,SAAS,CAAC,gBAAgB,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QACzD,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAqBK,kBAAQ,GAAG,UAAU,aAA4B;IACtD,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;IAC/B,IAAI,QAAkB,CAAC;IAEvB,IAAI,MAAM,EAAE,CAAC;QACX,QAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QACnC,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,2BAA2B;IAC3B,gBAAgB,GAAG;QACjB,IAAI,cAAc,GAAG,KAAK,CAAC;QAE3B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,aAAa,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;YAC3C,OAAO;QACT,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,IAAI,MAAM,CAAC,KAAK,KAAK,eAAe,EAAE,CAAC;gBACrC,MAAM,IAAI,4BAAiB,CAAC,qCAAqC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;YAChG,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,4BAAiB,CAAC,yBAAyB,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;QAED,6DAA6D;QAC7D,wBAAwB;QACxB,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;YAC/D,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;QAED,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACzB,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC5C,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;QAED,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,QAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACnC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAC,GAAG,GAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAG,2BAA2B;YAC9C,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAG,2CAA2C;YACvE,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,aAAa,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC,CAAC;IAEF,mBAAmB;IACnB,SAAe,WAAW,CAAC,IAAY;;;YACrC,MAAM,YAAY,GAAG,cAAc,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;YAC1E,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,iBAAG,EAAC,kGAAkG,CAAC,CAAC;gBACxG,OAAO;YACT,CAAC;YACD,QAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YACnC,IAAI,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;YAClC,IAAI,QAAQ,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;gBAC9B,WAAW,IAAI,QAAQ,CAAC,QAAQ,CAAC;YACnC,CAAC;YACD,MAAM,UAAU,GAAG,IAAI,eAAe,CAAC;gBACrC,IAAI,EAAE,IAAI;gBACV,UAAU,EAAE,oBAAoB;gBAChC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,QAAQ;gBACxC,YAAY,EAAE,WAAW;gBACzB,aAAa,EAAE,YAAY;aAC5B,CAAC,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,iCAAkB,EAChC,MAAM,EACN,aAAa,CAAC,MAAM,CAAC,SAAS,EAC9B;gBACE,OAAO,EAAE,EAAC,cAAc,EAAE,mCAAmC,EAAC;gBAC9D,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;gBAC3B,YAAY,EAAE,MAAM;aACrB,CACJ,CAAC;YAEF,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;gBACnB,KAAK,GAAG;oBACN,iBAAG,EAAC,qCAAqC,SAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,UAAU,UAAU,CAAC,CAAC;oBAC9E,MAAM,QAAQ,GAAG;wBACf,KAAK,EAAE,SAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,YAAY;wBAClC,YAAY,EAAE,SAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,aAAa;wBAC1C,SAAS,EAAE,SAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,QAAQ,0CAAE,UAAU;qBACrC,CAAC;oBACF,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;wBACnB,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;oBAC3C,CAAC;yBAAM,CAAC;wBACN,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,6CAA6C,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;oBACvG,CAAC;oBACD,cAAc,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;oBACxD,MAAM;gBACR;oBACE,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,UAAU,KAAK,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAClF,CAAC;QACH,CAAC;KAAA;IAED,aAAa,CAAC,EAAE,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AACxD,CAAC,CAAC;AAOJ,qBAAe,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AClXzB,2FAAsB;AAItB,sFAA4B;AAC5B,yIAAsD;AACtD,8GAA4C;AAC5C,yFAA8B;AAC9B,kEAA0D;AAG1D,SAAS,qBAAqB,CAAC,IAAY;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+MG;AACH,MAAa,UAAU;IAkBrB,YAAY,OAAsB,EAAE,IAAY;QAmhBhD;;;;WAIG;QACH,YAAO,GAAG;YACR,YAAY,EAAE,IAAI;YAElB,GAAG;gBACD,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACnD,CAAC;SACF,CAAC;QA7hBA,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAClC,MAAM,gBAAgB,GAAG,IAAI,CAAC;QAChC,CAAC;QAED,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,wDAAwD;YACxD,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE;gBACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;YAC7C,CAAC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEnD,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAE,IAAY;QACjB,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACH,4BAA4B;IACtB,UAAU,CAAE,IAAa,EAAE,MAAuB;;YACtD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAAC,IAAI,GAAG,EAAE,CAAC;YAAC,CAAC;iBACvC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;gBAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;YACjD,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAwB,EAAE,EAAE;gBACrF,OAAO,CAAC,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,4BAA4B;IACtB,MAAM,CAAE,IAAa,EAAE,MAAuB;;YAClD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAAC,IAAI,GAAG,EAAE,CAAC;YAAC,CAAC;iBACvC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;gBAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;YACjD,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAwB,EAAE,EAAE;gBACrF,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAAC,OAAO,EAAE,CAAC;gBAAC,CAAC;gBACxC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;oBACjC,+DAA+D;oBAC/D,gDAAgD;oBAChD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBAAC,OAAO,EAAE,CAAC;oBAAC,CAAC;oBAErC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAW,EAAE,EAAE;wBACrC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,MAAM,CAAC;6BACvD,IAAI,CAAC,CAAC,CAAwB,EAAE,EAAE;4BACjC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gCAC/B,IAAI,CAAC;oCAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gCAAC,CAAC;gCACpC,OAAO,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;4BAC3B,CAAC;4BACD,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gCAC/B,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;4BACvB,CAAC;wBACH,CAAC,CAAC,CAAC;oBACP,CAAC,CAAC,CAAC;oBAEH,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,4BAA4B;IACtB,OAAO,CAAE,IAAY,EAAE,MAAuB;;YAClD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,0DAA0D,CAAC,CAAC;YACpF,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAwB,EAAE,EAAE;gBACrF,OAAO;oBACL,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,WAAW,EAAE,CAAC,CAAC,WAAW;oBAC1B,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB;iBACtC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,SAAS,CAAE,QAAgB,EAAE,IAAY,EAAE,IAA4C;;YAC3F,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,OAAO,OAAO,CAAC,MAAM,CAAC,gEAAgE,CAAC,CAAC;YAC1F,CAAC;YACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,4DAA4D,CAAC,CAAC;YACtF,CAAC;YACD,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,EAAE,CAAC;gBAC7D,OAAO,OAAO,CAAC,MAAM,CAAC,6FAA6F,CAAC,CAAC;YACvH,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;gBACxE,OAAO,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;YAC5F,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAwB,EAAE,EAAE;gBAC7F,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACjD,OAAO,CAAC,CAAC,QAAQ,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACN,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,wBAAwB,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;gBACzG,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;;;;;;OAYG;IAEH,4BAA4B;IACtB,SAAS,CAAE,IAAY,EAAE,MAAuB;;YACpD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,4DAA4D,CAAC,CAAC;YACtF,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAwB,EAAE,EAAE;gBACrF,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC,CAAC,mEAAmE;oBACnG,OAAO,CAAC,CAAC,IAAI,CAAC;gBAChB,CAAC;qBAAM,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACtC,IAAI,CAAC;wBACH,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;oBAC5B,CAAC;oBAAC,OAAO,CAAC,EAAE,CAAC;wBACX,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC5D,CAAC;gBACH,CAAC;qBAAM,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACjE,OAAO,OAAO,CAAC,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;gBACjE,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,WAAW,CAAE,SAAiB,EAAE,IAAY,EAAE,MAAc;;YAChE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;gBAClC,OAAO,OAAO,CAAC,MAAM,CAAC,mEAAmE,CAAC,CAAC;YAC7F,CAAC;YACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,8DAA8D,CAAC,CAAC;YACxF,CAAC;YACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,iEAAiE,CAAC,CAAC;YAC3F,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YAEpC,IAAI,CAAC;gBACH,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAC/C,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;oBAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBAC1C,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7B,CAAC;YAED,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,iCAAiC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAwB,EAAE,EAAE;gBACxI,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACjD,OAAO,CAAC,CAAC,QAAQ,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACN,OAAO,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,wBAAwB,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;gBACzG,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;OAOG;IACH,4BAA4B;IAC5B,0EAA0E;IAC1E,MAAM,CAAE,IAAY;QAClB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,OAAO,CAAC,MAAM,CAAC,yDAAyD,CAAC,CAAC;QACnF,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;YACxE,OAAO,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;QAC7F,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,+CAA+C;IAC/C,UAAU,CAAE,IAAY;QACtB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,6DAA6D,CAAC;QACtE,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC3B,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACzC,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAE,IAAY,EAAE,WAAqC,KAAK;QAC7D,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,wDAAwD,CAAC;QACjE,CAAC;QACD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,yEAAyE,CAAC;QAClF,CAAC;QACD,IAAI,QAAQ,KAAK,OAAO;YACtB,QAAQ,KAAK,MAAM;YACnB,QAAQ,KAAK,KAAK,EAAE,CAAC;YACrB,MAAM,2DAA2D;kBAC/D,0BAA0B,CAAC;QAC/B,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+BI;IACJ,WAAW,CAAE,KAAa,EAAE,WAAkC,EAAE,MAAuB;QACrF,IAAI,GAAW,CAAC;QAEhB,IAAI,MAAM,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YAC9C,GAAG,GAAG,WAAW,CAAC;QACpB,CAAC;aAAM,IAAI,CAAC,MAAM,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,GAAG,WAAW,CAAC;YACrB,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;aAAM,IAAI,CAAC,MAAM,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAG,CAAC;YACvD,MAAM,IAAI,KAAK,CAAC,qGAAqG,CAAC,CAAC;QACzH,CAAC;QAED,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;;;;;;;;QAgBI;IACJ,QAAQ,CAAE,MAA4B;QACpC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAC9D,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,aAAG,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,gCAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAeD;;;;OAIG;IACH,eAAe,CAAE,KAAa;QAC5B,OAAO,uCAAuC,GAAG,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACzH,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAE,MAAc,EAAE,KAAa;QACxC,MAAM,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACnH,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAE,IAAY;QACpB,OAAO,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAE,KAAgB;QAC3B,IAAI,gBAAM,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,UAAU,eAAe;gBAC5D,IAAI,CAAC,CAAC,KAAK,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC;uBACxC,CAAC,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;oBACjF,IAAI,OAAO,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;wBACzD,IAAI,CAAC;4BACH,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC;wBAClF,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,QAAQ;wBACV,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAID,MAAM,CAAC,QAAQ;QACb,OAAO;IACT,CAAC;;AAxmBH,gCAymBC;AALQ,gBAAK,GAAG,eAAK,CAAC;AAQvB,sBAAW,EAAC,UAAU,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAEzC,qBAAe,UAAU,CAAC;;;;;;;;;;;;;;;;;;AC90B1B,kEAAoD;AACpD,gFAAwB;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsCI;AACJ,MAAa,OAAO;IAOlB;QANA,uBAAkB,GAAa,EAAE,CAAC;QAOhC,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,GAAG,CAAE,IAAY,EAAE,QAAkC;QACnD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QACD,yEAAyE;QACzE,2DAA2D;QAC3D,oEAAoE;QACpE,gGAAgG;QAChG,IAAI;QACJ,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;QAEjC,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACvB,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACzB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,MAAM,CAAE,IAAY;QAClB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,OAAO,CAAE,IAAY;QACnB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAE,EAAkC;QAC5C,iBAAG,EAAC,oCAAoC,EAAE,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACvE,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxD,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;QAcI;IACJ,SAAS,CAAE,IAAY;QACrB,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACxB,OAAO,MAAM,CAAC;QAChB,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,SAAS,CAAC,2BAAgB,EAAC,IAAI,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED;;;;;;;QAOI;IACJ,KAAK;QACH,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;;;QAII;IACJ,MAAM,CAAC,QAAQ,EAAE,iBAAiB;QAChC,OAAO;IACT,CAAC;CACF;AAhJD,0BAgJC;AAED,qBAAe,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;ACxLvB,8GAA4C;AAC5C,yFAA8B;AAC9B,gFAAwB;AACxB,kEAOgB;AAEhB,SAAS,SAAS,CAAE,IAAY;IAC9B,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;QAClE,OAAO;IACT,CAAC;IACD,IAAI,mBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;gBAC9C,OAAO,IAAI,CAAC,KAAK,CAAC;YACpB,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC9B,OAAO;YACT,CAAC;QACH,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;QACD,yEAAyE;QACzE,wEAAwE;QACxE,kEAAkE;QAClE,2BAA2B;QAC3B,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAClC,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,WAAW,EAAE,IAAI,CAAC,WAAW;aAC9B,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAE,KAAc,EAAE,MAAc;IACjD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3C,IAAI,WAAW,IAAI,WAAW,CAAC,SAAS,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,WAAW,CAAC,SAAS,IAAI,MAAM,EAAE,CAAC;YACrG,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,IAAI,CAAC,WAAW,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAGD,SAAS,QAAQ,CAAE,IAAY;IAC7B,MAAM,IAAI,GAAW,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,CAAC;IAE9C,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,4BAA4B,CAAE,IAAY,EAAE,QAAgB;IACnE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;IAC5B,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,oBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC7C,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAErC,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;GAWG;AAEH,MAAe,YAAY;IAA3B;QACE,QAAQ;QACR,4EAA4E;QAC5E,yEAAyE;QACzE,6EAA6E;QAC7E,2CAA2C;QACnC,wBAAmB,GAAG,KAAK,CAAC;QAC5B,uBAAkB,GAAG,EAAE,CAAC;IAsUlC,CAAC;IAxTC,qDAAqD;IAErD,yDAAyD;IACzD,8DAA8D;IAC9D,2CAA2C;IACrC,GAAG,CAAE,IAAY,EAAE,MAAc,EAAE,eAAkE;;YACzG,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,wBAAa,EAAC,IAAI,CAAC,CAAC;qBACtC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBACb,MAAM,IAAI,GAAW,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;oBAE3C,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;wBAC7B,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;oBAC/B,CAAC;yBAAM,IAAI,IAAI,EAAE,CAAC;wBAChB,OAAO;4BACL,UAAU,EAAE,GAAG;4BACf,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ;4BAChC,WAAW,EAAE,IAAI,CAAC,WAAW;yBAC9B,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;oBAC7B,CAAC;gBACH,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;qBACzB,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBACb,MAAM,IAAI,GAAW,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;oBAE3C,IAAI,IAAI,EAAE,CAAC;wBACT,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;4BACnB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gCAC9B,gFAAgF;gCAChF,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;oCAClE,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gCAC1B,CAAC;4BACH,CAAC;wBACH,CAAC;wBACD,OAAO;4BACL,UAAU,EAAE,GAAG;4BACf,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ;4BAChC,WAAW,EAAE,IAAI,CAAC,WAAW;yBAC9B,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,OAAO,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC;oBAC3B,CAAC;gBACH,CAAC,CAAC,CAAC;YACP,CAAC;QACH,CAAC;KAAA;IAEK,GAAG,CAAE,IAAY,EAAE,IAAa,EAAE,WAAmB;;YACzD,MAAM,KAAK,GAAG,wBAAa,EAAC,IAAI,CAAC,CAAC;YAElC,SAAS,aAAa,CAAC,SAAmB,EAAE,KAAc;gBACxD,IAAI,CAAC;oBACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;wBACrD,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;wBAC9B,IAAI,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;wBAC3B,IAAI,QAAgB,CAAC;wBAErB,IAAI,CAAC,IAAI,EAAE,CAAC;4BACV,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;wBAC9C,CAAC;wBAED,WAAW;wBACX,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;4BACZ,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;4BAC3B,IAAI,CAAC,KAAK,GAAG;gCACX,IAAI,EAAE,IAAI;gCACV,WAAW,EAAE,WAAW;gCACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gCACpD,mBAAmB,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;6BACnE,CAAC;wBACJ,CAAC;wBACD,SAAS;6BACJ,CAAC;4BACJ,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;4BAC7D,IAAI,GAAG,4BAA4B,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;wBACtD,CAAC;oBACH,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,iBAAG,EAAC,iCAAiC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;oBACjD,MAAM,CAAC,CAAC;gBACV,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QACjD,CAAC;KAAA;IAED,MAAM,CAAE,IAAY;QAClB,MAAM,KAAK,GAAG,wBAAa,EAAC,IAAI,CAAC,CAAC;QAElC,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,UAAU,SAAS,EAAE,KAAK;YACxD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrD,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAC7B,IAAI,QAAQ,CAAC;gBAEb,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO,CAAC,KAAK,CAAC,kCAAkC,GAAG,QAAQ,CAAC,CAAC;oBAC7D,SAAS;gBACX,CAAC;gBAED,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBACZ,WAAW;oBACX,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;oBAC3B,IAAI,CAAC,KAAK,GAAG;wBACX,IAAI,EAAE,KAAK;wBACX,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;wBACpD,mBAAmB,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;qBACnE,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,SAAS;oBACT,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;wBAChB,IAAI,CAAC,KAAK,GAAG,oBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACtC,CAAC;oBACD,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;oBAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oBAErC,IAAI,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC/D,6EAA6E;wBAC7E,MAAM;oBACR,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAY;QAEhB,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAe,EAAE,EAAE;YAChE,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAc,EAAE,EAAE;YACzB,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;gBAE7B,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBACtC,IAAI,CAAC,WAAW,CAAC;wBACf,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,MAAM,EAAE,OAAO;wBACf,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;wBACnE,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;qBACtE,CAAC,CAAC;gBACL,CAAC;gBACD,KAAK,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,WAAW,CAAC,GAAc;QAChC,IAAI,gBAAM,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACpC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,WAAW;QACT,IAAI,CAAC,gBAAM,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAE3C,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YACxB,IAAI,qBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1B,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;gBAC/B,IAAI,MAAM,EAAE,CAAC;oBACX,IAAI,CAAC,WAAW,CAAC;wBACf,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,MAAM,EAAE,OAAO;wBACf,QAAQ,EAAE,SAAS;wBACnB,cAAc,EAAE,SAAS;wBACzB,QAAQ,EAAE,MAAM,CAAC,IAAI;wBACrB,cAAc,EAAE,MAAM,CAAC,WAAW;qBACnC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,uBAAuB;IACvB,MAAM,CAAC,WAAgB;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/C,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACjB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACpC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;oBACpE,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;gBACnC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,uDAAuD;gBACvD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;oBAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;gBAClB,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;gBAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAGO,YAAY,CAAC,KAAe,EAAE,aAA2B;QAC/D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE;gBACxC,OAAO,EAAE,OAAO;gBAChB,MAAM,EAAE,MAAM;aACf,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,KAAe,EAAE,aAA2B,EAAE,OAAO;QAC1E,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC7B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC;gBAC3B,KAAK,EAAE,KAAK;gBACZ,EAAE,EAAE,aAAa;gBACjB,OAAO,EAAE,OAAO;aACjB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAClC,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YAClC,MAAM,aAAa,GAAG,oBAAS,EAAC,KAAK,CAAC,CAAC;YACvC,MAAM,YAAY,GAAG,EAAE,CAAC;YAExB,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAEpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;gBACzB,IAAI,gBAAK,EAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;oBACrC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC;gBACrB,CAAC;qBAAM,IAAI,qBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;oBAC5B,IACE,CAAC,gBAAK,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;wBAChD,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,KAAK,CAAC,mBAAmB,EACzD,CAAC;wBACD,YAAY,CAAC,IAAI,CAAC;4BAChB,IAAI,EAAE,IAAI;4BACV,MAAM,EAAE,QAAQ;4BAChB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;4BACjC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI;4BACjE,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,mBAAmB;4BAC9C,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;yBACvC,CAAC,CAAC;oBACL,CAAC;oBACD,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;oBAC/B,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC;gBACxC,CAAC;YACH,CAAC;YAED,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC7B,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;gBACrC,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC,CAAC;YACrC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;YACT,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;YACjC,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;YAChD,IAAI,OAAO,EAAE,CAAC;gBACZ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAClE,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,iBAAiB,CAAC,MAAiB;QACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5B,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IAEO,sBAAsB,CAAC,IAAY;QACzC,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC1C,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,CAAC;gBACxB,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBAEtC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACvC,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;wBACjE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;4BACjD,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBAC1B,CAAC;oBACH,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;gBACH,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;oBAClC,OAAO,QAAQ,CAAC;gBAClB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,sDAAsD;IACtD,aAAa;QACX,OAAO;YACL,SAAS,EAAE,SAAS;YACpB,QAAQ,EAAE,QAAQ;YAClB,UAAU,EAAE,UAAU;SACvB,CAAC;IACJ,CAAC;CACF;AAID,sBAAW,EAAC,YAAY,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAE3C,iBAAS,YAAY,CAAC;;;;;;;;;;;;;ACjctB;;;GAGG;AACH,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,IAAI;IACX,YAAY,EAAE;QACZ,KAAK,EAAK,IAAI;QACd,MAAM,EAAI,KAAK;QACf,MAAM,EAAI,IAAI;QACd,QAAQ,EAAE,IAAI;KACf;IACD,kBAAkB,EAAE,SAAS;IAC7B,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,EAAE;IACX,wEAAwE;IACxE,iBAAiB;IACjB,sBAAsB,EAAE,KAAK;IAC7B,eAAe,EAAE,EAAE;IACnB,gBAAgB,EAAE,KAAK;IACvB,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF,iBAAS,MAAM,CAAC;;;;;;;;;;;;ACzBH;;;;AAEb,gIAAqC;AAErC,gFAAwB;AACxB,kEAA8D;AAE9D,0BAA0B;AAC1B,IAAI,eAAe,CAAC;AAEpB,yCAAyC;AACzC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAE9C,iCAAiC;AACjC,0BAA0B;AAC1B,IAAI,UAAU,GAAG,EAAE,CAAC;AAEpB;;;;;;;;;;;IAWI;AAEJ,MAAM,QAAQ,GAAG,SAAS,QAAQ,CAAC,WAAmB;IACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAErC,IAAI,WAAW,IAAI,UAAU,EAAE,CAAC;YAC9B,OAAO,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;QAC1C,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC;YAC9B,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,GAAG,EAAE,QAAQ;YAC1D,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;iBAAM,IAAI,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC;gBACtD,CAAC,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,KAAK,QAAQ,CAAC;gBAC7D,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC;gBAC1D,iBAAG,EAAC,kCAAkC,GAAG,WAAW,GAAG,4DAA4D,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;gBACpJ,OAAO,MAAM,CAAC,uBAAuB,GAAG,WAAW,GAAG,4DAA4D,CAAC,CAAC;YACtH,CAAC;YAED,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,gDAAgD,CAAC;gBACjE,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;YAC7C,MAAM,UAAU,GAAG,EAAE,CAAC,UAAU,CAAC,sCAAsC,CAAC;gBACvD,EAAE,CAAC,IAAI,CAAC;YAEzB,qBAAqB;YACrB,UAAU,CAAC,WAAW,CAAC,GAAG;gBACxB,IAAI,EAAE,EAAE,CAAC,IAAI;gBACb,UAAU,EAAE,UAAU;gBACtB,OAAO,EAAE,OAAO;gBAChB,UAAU,EAAE,EAAE,CAAC,UAAU;aAC1B,CAAC;YAEF,IAAI,eAAe,EAAE,CAAC;gBACpB,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;YAC5E,CAAC;YAED,OAAO,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,QAAQ,CAAC,cAAc,GAAG,UAAS,OAAO;IACxC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACvB,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;AACnC,CAAC,CAAC;AACF,QAAQ,CAAC,cAAc,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACnE,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,WAAW,GAAG,QAAQ,CAAC,cAAc,CAAC;AAExE,QAAQ,CAAC,QAAQ,GAAG,WAAU,iBAAiB;IAC7C,eAAe,GAAG,gCAAqB,GAAE,CAAC;IAC1C,IAAI,eAAe,EAAE,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;YACxD,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC9B,CAAC;QAAC,OAAM,CAAC,EAAE,CAAC;YACV,WAAW;QACb,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF,QAAQ,CAAC,aAAa,GAAG;IACvB,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,oBAAa,EAAE,OAAO,CAAC;QAC5D,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,oBAAa,EAAE,gBAAgB,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG;IACrB,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;AACH,CAAC,CAAC;AAGF,iBAAS,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AC5GlB,8GAA4C;AAC5C,qGAAsC;AACtC,8GAA4C;AAC5C,qGAAqC;AACrC,6HAAqD;AACrD,kEAQgB;AAChB,8EAA+E;AAC/E,wEAA4E;AAE5E,kGAAoC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,IAAI,eAAe,CAAC;AACpB,MAAM,QAAQ,GAAG,0CAA0C,CAAC;AAC5D,MAAM,WAAW,GAAG,wDAAwD,CAAC;AAC7E,MAAM,SAAS,GAAG,yCAAyC,CAAC;AAC5D,MAAM,WAAW,GAAG,mGAAmG,CAAC;AACxH,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAC7C,MAAM,UAAU,GAAG,gDAAgD,CAAC;AACpE,MAAM,YAAY,GAAG,yDAAyD,CAAC;AAC/E,MAAM,YAAY,GAAG,iDAAiD,CAAC;AACvE,MAAM,UAAU,GAAG,+CAA+C,CAAC;AACnE,MAAM,UAAU,GAAG,2CAA2C,CAAC;AAC/D,MAAM,YAAY,GAAG,iDAAiD,CAAC;AACvE,MAAM,iBAAiB,GAAG,uEAAuE,CAAC;AAClG,MAAM,eAAe,GAAG,qDAAqD,CAAC;AAC9E,MAAM,WAAW,GAAG,gBAAgB,CAAC;AACrC,MAAM,WAAW,GAAG,CAAC,CAAC;AAiCtB;;;;;;;GAOG;AACH,SAAS,cAAc,CAAE,IAAY;IACnC,OAAO,CAAC,WAAW,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC7E,CAAC;AAED,kEAAkE;AAClE,6DAA6D;AAC7D,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,SAAS,kBAAkB,CAAC,GAAG;IAC7B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,EAC9C,UAAS,CAAC;QACR,OAAO,KAAK,GAAC,CAAC,KAAK,GAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAE,QAAiC,EAAE,MAAgB;IAC3E,OAAO,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AACvF,CAAC;AAED,SAAS,YAAY,CAAE,IAAI;IACzB,OAAO,IAAI,YAAY,WAAW,IAAI,gCAAiB,EAAC,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,MAAM,OAAQ,SAAQ,mBAAU;IAiB9B,YAAa,EAAE;QACb,KAAK,CAAC,EAAE,CAAC,CAAC;QACV,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,qDAAqD;QACzE,IAAI,CAAC,UAAU,GAAG,+BAA+B,CAAC;QAClD,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAE/B,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;QAC1C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,IAAI,uBAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QAEpB,eAAe,GAAG,gCAAqB,GAAE,CAAC;QAE1C,IAAI,eAAe,EAAC,CAAC;YACnB,MAAM,QAAQ,GAAG,kCAAuB,EAAC,YAAY,CAAC,CAAC;YACvD,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAG,6BAA6B;YAC3D,CAAC;YACD,IAAI,CAAC,SAAS,GAAG,kCAAuB,EAAC,GAAG,YAAY,SAAS,CAAC,IAAI,EAAE,CAAC;QAC3E,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED;;;OAGG;IACG,OAAO;;YACX,8CAA8C;YAC9C,IAAI,CAAC;gBACH,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBAC9B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAClB,CAAC;qBAAM,CAAC,CAAG,cAAc;oBACvB,MAAM,EAAC,YAAY,EAAE,aAAa,EAAE,KAAK,EAAC,GAAG,MAAM,+BAAoB,GAAE,CAAC;oBAC1E,cAAc,CAAC,OAAO,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAAC;oBACnE,cAAc,CAAC,OAAO,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;oBACrD,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC;wBAChB,OAAO,EAAE,QAAQ;wBACjB,KAAK,EAAE,WAAW;wBAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ;wBACvB,aAAa,EAAE,MAAM;wBACrB,KAAK,EAAE,KAAK;wBACZ,cAAc,EAAE,aAAa;wBAC7B,qBAAqB,EAAE,MAAM;wBAC7B,iBAAiB,EAAE,SAAS;qBAC7B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;gBAC5B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBAC9B,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;KAAA;IAED;;;;;;;;;;QAUI;IACE,SAAS,CAAE,QAAwB;;YACvC,yFAAyF;YACzF,IAAI,OAAO,QAAQ,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;gBAAC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;YAAC,CAAC;YAC7F,sGAAsG;YACtG,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;gBAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAe,CAAC;YAAC,CAAC;YACrF,IAAI,OAAO,QAAQ,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;gBAAC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;YAAC,CAAC;YAChG,IAAI,OAAO,QAAQ,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;gBAAC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;YAAC,CAAC;YAEvF,MAAM,oBAAoB,GAAG,GAAG,EAAE;gBAChC,IAAI,eAAe,EAAE,CAAC;oBACpB,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;wBAChD,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;wBACjB,YAAY,EAAE,IAAI,CAAC,YAAY;wBAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;qBAC1B,CAAC,CAAC,CAAC;gBACN,CAAC;YACH,CAAC,CAAC;YAEF,MAAM,WAAW,GAAG,GAAG,EAAE;gBACvB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBACvB,IAAI,eAAe,EAAE,CAAC;oBACpB,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;gBACxC,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAChC,CAAC,CAAC;YAEF,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBACtB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;oBACrB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;oBACxB,oBAAoB,EAAE,CAAC;gBACzB,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC;wBACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;wBAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC;wBAC9B,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;wBACxB,oBAAoB,EAAE,CAAC;oBACzB,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACb,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;wBACvB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC;wBAChE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACnC,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,WAAW,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;KAAA;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAE,IAAY;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAEhC,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,EAAE;YAC/B,IAAI,IAAI,CAAC;YAET,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC/C,OAAO,OAAO,CAAC,MAAM,CAAC,8BAA8B,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YACtE,CAAC;YAED,IAAI,CAAC;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACvC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;YAED,IAAI,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACxB,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;oBACjD,2DAA2D;oBAC3D,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBAC7B,CAAC;gBAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACnF,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBAChD,IAAI,CAAC;oBACH,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC;oBACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAChF,IAAI,KAAK,EAAE,CAAC;wBACV,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,QAAQ,CAAC,EAAC,CAAC;oBACxD,CAAC;yBAAM,CAAC;wBACN,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;wBAC5C,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,CAAC,WAAW,EAAE,EAAC,CAAC;wBACnG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;oBAChD,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,eAAe,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACtF,CAAC;gBACD,OAAO,GAAG,CAAC;YACb,CAAC,EAAE,EAAE,CAAC,CAAC;YAEP,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,WAAW;oBACrD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;gBAC7C,CAAC,CAAC,CAAC;YACL,CAAC;YAED,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC;QAEF,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;aACzB,CAAC;YAEF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC3E,CAAC,CAAC;QAEF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE;YACvC,IAAI,EAAE;gBACJ,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;aAC3B;SACF,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,UAAU,OAAO;YAC7C,OAAO,OAAO,CAAC,OAAO,CAAC;gBACrB,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,iCAAiC;gBAC9C,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;aAC7B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,GAAG,CAAE,IAAY,EAAE,UAAoC,EAAE;QACvD,IAAI,CAAE,IAAI,CAAC,SAAS,EAAE,CAAC;YAAC,OAAO,OAAO,CAAC,MAAM,CAAC,uBAAuB,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;QAAC,CAAC;QACtF,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,+BAA+B;YAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,OAAO,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACnC,iEAAiE;YACjE,yCAAyC;YACzC,IAAI,CAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;oBACjC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBACjC,CAAC,CAAC,CAAC;YACL,CAAC;YAED,IAAI,QAAQ,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;gBACnD,mBAAmB;gBACnB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QAED,6BAA6B;QAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QAED,MAAM,MAAM,GAAG;YACb,OAAO,EAAE;gBACP,iBAAiB,EAAE,kBAAkB,CAAC,EAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAC,CAAC;aACpE;YACD,YAAY,EAAE,aAAa;SAC5B,CAAC;QACF,IAAI,OAAO,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACnC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;QACxD,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,IAAI,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;YAC1B,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACrC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,MAAM,EAAC,CAAC,CAAC;YAC/C,CAAC;YACD,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;YACpD,uDAAuD;YACvD,yCAAyC;YACzC,OAAO,iCAAsB,EAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;gBACxE,IAAI,GAAG,YAAY,CAAC;gBACpB,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;oBACnB,IAAI,GAAG,IAAI,CAAC;gBACd,CAAC;gBAED,IAAI,CAAC;oBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC1B,CAAC;gBAAC,OAAM,CAAC,EAAE,CAAC;oBACV,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC3B,CAAC;gBAED,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;oBACnB,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;wBACjD,OAAO,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC;oBAC3B,CAAC;oBACD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,qCAAqC,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;gBAC/G,CAAC;gBAED,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;gBAC9C,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;gBACf,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC9B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAG,mDAAmD;gBAEhF,IAAI,kCAAuB,EAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC;oBAChD,8BAA8B;oBAC9B,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;gBACvB,CAAC;qBAAM,CAAC;oBACN,6BAA6B;oBAC7B,IAAI,CAAC;wBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;wBACxB,IAAI,GAAG,iCAAiC,CAAC;oBAC3C,CAAC;oBAAC,OAAM,CAAC,EAAE,CAAC;wBACV,uDAAuD;oBACzD,CAAC;gBACH,CAAC;gBAED,OAAO;oBACL,UAAU,EAAE,MAAM;oBAClB,IAAI,EAAE,IAAI;oBACV,WAAW,EAAE,IAAI;oBACjB,QAAQ,EAAE,GAAG;iBACd,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,GAAG;6DAAE,IAAY,EAAE,IAAI,EAAE,WAAmB,EAAE,UAAsD,EAAE;YAC1G,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;YACxD,CAAC;YAED,2CAA2C;YAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO;gBAC1B,QAAQ,IAAI,CAAC,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/C,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC;YAC/C,CAAC;YACD,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,GAAG,CAAC;gBACxC,QAAQ,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,EAAE,CAAC;gBACrC,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC;YAC/C,CAAC;YAED,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3D,WAAW,IAAI,kBAAkB,CAAC;YACpC,CAAC;YAED,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC;gBACpC,6DAA6D;gBAC7D,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;YAC1D,CAAC;YAED,MAAM,aAAa,GAAG,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC;YACpF,MAAM,YAAY,GAAG;gBACnB,IAAI,EAAE,IAAI;gBACV,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,IAAI;aACX,CAAC;YAEF,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;gBAC/C,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,GAAG,CAAC,IAAI,QAAQ,EAAE,CAAC;oBACzD,0CAA0C;oBAC1C,OAAO;wBACL,UAAU,EAAE,GAAG;wBACf,QAAQ,EAAE,QAAQ,CAAC,GAAG;qBACvB,CAAC;gBACJ,CAAC;gBAED,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;oBACjF,OAAO;wBACL,UAAU,EAAE,GAAG;wBACf,QAAQ,EAAE,QAAQ,CAAC,GAAG;qBACvB,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACtD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAG,mDAAmD;YAChF,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;IAED;;;;;;;;;;;;OAYG;IACG,QAAQ;6DAAE,IAAY,EAAE,UAAgC,EAAE;YAC9D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;YACxD,CAAC;YAED,2CAA2C;YAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,QAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,EAAE,CAAC;gBACnE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;YACjD,CAAC;YAED,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,EAAE,CAAC;gBACrB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;gBAC/C,IAAI,QAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;oBACvE,OAAO;wBACL,UAAU,EAAE,GAAG;wBACf,QAAQ,EAAE,QAAQ,CAAC,GAAG;qBACvB,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;KAAA;IAED;;;OAGG;IACH,cAAc,CAAE,IAAY;QAC1B,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3E,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAE,IAAY;QACjB,MAAM,OAAO,GAAG;YACd,IAAI,EAAE,EAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAC;SACnC,CAAC;QAEF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACzE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACjF,CAAC;YAED,IAAI,IAAI,CAAC;YAET,IAAI,CAAC;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YACtF,CAAC;YAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC,4BAA4B,CAAC,CAAC,EAAE,CAAC;oBAC1D,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;gBACnC,CAAC;gBAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACvE,CAAC;YAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YAE5B,IAAI,eAAe,EAAE,CAAC;gBACpB,YAAY,CAAC,OAAO,CAAC,YAAY,GAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAC/E,CAAC;YAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;YACX,KAAK,CAAC,OAAO,GAAG,mCAAmC,GAAG,IAAI,GAAG,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC;YAC3F,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;YACnE,IAAI,KAAK,CAAC;YAEV,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBAC/C,KAAK,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC;YACtB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,8DAA8D,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3H,CAAC;YAED,OAAO,OAAO,CAAC,OAAO,CAAC;gBACrB,KAAK,EAAE,KAAK;aACb,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACG,QAAQ;6DAAE,MAAc,EAAE,GAAW,EAAE,OAAO,EAAE,WAAW,GAAG,CAAC;YACnE,IAAI,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;gBAC/C,MAAM,aAAa,MAAM,kBAAkB,CAAC;YAC9C,CAAC;YAED,IAAI,CAAE,IAAI,CAAC,KAAK,EAAE,CAAC;gBAAC,MAAM,IAAI,4BAAiB,CAAC,iBAAiB,CAAC,CAAC;YAAC,CAAC;YAErE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;gBAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;YAAC,CAAC;YAC/C,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;YAE1D,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC5C,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,iCAAiC,CAAC;YACtE,CAAC;YAED,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;gBACzB,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;aACxB,CAAC,CAAC;YAEH,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,iCAAkB,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;gBAC3D,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;oBACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;oBACnB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;gBAClC,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;oBACzB,MAAM,EAAE,MAAM;oBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;oBACvB,OAAO,EAAE,IAAI;iBACd,CAAC,CAAC;gBACH,IAAI,IAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,MAAK,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;oBAC7C,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;wBAC/B,OAAO,CAAC,KAAK,CAAC,mBAAmB,WAAW,cAAc,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC;wBAC3E,OAAO,GAAG,CAAC;oBACb,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;4BACzB,MAAM,EAAE,MAAM;4BACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;yBACxB,CAAC,CAAC;wBACH,MAAM,mBAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;wBACrE,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;4BACzB,MAAM,EAAE,MAAM;4BACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;4BACvB,OAAO,EAAE,IAAI;yBACd,CAAC,CAAC;wBACH,2BAA2B;wBAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,GAAG,CAAC,CAAC,CAAC;oBAC9D,CAAC;gBACH,CAAC;qBAAM,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAC,EAAE,CAAC;oBAC5C,iDAAiD;oBACjD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;wBAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;wBACpB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;oBACnC,CAAC;oBAED,IAAI,WAAW,IAAI,WAAW,EAAE,CAAC;wBAC/B,OAAO,CAAC,IAAI,CAAC,mBAAmB,WAAW,cAAc,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC;wBAC1E,OAAO,GAAG,CAAC;oBACb,CAAC;yBAAM,CAAC;wBACN,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,2BAAY,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC;wBACrE,2BAA2B;wBAC3B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,GAAC,CAAC,CAAC,CAAC;oBAC5D,CAAC;gBACH,CAAC;qBAAM,CAAC;oBAEN,OAAO,GAAG,CAAC;gBACb,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;oBAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;oBACpB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACnC,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;oBACzB,MAAM,EAAE,MAAM;oBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;oBACvB,OAAO,EAAE,KAAK;iBACf,CAAC,CAAC;gBACH,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;IAED;;;;;;OAMG;IACH,UAAU,CAAE,GAAG,IAAiB;QAC9B,2EAA2E;QAC3E,+CAA+C;QAC/C,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC;QACjC,CAAC;QAED,2EAA2E;QAC3E,MAAM,KAAK,GAAG,CAAO,MAAc,EAAE,EAAE;YACrC,IAAI,GAAG,CAAC;YACR,IAAI,WAAW,CAAC;YAEhB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,GAAG,GAAG,YAAY,CAAC;gBACnB,WAAW,GAAG,EAAE,MAAM,EAAE,CAAC;YAC3B,CAAC;iBAAM,CAAC;gBACN,GAAG,GAAG,UAAU,CAAC;gBACjB,WAAW,GAAG;oBACZ,IAAI,EAAE,WAAW;oBACjB,SAAS,EAAE,IAAI;oBACf,eAAe,EAAE,IAAI;iBACtB,CAAC;YACJ,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC;gBACvE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC5B,MAAM,IAAI,4BAAiB,EAAE,CAAC;gBAChC,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBACvD,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;gBACjE,CAAC;gBAED,IAAI,YAAY,CAAC;gBAEjB,IAAI,CAAC;oBACH,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACnD,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACrE,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC5B,IAAI,eAAe,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;wBACzD,YAAY,GAAG;4BACb,MAAM,EAAE,IAAI;4BACZ,OAAO,EAAE,EAAE;4BACX,QAAQ,EAAE,KAAK;yBAChB,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC;oBAC1E,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,oFAAoF;oBACpF,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,CAAC;gBACzC,CAAC;gBAED,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACnC,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;oBAE1D,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE,CAAC;wBAChC,kEAAkE;wBAClE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBAC5B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;oBACpC,CAAC;yBAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC;wBACpC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;oBACtC,CAAC;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,CAAC,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC;gBAC7C,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;oBAC1B,OAAO,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBACpC,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC;oBACrC,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAChC,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxB,4DAA4D;oBAC5D,OAAO;gBACT,CAAC;qBAAM,CAAC;oBACN,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC,EAAC;QAEF,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACpE,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;gBACrD,KAAK,CAAC,OAAO,GAAG,uBAAuB,GAAG,KAAK,CAAC,OAAO,CAAC;YAC1D,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,wBAAwB,KAAK,EAAE,CAAC;YAC1C,CAAC;YACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC9B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAE,IAAY;QACxB,MAAM,WAAW,GAAG;YAClB,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;SAC3B,CAAC;QAEF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAClF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YACjF,CAAC;YAED,IAAI,YAAY,CAAC;YAEjB,IAAI,CAAC;gBACH,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACnD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YACtF,CAAC;YAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,IAAI,eAAe,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;oBACzD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC3B,CAAC;gBAED,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;YAC/E,CAAC;YAED,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3B,KAAK,CAAC,OAAO,GAAG,+CAA+C,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;YAChG,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,aAAa,CAAE,MAA+F;QAC5G,MAAM,IAAI,GAAG;YACX,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,IAAI,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE;YAChD,IAAI,EAAE,IAAI;SACX,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,IAAI,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QAC3D,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE;YACvC,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,OAAO,EAAE;gBACP,cAAc,EAAE,0BAA0B;gBAC1C,iBAAiB,EAAE,kBAAkB,CAAC,IAAI,CAAC;aAC5C;SACF,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACjB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAC;YACxD,CAAC;YAED,IAAI,IAAI,CAAC;YAET,IAAI,CAAC;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC3C,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,sBAAsB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YACnF,CAAC;YAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,IAAI,eAAe,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC;oBAChD,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;wBAC3D,OAAO,OAAO,CAAC,OAAO,CAAC;4BACrB,UAAU,EAAE,GAAG;4BACf,QAAQ,EAAE,QAAQ,CAAC,GAAG;yBACvB,CAAC,CAAC;oBACL,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;gBACtD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAC;YACxD,CAAC;YAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAE1C,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC9E,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,aAAa,CAAE,IAAY;QACzB,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAEnD,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACvD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAC;YACxD,CAAC;YAED,IAAI,YAAY,CAAC;YAEjB,IAAI,CAAC;gBACH,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACnD,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YACtF,CAAC;YAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,IAAI,eAAe,CAAC,YAAY,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;oBAChE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC,CAAC;gBAC5C,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;YAChE,CAAC;YAED,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACf,IAAI,MAAM,CAAC,UAAU,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;gBAC3D,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;YACX,KAAK,CAAC,OAAO,GAAG,4CAA4C,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;YAC7F,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACG,cAAc,CAAE,IAAY;;YAChC,MAAM,OAAO,GAAG;gBACd,IAAI,EAAE;oBACJ,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;oBAC1B,WAAW,EAAE,IAAI;iBAClB;aACF,CAAC;YAEF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACvE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBACvD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,2BAA2B,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;gBAClF,CAAC;gBAED,IAAI,IAAI,CAAC;gBAET,IAAI,CAAC;oBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBAC3C,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;gBACtF,CAAC;gBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,aAAa,IAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,aAAa,KAAI,CAAqB,CAAC,CAAC,CAAC;gBACjG,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;oBACvB,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;gBACxD,CAAC;gBAED,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAC5C,CAAC,EAAE,KAAK,CAAC,EAAE;gBACT,KAAK,CAAC,OAAO,GAAG,kDAAkD,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC;gBACnG,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAE,EAAiB;QAChC,eAAe,GAAG,gCAAqB,GAAE,CAAC;QAC1C,IAAK,EAAE,CAAC,OAAO,CAAC,OAAO,EAAG,CAAC;YACzB,EAAE,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI,EAAE,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC7B,MAAM,CAAC,EAAE,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAE,EAAiB;QACnC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACb,IAAI,eAAe,EAAC,CAAC;YACnB,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACxC,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;CACF;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,EAAE,EAAE,GAAG,IAAI;IAC3B,IAAI,EAAE,CAAC,gBAAgB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC,CAAC,iBAAiB;IACtD,EAAE,CAAC,gBAAgB,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjD,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC;YACzC,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE,UAAU,GAAG;YACrC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,oBAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU,CAAC,EAAE;IACpB,IAAI,CAAE,EAAE,CAAC,gBAAgB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC,CAAC,aAAa;IACpD,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,gBAAgB,CAAC;IACnC,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,EAAE,EAAE,GAAG,IAAI;IAChC,IAAI,EAAE,CAAC,qBAAqB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC,CAAC,iBAAiB;IAC3D,EAAE,CAAC,qBAAqB,GAAG,EAAE,CAAC,SAAS,CAAC;IACxC,EAAE,CAAC,SAAS,GAAG,GAAG,EAAE;QAClB,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;YACZ,QAAQ,CAAC,EAAE,CAAC,CAAC;YACb,EAAE,CAAC,qBAAqB,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;YACtC,eAAe,CAAC,EAAE,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,EAAE;IACzB,IAAI,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC,CAAC,aAAa;IACxD,EAAE,CAAC,SAAS,GAAG,EAAE,CAAC,qBAAqB,CAAC;IACxC,OAAO,EAAE,CAAC,qBAAqB,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAE,EAAE;IACzB,IAAI,EAAE,CAAC,yBAAyB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC7C,EAAE,CAAC,yBAAyB,GAAG,oBAAU,CAAC,SAAS,CAAC,UAAU,CAAC;IAC/D,oBAAU,CAAC,SAAS,CAAC,UAAU,GAAG,WAAU,QAAQ;QAClD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,EAAE;IAC1B,IAAI,CAAE,EAAE,CAAC,yBAAyB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC/C,oBAAU,CAAC,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC,yBAAyB,CAAC;IAC/D,OAAO,EAAE,CAAC,yBAAyB,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAC,EAAE;IACpB,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC/B,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,MAAM,CAAC;IAC3B,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,EAAE;IACtB,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACnB,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,WAAW,CAAC;QAC3B,OAAO,EAAE,CAAC,WAAW,CAAC;IACxB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,EAAiB;IAC/B,UAAU,CAAC,EAAE,CAAC,CAAC;IACf,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;QACZ,QAAQ,CAAC,EAAE,CAAC,CAAC;IACf,CAAC;SAAM,CAAC;QACN,iFAAiF;QACjF,kCAAkC;QAClC,aAAa,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;IACD,cAAc,CAAC,EAAE,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,QAAQ,CAAC,EAAiB;IACjC,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,UAAU,CAAC,EAAE,CAAC,CAAC;IACf,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC;AAGD,sBAAW,EAAC,OAAO,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAEtC,iBAAS,OAAO,CAAC;;;;;;;;;;;;;;;;ACptCjB,8GAA4C;AAC5C,kEAAqC;AAErC,MAAM,GAAG;IAKP;QACE,IAAI,CAAC,SAAS,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;QAE7C,IAAI,CAAC,IAAI,GAAG,OAAM,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;QAEhE,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAC/B,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;YAC5F,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;IAED,uBAAuB;QACrB,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAExC,IAAI,OAAO,QAAQ,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YAC3C,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;YAC/B,IAAI,CAAC,qBAAqB,GAAG,kBAAkB,CAAC;QAClD,CAAC;aAAM,IAAI,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,WAAW,EAAE,CAAC;YACxD,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC;YAClC,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;QACrD,CAAC;aAAM,IAAI,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,WAAW,EAAE,CAAC;YACvD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC;YACjC,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;QACpD,CAAC;aAAM,IAAI,OAAO,QAAQ,CAAC,cAAc,CAAC,KAAK,WAAW,EAAE,CAAC;YAC3D,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;YACrC,IAAI,CAAC,qBAAqB,GAAG,wBAAwB,CAAC;QACxD,CAAC;IACH,CAAC;IAED,aAAa;QACX,IAAI,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,YAAY,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;IACjC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;IAC9B,CAAC;IAED,YAAY;QACV,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC3B,CAAC;IAED,YAAY;QACV,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,QAAQ,EAAE,mBAAmB;QAClC,OAAO;IACT,CAAC;IAED,MAAM,CAAC,WAAW,EAAE,mBAAmB;QACrC,OAAO;IACT,CAAC;CACF;AAGD,sBAAW,EAAC,GAAG,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAElC,iBAAS,GAAG,CAAC;;;;;;;;;;;;;;;;;;AC1Eb,gFAAwB;AAMxB,MAAa,aAAa;IAMxB;;;;;;OAMG;IACH,SAAS,CAAC,gBAA0B;QAClC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACH,gBAAgB,CAAE,SAAiB,EAAE,OAAqB;QACxD,2CAA2C;QAC3C,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,UAAU,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QACD,iBAAG,EAAC,uCAAuC,EAAE,SAAS,CAAC,CAAC;QACxD,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,EAAE,CAAE,SAAiB,EAAE,OAAqB;QAC1C,OAAO,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAE,SAAiB,EAAE,OAAqB;QAC3D,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC/B,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;gBAC7C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACvC,OAAO;YACT,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAE,SAAiB,EAAE,GAAG,IAAe;QAC1C,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,cAAc,CAAE,SAAiB;QAC/B,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc,CAAE,SAAiB,EAAE,MAAM;QACvC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YAC7B,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,SAAS,CAAE,SAAiB;QAC1B,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;YAC1C,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;IACjC,CAAC;CACF;AAvGD,sCAuGC;AAED,qBAAe,aAAa,CAAC;;;;;;;;;;;;AC/GhB;;;;AAEb,yFAA8B;AAC9B,gFAAwB;AACxB,gFAAwB;AACxB,kEAA0C;AAC1C,6HAAwC;AAExC,yFAA8B;AAC9B,kGAAoC;AACpC,+FAAkC;AAClC,qGAAsC;AACtC,wGAAwC;AACxC,4FAAgC;AAChC,sFAA4B;AAC5B,qGAAsC;AACtC,mFAA0B;AAE1B,UAAU;AACV,4FAAgC;AAChC,kGAAoC;AACpC,2GAA0C;AAC1C,oHAAgD;AAEhD,MAAM,QAAQ,GAAG;IACf,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,CAAC;IACf,UAAU,EAAE,KAAK;IAEjB,YAAY;QACV,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAExB,IAAI,CAAC,cAAc,GAAG;YACpB,YAAY,EAAE,oBAAU;YACxB,SAAS,EAAE,iBAAO;YAClB,aAAa,EAAE,qBAAW;YAC1B,OAAO,EAAE,eAAK;YACd,QAAQ,EAAE,gBAAM;YAChB,UAAU,EAAE,kBAAQ;YACpB,WAAW,EAAE,mBAAS;YACtB,YAAY,EAAE,oBAAU;YACxB,KAAK,EAAE,aAAG;SACX,CAAC;QAEF,2CAA2C;QAC3C,IAAI,gBAAM,CAAC,KAAK,EAAE,CAAC;YACjB,iEAAiE;YACjE,iBAAM,EAAC,IAAI,CAAC,cAAc,EAAE;gBAC1B,SAAS,EAAE,iBAAO;gBAClB,WAAW,EAAE,mBAAS;gBACtB,cAAc,EAAE,sBAAY;gBAC5B,iBAAiB,EAAE,yBAAe;gBAClC,MAAM,EAAE,cAAI;aACb,CAAC,CAAC;QACL,CAAC;QAED,wEAAwE;QACxE,cAAc;QACd,6BAA6B;QAC7B,gBAAM,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACvC,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;gBACjC,2CAA2C;gBAC3C,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAExB,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YAC9C,4DAA4D;YAC5D,wDAAwD;YACxD,0DAA0D;YAC1D,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CAAE,OAAO;QACjB,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACnD,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACpC,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,WAAW,CAAE,WAAW;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACjD,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAEpE,iBAAG,EAAC,4BAA4B,WAAW,oBAAoB,CAAC,CAAC;QAEjE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,SAAS,CAAC,IAAI,CAAE,GAAG,EAAE;gBACnB,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;gBACzC,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAChC,CAAC,EAAE,GAAG,EAAE;gBACN,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,IAAI,OAAO,SAAS,KAAK,SAAS,EAAE,CAAC;YAC1C,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;YAC9C,IAAI,SAAS,EAAE,CAAC;gBACd,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,WAAW,CAAE,WAAW;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACjD,IAAI,UAAU,CAAC;QACf,IAAI,CAAC;YACH,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QAAC,OAAM,CAAC,EAAE,CAAC;YACV,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;YACnC,OAAO;QACT,CAAC;QAED,IAAI,OAAM,CAAC,UAAU,CAAC,KAAK,QAAQ,IAAI,OAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE,CAAC;YAC9E,UAAU,CAAC,IAAI,CACb,GAAG,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAC/C,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CACnD,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;IAED,aAAa,CAAE,WAAW,EAAE,GAAG;QAC7B,iBAAG,EAAC,4BAA4B,WAAW,4BAA4B,GAAG,GAAG,CAAC,CAAC;QAC/E,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,gBAAgB,CAAE,WAAW,EAAE,OAAO;QACpC,iBAAG,EAAC,4BAA4B,WAAW,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,YAAY,CAAC,CAAC;QAClF,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IAED,kBAAkB,CAAE,WAAW;QAC7B,iBAAG,EAAC,4BAA4B,WAAW,eAAe,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,IAAI,EAAG,WAAW;YAClB,IAAI,EAAI,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,QAAQ;YACjD,SAAS,EAAG,IAAI;YAChB,OAAO,EAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,WAAW;SACvD,CAAC,CAAC;QACH,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,WAAW;QACT,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,YAAY,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,EAAE,CAAC;YAClE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,iBAAiB;QACf,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC;QAExE,cAAc,CAAC,IAAI,CAAE,YAAY,CAAC,EAAE;YAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC;gBACjE,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;gBACxD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACpB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACzB,CAAC;QACH,CAAC;QAAC,OAAM,CAAC,EAAE,CAAC;YACV,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,cAAc;QACZ,iBAAG,EAAC,qCAAqC,CAAC,CAAC;QAE3C,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,mCAAmC;QACnC,IAAI,CAAC,KAAK,GAAG,gBAAM,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAE9E,6DAA6D;QAC7D,eAAe;QAEf,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,CAAC,4BAAI,EAAE,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;gBAC/B,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1B,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;gBACnC,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YACH,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC1B,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1B,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;YACpC,CAAC;QACH,CAAC;QAED,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEhC,IAAI,CAAC;YACH,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAChC,CAAC;QAAC,OAAM,GAAG,EAAE,CAAC;YACZ,mBAAQ,EAAC,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,eAAe,EAAE,CAAC;IACzB,CAAC;IAED,wBAAwB;QACtB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YACzC,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,UAAU,EAAE,CAAC;gBACnC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC;AAEF,iBAAS,QAAQ,CAAC;;;;;;;;;;;;;;;;AClQlB,qGAAsC;AACtC,8GAA4C;AAC5C,kEAQgB;AAChB,8EAA8D;AAC9D,wEAA4E;AAE5E,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,MAAM,QAAQ,GAAG,2CAA2C,CAAC;AAC7D,MAAM,UAAU,GAAG,uCAAuC,CAAC;AAC3D,MAAM,YAAY,GAAG,2BAA2B,CAAC;AACjD,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAC9D,MAAM,gBAAgB,GAAG,iCAAiC,CAAC;AAE3D,IAAI,eAAe,CAAC;AAEpB;;;;;;;GAOG;AACH,SAAS,qBAAqB,CAAE,QAAgB;IAC9C,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QAChC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,UAAU,CAAE,IAAY;IAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,QAAQ,CAAE,IAAY;IAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAC,CAAC,CAAC,GAAC,GAAG,CAAC;IACnC,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,eAAe,CAAE,IAAY;IACpC,OAAO,oBAAS,EAAC,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,WAAW;IAIf,YAAY,MAAe;QAF3B,WAAM,GAAG,EAAE,CAAC;QAGV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,GAAG,CAAE,GAAG;QACN,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACtE,CAAC;IAED,GAAG,CAAE,GAAG,EAAE,KAAK;QACb,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG;YACjB,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE;SACxB,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;GASG;AACH,SAAS,cAAc,CAAE,EAAE;IACzB,IAAI,EAAE,CAAC,yBAAyB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC7C,EAAE,CAAC,yBAAyB,GAAG,oBAAU,CAAC,SAAS,CAAC,UAAU,CAAC;IAC/D,oBAAU,CAAC,SAAS,CAAC,UAAU,GAAG,WAAU,UAAU;QACpD,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAE,EAAE;IAC3B,IAAI,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC9C,oBAAU,CAAC,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC,yBAAyB,CAAC;IAC/D,OAAO,EAAE,CAAC,yBAAyB,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAY,SAAQ,mBAAU;IAMlC,YAAY,aAAa,EAAE,QAAQ;QACjC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,+BAA+B,CAAC;QAClD,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,oDAAoD;QAEjG,eAAe,GAAG,gCAAqB,GAAE,CAAC;QAE1C,IAAI,eAAe,EAAC,CAAC;YACnB,MAAM,QAAQ,GAAG,kCAAuB,EAAC,YAAY,CAAC,CAAC;YACvD,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;;;OAUG;IACH,SAAS,CAAE,QAAwB;QACjC,wFAAwF;QACxF,IAAI,OAAO,QAAQ,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QAAC,CAAC;QAC7F,qGAAqG;QACrG,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAe,CAAC;QAAC,CAAC;QAErF,MAAM,oBAAoB,GAAG;YAC3B,IAAI,eAAe,EAAE,CAAC;gBACpB,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;oBAChD,WAAW,EAAE,IAAI,CAAC,WAAW;oBAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;iBAClB,CAAC,CAAC,CAAC;YACN,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,WAAW,GAAG;YAClB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC;YAClB,IAAI,eAAe,EAAE,CAAC;gBACpB,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YACxC,CAAC;QACH,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YAEtB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBACxB,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;oBACxB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;oBAC1C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;oBACxB,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACnC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;oBACZ,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACxB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAAC;gBAClE,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAClC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;OASG;IACH,GAAG,CAAE,IAAY,EAAE,UAAoC,EAAE;QACvD,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAE,IAAY,EAAE,IAA4B,EAAE,WAAmB,EAAE,UAAsD,EAAE;QAC5H,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QAEvC,SAAS,OAAO,CAAC,QAAQ;YACvB,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;gBACpD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBAC/C,MAAM,iBAAiB,GAAW,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAC,CAAC,CAAC;YACrG,CAAC;iBAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACnC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAC,CAAC,CAAC;YAClE,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC,MAAM,CAAC,yBAAyB,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC;YAC1G,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YAC3C,IAAI,EAAE,EAAE,CAAC;gBACP,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,GAAG,CAAC,EAAE,CAAC;oBAC7C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;gBAClC,CAAC;gBACD,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAClF,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrE,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAE,IAAY,EAAE,UAAgC,EAAE;QACtD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YAC3C,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,8BAA8B;gBAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC,CAAC;YAC5C,CAAC;YAED,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACrC,IAAI,iBAAiB,CAAC;gBACtB,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,CAAC;oBAClE,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClD,CAAC;gBACD,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,KAAK,iBAAiB,CAAC,EAAE,CAAC;oBAC1E,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,iBAAiB,EAAC,CAAC;gBACxD,CAAC;gBAED,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,kBAAkB,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACvF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;wBACvD,OAAO,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC;oBAC3B,CAAC;yBAAM,CAAC;wBACN,OAAO,OAAO,CAAC,MAAM,CAAC,iBAAiB,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC;oBAClG,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,IAAI;QACF,MAAM,GAAG,GAAG,QAAQ,GAAG,6BAA6B,CAAC;QACrD,8CAA8C;QAC9C,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI;YACtD,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO;QAC/C,MAAM,QAAQ,GAAG;YACf,QAAQ,EAAE,WAAW;SACtB,CAAC;QACF,MAAM,OAAO,GAAG;YACd,cAAc,EAAE,iCAAiC;SAClD,CAAC;QAEF,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YAC/B,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,yBAAyB,GAAG,EAAE,GAAG,uBAAuB,EAAE;YAC/F,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;YAC9B,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE;oBAClE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC5E,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,WAAW,CAAE,IAAI,EAAE,IAAI,EAAE,WAAW;QAClC,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC/C,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAChC,MAAM,QAAQ,GAAG;gBACf,KAAK,EAAE,qBAAqB,CAAC,QAAQ,CAAC;gBACtC,QAAQ,EAAE,WAAW;gBACrB,OAAO,EAAE,CAAC;wBACR,IAAI,EAAE,gBAAgB;wBACtB,EAAE,EAAE,QAAQ;qBACb,CAAC;aACH,CAAC;YACF,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,6CAA6C,EAAE;gBACrF,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;gBAC9B,OAAO,EAAE;oBACP,cAAc,EAAE,iCAAiC;iBAClD;aACF,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE;oBACnE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC5E,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,QAAQ,CAAE,IAAI,EAAE,OAAO;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;gBACrC,IAAI,iBAAiB,CAAC;gBACtB,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;oBAChE,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClD,CAAC;gBAED,IAAI,OAAO,IAAI,OAAO,CAAC,WAAW,IAAI,CAAC,iBAAiB,KAAK,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;oBAClF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC,CAAC;gBAC5C,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;oBACtB,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;wBACtD,0DAA0D;wBAC1D,6DAA6D;wBAC7D,IAAI,CAAC,QAAQ,IAAI,mBAAmB,CAAC;wBACrC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;oBACnD,CAAC;yBAAM,CAAC;wBACN,aAAa;wBACb,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAAC,CAAC,CAAC;oBAC/G,CAAC;gBACH,CAAC;gBAED,MAAM,MAAM,GAAmB;oBAC7B,YAAY,EAAE,aAAa;iBAC5B,CAAC;gBACF,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACtE,uDAAuD;oBACvD,yCAAyC;oBACzC,OAAO,iCAAsB,EAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,YAAY;wBACnF,IAAI,IAAI,GAAG,YAAY,CAAC;wBACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;4BAC9C,IAAI,CAAC;gCACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAc,CAAC,CAAC;4BACpC,CAAC;4BAAC,OAAM,CAAC,EAAE,CAAC;gCACV,iEAAiE;4BACnE,CAAC;wBACH,CAAC;6BAAM,IAAI,kCAAuB,EAAC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;4BAChE,6BAA6B;4BAC7B,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC;wBAC3B,CAAC;wBAED,OAAO;4BACL,UAAU,EAAE,GAAG;4BACf,IAAI,EAAE,IAAI;4BACV,WAAW,EAAE,IAAI,CAAC,QAAQ;4BAC1B,QAAQ,EAAE,iBAAiB;yBAC5B,CAAC;oBACJ,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,UAAU,CAAE,IAAY;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YACvC,IAAI,IAAI,EAAE,iBAAiB,EAAE,QAAQ,CAAC;YACtC,IAAI,CAAE,EAAE,EAAE,CAAC;gBACT,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAC,CAAC,CAAC;YAC5C,CAAC;YAED,MAAM,KAAK,GAAG,IAAI,GAAG,EAAE,GAAG,eAAe,CAAC;YAC1C,MAAM,MAAM,GAAG,2DAA2D,CAAC;YAC3E,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,kBAAkB;kBACnD,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC;kBAChC,UAAU,GAAG,kBAAkB,CAAC,MAAM,CAAC;kBACvC,kBAAkB;kBAClB,gBAAgB,EAClB,EAAE,CAAC;iBACN,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;;gBACjB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC5B,OAAO,OAAO,CAAC,MAAM,CAAC,+BAA+B,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;gBAC3E,CAAC;gBAED,IAAI,CAAC;oBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBAC3C,CAAC;gBAAC,OAAM,CAAC,EAAE,CAAC;oBACV,OAAO,OAAO,CAAC,MAAM,CAAC,oCAAoC,CAAC,CAAC;gBAC9D,CAAC;gBAED,QAAQ,GAAG,EAAE,CAAC;gBACd,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBAC9B,IAAI,UAAI,CAAC,MAAM,0CAAE,OAAO,EAAE,CAAC;wBAAC,SAAS;oBAAC,CAAC,CAAC,uBAAuB;oBAE/D,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAChD,IAAI,IAAI,CAAC,QAAQ,KAAK,gBAAgB,EAAE,CAAC;wBACvC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;wBACnE,QAAQ,CAAC,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG;4BAC3B,IAAI,EAAE,iBAAiB;yBACxB,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;wBAC7D,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG;4BACrB,IAAI,EAAE,iBAAiB;4BACvB,cAAc,EAAE,IAAI,CAAC,QAAQ;4BAC7B,gBAAgB,EAAE,IAAI,CAAC,QAAQ;yBAChC,CAAC;oBACJ,CAAC;gBACH,CAAC;gBAED,iCAAiC;gBACjC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,EAAC,CAAC,CAAC;YAChH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,YAAY,CAAE,IAAI;QAChB,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnD,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACxC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,aAAa,CAAE,IAAI;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC/C,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,iBAAiB,EAAE;gBACzD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,KAAK,EAAE,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAC5C,QAAQ,EAAE,gBAAgB;oBAC1B,OAAO,EAAE,CAAC;4BACR,EAAE,EAAE,QAAQ;yBACb,CAAC;iBACH,CAAC;gBACF,OAAO,EAAE;oBACP,cAAc,EAAE,iCAAiC;iBAClD;aACF,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACnB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBAC/C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAE,IAAI;QACd,IAAI,EAAE,CAAC;QAEP,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,8DAA8D;YAC9D,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;aAAM,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAC9C,gBAAgB;YAChB,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,4CAA4C;QAC5C,6DAA6D;QAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YACjD,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBAC5B,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;wBACxC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;oBAC/B,CAAC,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC3B,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAE,EAAE;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,kBAAkB,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,QAAQ;YACzF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC,MAAM,CAAC,gCAAgC,GAAG,EAAE,GAAG,wBAAwB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC5G,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAE,MAAc,EAAE,GAAW,EAAE,OAAuB;QAC5D,IAAI,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YAC/C,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,MAAM,kBAAkB,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,CAAE,OAAO,CAAC,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;QAAC,CAAC;QAChD,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAE1D,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;YACzB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;SACxB,CAAC,CAAC;QAEH,OAAO,iCAAkB,EAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YAC3D,4CAA4C;YAC5C,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACf,OAAO;YACT,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;oBACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;oBACnB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;gBAClC,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;oBACzB,MAAM,EAAE,MAAM;oBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;oBACvB,OAAO,EAAE,IAAI;iBACd,CAAC,CAAC;gBAEH,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;YACX,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;gBACpB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACnC,CAAC;YACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;gBACzB,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;gBACvB,OAAO,EAAE,KAAK;aACf,CAAC,CAAC;YAEH,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAE,aAAa;QAC5B,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;QACjD,IAAI,MAAM,EAAE,CAAC;YACX,aAAa,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,aAAa,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5E,IAAI,aAAa,CAAC,OAAO,KAAK,aAAa,EAAE,CAAC;gBAC5C,aAAa,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;gBACjD,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,WAAW,CAAC;gBAEjD,cAAc,CAAC,aAAa,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAE,aAAa;QAC/B,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;YAC9B,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,WAAW,CAAC;YACjD,OAAO,aAAa,CAAC,WAAW,CAAC;QACnC,CAAC;QACD,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;CACF;AAGD,sBAAW,EAAC,WAAW,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAE1C,iBAAS,WAAW,CAAC;;;;;;;;;;;;;AC1wBrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;;;;;;;;;;;AAGH,8GAA4C;AAC5C,2GAA0C;AAC1C,gFAAwB;AACxB,kEAIgB;AAEhB,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC,2CAA2C;AAC3C,IAAI,UAAU,CAAC;AAEf,MAAM,SAAU,SAAQ,sBAAY;IAQlC,YAAY,QAAQ;QAClB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC;QAEhD,IAAI,CAAC,EAAE,GAAG,QAAQ,IAAI,UAAU,CAAC;QAEjC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,sCAAsC;YACtC,iBAAG,EAAC,+BAA+B,CAAC,CAAC;YACrC,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QAErB;;;;;;;WAOG;QACH,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QAExB;;;;;;;;;WASG;QACH,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QAEzB,gBAAgB;QAChB,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;IACpC,CAAC;IAED;;OAEG;IACG,QAAQ,CAAE,KAAe;;YAC7B,MAAM,MAAM,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,CAAC;YAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBACjD,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;oBAC/C,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,oBAAS,EAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;gBAC7E,CAAC;qBAAM,IAAI,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;oBACvD,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,oBAAS,EAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;gBAC9E,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAU,KAAK;oBACrD,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;wBAC1B,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;oBAC1B,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;KAAA;IAED;;OAEG;IACG,QAAQ,CAAE,KAAc;;YAC5B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;gBACtB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;YAC5C,CAAC;YACD,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KAAA;IAED;;OAEG;IACH,UAAU;QACR,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBAChC,IAAI,CAAC,qBAAqB,GAAG,qBAAM,CAAC,WAAW,CAAC;oBAC9C,OAAO,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;gBACrF,CAAC,EAAE,KAAK,CAAC,CAAC;YACZ,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC/B,aAAa,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAC1C,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;QACpC,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;YACzC,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED;;OAEG;IACH,cAAc,CAAE,KAAe;QAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAErC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC;YAC/D,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC/C,MAAM,cAAc,GAAG,EAAE,CAAC;YAE1B,IAAI,CAAC,WAAW,EAAE,CAAC;YAEnB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE;gBACzB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,EAAE;oBAClC,cAAc,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;gBAC3C,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,WAAW,CAAC,UAAU,GAAG,GAAG,EAAE;gBAC5B,OAAO,CAAC,cAAc,CAAC,CAAC;gBACxB,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC,CAAC;YAEF,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,GAAG,EAAE;gBAC/C,MAAM,CAAC,6BAA6B,CAAC,CAAC;gBACtC,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC,CAAC;QAEJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACG,YAAY,CAAE,KAAiC;;YACnD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBAErC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;gBAChE,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBACpD,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;gBAEvC,IAAI,CAAC,WAAW,EAAE,CAAC;gBAEnB,iBAAG,EAAC,0BAA0B,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBAEzD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;oBACzB,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;wBAC/B,IAAI,CAAC;4BACH,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;wBACvB,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,iBAAG,EAAC,iCAAiC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;4BAChD,MAAM,CAAC,CAAC;wBACV,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC;4BACH,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;wBAC1B,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,iBAAG,EAAC,kCAAkC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;4BAC7D,MAAM,CAAC,CAAC;wBACV,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,WAAW,CAAC,UAAU,GAAG,GAAG,EAAE;oBAC5B,IAAI,CAAC,WAAW,EAAE,CAAC;oBACnB,iBAAG,EAAC,0BAA0B,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;oBACpG,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC;gBAEF,WAAW,CAAC,OAAO,GAAG,GAAG,EAAE;oBACzB,IAAI,CAAC,WAAW,EAAE,CAAC;oBACnB,MAAM,CAAC,mBAAmB,CAAC,CAAC;gBAC9B,CAAC,CAAC;gBAEF,WAAW,CAAC,OAAO,GAAG,GAAG,EAAE;oBACzB,MAAM,CAAC,mBAAmB,CAAC,CAAC;oBAC5B,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,CAAC,CAAC;YAEJ,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;OAEG;IACH,iCAAiC;IACjC,KAAK,CAAE,QAAiC;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;QAE5B,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAEhB,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE;YACjC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;gBACpC,IAAI,GAAG,EAAE,CAAC;oBACR,iBAAG,EAAC,iDAAiD,EAAE,GAAG,CAAC,CAAC;gBAC9D,CAAC;qBAAM,CAAC;oBACN,SAAS;oBACT,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC;gBAClB,CAAC;gBACD,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;oBACnC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACjB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACG,WAAW,CAAE,EAA0B;;YAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,aAAY,EAAE,EAAE;gBAEzC,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC;gBAC/D,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC;gBAEhE,SAAS,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,EAAE;oBAC5B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;oBAEjC,IAAI,MAAM,EAAE,CAAC;wBACX,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;wBAC/B,MAAM,CAAC,QAAQ,EAAE,CAAC;oBACpB,CAAC;yBAAM,CAAC;wBACN,OAAO,EAAE,CAAC;oBACZ,CAAC;gBACH,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED,OAAO;QACL,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC,CAAC,8CAA8C;YAC1E,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,2BAA2B;QACvE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,iCAAiC;IACjC,MAAM,CAAC,IAAI,CAAE,IAAY,EAAE,QAA+C;QACxE,MAAM,KAAK,GAAG,UAAU,CAAC;YACvB,QAAQ,CAAC,2BAA2B,CAAC,CAAC;QACxC,CAAC,EAAE,KAAK,CAAC,CAAC;QAEV,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAE7C,GAAG,CAAC,OAAO,GAAG;gBACZ,iBAAG,EAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;gBAE1C,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC,CAAC;YAEF,GAAG,CAAC,eAAe,GAAG,UAAU,KAAK;gBACnC,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;gBAEtB,iBAAG,EAAC,4BAA4B,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;gBAE9E,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,EAAE,CAAC;oBAC3B,iBAAG,EAAC,0CAA0C,CAAC,CAAC;oBAChD,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,CAAC,CAAC;gBACnD,CAAC;gBAED,iBAAG,EAAC,4CAA4C,CAAC,CAAC;gBAElD,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,EAAC,OAAO,EAAE,MAAM,EAAC,CAAC,CAAC;YACrD,CAAC,CAAC;YAEF,GAAG,CAAC,SAAS,GAAG;gBACd,YAAY,CAAC,KAAK,CAAC,CAAC;gBAEpB,mCAAmC;gBACnC,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;gBACtB,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;oBACvF,iBAAG,EAAC,2DAA2D,CAAC,CAAC;oBACjE,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE;wBACpB,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;oBACjC,CAAC,CAAC,CAAC;oBACH,OAAO;gBACT,CAAC;gBAED,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;YAC7B,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAG,EAAC,uCAAuC,GAAG,KAAK,CAAC,CAAC;YACrD,iBAAG,EAAC,kDAAkD,CAAC,CAAC;YAExD,YAAY,CAAC,KAAK,CAAC,CAAC;YAEpB,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE;gBACpB,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAE,YAAoB,EAAE,QAAoB;QACtD,MAAM,GAAG,GAAG,SAAS,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAEnD,GAAG,CAAC,SAAS,GAAG;YACd,iBAAG,EAAC,8BAA8B,CAAC,CAAC;YACpC,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC;QAEF,qFAAqF;QACrF,GAAG,CAAC,OAAO,GAAI,GAAW,CAAC,OAAO,GAAG,UAAU,GAAG;YAChD,OAAO,CAAC,KAAK,CAAC,6BAA6B,GAAG,YAAY,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;QACzE,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,gCAAgC;IAChC,MAAM,CAAC,QAAQ,CAAE,aAAsB;QAErC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAErC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,EAAE,EAAE;gBAC/C,IAAI,GAAG,EAAE,CAAC;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;gBACd,CAAC;qBAAM,CAAC;oBACN,UAAU,GAAG,EAAE,CAAC;oBAChB,wCAAwC;oBACvC,EAAU,CAAC,OAAO,GAAG,GAAG,EAAE;wBACxB,aAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;oBAC7C,CAAC,CAAC;oBACF,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QAEL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAErC,MAAM,OAAO,GAAG,2BAAgB,GAAE,CAAC;YAEnC,4CAA4C;YAC5C,yEAAyE;YACzE,wEAAwE;YACxE,0CAA0C;YAE1C,qEAAqE;YACrE,IAAI,oBAAoB,GAAG,KAAK,CAAC;YACjC,IAAI,OAAO,SAAS,KAAK,WAAW;gBAClC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,wBAAwB,CAAC,EAAE,CAAC;gBACtD,uCAAuC;gBACvC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC;oBACjD,oBAAoB,GAAG,IAAI,CAAC;gBAC9B,CAAC;YACH,CAAC;YAED,IAAI,WAAW,IAAI,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBACpD,IAAI,CAAC;oBACH,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACzC,KAAK,CAAC,OAAO,GAAG,WAAU,WAAW;wBACnC,MAAM,EAAE,CAAC;oBACX,CAAC,CAAC;oBACF,KAAK,CAAC,SAAS,GAAG,WAAU,WAAW;wBACrC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;wBACrB,SAAS,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;wBACrC,OAAO,EAAE,CAAC;oBACZ,CAAC,CAAC;gBACJ,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,MAAM,EAAE,CAAC;gBACX,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,CAAC;YACX,CAAC;QAEH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAE,aAAkB;QACpC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,aAAY,EAAE,EAAE;YACzC,IAAI,aAAa,CAAC,KAAK,EAAE,CAAC;gBACxB,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC;YAED,SAAS,CAAC,KAAK,CAAC,eAAe,EAAE,OAAqB,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC;IAED,WAAW;QACT,QAAQ;IACV,CAAC;CACF;AAID,sBAAW,EAAC,SAAS,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAExC,iBAAS,SAAS,CAAC;;;;;;;;;;;;;;;;ACpenB,8GAA4C;AAC5C,2GAA0C;AAC1C,kEAAgD;AAEhD;;;;;IAKI;AAEJ,MAAM,eAAgB,SAAQ,sBAAY;IAIxC;QACE,KAAK,EAAE,CAAC;QAJV,8DAA8D;QACtD,aAAQ,GAA2B,EAAE,CAAC;QAI5C,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ,CAAC,KAAe;QACtB,MAAM,KAAK,GAAY,EAAE,CAAC;QAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACjD,8DAA8D;YAC9D,6DAA6D;YAC7D,iBAAiB;YACjB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,oBAAS,EAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAc;QACrB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,WAAW,CAAC,EAA0B;QACpC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,WAAW;QACT,QAAQ;IACV,CAAC;IAED;;;;;;OAMG;IACO,MAAM,CAAC,QAAQ;QACvB,QAAQ;IACV,CAAC;IAED;;;;;;OAMG;IACO,MAAM,CAAC,aAAa;QAC5B,wCAAwC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACO,MAAM,CAAC,WAAW;QAC1B,QAAQ;IACV,CAAC;CACF;AAID,sBAAW,EAAC,eAAe,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAE9C,iBAAS,eAAe,CAAC;;;;;;;;;;;;;;;;AC7FzB,2GAA0C;AAC1C,8GAA4C;AAC5C,gFAAwB;AACxB,kEAA4D;AAE5D;;IAEI;AAEJ,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAClD,MAAM,cAAc,GAAG,8BAA8B,CAAC;AAEtD,SAAS,kBAAkB,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,YAAY;QACxD,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,KAAK,cAAc,CAAC;AAC5D,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,YAAY,CAAC;AAC7D,CAAC;AAED,MAAM,YAAa,SAAQ,sBAAY;IACrC;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,gBAAgB;IAChB,WAAW,CAAC,GAAG,IAAW;QACxB,OAAO;IACT,CAAC;IAED,QAAQ,CAAC,KAAe;QACtB,MAAM,KAAK,GAAG,EAAE,CAAC;QAEjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACjD,IAAI,CAAC;gBACH,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtE,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;YAC9B,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,QAAQ,CAAC,KAAc;QACrB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,yCAAyC;YACzC,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,WAAW,CAAC,EAA0B;QACpC,IAAI,IAAwB,CAAC;QAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACxD,IAAI,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnC,IAAI,CAAC;oBACH,4EAA4E;oBAC5E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrE,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,IAAI,GAAG,SAAS,CAAC;gBACnB,CAAC;gBACD,IAAI,IAAI,EAAE,CAAC;oBACT,EAAE,CAAC,IAAI,CAAC,CAAC;gBACX,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ;QACb,OAAO;IACT,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO,gCAAqB,GAAE,CAAC;IACjC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW;QAChB,MAAM,IAAI,GAAG,EAAE,CAAC;QAEhB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACxD,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,iBAAG,EAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;YACpC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAID,sBAAW,EAAC,YAAY,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAE3C,iBAAS,YAAY,CAAC;;;;;;;;;;;;;;;;ACzHtB,yFAA8B;AAE9B;;;;;;;GAOG;AACH,SAAS,GAAG,CAAC,GAAG,IAAI;IAClB,IAAI,gBAAM,CAAC,OAAO,EAAE,CAAC;QACnB,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,iBAAS,GAAG,CAAC;;;;;;;;;;;;;;;;;;AChBb,8GAA4C;AAC5C,kEAAkC;AAElC;;GAEG;AACH,MAAa,UAAW,SAAQ,uBAAa;IAQ3C,YAAY,EAAiB;QAC3B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,4EAA4E;IAC9E,CAAC;IAED,mBAAmB;QACjB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED,SAAS,CAAE,GAAW;QACpB,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,GAAG,CAAC;QACb,CAAC;QACD,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YAChB,OAAO,GAAG,CAAC;QACb,CAAC;QAED,OAAO,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,CAAC;IAED,WAAW,CAAE,GAAW;QACtB,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,GAAG,CAAC;QACb,CAAC;QAED,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,wBAAwB,CAAC,MAAc,EAAE,GAAW;QAClD,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC5C,OAAO,mBAAQ,EAAC,GAAG,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AA/CD,gCA+CC;;;;;;;;;;;;ACtDY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,yFAA8B;AAC9B,gFAAwB;AACxB,kEAMgB;AAEhB,yFAA8B;AAC9B,kGAAoC;AACpC,qGAAsC;AACtC,4FAAgC;AAIhC,6FAA8D;AAC9D,wGAAwC;AACxC,4FAAgC;AAChC,sFAA4B;AAC5B,+FAAkC;AAClC,qGAAqC;AACrC,6HAAqD;AACrD,+FAAkC;AAOlC,2EAA2E;AAC3E,8EAA+B;AAE/B,MAAM,aAAa,GAAG,2BAAgB,GAAE,CAAC;AACzC,mBAAmB;AACnB,uCAAuC;AACvC,IAAI;AAEJ,IAAI,eAAwB,CAAC;AAE7B,8CAA8C;AAC9C,SAAS,gBAAgB,CAAC,CAAC;IACzB,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,IAAK,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;QAClD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,4BAAiB,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC5B,CAAC;AAED;;EAEE;AACF,SAAS,eAAe,CAAC,QAAiB;IACxC,OAAO,CAAC,OAAO,QAAQ,KAAK,QAAQ;QAC5B,QAAQ,IAAI,IAAI;QAChB,QAAQ,IAAI,OAAO,CAAC,CAAC;AAC/B,CAAC;AAwCD,IAAK,UAGJ;AAHD,WAAK,UAAU;IACb,oCAAsB;IACtB,iCAAmB;AACrB,CAAC,EAHI,UAAU,KAAV,UAAU,QAGd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoKG;AACH,MAAa,aAAa;IAkGxB,YAAa,GAAY;QAjGzB;;;WAGG;QACH,aAAQ,GAA2B,EAAE,CAAC;QAEtC;;;WAGG;QACH,cAAS,GAAO,EAAE,CAAC;QAEnB;;;WAGG;QACH,kBAAa,GAA2B,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QAEvD;;;WAGG;QACH,YAAO,GAAmE,EAAE,CAAC;QAygB7E,EAAE;QACF,0BAA0B;QAC1B,EAAE;QAEF;;WAEG;QACH,UAAK,GAAG,kBAAQ,CAAC,YAAY,CAAC;QAC9B;;WAEG;QACH,aAAQ,GAAG,kBAAQ,CAAC,QAAQ,CAAC;QAC7B;;WAEG;QACH,gBAAW,GAAG,kBAAQ,CAAC,WAAW,CAAC;QACnC;;WAEG;QACH,qBAAgB,GAAG,kBAAQ,CAAC,gBAAgB,CAAC;QAC7C;;WAEG;QACH,gBAAW,GAAG,kBAAQ,CAAC,WAAW,CAAC;QACnC;;WAEG;QACH,iBAAY,GAAG,kBAAQ,CAAC,YAAY,CAAC;QACrC;;WAEG;QACH,mBAAc,GAAG,kBAAQ,CAAC,cAAc,CAAC;QACzC;;WAEG;QACH,uBAAkB,GAAG,kBAAQ,CAAC,kBAAkB,CAAC;QACjD;;WAEG;QACH,kBAAa,GAAG,kBAAQ,CAAC,aAAa,CAAC;QACvC;;WAEG;QACH,eAAU,GAAG,kBAAQ,CAAC,UAAU,CAAC;QACjC;;WAEG;QACH,sBAAiB,GAAG,kBAAQ,CAAC,iBAAiB,CAAC;QAC/C;;WAEG;QACH,6BAAwB,GAAG,kBAAQ,CAAC,wBAAwB,CAAC;QAC7D;;WAEG;QACH,eAAU,GAAG,kBAAQ,CAAC,UAAU,CAAC;QACjC;;WAEG;QACH,gBAAW,GAAG,kBAAQ,CAAC,WAAW,CAAC;QAxfjC,2CAA2C;QAC3C,gDAAgD;QAChD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAAC,iBAAM,EAAC,gBAAM,EAAE,GAAG,CAAC,CAAC;QAAC,CAAC;QAErD,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc;YACjF,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB;YACvD,sBAAsB,EAAE,eAAe,EAAE,WAAW;YACpD,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB;SAC9D,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC;YACX,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAC5B,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAC5B,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;SACnC,CAAC,CAAC;QAEH,eAAe,GAAG,gCAAqB,GAAE,CAAC;QAE1C,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,kCAAuB,EAAC,wBAAwB,CAAC,IAAI,EAAE,CAAC;YACvE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,eAAe,CAAC,CAAC;QACpF,CAAC;QAED,gDAAgD;QAChD,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;QAEvB,IAAI,CAAC,EAAE,GAAG,UAAU,SAAiB,EAAE,OAAiB;YACtD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,iEAAiE;gBACjE,6BAA6B;gBAC7B,QAAO,SAAS,EAAE,CAAC;oBACjB,KAAK,iBAAiB;wBACpB,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;wBACvB,MAAM;oBACR,KAAK,OAAO;wBACV,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;4BAChB,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;wBACzB,CAAC;wBACD,MAAM;oBACR,KAAK,WAAW;wBACd,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;4BACzC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;wBACzB,CAAC;wBACD,MAAM;oBACR,KAAK,eAAe;wBAClB,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;4BAC1C,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;wBACzB,CAAC;wBACD,MAAM;oBACR,KAAK,kBAAkB;wBACrB,IAAI,CAAC,IAAI,CAAC,MAAM,YAAY,eAAK,CAAC;+BAC7B,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,MAAM,GAAG,CAAC;+BACnC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE,CAAC;4BACtC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;wBACzB,CAAC;wBACD,MAAM;gBACV,CAAC;YACH,CAAC;YAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC,CAAC;QAEF,qCAAqC;QACrC,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb;;WAEG;QACH,IAAI,CAAC,WAAW,GAAG;YACjB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;YACzD,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAeD;;;;OAIG;IACH,WAAW;QACT,gBAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAE,OAAyB;QAClC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACnD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YACzC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7C,CAAC;QAED,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;YAC1B,OAAO,CAAC,WAAW,GAAG,gBAAM,CAAC,kBAAkB,CAAC;QAClD,CAAC;aAAM,CAAC;YACN,MAAM,QAAQ,GAAG,mBAAS,CAAC,WAAW,EAAE,CAAC;YACzC,IAAI,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;YAClC,IAAI,QAAQ,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;gBAC9B,WAAW,IAAI,QAAQ,CAAC,QAAQ,CAAC;YACnC,CAAC;YAED,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;QACpC,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;YAC5C,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;QACzE,CAAC;QAED,mBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,WAAW,CAAE,UAAmB,EAAE,WAAoB;QACpD,mDAAmD;QACnD,UAAU,GAAG,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QAClD,WAAW,GAAG,WAAW,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEvD,iBAAG,EAAC,6DAA6D,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,CAAC,CAAC;QAClH,gEAAgE;QAChE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,mBAAS,CAAC,kBAAkB;SACpC,CAAC,CAAC;QACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,OAAO,CAAE,WAAmB,EAAE,KAAc;QAC1C,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QACjC,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,uCAAuC,CAAC,EAAE,CAAC;YAChG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,aAAa,CAAC,cAAc,CAAC,kCAAkC,CAAC,CAAC,CAAC;YAC1F,OAAO;QACT,CAAC;QAED,2CAA2C;QAC3C,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;YACvE,WAAW,GAAG,WAAW,WAAW,EAAE,CAAC;QACzC,CAAC;QAED,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,OAAO,gBAAM,CAAC,kBAAkB,KAAK,QAAQ,EAAE,CAAC;gBAClD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,aAAa,CAAC,cAAc,CAAC,gEAAgE,CAAC,CAAC,CAAC;gBACxH,OAAO;YACT,CAAC;YACD,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;gBACxC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,aAAa,CAAC,cAAc,CAAC,gEAAgE,CAAC,CAAC,CAAC;gBACxH,OAAO;YACT,CAAC;QACH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;YACpB,WAAW,EAAE,WAAW;SACzB,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAEzB,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAS,EAAE;YAC7C,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,aAAa,CAAC,cAAc,CAAC,qDAAqD,CAAC,CAAC,CAAC;QAC/G,CAAC,EAAE,gBAAM,CAAC,gBAAgB,CAAC,CAAC;QAE5B,sBAAQ,EAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,IAAiB,EAAQ,EAAE;YACrD,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,CAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC5B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;wBACjC,wDAAwD;wBACxD,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC5C,CAAC;yBAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;wBACrC,gDAAgD;wBAChD,iBAAG,EAAC,iEAAiE,CAAC,CAAC;wBACvE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;oBAC1C,CAAC;yBAAM,CAAC;wBACN,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;oBAC5D,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,+DAA+D;oBAC/D,+DAA+D;oBAC/D,gEAAgE;oBAChE,kEAAkE;oBAClE,2BAA2B;oBAC3B,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,CAAC;YACH,CAAC;QACH,CAAC,EAAE,EAAC,OAAO,EAAE,EAAE;YACb,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,aAAa,CAAC,cAAc,CAAC,qDAAqD,CAAC,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,SAAS;QACP,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvC,IAAI,IAAI,CAAC,OAAO,KAAK,eAAe,EAAE,CAAC;YACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,UAAU;QACR,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;gBACpB,WAAW,EAAE,IAAI;gBACjB,IAAI,EAAE,IAAI;gBACV,UAAU,EAAE,IAAI;gBAChB,KAAK,EAAE,IAAI;gBACX,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,CAAC;YACX,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAC5B,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAC5B,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;SACnC,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEV,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,CAAC,EAAE,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACX,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,+CAA+C;gBAC/C,wEAAwE;gBACxE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC,CAAC;QAEF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAA2C,EAAE,EAAE;gBACrE,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;gBACpC,IAAI,OAAM,CAAC,aAAa,CAAC,KAAK,QAAQ,IAAI,OAAM,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE,CAAC;oBACpF,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC9B,CAAC;qBAAM,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,UAAU,CAAE,IAAI;QACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,eAAe,EAAE,CAAC;YACpB,IAAI,IAAI,EAAE,CAAC;gBACT,YAAY,CAAC,OAAO,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAE,IAAY,EAAE,OAAqB;QAC3C,IAAI,CAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACvC,CAAC;QACD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;;OAQG;IACH,SAAS;QACP,gBAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,gBAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAE,GAAG,IAAI;QACV,aAAG,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAED;;;;;;;;;;OAUG;IACH,UAAU,CAAE,OAAuC;QACjD,MAAM,UAAU,GAAa,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QACrE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YAClG,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAE;YACjE,OAAO,KAAK,CAAC;QACf,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAClC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1B,IAAI,CAAC,GAAG,EAAE,CAAC;gBAAC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAAC,OAAO;YAAC,CAAC;YAEhD,QAAO,IAAI,EAAE,CAAC;gBACZ,KAAK,UAAU,CAAC,OAAO;oBACrB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;oBACnD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW;wBACnC,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;wBAClC,iBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBACzB,CAAC;oBACD,MAAM;gBACR,KAAK,UAAU,CAAC,MAAM;oBACpB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC;oBACpD,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,WAAW;wBACzC,IAAI,CAAC,WAAW,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;wBACpC,qBAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAC7B,CAAC;oBACD,MAAM;YACV,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,IAAI,eAAe,EAAE,CAAC;YACpB,YAAY,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,CAAC;IAEH,CAAC;IAED;;;;;;;;;OASG;IACH,qBAAqB,CAAE,GAAW;QAChC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QACD,gBAAM,CAAC,kBAAkB,GAAG,GAAG,CAAC;IAClC,CAAC;IA+DD,EAAE;IACF,mCAAmC;IACnC,EAAE;IAEF;;;OAGG;IACH,OAAO,CAAE,IAAI,EAAE,OAAQ;QACrB,SAAS,IAAI,CAAC,IAAI;YAChB,OAAO,UAAU,GAAG,IAAI;gBACtB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;qBAC7B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACvC,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,WAAW,CAAE,UAAU;QACrB,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE;YACjB,MAAM,eAAe,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;oBACjB,MAAM,EAAE,UAAU;oBAClB,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE;wBACP,OAAO,EAAE,OAAO;wBAChB,MAAM,EAAE,MAAM;qBACf;iBACF,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAChC,IAAI,CAAC;gBACH,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC9F,CAAC;YAAC,OAAM,CAAC,EAAE,CAAC;gBACV,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,EAAE;IACF,wBAAwB;IACxB,EAAE;IAEF;;;OAGG;IACH,WAAW,CAAE,MAAc;QACzB,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,cAAc,CAAE,SAAiB,EAAE,KAAK;QACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAY,EAAE,EAAE;YAClE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;YACvB,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;gBACtC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;oBACtD,MAAM,EAAE,GAA8B,EAAE,CAAC;oBACzC,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;wBAAC,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;oBAAC,CAAC;oBAClD,EAAE,CAAC,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;oBACjE,IAAI,CAAC;wBACH,OAAO,CAAC,EAAE,CAAC,CAAC;oBACd,CAAC;oBAAC,OAAM,CAAC,EAAE,CAAC;wBACV,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;wBACvD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;oBACzB,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAE,IAAY;QACjB,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,wDAAwD,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,iKAAiK,CAAC,CAAC;QAClL,CAAC;QACD,OAAO,IAAI,oBAAU,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;;;;;;OAQG;IACH,eAAe;QACb,OAAO,gBAAM,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;;;;;OAOG;IACH,eAAe,CAAE,QAAgB;QAC/B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,+BAA+B,CAAC;QACnD,CAAC;QACD,MAAM,QAAQ,GAAG,gBAAM,CAAC,YAAY,CAAC;QACrC,gBAAM,CAAC,YAAY,GAAG,QAAQ,CAAC;QAE/B,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACjC,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,yBAAyB;QACvB,OAAO,gBAAM,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACH,yBAAyB,CAAE,QAAgB;QACzC,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,+BAA+B,CAAC;QACnD,CAAC;QACD,MAAM,QAAQ,GAAG,gBAAM,CAAC,sBAAsB,CAAC;QAC/C,gBAAM,CAAC,sBAAsB,GAAG,QAAQ,CAAC;QAEzC,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACjC,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,sBAAsB;QACpB,OAAO,gBAAM,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,gBAAM,CAAC,YAAY,CAAC;IACnF,CAAC;IAED;;;;;;;;OAQG;IACH,iBAAiB;QACf,OAAO,gBAAM,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;;;OAOG;IACH,iBAAiB,CAAE,OAAe;QAChC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,OAAO,GAAG,iCAAiC,CAAC;QACpD,CAAC;QACD,gBAAM,CAAC,cAAc,GAAG,OAAO,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAEhD,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,GAAS,EAAE;YAC9B,+CAA+C;YAC/C,4EAA4E;YAC5E,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACpC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;oBACpB,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;gBAC9B,CAAC;gBACD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;YAC9F,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,SAAS;QACP,IAAI,CAAC,gBAAM,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;YAC9D,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,+CAA+C;YAC/C,+BAA+B;YAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,uEAAuE;YACvE,6DAA6D;YAC7D,+CAA+C;YAC/C,+CAA+C;YAC/C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,SAAS,CAAE,MAAgB;QACzB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC;QAC/B,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC;QAErC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE;YACtC,YAAY,EAAE,IAAI;YAClB,GAAG,EAAE;gBACH,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;gBAC7D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE;oBACtC,KAAK,EAAE,QAAQ;iBAChB,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC;YAClB,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACnC,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC;gBAC9D,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAC5B,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE;gBACzC,GAAG,EAAE;oBACH,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC1B,CAAC;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAE,UAAkB,EAAE,aAAa;QAC5C,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,aAAa,CAC1B,IAAI,oBAAU,CAAC,IAAI,EAAE,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC,EAC5C,IAAI,oBAAU,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,GAAG,CAAC,CACpD,CAAC;YACF,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,MAAM,kBAAkB,GAAG,UAAU,CAAC;QACxC,CAAC;IACH,CAAC;;AA58BH,sCA68BC;AApxBC;;;;;GAKG;AACI,uBAAS,GAAG,mBAAS,CAAC;AAEtB,uBAAS,GAAG,oBAAS,CAAC;AACtB,0BAAY,GAAG,4BAAiB,CAAC;AACjC,4BAAc,GAAG,kBAAQ,CAAC,cAAc,CAAC;AACzC,kBAAI,GAAG,IAAI,CAAC;AA2wBrB;;;;EAIE;AACF,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,EAAE;IACvD,GAAG,EAAE;QACH,MAAM,MAAM,GAAG,IAAI,gBAAM,EAAE,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE;YACpC,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC;AAEH,4FAA4F;AAC5F,EAAE;AACF,mEAAmE;AACnE,qEAAqE;AACrE,qBAAqB;AAErB;;;;GAIG;AACH,sFAAsF;AACtF,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE;IACxD,YAAY,EAAE,IAAI;IAClB,GAAG,EAAE;QACH,MAAM,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE;YACrC,KAAK,EAAE,OAAO;SACf,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC,CAAC;AAGH,sBAAW,EAAC,aAAa,EAAE,CAAC,6BAAa,CAAC,CAAC,CAAC;AAE5C,qBAAe,aAAa,CAAC;;;;;;;;;;;;;ACrwC7B;;;;;GAKG;;;;;;;;;;;;;;;AAUH,oCASC;AA8BD,gDAQC;AAvDD,gFAAwB;AACxB,yFAA8B;AAG9B;;;KAGK;AACL,SAAgB,YAAY,CAAC,GAAmB;IAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC,GAAG,IAAI,CAAC;IACvE,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAG,eAAe;QACvC,OAAO,QAAQ,CAAC;IAClB,CAAC;SAAM,CAAC,CAAG,+CAA+C;QACxD,iDAAiD;QACjD,4BAA4B;QAC5B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAM,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAM,CAAC,YAAY,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACzG,CAAC;AACH,CAAC;AAID,IAAI,OAAO,CAAC,CAAC,qBAAM,IAAI,MAAa,CAAC,CAAC,eAAe,CAAC,KAAK,UAAU,EAAE,CAAC;IACtE,yBAAiB,GAAG,UAAU,MAAM;QAClC,OAAO,MAAM,IAAI,CAAC,MAAM,YAAY,CAAC,qBAAM,IAAI,MAAa,CAAC,CAAC,eAAe,CAAC,CAAC;IACjF,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,MAAM,gBAAgB,GAAG;QACvB,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW;QAC9C,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY;KACpD,CAAC;IACF,yBAAiB,GAAG,UAAU,MAAM;QAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,IAAI,MAAM,YAAY,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1C,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AASD,SAAsB,kBAAkB,CAAC,MAAc,EAAE,GAAW,EAAE,OAAuB;;QAC3F,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,OAAO,wBAAwB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;aAAM,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE,CAAC;YAChD,OAAO,sBAAsB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACtD,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,MAAM,CAAC,mEAAmE,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC;CAAA;AAED,SAAe,wBAAwB,CAAC,MAAc,EAAE,GAAW,EAAE,OAAuB;;QAC1F,MAAM,eAAe,GAAG,OAAO,eAAe,KAAK,UAAU,CAAC,CAAC;YAC7D,IAAI,eAAe,EAAE,CAAC,CAAC;YACvB,IAAI,CAAC;QACP,IAAI,SAAS,CAAC;QAEd,MAAM,cAAc,GAAmB,IAAI,OAAO,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;YACtE,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC1B,IAAI,eAAe,EAAE,CAAC;oBACpB,eAAe,CAAC,KAAK,EAAE,CAAC;gBAC1B,CAAC;gBACD,MAAM,CAAC,SAAS,CAAC,CAAC;YACpB,CAAC,EAAE,gBAAM,CAAC,cAAc,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,IAAI,YAAY,CAAC;QACjB,MAAM,eAAe,GAAG,EAAE,CAAC;QAE3B,MAAM,cAAc,GAA4B,KAAK,CAAC,GAAG,EAAE;YACzD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SAC7D,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnB,iBAAG,EAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;YAElC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAa,EAAE,UAAkB,EAAE,EAAE;gBAC7D,eAAe,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;YACpD,CAAC,CAAC,CAAC;YAEH,YAAY,GAAG;gBACb,UAAU,EAAE,CAAC;gBACb,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,QAAQ,EAAE,SAAS;gBACnB,iBAAiB,EAAE,CAAC,UAAkB,EAAU,EAAE;oBAChD,OAAO,eAAe,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;gBAC3D,CAAC;gBACD,uBAAuB;gBACvB,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,WAAW,EAAE,GAAG;aACjB,CAAC;YACF,QAAQ,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC7B,KAAK,aAAa;oBAChB,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;gBAChC,KAAK,MAAM;oBACT,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACzB,KAAK,MAAM;oBACT,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACzB,KAAK,SAAS,CAAC;gBACf,KAAK,EAAE,CAAC;gBACR,KAAK,MAAM;oBACT,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACzB,SAAW,WAAW;oBACpB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;YACtF,CAAC;QACH,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE;YACxB,YAAY,CAAC,QAAQ,GAAG,aAAa,CAAC;YACtC,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;gBAC7D,YAAY,CAAC,YAAY,GAAG,aAAa,CAAC;YAC5C,CAAC;YACD,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACd,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IACxD,CAAC;CAAA;AAED,SAAe,sBAAsB,CAAC,MAAc,EAAE,GAAW,EAAE,OAAuB;;QACxF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAErC,iBAAG,EAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YAEnC,IAAI,QAAQ,GAAG,KAAK,CAAC;YAErB,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,QAAQ,GAAG,IAAI,CAAC;gBAChB,MAAM,CAAC,SAAS,CAAC,CAAC;YACpB,CAAC,EAAE,gBAAM,CAAC,cAAc,CAAC,CAAC;YAE1B,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;YACjC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;YAE5B,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;gBACzB,GAAG,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;YAC1C,CAAC;YAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;oBAClC,GAAG,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBAClD,CAAC;YACH,CAAC;YAED,GAAG,CAAC,MAAM,GAAG,GAAS,EAAE;gBACtB,IAAI,QAAQ,EAAE,CAAC;oBACb,OAAO;gBACT,CAAC;gBACD,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC,CAAC;YAEF,GAAG,CAAC,OAAO,GAAG,CAAC,KAAK,EAAQ,EAAE;gBAC5B,IAAI,QAAQ,EAAE,CAAC;oBACb,OAAO;gBACT,CAAC;gBACD,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC;YAEF,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAExB,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,6BAAiB,EAAC,IAAI,CAAC,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;gBAC1F,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;;;;;;;;;;;;;ACrLD;;;;;;;;GAQG;AAEH,MAAM,aAAa;IAOjB,YAAY,YAAoB;QAJxB,cAAS,GAA2B,EAAE,CAAC;QACvC,aAAQ,GAA8B,EAAE,CAAC;QACzC,kBAAa,GAAG,KAAK,CAAC;QAG5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAGD;;;OAGG;IACH,GAAG,CAAC,GAAW;QACb,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACxB,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;YAC3B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;QAC9B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,GAAW,EAAE,KAAK;QACpB,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,0BAA0B,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,qBAAqB;QACnB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,mBAAmB;QACjB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,GAAW;QAC3B,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;YAC9B,sCAAsC;YACtC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC;YAClC,sCAAsC;YACtC,IAAI,IAAI,CAAC,CAAC,CAAC,2BAA2B;QACxC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,KAAe;QACnC,0EAA0E;QAC1E,aAAa;QACb,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACK,0BAA0B,CAAC,GAAW,EAAE,GAAG;QACjD,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;YACpC,CAAC;YACD,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC1D,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,oBAAoB,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;YAClC,CAAC;YACD,2BAA2B;YAC3B,IAAI,CAAC,0BAA0B,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,GAAW;QAClC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;OAGG;IACK,UAAU,CAAC,GAAW;QAC5B,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;YAChD,MAAM,oBAAoB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC1D,MAAM,SAAS,GAAG,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,oBAAoB,EAAE,CAAC;gBACxC,SAAS,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7C,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YAC7C,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,kBAAkB,CAAC,MAAc;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7B,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,SAAS,GAAG,EAAE,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC5B,MAAM,KAAK,GAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;gBACjD,IAAI,QAAQ,CAAC;gBACb,IAAI,KAAK,EAAE,CAAC;oBACV,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;gBAC3C,CAAC;qBAAM,CAAC;oBACN,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC5B,CAAC;gBACD,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC;YACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzB,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,iBAAS,aAAa,CAAC;;;;;;;;;;;;;ACtLvB,MAAM,cAAe,SAAQ,KAAK;IAChC,YAAY,GAAW;QACrB,KAAK,EAAE,CAAC;QACR,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,oBAAoB,GAAG,GAAG,CAAC,CAAC;QACpD,KAAK,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,iBAAS,cAAc,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;ACTxB,sKAG4C;AAC5C,4HAK8B;AAC9B,qGAAsC;AACtC,8GAA4C;AAC5C,kEAKgB;AAChB,wEAA4E;AAE5E,2GAA2C;AAC3C,+FAAwB;AAExB,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAE3C,IAAI,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,SAAS,cAAc,CAAE,EAAE;IACzB,IAAI,EAAE,CAAC,yBAAyB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC7C,EAAE,CAAC,yBAAyB,GAAG,oBAAU,CAAC,SAAS,CAAC,UAAU,CAAC;IAC/D,oBAAU,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,IAAY;QACtD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,MAAM,6DAA6D,CAAC;QACtE,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC;YACD,OAAO,IAAI,CAAC,cAAc,GAAG,oBAAS,EAAC,IAAI,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAE,EAAE;IAC3B,IAAI,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC9C,oBAAU,CAAC,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC,yBAAyB,CAAC;IAC/D,OAAO,EAAE,CAAC,yBAAyB,CAAC;AACtC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,IAA4B;IACrD,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,IAAI,YAAY,cAAI,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,IAAI,YAAY,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,cAAI,CAAC,CAAE,IAAI,CAAE,EAAE,EAAE,IAAI,EAAG,0BAA0B,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,IAAI,YAAY,WAAW,EAAE,CAAC;YAChC,OAAO,IAAI,cAAI,CAAC,CAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAE,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,cAAI,CAAC,CAAE,IAAI,CAAE,EAAE,EAAE,IAAI,EAAG,0BAA0B,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,IAAI,IAAI,YAAY,QAAQ,EAAE,CAAC;YAC7B,OAAO,IAAI,cAAI,CAAC,CAAE,IAAI,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAE,EAC5F,EAAE,IAAI,EAAG,mCAAmC,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,IAAI,YAAY,eAAe,EAAE,CAAC;YACpC,OAAO,IAAI,cAAI,CAAC,CAAE,IAAI,CAAC,QAAQ,EAAE,CAAE,EAAE,EAAE,IAAI,EAAG,mCAAmC,EAAE,CAAC,CAAC;QACvF,CAAC;IACH,CAAC;IACD,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,cAAI,CAAC,CAAE,IAAI,CAAE,EAAE,EAAE,IAAI,EAAG,YAAY,EAAE,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,IAAI,cAAI,CAAC,CAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAE,EAAE,EAAE,IAAI,EAAG,kBAAkB,EAAE,CAAC,CAAC;AAC3E,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,KAAM,SAAQ,mBAAU;IAQ5B,YAAY,aAAa;QACvB,KAAK,CAAC,aAAa,CAAC,CAAC;QAPvB,YAAO,GAAa,IAAI,CAAC;QAQvB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC,CAAC;QAEnE,oFAAoF;QACpF,0CAA0C;QAC1C,IAAI,CAAC,aAAa,GAAG,IAAI,sBAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,oCAAO,CAAC;YACzB,aAAa,EAAE,IAAI,4CAAe,EAAE,EAAE,8DAA8D;YACpG,eAAe,EAAE,IAAI,CAAC,aAAa;SACpC,EAAE,KAAK,CAAC,CAAC;QAEV,eAAe,GAAG,gCAAqB,GAAE,CAAC;QAE1C,IAAI,eAAe,EAAC,CAAC;YACnB,MAAM,QAAQ,GAAG,kCAAuB,EAAC,YAAY,CAAC,CAAC;YACvD,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,eAAe,CAAC,MAAc;QAC5B,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAEzC,IAAI,OAAO,aAAa,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;gBACtD,IAAI,QAAQ,GAAG,kCAAuB,EAAC,YAAY,CAAC,CAAC;gBAErD,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,QAAQ,GAAG,EAAG,CAAC;gBACjB,CAAC;gBAED,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;gBAC7B,QAAQ,CAAC,UAAU,GAAG;oBACpB,iBAAiB,EAAE,aAAa;oBAChC,MAAM,EAAE,IAAI,CAAC,cAAc;iBAC5B,CAAC;gBAEF,IAAI,CAAC,iBAAiB,GAAG,aAAa,CAAC;gBAEvC,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC7D,OAAO;YACT,CAAC;QACH,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;OASG;IACH,SAAS,CAAE,QAAwB;QACjC,wFAAwF;QACxF,IAAI,OAAO,QAAQ,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QAAC,CAAC;QAC7F,6EAA6E;QAC7E,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC;QAAC,CAAC;QAC3E,uEAAuE;QACvE,IAAI,OAAO,QAAQ,CAAC,UAAU,KAAK,WAAW,EAAE,CAAC;YAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAyD,CAAC;YAEtF,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,OAAO,UAAU,CAAC,iBAAiB,KAAK,WAAW,EAAE,CAAC;oBACxD,IAAI,CAAC,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC;gBACxD,CAAC;qBACI,CAAC;oBACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAChC,CAAC;gBACD,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;oBAC7C,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;gBAC1C,CAAC;qBACI,CAAC;oBACJ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;gBAC7B,CAAC;YACH,CAAC;iBACI,CAAC;gBACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;gBAC9B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,MAAM,oBAAoB,GAAG;YAC3B,IAAI,eAAe,EAAE,CAAC;gBACpB,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;oBAChD,WAAW,EAAE,IAAI,CAAC,WAAW;oBAC7B,IAAI,EAAE,IAAI,CAAC,OAAO;oBAClB,UAAU,EAAE;wBACV,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;wBACzC,MAAM,EAAE,IAAI,CAAC,cAAc;qBAC5B;iBACF,CAAC,CAAC,CAAC;YACN,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,WAAW,GAAG;YAClB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,eAAe,EAAE,CAAC;gBACpB,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YACxC,CAAC;QACH,CAAC,CAAC;QAEF,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;YACrE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;YACnE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,UAAU,CAAC,OAAe;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;OAQG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,MAAc;QACtB,IAAI,IAAI,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;YACnC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAE7B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACtD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;gBACxB,IAAI,QAAQ,GAAG,kCAAuB,EAAC,YAAY,CAAC,CAAC;gBACrD,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,QAAQ,GAAG,EAAG,CAAC;gBACjB,CAAC;gBAED,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;gBAC/C,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC;gBAC7B,QAAQ,CAAC,UAAU,GAAG;oBACpB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;oBACzC,MAAM,EAAE,IAAI,CAAC,cAAc;iBAC5B,CAAC;gBAEF,YAAY,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAE7D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;gBACtB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YAC1B,CAAC;iBACI,CAAC;gBACJ,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBACvB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAE5B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC,CAAC;YAC/D,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YACjB,UAAU,EAAE,IAAI,CAAC,OAAO;YACxB,WAAW,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;YAC1D,UAAU,EAAE,gBAAgB;SAC7B,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,KAAI,CAAC,OAAO,EAAC,KAAI,CAAC;IAC/E,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,IAAY;QACrB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3B,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,IAAI,GAAG,GAAG,CAAC;QACb,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IACpC,CAAC;IAED;;;;;;;;;OASG;IACH,GAAG,CAAE,IAAY,EAAE,UAAoC,EAAE;QACvD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEtC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC3B,OAAO,kCAAe,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE;gBACrF,MAAM,IAAI,GAAgB,6CAA0B,EAAC,gBAAgB,CAAC,CAAC;gBACvE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;oBACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;oBAChD,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;oBAE5C,IAAI,QAAQ,EAAE,CAAC;wBACb,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAG,CAAC,CAAC,uBAAuB;oBAC9C,CAAC;yBACI,CAAC;wBACJ,MAAM,WAAW,GAAG,2BAAQ,EAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;wBAErD,GAAG,CAAC,QAAQ,CAAC,GAAG;4BACd,gBAAgB,EAAE,6BAAU,EAAC,WAAW,EAAE,sCAAsC,CAAC;4BACjF,eAAe,EAAE,8BAAW,EAAC,WAAW,EAAE,mCAAmC,CAAC,CAAC,WAAW,EAAE,EAAE,qBAAqB;yBACpH,CAAC;oBACJ,CAAC;oBAED,OAAO,GAAG,CAAC;gBACb,CAAC,EAAE,EAAG,CAAC,CAAC;gBAER,OAAO,OAAO,CAAC,OAAO,CAAC;oBACrB,UAAU,EAAE,GAAG;oBACf,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,iCAAiC;oBAC9C,4BAA4B;iBACX,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACf,IAAI,KAAK,YAAY,yBAAU,EAAE,CAAC;oBAChC,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;wBAC7B,OAAO,OAAO,CAAC,OAAO,CAAC;4BACrB,UAAU,EAAE,GAAG;4BACf,IAAI,EAAE,EAAG;4BACT,WAAW,EAAE,iCAAiC;4BAC9C,cAAc;yBACG,CAAC,CAAC;oBACvB,CAAC;gBACH,CAAC;gBAED,OAAO,OAAO,CAAC,MAAM,CAAC,2BAA2B,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,0BAAO,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAChE,OAAO;gBACL,UAAU,EAAE,GAAG;gBACf,IAAI,EAAE,IAAI;gBACV,WAAW,EAAE,iCAAc,EAAC,IAAI,CAAC;aAChB,CAAC;QACtB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACf,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAEpC,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBACnE,OAAO;oBACL,UAAU,EAAE,UAAU;iBACL,CAAC;YACtB,CAAC;YAED,OAAO,OAAO,CAAC,MAAM,CAAC,0BAA0B,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAE,IAAY,EAAE,IAA4B,EAAE,WAAmB,EAAE,UAAsD,EAAE;QAC5H,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAEjC,MAAM,SAAS,GAAG;YAChB,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACrC,OAAO,gCAAa,EAAC,OAAO,EAAE,IAAI,EAAE;gBAClC,WAAW,EAAE,WAAW;gBACxB,KAAK,EAAE,KAAK;aACb,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBAClB,OAAO;oBACL,UAAU,EAAE,GAAG;iBACE,CAAC;YACtB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBACf,OAAO,OAAO,CAAC,MAAM,CAAC,yBAAyB,GAAG,KAAK,CAAC,UAAU,GAAG,IAAI,GAAG,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC;YACnG,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,0BAAO,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACnD,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,KAAK,GAAG,CAAC,EAAE,CAAC;gBAC7C,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAmB,CAAC;YACnE,CAAC;YAED,OAAO,SAAS,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACf,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAEpC,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBACvB,OAAO,SAAS,EAAE,CAAC;YACrB,CAAC;YAED,OAAO,OAAO,CAAC,MAAM,CAAC,yBAAyB,GAAG,UAAU,GAAG,IAAI,GAAG,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC;QAC7F,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAE,IAAY,EAAE,UAAgC,EAAE;QACtD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEtC,OAAO,6BAAU,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;YAClE,OAAO,EAAC,UAAU,EAAE,GAAG,EAAmB,CAAC;QAC7C,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACf,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;YAEpC,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;gBACvB,OAAO,EAAC,UAAU,EAAE,GAAG,EAAmB,CAAC;YAC7C,CAAC;YAED,OAAO,OAAO,CAAC,MAAM,CAAC,4BAA4B,GAAG,UAAU,GAAG,IAAI,GAAG,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAE,aAAa;QAC5B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;QACvC,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;QAC5B,IAAI,aAAa,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;YACtC,aAAa,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC;YACjD,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC;YAE3C,cAAc,CAAC,aAAa,CAAC,CAAC;YAE9B,CAAC,GAAS,EAAE;gBACV,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;gBAC9B,MAAM,OAAO,CAAC,sBAAsB,EAAE,CAAC;gBACvC,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;oBAC5B,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;oBACjC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;oBAE1B,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;wBACzB,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;oBAC3B,CAAC;yBACI,CAAC;wBACJ,KAAK,CAAC,OAAO,GAAG,MAAM,+BAAY,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;wBAC5D,aAAa,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;oBAC1C,CAAC;gBACH,CAAC;qBACI,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;oBACjC,KAAK,CAAC,OAAO,EAAE,CAAC;gBAClB,CAAC;YACH,CAAC,EAAC,EAAE,CAAC;QACP,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,aAAa;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAE,aAAa;QAC/B,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;YAC9B,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,WAAW,CAAC;YACjD,OAAO,aAAa,CAAC,WAAW,CAAC;QACnC,CAAC;QACD,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAClC,CAAC;CACF;AAED,sBAAW,EAAC,KAAK,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAEpC,iBAAS,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;AC3lBf,MAAM,cAAc;IAClB,IAAI,OAAO;QACT,OAAO,MAAM,CAAC,YAAY,CAAC;IAC7B,CAAC;IAEK,GAAG,CAAC,GAAW;;YACnB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;QAChD,CAAC;KAAA;IAEK,GAAG,CAAC,GAAW,EAAE,KAAa;;YAClC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACnC,CAAC;KAAA;IAEK,MAAM,CAAC,GAAW;;YACtB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;KAAA;CACF;AAED,MAAqB,aAAa;IAKhC,YAAY,QAAwB;QAJ5B,mBAAc,GAAmB,IAAI,cAAc,EAAE,CAAC;QAK5D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,WAAW,CAAC,GAAW;QAC7B,OAAO,GAAG,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC;IACzD,CAAC;IAEM,SAAS,CAAC,MAAc;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEK,GAAG,CAAC,GAAW;;YACnB,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB,CAAC;iBACI,CAAC;gBACJ,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;KAAA;IAEK,GAAG,CAAC,GAAW,EAAE,KAAa;;YAClC,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;oBAChB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAC1C,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBAC3C,MAAM,SAAS,mCAAQ,SAAS,GAAK,gBAAgB,CAAE,CAAC;oBACxD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;gBAC1C,CAAC;qBACI,CAAC;oBACJ,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;gBACtB,CAAC;gBACD,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7C,CAAC;iBACI,CAAC;gBACJ,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;KAAA;IAEK,MAAM,CAAC,GAAW;;YACtB,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;gBACxB,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7C,CAAC;iBACI,CAAC;gBACJ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;KAAA;CACF;AArDD,mCAqDC;;;;;;;;;;;;;AC5ED,MAAM,SAAU,SAAQ,KAAK;IAG3B,YAAa,aAA6B;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC;QAC/B,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;YACtC,IAAI,CAAC,OAAO,IAAI,aAAa,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO,CAAC;YACtC,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACrC,CAAC;IACH,CAAC;CACF;AAED,iBAAS,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AChBnB,yFAA8B;AAC9B,gFAAwB;AACxB,8GAA4C;AAC5C,gFAAwB;AACxB,kGAAoC;AACpC,qGAAqC;AACrC,6HAAqD;AACrD,kEAOgB;AAEhB,IAAI,WAAW,EAAE,aAAa,CAAC;AAkB/B,SAAS,OAAO,CAAE,MAAM,EAAE,IAAY,EAAE,OAAqB;IAC3D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC;AAED,SAAS,WAAW,CAAE,IAAY,EAAE,IAAY;IAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI;QAC7B,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,YAAY,CAAE,IAAY;IACjC,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AAC3F,CAAC;AAED,SAAS,iBAAiB,CAAE,IAAY;IACtC,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC7C,CAAC;AAED,SAAS,kBAAkB,CAAE,IAAY;IACvC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;QACnE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI;YACrC,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,mBAAmB,CAAE,IAAY;IACxC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK;QACzC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,gBAAgB,CAAE,GAAG,EAAE,EAAE;IAChC,SAAS,YAAY,CAAE,YAAY;QACjC,MAAM,QAAQ,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC;QAC7C,gBAAM,CAAC,YAAY,GAAG,CAAC,YAAY,CAAC;QACpC,MAAM,QAAQ,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC;QAC7C,EAAE,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC,CAAC;IAC7E,CAAC;IACD,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAChD,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;IAiBI;AACJ,MAAa,IAAI;IAcf,YAAa,aAAqB;QAFlC,mBAAc,GAAoB,EAAE,CAAC;QAGnC,IAAI,CAAC,EAAE,GAAG,aAAa,CAAC;QAExB,IAAI,CAAC,MAAM,GAAS,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAO,EAAE,CAAC;QACvB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAEvB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QAErB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnB,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,IAAY,EAAQ,EAAE;YAChD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACnB,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACvC,CAAC;IAEM,GAAG;QACR,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;IAEM,eAAe,CAAE,IAAY;QAClC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC9B,MAAM,CAAC,6DAA6D,CAAC,CAAC;YACxE,CAAC;iBAAM,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClC,MAAM,CAAC,0DAA0D,CAAC,CAAC;YACrE,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;oBACjB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBAChD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAEd,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,8DAA8D;IACvD,qBAAqB,CAAE,QAAQ,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAEhC,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,OAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACnC,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,mBAAQ,EAAC,QAAQ,CAAC,EAAE,CAAC;gBACvB,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;oBACjE,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;oBACjC,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,IAAI,OAAO,EAAE,CAAC;oBACZ,IAAI,OAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;wBAC9C,OAAO,IAAI,CAAC;oBACd,CAAC;oBACD,IAAI,OAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;wBAChD,OAAO,IAAI,CAAC;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,eAAe,CAAE,QAAQ;QAC9B,IAAI,CAAC,OAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;YAC5B,IAAI,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;gBACxC,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,eAAe,CAAE,GAAG;QACzB,OAAO,CAAC,CAAC,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC;YAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC;YACnD,CAAC,GAAG,CAAC,IAAI,IAAI,OAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,OAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC;YAC5E,CAAC,GAAG,CAAC,WAAW,IAAI,OAAM,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC;YACzD,CAAC,GAAG,CAAC,aAAa,IAAI,OAAM,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,QAAQ,CAAC;YAC7D,CAAC,GAAG,CAAC,SAAS,IAAI,OAAM,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC;YACrD,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAEM,SAAS,CAAE,IAAY;QAC5B,OAAO,CAAC,CAAC,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC;YAC3B,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC,OAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC;YAChC,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IAEM,QAAQ;QACb,OAAO,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5D,CAAC;IAEY,gBAAgB;;YAC3B,IAAI,GAAG,GAAG,CAAC,CAAC;YAEZ,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAY,EAAE,EAAE;gBAChD,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;oBAAC,OAAO;gBAAC,CAAC;gBAE1B,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;oBACzB,iBAAG,EAAC,6CAA6C,EAAE,IAAI,CAAC,CAAC;oBACzD,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;wBAC3C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBACxB,GAAG,EAAE,CAAC;oBACR,CAAC;gBACH,CAAC;qBAAM,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;oBACvF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACxB,GAAG,EAAE,CAAC;gBACR,CAAC;qBAAM,IAAI,qBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;oBAC7C,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;oBAC/D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACxB,GAAG,EAAE,CAAC;gBACR,CAAC;YACH,CAAC,CAAC;iBACD,IAAI,CAAC,GAAW,EAAE,CAAC,GAAG,CAAC;iBACvB,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;KAAA;IAEM,UAAU,CAAE,IAAY;QAC7B,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM;YACzB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,CAAC;IAEM,YAAY,CAAE,IAAY;QAC/B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,gBAAM,CAAC,YAAY,CAAC,CAAC;QACpE,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,UAAU,CAAE,IAAY;QAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,IAAI,CAAC,MAAM;YACX,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS;YAClC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,IAAI,CAAC,MAAM;YACX,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS;YAClC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,SAAS,CAAE,IAAY;QAC5B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAEM,cAAc,CAAE,IAAY;QACjC,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACvC,CAAC;IAEM,iBAAiB,CAAE,IAAY;QACpC,OAAO,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC;IACjD,CAAC;IAEM,aAAa,CAAE,IAAY;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAEhD,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAC,IAAI,GAAC,GAAG,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAEM,yBAAyB;QAC9B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,wBAAa,EAAC,IAAI,CAAC,CAAC;YAElC,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAClC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC1B,uCAAuC;oBACvC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;wBACjE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAClB,CAAC;oBACJ,CAAC;oBACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC3B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAEY,mBAAmB;;YAC9B,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAY,EAAE,EAAE;gBAChD,IAAI,UAAkB,CAAC;gBACvB,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC5B,IAAI,CAAC;wBACH,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC7C,CAAC;oBAAC,OAAM,CAAC,EAAE,CAAC;wBACV,kDAAkD;oBACpD,CAAC;oBACD,IAAI,UAAU,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,CAAC;wBACtE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;oBAC3B,CAAC;yBAAM,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;wBAC9D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC1B,CAAC;gBACH,CAAC;YACH,CAAC,CAAC;iBACD,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;iBAC5C,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;KAAA;IAEM,KAAK,CAAE,KAAc;QAC1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,iDAAiD;YACjD,IAAI,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,OAAO;gBAC3C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;gBACtC,iBAAG,EAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;gBAC7B,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,sCAAsC;YACjE,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,MAAM,CAAE,IAAY;QACzB,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAc,EAAE,EAAE;YAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;YACzB,eAAe;YACf,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,WAAW,EAAE,CAAC;gBACjC,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,CAAC;YACD,2BAA2B;iBACtB,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5B,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,CAAC;YACD,YAAY;iBACP,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;gBACnC,IAAI,CAAC,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAClC,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBAEjC,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;oBACzD,IAAI,OAAO,CAAC;oBACZ,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC5B,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;oBAC9C,CAAC;yBAAM,CAAC;wBACN,mDAAmD;wBACnD,OAAO,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;oBACjC,CAAC;oBAED,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,EACxB,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CACzE,CAAC;gBACJ,CAAC,CAAC,CAAC;YACL,CAAC;YACD,eAAe;iBACV,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;gBAEnD,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;oBACzD,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;wBAC5B,OAAO,OAAO,CAAC,QAAQ,EAAE,IAAI,EAC3B,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAC/D,CAAC;oBACJ,CAAC;yBAAM,CAAC,CAAC,oDAAoD;wBAC3D,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;oBACxD,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;YACD,uBAAuB;iBAClB,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;gBACjC,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,EACxB,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAChE,CAAC;YACJ,CAAC;iBACI,CAAC;gBACJ,OAAO,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACxD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,eAAe,CAAE,IAAY;QAClC,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC1B,OAAO,IAAI,CAAC,MAAM,CAAC;YAEnB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACzB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;oBAC5C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACnC,mDAAmD;wBACnD,iEAAiE;wBACjE,iEAAiE;wBACjE,UAAU;wBACV,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;oBACxC,CAAC;gBACH,CAAC;gBAED,IAAI,gBAAK,EAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;oBACrD,OAAO,IAAI,CAAC,KAAK,CAAC;gBACpB,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,iBAAiB,CAAE,IAAY;QACpC,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC1C,eAAe;YACf,iBAAG,EAAC,6BAA6B,CAAC,CAAC;YAEnC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;gBACxB,MAAM,EAAU,UAAU;gBAC1B,IAAI,EAAY,IAAI,CAAC,IAAI;gBACzB,QAAQ,EAAQ,IAAI,CAAC,KAAK,CAAC,IAAI;gBAC/B,QAAQ,EAAQ,IAAI,CAAC,MAAM,CAAC,IAAI;gBAChC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;gBACjC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;gBACtC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;gBACvC,qBAAqB,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;aAC/C,CAAC,CAAC;YAEH,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACnB,CAAC;YACD,OAAO,IAAI,CAAC,MAAM,CAAC;YACnB,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,SAAS,CAAE,IAAY;QAC5B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,IAAI,mBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;gBACpC,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBACtC,CAAC;YACH,CAAC;iBAAM,CAAC,CAAC,mBAAmB;gBAC1B,IAAI,mBAAQ,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACxB,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;wBACvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;wBAC1B,OAAO,IAAI,CAAC,MAAM,CAAC;oBACrB,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;wBACnC,MAAM,MAAM,GAAG;4BACb,MAAM,EAAI,QAAQ;4BAClB,IAAI,EAAM,IAAI,CAAC,IAAI;4BACnB,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;4BACrE,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;4BACrE,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;4BACvC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;yBACxC,CAAC;wBACF,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;4BACvC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;wBACpC,CAAC;wBAED,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,oCAAoC;4BAC3D,OAAO;wBACT,CAAC;wBAED,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;wBAC1B,OAAO,IAAI,CAAC,MAAM,CAAC;oBACrB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACrB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;oBACxB,MAAM,EAAI,QAAQ;oBAClB,IAAI,EAAM,IAAI,CAAC,IAAI;oBACnB,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;oBAC1B,QAAQ,EAAE,SAAS;oBACnB,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;oBACvC,cAAc,EAAE,SAAS;iBAC1B,CAAC,CAAC;YACL,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEY,qBAAqB,CAAE,IAAY,EAAE,QAAgB;;YAChE,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC5D,IAAI,KAAK,CAAC,IAAI,CAAC;oBACX,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM;oBAClB,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;oBAC7C,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC5C,CAAC;gBACD,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,YAAY,CAAE,IAAI,EAAE,QAAQ,EAAE,YAAqB,EAAE,eAAe;;YAC/E,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,EAAE,CAAC;YAChB,MAAM,OAAO,GAAG,EAAE,CAAC;YAEnB,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;gBAC5B,KAAK,CAAC,IAAI,CAAC,IAAI,GAAC,IAAI,CAAC,CAAC;gBACtB,IAAI,CAAC,IAAI,GAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YACnC,CAAC;YACD,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;gBACxC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAC,SAAS,CAAC,CAAC;YAC7B,CAAC;YAED,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC3D,IAAI,eAAe,CAAC;gBACpB,IAAI,IAAI,CAAC;gBAET,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;oBAC7B,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;oBAEvB,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;wBACnB,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;4BACxB,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gCAC3C,YAAY,CAAC,QAAQ,CAAC,GAAG,oBAAS,EAAC,IAAI,CAAC,CAAC;gCACzC,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG;oCAC9B,QAAQ,EAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI;oCAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iCACtB,CAAC;gCACF,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;4BAClE,CAAC;wBACH,CAAC;6BAAM,CAAC;4BACN,eAAe,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;4BACtD,IAAI,eAAe,KAAK,KAAK,EAAE,CAAC;gCAC9B,YAAY,CAAC,QAAQ,CAAC,GAAG;oCACvB,IAAI,EAAE,QAAQ;oCACd,MAAM,EAAE;wCACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;qCACtB;oCACD,MAAM,EAAE;wCACN,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI;wCAC7B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;qCACtB;iCACF,CAAC;4BACJ,CAAC;wBACH,CAAC;wBAED,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC;4BAC7D,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC;wBAC7E,CAAC;wBAED,IAAI,YAAY,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC;4BAC/D,YAAY,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,CAAC;wBACjF,CAAC;oBACH,CAAC;yBAAM,IAAI,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;wBACnF,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;4BACzB,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;gCAC9C,OAAO,CAAC,QAAQ,GAAC,UAAU,CAAC,GAAG,IAAI,CAAC;4BACtC,CAAC;wBACH,CAAC;wBAED,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;4BACtC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;gCAC5C,OAAO,CAAC,QAAQ,GAAC,SAAS,CAAC,GAAG,IAAI,CAAC;4BACrC,CAAC;wBACH,CAAC;wBAED,IAAI,IAAI,CAAC,MAAM,IAAI,mBAAQ,EAAC,QAAQ,CAAC,EAAE,CAAC;4BACtC,YAAY,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;wBACrC,CAAC;6BAAM,CAAC;4BACN,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;4BAE9C,IAAI,OAAO,YAAY,CAAC,QAAQ,CAAC,KAAK,WAAW,EAAE,CAAC;gCAClD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;gCAChD,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;gCAC5C,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gCACjD,IAAI,UAAU,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;oCACnC,OAAO,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oCAE3C,IAAI,gBAAK,EAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;wCACjE,OAAO,UAAU,CAAC,KAAK,CAAC;oCAC1B,CAAC;gCACH,CAAC;4BACH,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;qBAC9D,IAAI,CAAC,YAAY,CAAC,EAAE;oBACnB,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,iBAAiB,CAAE,KAAoB,EAAE,YAAqB;;YACzE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACvC,CAAC;YAED,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAO,KAAc,EAAE,EAAE;gBACjE,MAAM,QAAQ,GAAG,EAAE,CAAC;gBAEpB,SAAS,eAAe,CAAE,MAAM,EAAE,IAAY;oBAC5C,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;wBAC9B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;4BACvC,QAAQ,CAAC,IAAI,GAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;wBACjC,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;oBACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;oBAEzB,0EAA0E;oBAC1E,IAAI,CAAC,IAAI,EAAE,CAAC;wBAAC,SAAS;oBAAC,CAAC;oBAExB,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;wBACnB,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;wBACnC,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBACpC,CAAC;yBAAM,CAAC;wBACN,IAAI,IAAI,CAAC,MAAM,IAAI,OAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;4BAC1D,YAAY,CAAC,IAAI,CAAC,GAAG,oBAAS,EAAC,IAAI,CAAC,CAAC;4BACrC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG;gCAC1B,IAAI,EAAO,KAAK;gCAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;6BACtB,CAAC;4BACF,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;wBAC1D,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,2CAA2C;gBAC3C,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;qBAC/D,IAAI,CAAC,aAAa,CAAC,EAAE;oBACpB,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;gBAC3D,CAAC,CAAC,CAAC;YACP,CAAC,EAAC,CAAC;QACL,CAAC;KAAA;IAEY,aAAa,CAAE,IAAY,EAAE,cAAsB,EAAE,WAAmB,EAAE,QAAgB;;YACrG,IAAI,KAAoB,CAAC;YACzB,IAAI,UAAkB,CAAC;YACvB,MAAM,gBAAgB,GAAG,wBAAa,EAAC,IAAI,CAAC,CAAC;YAE7C,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;gBACnB,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,UAAU,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;gBACjC,KAAK,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YAC7B,CAAC;YAED,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC3D,IAAI,QAAgB,CAAC;gBACrB,IAAI,IAAI,GAAW,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC/B,IAAI,UAAkB,CAAC;gBACvB,MAAM,eAAe,GAAG,EAAE,CAAC;gBAE3B,SAAS,sBAAsB,CAAE,MAAM;oBACrC,IAAI,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;wBAC9B,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;4BACjC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;gCAC9B,eAAe,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;4BACnC,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ;oBACzB,IAAI,CAAC,IAAI,KAAK,IAAI;oBAClB,OAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC;oBACrC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;oBAClC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;gBACrB,CAAC;gBAED,IAAI,CAAC,MAAM,GAAG;oBACZ,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;iBACtB,CAAC;gBAEF,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;oBACnB,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACpC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBAEpC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;oBAC1B,KAAK,QAAQ,IAAI,cAAc,EAAE,CAAC;wBAChC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;oBACxC,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,cAAc,CAAC;oBAClC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;oBAEtC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;oBAC/B,IAAI,UAAU,IAAI,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;wBAChE,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;wBAC7C,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;wBAC3C,IAAI,gBAAK,EAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;4BACjE,OAAO,UAAU,CAAC,KAAK,CAAC;wBAC1B,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBAEnC,OAAO;oBACL,SAAS,EAAQ,KAAK;oBACtB,eAAe,EAAE,eAAe;iBACjC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,YAAY,CAAE,IAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAgB;;YACzE,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;gBAEzB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;oBACf,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;oBACpB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;gBAC9D,CAAC;gBAED,IAAI,QAAQ,EAAE,CAAC;oBACb,iBAAG,EAAC,2BAA2B,CAAC,CAAC;oBAEjC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;wBACtD,IAAI,CAAC,MAAM,GAAG;4BACZ,QAAQ,EAAG,QAAQ,IAAI,UAAU;4BACjC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;yBACtB,CAAC;wBACF,OAAO,IAAI,CAAC,IAAI,CAAC;oBACnB,CAAC;oBAED,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACrC,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,GAAG;wBACZ,QAAQ,EAAG,QAAQ;wBACnB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;qBACtB,CAAC;oBAEF,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;wBACrB,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;wBAClC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;wBAEhD,IAAI,gBAAK,EAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;4BACtC,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;4BACrD,OAAO,IAAI,CAAC,KAAK,CAAC;wBACpB,CAAC;wBAED,OAAO,IAAI,CAAC,IAAI,CAAC;oBACnB,CAAC;yBAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;wBAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,6CAA6C;4BAC5E,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;wBAC1B,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC,IAAI,CAAC;wBACnB,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAEY,eAAe,CAAE,IAAY;;YACxC,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC5D,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;oBAChB,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;oBACxB,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;gBACnD,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAEM,eAAe,CAAE,UAA2B;QACjD,MAAM,MAAM,GAAmB;YAC7B,UAAU,EAAO,UAAU;YAC3B,UAAU,EAAO,SAAS;YAC1B,QAAQ,EAAS,SAAS;YAC1B,MAAM,EAAW,SAAS;YAC1B,QAAQ,EAAS,SAAS;YAC1B,OAAO,EAAU,SAAS;YAC1B,eAAe,EAAE,SAAS;SAC3B,CAAC;QAEF,IAAI,OAAO,UAAU,KAAK,QAAQ;YAC9B,CAAC,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,SAAS,CAAC,EAAE,CAAC;YAC3D,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC;YAC1B,MAAM,CAAC,eAAe,GAAG,IAAI,CAAC;YAC9B,OAAO,MAAM,CAAC;QAChB,CAAC;aAAM,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;YAE5C,MAAM,CAAC,UAAU,GAAG,CAAC,MAAM,KAAK,CAAC;gBACZ,UAAU,KAAK,GAAG;gBAClB,UAAU,KAAK,GAAG;gBAClB,UAAU,KAAK,GAAG,CAAC;gBACxC,MAAM,CAAC,QAAQ,GAAK,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;YACzC,MAAM,CAAC,MAAM,GAAO,CAAC,CAAC,UAAU,KAAK,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,mBAAS,CAAC,kBAAkB,CAAC;gBAC7E,UAAU,KAAK,GAAG;gBAClB,UAAU,KAAK,GAAG,CAAC,CAAC;YACzC,MAAM,CAAC,QAAQ,GAAK,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;YACzC,MAAM,CAAC,OAAO,GAAM,CAAC,UAAU,KAAK,GAAG,CAAC,CAAC;YAEzC,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAEY,iBAAiB,CAAE,IAAY,EAAE,MAAsB,EAAE,cAAc,EAAE,WAAmB,EAAE,QAAgB;;YACzH,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;oBACnB,cAAc,GAAG,EAAE,CAAC;gBACtB,CAAC;qBAAM,CAAC;oBACN,cAAc,GAAG,KAAK,CAAC;gBACzB,CAAC;YACH,CAAC;YAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,CAAC;qBACnE,IAAI,CAAC,aAAa,CAAC,EAAE;oBACpB,IAAI,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;wBACnB,IAAI,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,EAAE,CAAC;4BAC/C,iBAAG,EAAC,wEAAwE,GAAG,IAAI,CAAC,CAAC;4BACrF,OAAO,KAAK,CAAC;wBACf,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC;iCACnG,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBAClC,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,OAAO,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;6BAC/D,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;oBAClC,CAAC;gBACH,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC;qBAC9C,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;KAAA;IAEM,cAAc,CAAE,IAAY,EAAE,MAAM,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QAElD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YACjF,CAAC;iBAAM,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACnD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;oBACvE,OAAO,IAAI,CAAC;gBACd,CAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,6CAA6C,MAAM,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,eAAe;YACf,IAAI,KAAY,CAAC;YACjB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClB,KAAK,GAAG,IAAI,4BAAiB,EAAE,CAAC;YAClC,CAAC;iBAAM,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;gBAClC,KAAK,GAAG,IAAI,oBAAS,CAAC,yBAAyB,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,IAAI,KAAK,CAAC,qBAAqB,GAAG,MAAM,CAAC,UAAU,GAAG,YAAY,CAAC,CAAC;YAC9E,CAAC;YAED,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC1C,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC9B,MAAM,KAAK,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEM,UAAU,CAAE,IAAc,EAAE,SAAS,GAAG,IAAI;QACjD,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO;QACT,CAAC;QAED,IAAI,SAAS,EAAE,CAAC;YACd,iBAAG,EAAC,6BAA6B,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnC,iBAAG,EAAC,gCAAgC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACjD,OAAO;YACT,CAAC;QACH,CAAC;QAED,iBAAG,EAAC,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO,IAAI,CAAC,OAAO;aAChB,IAAI,CAAC,GAAG,CAAC,EAAE;YACV,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1D,CAAC,EAAE,GAAG,CAAC,EAAE;YACP,iBAAG,EAAC,wCAAwC,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAC3E,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;QAChF,CAAC,CAAC;aACD,IAAI,CAAC,CAAO,SAAS,EAAE,EAAE;YACxB,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEhC,IAAI,SAAS,EAAE,CAAC;gBACd,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC3B,KAAK,IAAI,CAAC,GAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;wBACrD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC9B,CAAC;oBACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;YAED,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE;gBAC7B,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;aAChD,CAAC,CAAC;YAEH,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC/C,OAAO;YACT,CAAC;YAED,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACvC,6DAA6D;gBAC7D,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACrC,iBAAG,EAAC,kCAAkC,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;oBACtG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;wBACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;wBACjB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;oBAClD,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,oEAAoE;oBACpE,qEAAqE;oBACrE,gEAAgE;oBAChE,UAAU,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,GAAE,GAAG,CAAC,EAAE;YACP,iBAAG,EAAC,cAAc,EAAE,GAAG,CAAC,CAAC;YAEzB,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEhC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE;gBAC7B,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;aAChD,CAAC,CAAC;YAEH,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACnC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAC/C,OAAO;YACT,CAAC;YAED,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;gBACjB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,OAAO;QACZ,IAAI,SAAiB,EAAE,QAAQ,GAAG,CAAC,EAAE,IAAY,CAAC;QAClD,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC7B,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBAC1B,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;YAC9B,CAAC;iBAAM,CAAC;gBACN,SAAS,GAAG,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;aAAM,CAAC;YACN,SAAS,GAAG,CAAC,CAAC;QAChB,CAAC;QACD,MAAM,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;QAC9E,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBACrC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBACrD,QAAQ,EAAE,CAAC;gBACX,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;oBACzB,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC;IAChC,CAAC;IAEY,YAAY,CAAE,gBAA0B;;YACnD,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACpC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;YAED,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAC7C,IAAI,QAAQ,IAAI,gBAAgB,KAAK,KAAK,EAAE,CAAC;oBAC3C,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC3B,CAAC;qBAAM,CAAC;oBACN,OAAO,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBACpC,CAAC;YACH,CAAC,EAAE,UAAU,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;KAAA;IAEM,OAAO,CAAE,IAAY,EAAE,EAAG;QAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,OAAM,CAAC,EAAE,CAAC,KAAK,UAAU,EAAE,CAAC;YAC9B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED;;QAEI;IACG,IAAI;QACT,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAElB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;gBACnC,IAAI,CAAC;oBACH,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,CAAC;gBAAC,OAAM,CAAC,EAAE,CAAC;oBACV,iBAAG,EAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;gBACjC,CAAC;YACH,CAAC,EAAE,UAAU,CAAC;gBACZ,iBAAG,EAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;gBAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,QAAQ,CAAE,aAAa;QAC5B,WAAW,GAAG;YACZ,kCAAkC;YAClC,iBAAG,EAAC,sCAAsC,CAAC,CAAC;YAE5C,MAAM,GAAG,GAAG,IAAI,aAAG,EAAE,CAAC;YACtB,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;gBAAC,gBAAgB,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;YAAC,CAAC;YAE9D,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;gBACxB,uDAAuD;gBACvD,aAAa,CAAC,IAAI,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC;gBAE7C,IAAI,aAAa,CAAC,WAAW,EAAE,CAAC;oBAC9B,iBAAG,EAAC,mCAAmC,CAAC,CAAC;oBACzC,aAAa,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;oBAClC,OAAO,aAAa,CAAC,WAAW,CAAC;gBACnC,CAAC;YACH,CAAC;YAED,iBAAG,EAAC,sCAAsC,CAAC,CAAC;YAC5C,aAAa,CAAC,SAAS,EAAE,CAAC;QAC5B,CAAC,CAAC;QAEF,aAAa,GAAG;YACd,aAAa,CAAC,mBAAmB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YAC9D,aAAa,CAAC,SAAS,EAAE,CAAC;QAC5B,CAAC,CAAC;QAEF,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACvC,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,WAAW,CAAE,aAAa;QAC/B,aAAa,CAAC,QAAQ,EAAE,CAAC;QACzB,aAAa,CAAC,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACxD,aAAa,CAAC,mBAAmB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QAE9D,aAAa,CAAC,IAAI,GAAG,SAAS,CAAC;QAC/B,OAAO,aAAa,CAAC,IAAI,CAAC;IAC5B,CAAC;CACF;AAh/BD,oBAg/BC;AAGD,sBAAW,EAAC,IAAI,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAEnC,qBAAe,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;ACxlCpB,gFAAwB;AAExB,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,CAAE,IAAI,CAAC,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAE,CAAC;AACjD,CAAC;AAED,SAAS,aAAa,CAAC,OAAO;IAC5B,IAAI,CAAC,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC;QACpC,OAAO,CAAC,MAAM,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACtD,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,iBAAG,EAAC,wEAAwE,CAAC,CAAC;QAC9E,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG;IACzB,GAAG,EAAE,UAAU,IAAY,EAAE,MAAkC;QAC7D,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;gBAClC,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;iBAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;gBAC1D,OAAO,OAAO,CAAC,MAAM,CAAC,+CAA+C,CAAC,CAAC;YACzE,CAAC;YACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,GAAG,EAAE,UAAU,IAAY,EAAE,IAAa,EAAE,WAAmB;QAC7D,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,OAAO,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/F,CAAC;aACI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,OAAO,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;IAED,QAAQ,EAAE,UAAU,IAAY;QAC9B,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,OAAO,kBAAkB,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/E,CAAC;IACH,CAAC;IAED,aAAa,EAAE,UAAgB,MAAwB;;YACrD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACxB,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;gBACvB,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC,EAAE,CAAC,GAAU,EAAE,EAAE;gBAChB,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;gBAC5C,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;CACF,CAAC;AAEF,iBAAS,kBAAkB,CAAC;;;;;;;;;;;;;;;AC7D5B;;;;IAII;AACJ,MAAa,eAAe;IAA5B;QACE;;WAEG;QACH,SAAI,GAA8B,EAAE,CAAC;QAErC;;;;WAIG;QACH,YAAO,GAAgB,EAAE,CAAC;QAE1B;;WAEG;QACH,YAAO,GAA8B,EAAE,CAAC;IA+C1C,CAAC;IA7CC;;;;OAIG;IACH,OAAO,CAAE,UAAkB,EAAE,KAAa,EAAE,GAAW,EAAE,MAAsB;QAC7E,MAAM,SAAS,GAAG,UAAU,GAAG,GAAG,GAAG,KAAK,CAAC;QAE3C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxC,MAAM,aAAa,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;gBACxC,CAAC,CAAC,UAAU,GAAG,GAAG,GAAG,KAAK,CAAC,KAAK,EAAE;gBAClC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAEpB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC7C,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,QAAQ,GAAG,SAAS,GAAG,oCAAoC,GAAG,aAAa,GAAG,GAAG,CAAC;YAC1F,CAAC;YACD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;QAC9B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAC7B,CAAC;IAED,YAAY,CAAE,KAAa;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,SAAS,CAAE,GAAW;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,CAAE,UAAkB;QACzB,MAAM,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;QAC7B,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC9B,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,UAAU,GAAG,GAAG,EAAE,CAAC;gBACjD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC7B,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA/DD,0CA+DC;AAED,MAAM,KAAK,GAAG,IAAI,eAAe,EAAE,CAAC;AACpC,qBAAe,KAAK,CAAC;;;;;;;;;;;;;ACxErB,MAAM,iBAAkB,SAAQ,KAAK;IAGnC,YAAa,OAAgB,EAAE,UAA2B,EAAE;QAC1D,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,GAAG,uCAAuC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC;CACF;AAED,iBAAS,iBAAiB,CAAC;;;;;;;;;;;;;ACrB3B,6BAA6B;;;;;;;;;;;;AA+S7B,oDAiBC;AAmBD,kCASC;AA1VD;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,MAAc,EAAE,MAAc;IACtD,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAC7E,OAAO;IACT,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;YAClE,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,KAAK,sBAAsB,EAAE,CAAC;gBACxD,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;gBAC1D,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC5C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC5C,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACjD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAEM,MAAM,QAAQ,GAAG,CAAC,KAAqB,EAAQ,EAAE;IACtD,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC,CAAC;AANW,gBAAQ,YAMnB;AAEW,qBAAa,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAM,CAAC,CAAC,CAAC;AAE9G,MAAM,gBAAgB,GAAG,GAAQ,EAAE;IACxC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAM,CAAC,CAAC,CAAC;AACjG,CAAC,CAAC;AAFW,wBAAgB,oBAE3B;AAEF,qCAAqC;AACrC,6CAA6C;AACtC,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,EAAW,EAAE;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,OAAO,CAAC,UAAU,MAAM;QAC9B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AATW,cAAM,UASjB;AAEK,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAU,EAAE;IACvD,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC;IACb,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,iBAAiB,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SAC7B,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC,CAAC;AAVW,wBAAgB,oBAU3B;AAEK,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAW,EAAE;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;AAChC,CAAC,CAAC;AAFW,gBAAQ,YAEnB;AAEK,MAAM,UAAU,GAAG,CAAC,IAAY,EAAW,EAAE;IAClD,OAAO,CAAC,oBAAQ,EAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC;AAFW,kBAAU,cAErB;AAEK,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,oBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IACvC,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACjC,CAAC;AACH,CAAC,CAAC;AAPW,gBAAQ,YAOnB;AAEK,MAAM,SAAS,GAAG,CAAC,IAAY,EAAU,EAAE;IAChD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SAC7B,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;SAC5C,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1B,CAAC,CAAC;AAJW,iBAAS,aAIpB;AAEK,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE;IACxC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AANW,eAAO,WAMlB;AAEK,MAAM,KAAK,GAAG,CAAC,CAAM,EAAE,CAAM,EAAE,IAAI,GAAG,EAAE,EAAW,EAAE;IAC1D,IAAI,GAAG,CAAC;IAER,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACnF,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,YAAY,WAAW,IAAI,CAAC,YAAY,WAAW,EAAE,CAAC;QACzD,oEAAoE;QACpE,wCAAwC;QACxC,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QACtB,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,wEAAwE;IAExE,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,CAAC,iBAAK,EAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC;gBAC7B,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,oCAAoC;QACpC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;YACd,IAAI,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;gBACzC,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,4DAA4D;QAC5D,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;YACd,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3B,SAAS;YACX,CAAC;YAED,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC;gBAChB,OAAO,KAAK,CAAC;YACf,CAAC;YAED,IAAI,OAAO,CAAC;YAEZ,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACjC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC9B,4DAA4D;oBAC5D,oDAAoD;oBACpD,SAAS;gBACX,CAAC;gBAED,OAAO,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;gBACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACvB,CAAC;YAED,IAAI,CAAC,iBAAK,EAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;gBACpC,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAxEW,aAAK,SAwEhB;AAEK,MAAM,SAAS,GAAG,CAAC,GAAQ,EAAO,EAAE;IACzC,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9C,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7B,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AARW,iBAAS,aAQpB;AAEK,MAAM,aAAa,GAAG,CAAC,IAAY,EAAY,EAAE;IACtD,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;IACrB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,KAAK,CAAC,GAAG,EAAE,CAAC;QACZ,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AATW,qBAAa,iBASxB;AAEK,MAAM,qBAAqB,GAAG,GAAY,EAAE;IACjD,MAAM,OAAO,GAAG,4BAAgB,GAAE,CAAC;IAEnC,IAAI,CAAC,CAAC,cAAc,IAAI,OAAO,CAAC,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC9C,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAdW,6BAAqB,yBAchC;AAEF;;;;;;GAMG;AACI,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAA0B,EAAE;IAC7E,MAAM,OAAO,GAAG,4BAAgB,GAAY,CAAC;IAE7C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,iBAAiB;IACnB,CAAC;AACH,CAAC,CAAC;AARW,+BAAuB,2BAQlC;AAEF;;;;;;;;GAQG;AACI,MAAM,uBAAuB,GAAG,CAAC,OAA6B,EAAE,QAAgB,EAAW,EAAE;IAClG,4CAA4C;IAC5C,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,IAAI,4BAA4B,CAAC,IAAI,CAAC,OAAiB,CAAC,CAAC,CAAC;AACpH,CAAC,CAAC;AAHW,+BAAuB,2BAGlC;AAEF;;;;;GAKG;AACI,MAAM,sBAAsB,GAAG,CAAC,WAAwB,EAAE,QAAQ,EAAiC,EAAE;IAC1G,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,aAAY,EAAE,EAAE;QACzC,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,OAAO,UAAU,KAAK,WAAW,EAAE,CAAC;YACrE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACxC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,CAAC;YACT,MAAM,EAAE,GAAG,qBAAoB,CAAC;YAChC,2DAA2D;YAC3D,oEAAoE;YACpE,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,iBAAiB,CAAC;YACxD,IAAI,OAAO,EAAE,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;gBAC1C,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;gBAChC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBACvB,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;YACjC,CAAC;YAED,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;YACpC,IAAI,OAAO,UAAU,CAAC,gBAAgB,KAAK,UAAU,EAAE,CAAC;gBACtD,UAAU,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAU,GAAG;oBAClD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC7B,CAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,SAAS,GAAG,UAAU,GAAG;oBAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC7B,CAAC,CAAC;YACJ,CAAC;YACD,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAhCW,8BAAsB,0BAgCjC;AAEF;;;;GAIG;AACI,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE;IAC9C,MAAM,OAAO,GAAG,4BAAgB,GAAE,CAAC;IACnC,IAAI,MAAM,IAAI,OAAO,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC,CAAC;AAPW,gBAAQ,YAOnB;AAEF;;;;;;;;;GASG;AACH,SAAsB,oBAAoB;yDAAC,OAAO,GAAG,GAAG;QACtD,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAEpC,MAAM,OAAO,GAAG,oEAAoE,CAAC;QACrF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACvF,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEzC,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7E,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;QACvE,MAAM,aAAa,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAElD,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QACpC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5F,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEvC,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,KAAK,EAAC,CAAC;IAC9C,CAAC;CAAA;AAED,SAAS,eAAe,CAAC,GAAG;IAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EACtC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;GAOG;AACH,8DAA8D;AAC9D,SAAgB,WAAW,CAAC,WAAgB,EAAE,YAAmB;IAC/D,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC9B,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC5D,MAAM,CAAC,cAAc,CACnB,WAAW,CAAC,SAAS,EACrB,IAAI,EACJ,MAAM,CAAC,wBAAwB,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AC3TD,kGAAoC;AACpC,8GAA4C;AAC5C,6HAAqD;AACrD,gFAAwB;AACxB,kEAQgB;AAChB,8EAAiE;AACjE,wEAA4E;AAE5E,IAAI,eAAe,CAAC;AACpB,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,MAAM,QAAQ,GAAG,CAAC,CAAC;AACnB,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,MAAM,GAAG,CAAC,CAAC;AACjB,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB,MAAM,YAAY,GAAG;IACnB,+BAA+B,EAAE,MAAM;IACvC,+BAA+B,EAAE,MAAM;IACvC,+BAA+B,EAAE,MAAM;IACvC,gEAAgE,EAAE,QAAQ;CAC3E,CAAC;AAEF,SAAS,YAAY;IACnB,MAAM,QAAQ,GAAG,kCAAuB,EAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7D,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IAEtE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC9D,CAAC;AAED,SAAS,gBAAgB,CAAE,QAAgB;IACzC,IAAI,OAAO,GAAG,OAAO,CAAC;IACtB,IAAI,YAAY,CAAC;IAEjB,IAAI,QAAQ,EAAE,CAAC;QACb,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC/C,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,mBAAmB,CAAE,IAAY;IACxC,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,iDAAiD,CAAC;WAC3E,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,eAAe,CAAE,MAAc;IACtC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,aAAa,CAAE,MAAc;IACpC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAW,SAAQ,mBAAU;IA6BjC,YAAa,EAAiB;QAC5B,KAAK,CAAC,EAAE,CAAC,CAAC;QALZ,mBAAc,GAA2B,EAAE,CAAC;QAM1C,eAAe,GAAG,gCAAqB,GAAE,CAAC;QAE1C;;;;YAII;QACJ,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;QAE/C,IAAI,eAAe,EAAE,CAAC;YACpB,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;YAChC,IAAI,QAAQ,EAAE,CAAC;gBACb,UAAU,CAAC,GAAG,EAAE;oBACd,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;gBAC3B,CAAC,EAAE,CAAC,CAAC,CAAC;YACR,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,IAAI,WAAW;QACb,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAEK,QAAQ,CAAE,MAAc,EAAE,GAAW,EAAE,KAAqB,EAAE,OAAoB,EAAE,IAA4B,EAAE,OAAgB,EAAE,YAAqB;;YAC7J,IAAI,IAAI,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;gBAC/C,OAAO,OAAO,CAAC,MAAM,CAAC,aAAa,MAAM,kBAAkB,CAAC,CAAC;YAC/D,CAAC;YAED,IAAI,QAA4B,CAAC;YAEjC,IAAI,KAAK,KAAK,mBAAS,CAAC,kBAAkB,EAAE,CAAC;gBAC3C,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC;YAC/C,CAAC;YAED,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;gBACzB,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;aACxB,CAAC,CAAC;YAEH,OAAO,iCAAkB,EAAC,MAAM,EAAE,GAAG,EAAE;gBACrC,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,OAAO;gBAChB,YAAY,EAAE,aAAa;aAC5B,CAAC,CAAC,IAAI,CAAC,CAAC,QAAwB,EAA2B,EAAE;gBAC5D,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;oBACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;oBACnB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;gBAClC,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;oBACzB,MAAM,EAAE,MAAM;oBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;oBACvB,OAAO,EAAE,IAAI;iBACd,CAAC,CAAC;gBAEH,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBACnC,iBAAG,EAAC,oCAAoC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;oBAC3D,IAAI,OAAO,EAAE,CAAC;wBACZ,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAClE,CAAC;yBAAM,CAAC;wBACN,QAAQ,GAAG,SAAS,CAAC;oBACvB,CAAC;oBAED,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;wBAC5B,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,4BAAiB,EAAE,CAAC,CAAC;oBAClD,CAAC;oBAED,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC,CAAC;gBAC5E,CAAC;qBAAM,IAAI,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC;oBACzC,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,CAAC,EAAE,CAAC;oBAChD,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChE,iBAAG,EAAC,iCAAiC,EAAE,QAAQ,CAAC,CAAC;oBACjD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAC,CAAC,CAAC;gBAC5E,CAAC;qBAAM,CAAC;oBACN,MAAM,QAAQ,GAAG,QAAQ,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;oBAC5D,IAAI,OAAO,EAAE,CAAC;wBACZ,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAClE,CAAC;yBAAM,CAAC;wBACN,QAAQ,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;oBAClE,CAAC;oBAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;oBAE3C,IAAI,kCAAuB,EAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;wBACzD,iBAAG,EAAC,kEAAkE,EAAE,QAAQ,CAAC,CAAC;wBAClF,OAAO,OAAO,CAAC,OAAO,CAAC;4BACrB,UAAU,EAAE,QAAQ,CAAC,MAAM;4BAC3B,IAAI,EAAE,QAAQ,CAAC,QAAQ;4BACvB,WAAW,EAAE,QAAQ;4BACrB,QAAQ,EAAE,QAAQ;yBACnB,CAAC,CAAC;oBACL,CAAC;yBAAM,CAAC;wBACN,OAAO,iCAAsB,EAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;6BACtD,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;4BACpB,iBAAG,EAAC,iCAAiC,EAAE,QAAQ,CAAC,CAAC;4BACjD,OAAO,OAAO,CAAC,OAAO,CAAC;gCACrB,UAAU,EAAE,QAAQ,CAAC,MAAM;gCAC3B,IAAI,EAAE,WAAW;gCACjB,WAAW,EAAE,QAAQ;gCACrB,QAAQ,EAAE,QAAQ;6BACnB,CAAC,CAAC;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC;gBACH,CAAC;YACH,CAAC,EAAE,KAAK,CAAC,EAAE;gBACT,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;oBAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;oBACpB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACnC,CAAC;gBACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE;oBACzB,MAAM,EAAE,MAAM;oBACd,QAAQ,EAAE,mBAAQ,EAAC,GAAG,CAAC;oBACvB,OAAO,EAAE,KAAK;iBACf,CAAC,CAAC;gBAEH,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAE,QAAwB;QACjC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YAChD,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QAC1C,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YACzC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC5B,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,UAAU,KAAK,WAAW,EAAE,CAAC;YAC/C,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACxC,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YAC1C,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC9B,CAAC;QACD,IAAI,OAAO,QAAQ,CAAC,UAAU,KAAK,WAAW,EAAE,CAAC;YAC/C,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACxC,CAAC;QAED,IAAI,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC;YAC9D,IAAI,CAAC,YAAY,GAAG,WAAW,IAAI,MAAM,CAAC;QAC5C,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;QACD,IAAI,eAAe,EAAE,CAAC;YACpB,YAAY,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;gBAC1C,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,GAAG,CAAE,IAAY,EAAE,UAAoC,EAAE;QACvD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,OAAO,CAAC,MAAM,CAAC,uBAAuB,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;QAC9D,CAAC;QAED,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACxB,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QACD,4EAA4E;QAC5E,kCAAkC;QAClC,4CAA4C;QAC5C,IAAI;QAEJ,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAC1E,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aACvD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YACV,IAAI,CAAC,mBAAQ,EAAC,IAAI,CAAC,EAAE,CAAC;gBACpB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC;YACD,IAAI,QAAQ,GAAG,EAAE,CAAC;YAClB,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,WAAW,EAAE,CAAC;gBACpC,IAAI,CAAC;oBACH,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC9B,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,OAAO,OAAO,CAAC,MAAM,CAAC,wBAAwB,GAAG,IAAI,CAAC,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;gBACjG,CAAC;YACH,CAAC;YAED,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACzD,8BAA8B;gBAC9B,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACrC,mCAAmC;oBACnC,CAAC,CAAC,UAAU,GAAG,GAAG,CAAC;gBACrB,CAAC;qBAAM,IAAI,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;oBACvC,aAAa;oBACb,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;wBAChC,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;oBAC7D,CAAC;oBACD,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;gBAC1B,CAAC;qBAAM,CAAC;oBACN,YAAY;oBACZ,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;wBAClC,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBAC9C,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAC,CAAC;oBACxC,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,CAAC,CAAC,IAAI,GAAG,QAAQ,CAAC;gBAClB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,GAAG,CAAE,IAAY,EAAE,IAA4B,EAAE,WAAmB,EAAE,UAAsD,EAAE;QAC5H,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,OAAO,CAAC,MAAM,CAAC,uBAAuB,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,YAAY,WAAW,IAAI,gCAAiB,EAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACjG,WAAW,IAAI,kBAAkB,CAAC;QACpC,CAAC;QACD,MAAM,OAAO,GAAG,EAAC,cAAc,EAAE,WAAW,EAAC,CAAC;QAC9C,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxD,CAAC;YACD,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACxB,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,EACjE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAE,IAAY,EAAE,UAAgC,EAAE;QACtD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,IAAI,GAAG,GAAG,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QACD,MAAM,OAAO,GAAG,EAAE,CAAC;QACnB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBACpB,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,GAAG,oBAAS,EAAC,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,EACpE,OAAO,EACP,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,QAAQ,CAAE,aAAa;QAC5B,aAAa,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;QACrD,aAAa,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,aAAa;QAClB,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,OAAO,cAAc,KAAK,UAAU,CAAC;IAC7E,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;CACF;AAGD,sBAAW,EAAC,UAAU,EAAE,CAAC,uBAAa,CAAC,CAAC,CAAC;AAEzC,iBAAS,UAAU,CAAC;;;;;;;;;;;AC9apB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,IAA0C;AAChD;AACA,IAAI,iCAAO,EAAE,oCAAE,OAAO;AAAA;AAAA;AAAA,kGAAC;AACvB,IAAI,KAAK,EAMN;AACH,CAAC;AACD;AACA;AACA;AACA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,SAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG,wBAAwB;AAC3B,aAAa;AACb,gBAAgB;AAChB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,oBAAoB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,qBAAqB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,0BAA0B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE;AACF;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,wBAAwB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,kBAAkB;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,yCAAyC;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,mBAAmB;AACrC;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,MAAM;AACN,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,sBAAsB;AAC3E,GAAG;AACH,qDAAqD,qCAAqC;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gCAAgC;AAClD;AACA;AACA;AACA,wDAAwD,0BAA0B;AAClF,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,iFAAiF;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;AACA,mDAAmD,iDAAiD;AACpG;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,2BAA2B;AAC5C;AACA;AACA;AACA;AACA;AACA,oDAAoD,mEAAmE;AACvH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,oCAAoC;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,qCAAqC;AAC5F;AACA;AACA,iEAAiE,qCAAqC;AACtG;AACA;AACA;AACA;AACA,uDAAuD,qCAAqC;AAC5F;AACA;AACA,iEAAiE,qCAAqC;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,YAAY;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,+CAA+C;AAC3G;AACA;AACA;AACA;AACA,2DAA2D,+CAA+C;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,wBAAwB;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,8CAA8C;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,8CAA8C;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,iBAAiB;AACnC,uBAAuB,iBAAiB;AACxC;AACA,4DAA4D,qBAAqB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,qEAAqE;AACrE;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,GAAG;AACH,cAAc,iBAAiB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,0DAA0D;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE,0DAA0D;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,4BAA4B;AAC9C;AACA;AACA,8DAA8D,SAAS;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,SAAS;AAClF;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kEAAkE,0BAA0B;AAC5F;AACA;AACA;AACA;AACA,MAAM;AACN,qBAAqB,gBAAgB;AACrC;AACA;AACA,mEAAmE,kCAAkC;AACrG;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,yDAAyD,8BAA8B;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yBAAyB;AAC1C;AACA;AACA;AACA;AACA,mBAAmB,8BAA8B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,KAAK,KAAK;AAC9C;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,MAAM,WAAW,SAAS;AACzD,qCAAqC,MAAM;AAC3C;AACA;AACA,uFAAuF,QAAQ,KAAK,OAAO;AAC3G;AACA;AACA,6BAA6B,OAAO,sBAAsB,WAAW;AACrE,yBAAyB,OAAO,sBAAsB,QAAQ;AAC9D,mCAAmC,OAAO,+BAA+B,QAAQ;AACjF,yBAAyB,OAAO,yBAAyB,QAAQ;AACjE,mCAAmC,OAAO,+BAA+B,QAAQ;AACjF,8BAA8B,OAAO;AACrC;AACA,6CAA6C,QAAQ,iBAAiB,QAAQ;AAC9E,2CAA2C,QAAQ,iBAAiB,QAAQ;AAC5E,kDAAkD,QAAQ;AAC1D;AACA,0DAA0D,cAAc,YAAY,QAAQ;AAC5F,2DAA2D,cAAc,YAAY,QAAQ;AAC7F,+CAA+C,IAAI;AACnD;AACA,8DAA8D,SAAS,cAAc,IAAI;AACzF;AACA,2CAA2C,OAAO,YAAY,QAAQ;AACtE,yCAAyC,OAAO,YAAY,QAAQ;AACpE,qDAAqD,QAAQ,KAAK,OAAO;AACzE;AACA;AACA,4CAA4C,QAAQ;AACpD,mCAAmC,KAAK,EAAE,QAAQ;AAClD;AACA,uCAAuC,KAAK;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,2BAA2B;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA,CAAC;;;;;;;;;;;AChpDY;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,uCAAsC;AACtC;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,yCAAwC;AACxC;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,6CAA4C;AAC5C;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,sCAAqC;AACrC;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,sCAAqC;AACrC;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,sCAAqC;AACrC;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,sCAAqC;AACrC;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,4CAA2C;AAC3C;AACA;AACA;AACA;AACA,CAAC,EAAC;AACF,2CAA0C;AAC1C;AACA;AACA;AACA;AACA,CAAC,EAAC;;AAEF,gCAAgC,mBAAO,CAAC,gEAAS;;AAEjD,iCAAiC,mBAAO,CAAC,gEAAS;;AAElD,iCAAiC,mBAAO,CAAC,gEAAS;;AAElD,iCAAiC,mBAAO,CAAC,gEAAS;;AAElD,kCAAkC,mBAAO,CAAC,kEAAU;;AAEpD,sCAAsC,mBAAO,CAAC,0EAAc;;AAE5D,uCAAuC,mBAAO,CAAC,4EAAe;;AAE9D,wCAAwC,mBAAO,CAAC,8EAAgB;;AAEhE,oCAAoC,mBAAO,CAAC,sEAAY;;AAExD,uCAAuC,uCAAuC;;;;;;;;;;;AC9EjE;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;;AAErD;;AAEA,oBAAoB,gBAAgB;AACpC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,cAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,aAAa;AAC/B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;AC9NF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA,kBAAe;;;;;;;;;;;ACVF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA,kBAAe;;;;;;;;;;;ACPF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf,uCAAuC,mBAAO,CAAC,4EAAe;;AAE9D,uCAAuC,uCAAuC;;AAE9E;AACA;AACA;AACA;;AAEA;AACA,kCAAkC;;AAElC;AACA;AACA;AACA,qBAAqB;;AAErB;AACA,qBAAqB;;AAErB;AACA,qBAAqB;;AAErB;AACA,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;AC5CF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,6BAA6B,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,GAAG;AAC3F,kBAAe;;;;;;;;;;;ACPF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;ACxBa;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,qDAAqD;;AAErD;;AAEA,oBAAoB,gBAAgB;AACpC;AACA;AACA,IAAI;AACJ;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;;AAEA,oBAAoB,QAAQ;AAC5B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,kBAAkB,OAAO;AACzB;;AAEA,oBAAoB,QAAQ;AAC5B;AACA;;AAEA,qBAAqB,QAAQ;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;ACvGF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;AACf,uBAAuB;;AAEvB,uCAAuC,mBAAO,CAAC,4EAAe;;AAE9D,uCAAuC,uCAAuC;;AAE9E;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,SAAS;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;AC3CF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf,kCAAkC,mBAAO,CAAC,kEAAU;;AAEpD,iBAAiB,mBAAO,CAAC,8EAAgB;;AAEzC,uCAAuC,uCAAuC;;AAE9E;AACA;AACA;AACA;AACA;;AAEA,eAAe;;;AAGf;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA,gFAAgF;AAChF;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;;;AAGA,wEAAwE;AACxE;;AAEA,4EAA4E;;AAE5E,gEAAgE;;AAEhE;AACA;AACA,IAAI;AACJ;;;AAGA;AACA;AACA,IAAI;;;AAGJ;AACA;AACA;;AAEA;AACA;AACA,wBAAwB;;AAExB,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA,uBAAuB;;AAEvB,oCAAoC;;AAEpC,8BAA8B;;AAE9B,kCAAkC;;AAElC,4BAA4B;;AAE5B,kBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;AC1GF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf,gCAAgC,mBAAO,CAAC,kEAAU;;AAElD,iCAAiC,mBAAO,CAAC,kEAAU;;AAEnD,uCAAuC,uCAAuC;;AAE9E;AACA;AACA,kBAAe;;;;;;;;;;;ACfF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,WAAW,GAAG,WAAW;AACzB,kBAAe;;AAEf,iBAAiB,mBAAO,CAAC,8EAAgB;;AAEzC,oCAAoC,mBAAO,CAAC,sEAAY;;AAExD,uCAAuC,uCAAuC;;AAE9E;AACA,2CAA2C;;AAE3C;;AAEA,kBAAkB,gBAAgB;AAClC;AACA;;AAEA;AACA;;AAEA;AACA,WAAW;AACX;AACA,WAAW;;AAEX;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,QAAQ;AAC9B;AACA;;AAEA;AACA;;AAEA;AACA,IAAI;;;AAGJ;AACA,8BAA8B;AAC9B,IAAI,eAAe;;;AAGnB;AACA;AACA;AACA;;;;;;;;;;;AC/Ea;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf,qCAAqC,mBAAO,CAAC,wEAAa;;AAE1D,kCAAkC,mBAAO,CAAC,kEAAU;;AAEpD,iBAAiB,mBAAO,CAAC,8EAAgB;;AAEzC,uCAAuC,uCAAuC;;AAE9E;AACA;AACA;AACA;;AAEA;;AAEA,kEAAkE;;;AAGlE;AACA,mCAAmC;;AAEnC;AACA;;AAEA,oBAAoB,QAAQ;AAC5B;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;AC1CF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf,gCAAgC,mBAAO,CAAC,kEAAU;;AAElD,kCAAkC,mBAAO,CAAC,oEAAW;;AAErD,uCAAuC,uCAAuC;;AAE9E;AACA;AACA,kBAAe;;;;;;;;;;;ACfF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf,oCAAoC,mBAAO,CAAC,sEAAY;;AAExD,uCAAuC,uCAAuC;;AAE9E;AACA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;AChBF;;AAEb,8CAA6C;AAC7C;AACA,CAAC,EAAC;AACF,kBAAe;;AAEf,uCAAuC,mBAAO,CAAC,4EAAe;;AAE9D,uCAAuC,uCAAuC;;AAE9E;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAe;;;;;;;;;;;;ACpBf;AACA,+DAAe;AACf;AACA,CAAC;;;;;;;;;;;;ACHD,+DAAe,cAAc,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,GAAG,yCAAyC;;;;;;;;;;;;;;;ACApI;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;;;;ACjBqC;AACrC;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB,SAAS;AACzB;AACA;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;;AAEA,OAAO,wDAAQ;AACf;AACA;;AAEA;AACA;;AAEA,+DAAe,SAAS;;;;;;;;;;;;;;;AChCS;AACN;AACsB;;AAEjD;AACA,MAAM,kDAAM;AACZ,WAAW,kDAAM;AACjB;;AAEA;AACA,iDAAiD,+CAAG,KAAK;;AAEzD;AACA,mCAAmC;;AAEnC;AACA;;AAEA,oBAAoB,QAAQ;AAC5B;AACA;;AAEA;AACA;;AAEA,SAAS,8DAAe;AACxB;;AAEA,+DAAe,EAAE;;;;;;;;;;;;;AC5Bc;;AAE/B;AACA,qCAAqC,iDAAK;AAC1C;;AAEA,+DAAe,QAAQ;;;;;;;;;;ACNvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,mBAAO,CAAC,gDAAM;AACjC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mDAAmD;AACnE;AACA,KAAK;AACL;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ,SAAS;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;AACL,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,OAAO;AACP,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT,QAAQ;AACR;AACA;AACA,0CAA0C;AAC1C,UAAU;AACV;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,wCAAwC;AAC1F,QAAQ;AACR,kDAAkD,uDAAuD;AACzG;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,4BAA4B;AAC5B,4BAA4B;;AAE5B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uGAAuG;AACvG;AACA;AACA,QAAQ,8DAA8D;AACtE;AACA;AACA;AACA,QAAQ,uEAAuE;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,eAAe;AACf;AACA,WAAW;AACX,SAAS;AACT,QAAQ;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4DAA4D,mBAAmB;AAC/E,OAAO;AACP;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,UAAU;AACV;AACA;AACA,OAAO;AACP,MAAM;AACN;AACA;AACA;;;;AAIA;AACA,MAAM,IAA0C;AAChD,MAAM,iCAAO,EAAE,mCAAE,cAAc,mBAAmB;AAAA,kGAAC;AACnD;AACA,IAAI,KAAK,EAUN;AACH,CAAC;;;;;;;;;;;ACnbD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACA0D;AACI;AACJ;AACA;AACF;AACI;AACJ;AACZ;AACE;AACY;AACI;AACV;AACI;AACJ;AACZ;AACM;AAC0C;AACxC;AACI;AACE;AACJ;AACmB;AACY;AACP;AACzB;AACJ;AACf;AAC+B;AACH;AACP;AACf;AACyB;;;;;;;;;;;;;;;;;;;AC/BF;AACT;AACE;AAC7C;AACP;AACA,cAAc,yDAAO;AACrB;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,YAAY,6EAA6E;AACzF;AACA,kBAAkB,uDAAU;AAC5B;AACA,4BAA4B,uEAAgB;AAC5C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;;;;;;;;;;;;;;;;;AC1B2D;AACpD;AACP;AACA,8BAA8B,mEAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzBiE;AAClB;AACC;AACuC;AACrC;AACJ;AACyB;AACF;AAC1B;AACW;AACY;AAC3D;AACP;AACA,SAAS,6DAAQ;AACjB,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,qCAAqC,6DAAQ;AAC7C,kBAAkB,uDAAU;AAC5B;AACA,0CAA0C,6DAAQ;AAClD,kBAAkB,uDAAU;AAC5B;AACA;AACA;AACA;AACA,oCAAoC,6DAAS;AAC7C,oCAAoC,yDAAO;AAC3C;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA,SAAS,+DAAU;AACnB,kBAAkB,uDAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iEAAY,CAAC,uDAAU;AAC3B;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA;AACA,YAAY,WAAW;AACvB;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,+CAA+C,wEAAkB;AACjE;AACA,QAAQ,wEAAkB;AAC1B;AACA,kBAAkB,8DAAiB;AACnC;AACA;AACA,kBAAkB,8DAAiB;AACnC;AACA;AACA;AACA;AACA,2BAA2B,6DAAS;AACpC;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,0EAAoB;AACxC;AACA;AACA,uDAAuD,uDAAU,mBAAmB,6DAAgB;AACpG;AACA;AACA,cAAc,uDAAW;AACzB;AACA;AACA;AACA;AACA,aAAa,6DAAS;AACtB;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,cAAc,6DAAS;AACvB;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,4BAA4B,yDAAO;AACnC;AACA;AACA,yBAAyB,4DAAM,kBAAkB,yDAAO,cAAc,yDAAO;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,6DAAS;AAC9B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,0BAA0B,+DAAO;AACjC;AACA,qGAAqG,qDAAO;AAC5G;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,iDAAiD,6DAAS;AAC1D;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;ACrKiE;AAClB;AACC;AACP;AAC8B;AACH;AAClB;AACmB;AACf;AAC/C;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA,aAAa,+DAAU;AACvB,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,iEAAY,CAAC,uDAAU;AAC/B;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA,0BAA0B,6DAAgB;AAC1C;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gCAAgC,QAAQ,0EAAoB;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD;AACA;AACA;AACA;AACA,gCAAgC,sDAAU;AAC1C;AACA;AACA;AACA;AACA,8BAA8B,yDAAO,QAAQ,6DAAS;AACtD;AACA;AACA,8BAA8B,yDAAO;AACrC;AACA;AACA,wBAAwB,6DAAS;AACjC,6BAA6B,4DAAM,kBAAkB,yDAAO,cAAc,yDAAO;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8GAA8G,qDAAO;AACrH,eAAe,kBAAkB,QAAQ,+DAAO;AAChD;AACA;AACA;AACA,eAAe,kBAAkB,QAAQ,+DAAO;AAChD;AACA;AACA,wBAAwB,6DAAS;AACjC,gBAAgB,6DAAS;AACzB,iBAAiB,6DAAS;AAC1B;AACA;AACA,gCAAgC,6DAAS;AACzC;AACA;AACA;AACA;AACA;AACA,4BAA4B,yDAAO;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AC9K2D;AACY;AACzB;AACvC;AACP,SAAS,6DAAQ;AACjB,kBAAkB,uDAAU;AAC5B;AACA,gEAAgE,yDAAQ;AACxE,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA;AACA,yBAAyB,uEAAgB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,cAAc,gEAAmB;AACjC;;;;;;;;;;;;;;;;;;;;;;;AC9BwE;AACtB;AACP;AACO;AACqB;AACN;AACX;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,+DAA+D,sEAAsE;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA,oBAAoB;AACpB;AACA;AACA,wCAAwC,mEAAgB;AACxD;AACA;AACA;AACA;AACA,0CAA0C,kCAAkC;AAC5E;AACA;AACA;AACA,+BAA+B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,6BAA6B;AACrD;AACA,iBAAiB,+DAAU;AAC3B,0BAA0B,uDAAU;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,MAAM;AAC1B;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA,YAAY,iEAAY,CAAC,uDAAU;AACnC;AACA;AACA,8BAA8B,uDAAU;AACxC;AACA;AACA;AACA,oBAAoB,uDAAW;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,6BAA6B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mEAAgB;AAC5D;AACA;AACA;AACA;AACA;AACA,kDAAkD,KAAK;AACvD;AACA;AACA;AACA,qBAAqB,8DAAW;AAChC,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,2BAA2B,QAAQ,0EAAoB;AAC3E;AACA,yHAAyH,KAAK;AAC9H,mCAAmC,6DAAS;AAC5C;AACA,kCAAkC;AAClC;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACjL6C;AACF;AACI;AACxC;AACP;AACA;AACA;AACA;AACA,SAAS,6DAAQ;AACjB,kBAAkB,uDAAU;AAC5B;AACA,sBAAsB,yDAAS,GAAG,8BAA8B;AAChE;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;AChB0C;AACoB;AACG;AAChB;AACN;AAC3C;AACA;AACA,kBAAkB,uDAAU,IAAI,aAAa;AAC7C;AACA;AACO;AACP,SAAS,6DAAQ;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA,iBAAiB,yDAAO;AACxB,WAAW,6DAAS,OAAO,8DAAM;AACjC;AACO;AACP;AACA;AACA,uDAAuD,0BAA0B,GAAG,WAAW;AAC/F;;;;;;;;;;;;;;;;;;;;;ACpD6C;AACmE;AACrE;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,6DAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,sBAAsB,wDAAW;AACjC;AACA;AACA;AACA;AACA,gBAAgB,WAAW,IAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,gBAAgB,iBAAiB;AACjC;AACA,sBAAsB,8DAAiB;AACvC;AACA;AACA,8BAA8B,qEAAwB;AACtD,oBAAoB,UAAU;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD;AACA,0BAA0B,yDAAS,GAAG,mBAAmB;AACzD;AACA,sBAAsB,wDAAW;AACjC;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACnHiD;AACkB;AACd;AACrD;AACA;AACA;AACA;AACA;AACA,2BAA2B,kDAAW;AACtC;AACA,gBAAgB,UAAU;AAC1B;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,8DAAiB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,kEAAS;AAC7D;AACA,iBAAiB,qDAAU;AAC3B,0BAA0B,wDAAW;AACrC;AACA,2BAA2B;AAC3B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;AC3EqD;AAC9C;AACP;AACA,8BAA8B,6DAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,cAAc,GAAG,YAAY,GAAG,cAAc;AAChE;AACA;;;;;;;;;;;;;;;;;;;AChByD;AACP;AACE;AAC7C;AACP;AACA,cAAc,yDAAO;AACrB;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,YAAY,uDAAuD;AACnE;AACA,kBAAkB,uDAAU;AAC5B;AACA,2BAA2B,qEAAe,GAAG,gDAAgD;AAC7F,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;ACpBiE;AACxB;AACS;AACA;AACmB;AACd;AACD;AAC/C;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA,aAAa,+DAAU;AACvB,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;AACA;AACA,2BAA2B,iEAAY,CAAC,uDAAU;AAClD;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA,gBAAgB,MAAM;AACtB;AACA,sBAAsB,uDAAU;AAChC;AACA,QAAQ,kEAAY;AACpB;AACA;AACA,sBAAsB,yDAAO,QAAQ,6DAAS;AAC9C;AACA;AACA;AACA,8BAA8B,yDAAO,QAAQ,6DAAS;AACtD;AACA;AACA,8BAA8B,yDAAO;AACrC;AACA,qBAAqB,4DAAM,kBAAkB,yDAAO;AACpD,gCAAgC,4DAAI;AACpC;AACA,uBAAuB,6DAAS;AAChC;AACA;AACA;AACA,0BAA0B,yDAAO;AACjC;AACA;AACA;AACA;AACA;AACA,4BAA4B,yDAAO;AACnC;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;AChFiE;AACpB;AACwD;AAChC;AACnB;AACJ;AACS;AACD;AACY;AAC3D;AACP;AACA,SAAS,6DAAQ;AACjB,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,qCAAqC,6DAAQ;AAC7C,kBAAkB,uDAAU;AAC5B;AACA;AACA;AACA;AACA,oCAAoC,6DAAS;AAC7C,oCAAoC,yDAAO;AAC3C;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA,SAAS,+DAAU;AACnB,kBAAkB,uDAAU;AAC5B;AACA;AACA;AACA;AACA;AACA,uBAAuB,iEAAY,CAAC,uDAAU;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA,YAAY,MAAM;AAClB;AACA,kBAAkB,uDAAU;AAC5B;AACA,kCAAkC,uEAAkB;AACpD;AACA,kBAAkB,8DAAiB;AACnC;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,kEAAY;AAChB,iBAAiB,4DAAM,CAAC,yDAAO,mEAAmE,yDAAO,gDAAgD,yDAAO;AAChK;AACA;AACA,oBAAoB,6DAAS;AAC7B;AACA;AACA,kBAAkB,uDAAU;AAC5B;AACA,2BAA2B,8DAAM;AACjC;AACA,kBAAkB,2EAA8B;AAChD;AACA;AACA;AACA;AACA,sBAAsB,6DAAS;AAC/B;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA,kBAAkB,yDAAO;AACzB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;;;;;;;;;;;;;;;;;AClHqD;AACH;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;AACA;AACA,wBAAwB,6BAA6B;AACrD;AACA,kCAAkC,6DAAa;AAC/C;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AClEyD;AACyB;AACpC;AACvC;AACP,SAAS,6DAAQ;AACjB,kBAAkB,uDAAU;AAC5B;AACA,gEAAgE,yDAAQ;AACxE,kBAAkB,uDAAU;AAC5B;AACA;AACA;AACA,yBAAyB,qEAAe;AACxC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,cAAc,2EAA8B;AAC5C;;;;;;;;;;;;;;;;;;;ACvB2D;AACT;AACW;AACtD;AACP,4BAA4B,uEAAc;AAC1C,oBAAoB,kEAAU;AAC9B,YAAY,kBAAkB;AAC9B;AACA,kBAAkB,qEAAwB;AAC1C;AACA;AACA,kBAAkB,qEAAwB;AAC1C;AACA;AACA;AACA,kBAAkB,qEAAwB;AAC1C;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;;;;;;;;;;;;;;;;;;;ACtB2D;AACV;AACP;AACnC,yBAAyB,mDAAU;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mEAAc,CAAC,yDAAO;AAC9C;AACA,sCAAsC;AACtC;AACA;AACA,sCAAsC;AACtC;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;ACnEoC;AACO;AACT;AAC3B;AACP;AACA,aAAa,6DAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,8BAA8B,uBAAuB,yDAAK,eAAe,wDAAI;AAC7E;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA,8BAA8B,uBAAuB,yDAAK,eAAe,wDAAI;AAC7E;AACA;AACA;AACA;AACA;AACA,8BAA8B,uBAAuB,yDAAK;AAC1D;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACrDqD;AACN;AACE;AACP;AACnC,sBAAsB,mDAAU;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,6DAAW,CAAC,yDAAO;AAC3C;AACA;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;ACpBqD;AACJ;AACF;AACG;AACR;AACnC,2BAA2B,mDAAU;AAC5C;AACA,uBAAuB,yDAAgB,kBAAkB,aAAa;AACtE,wBAAwB,yDAAgB;AACxC,kBAAkB,OAAO,GAAG,QAAQ;AACpC;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA,gBAAgB,4DAA4D;AAC5E;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA,gCAAgC,yDAAO,QAAQ,yDAAgB;AAC/D;AACA;AACA;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA,wBAAwB,kEAAU,SAAS,yDAAgB;AAC3D,iBAAiB;AACjB;AACA;;;;;;;;;;;;;;;;;;;AC/ByD;AACP;AACH;AACxC;AACP;AACA,2BAA2B,qEAAa;AACxC;AACA,kBAAkB,uDAAU;AAC5B;AACA,oBAAoB,kEAAU;AAC9B,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACf4D;AACE;AACd;AACzC;AACP,WAAW,wDAAY;AACvB;AACO;AACP,WAAW,yDAAa;AACxB;AACO;AACP,WAAW,kEAAQ;AACnB;;;;;;;;;;;;;;;;;ACXqE;AAC9D;AACP,WAAW,qEAAQ;AACnB;;;;;;;;;;;;;;;;;ACHoE;AAC7D;AACP,WAAW,oEAAQ;AACnB;;;;;;;;;;;;;;;;;;;;;;;;ACHoE;AACD;AAChB;AACE;AACV;AACpC;AACP;AACA;AACA;AACA,WAAW,0DAAQ;AACnB;AACO;AACP;AACA;AACA;AACA,WAAW,0DAAQ;AACnB;AACO;AACP;AACA;AACA;AACA,WAAW,2DAAS;AACpB;AACO;AACP;AACA,SAAS,6DAAQ;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kEAAW,GAAG,yEAAyE;AAC9G;AACA,mBAAmB,6DAAe;AAClC;AACA;AACA,0BAA0B,6DAAgB;AAC1C;AACA;AACA;AACA,mBAAmB,kEAAW,GAAG,aAAa;AAC9C;AACA,sBAAsB,6DAAgB;AACtC;AACA;;;;;;;;;;;;;;;;;;;;;ACjD4C;AACA;AACX;AAC6B;AACvD;AACP;AACA,gBAAgB,kDAAU;AAC1B,YAAY,gCAAgC,QAAQ,+DAAO;AAC3D,aAAa,kBAAkB,6DAAS,WAAW,6DAAS;AAC5D;AACO;AACP;AACA,WAAW,+DAAO;AAClB;;;;;;;;;;;;;;;;;;;;;;;;ACb0C;AACnC;AACA;AACP;AACO;AACP,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA;AACA;AACA,0DAA0D,cAAc,aAAa,MAAM;AAC3F;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA,sBAAsB,8DAAM;AAC5B;AACA;AACA;;;;;;;;;;;;;;;;;;AClDqD;AACX;AACnC;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB,+BAA+B,IAAI;AACzE;AACA;AACA,+DAAe,SAAS,8DAAM,qCAAqC,EAAC;;;;;;;;;;;;;;;ACnBrB;AACX;AACpC;AACA,2BAA2B,iDAAS;AACpC,kBAAkB,uDAAU;AAC5B;AACA;AACA,+DAAe,aAAa,EAAC;;;;;;;;;;;;;;;ACPuC;AACP;AAC7D;AACA;AACA;AACA,SAAS,mEAAS;AAClB,4BAA4B,8DAAe,cAAc,0DAAK;AAC9D;AACA;AACA,+BAA+B,0DAAK,eAAe;AACnD;AACA;AACA;AACA,SAAS,mEAAS;AAClB,4BAA4B,8DAAe,cAAc,0DAAK;AAC9D;AACA;AACA,+BAA+B,0DAAK,eAAe;AACnD;AACA;AACA,+BAA+B,0DAAK,eAAe;AACnD;AACA;AACA,+BAA+B,0DAAK,eAAe;AACnD;AACA;AACA,+BAA+B,0DAAK,eAAe;AACnD;AACA;AACA,+BAA+B,0DAAK,eAAe;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,EAAE;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe,YAAY,EAAC;;;;;;;;;;;;;;;;;AC5CmB;AAChC;AACf;AACA,kBAAkB,uDAAU;AAC5B;AACA;;;;;;;;;;;;;;;;;ACLA;AACA,2EAA2E,MAAM,UAAU,KAAK;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,kBAAkB,OAAO,KAAK;AAC3D;AACA;AACA,6BAA6B,WAAW,KAAK,UAAU;AACvD;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;ACvJsD;AACT;AACc;AACJ;AACO;AACG;AACV;AACV;AACE;AACT;AACa;AACnD;AACA,IAAI,8DAAY;AAChB;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA;AACA,iBAAiB,yDAAQ;AACzB,0BAA0B,uDAAU;AACpC,iBAAiB,2DAAgB;AACjC,0BAA0B,6DAAgB;AAC1C,8BAA8B,yDAAS;AACvC;AACA;AACA;AACA;AACA,8BAA8B,uDAAU;AACxC;AACA,iCAAiC,6DAAS;AAC1C;AACA;AACA,8BAA8B,uDAAU;AACxC;AACA;AACA;AACA;AACA,8BAA8B,uDAAU;AACxC;AACA,iCAAiC,6DAAS;AAC1C;AACA;AACA,8BAA8B,uDAAU;AACxC;AACA;AACA,uCAAuC,yDAAc,yEAAyE,sDAAS;AACvI;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC,mBAAmB,yDAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC,mBAAmB,0DAAK;AACxB;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA,sBAAsB,6DAAS;AAC/B;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA,mBAAmB,4DAAO;AAC1B;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC,mBAAmB,yDAAK;AACxB;AACA;AACA;AACA;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA,0BAA0B,uDAAU;AACpC;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA,qBAAqB,6DAAS;AAC9B;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA;AACA;AACA,sBAAsB,6DAAS;AAC/B;AACA;AACA,0BAA0B,uDAAU;AACpC;AACA,mBAAmB,qDAAQ;AAC3B;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA;AACA;AACA,+DAAe,oBAAoB,EAAC;;;;;;;;;;;;;;;;;;;;;;;AC9HgB;AACP;AACc;AACJ;AACO;AACM;AACf;AACR;AACE;AACE;AACjD,uFAAuF;AACvF;AACA;AACA;AACA,IAAI,8DAAY;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,2DAAgB;AACjC,0BAA0B,6DAAgB;AAC1C;AACA,oBAAoB,WAAW;AAC/B,kBAAkB,oBAAoB;AACtC,mDAAmD,2DAAgB;AACnE,oBAAoB,iBAAiB,QAAQ,yDAAS;AACtD,uCAAuC,yDAAc,uEAAuE,sDAAS;AACrI,2BAA2B,OAAO;AAClC;AACA;AACA;AACA,iCAAiC,6DAAS;AAC1C;AACA,iCAAiC,6DAAS;AAC1C;AACA;AACA;AACA;AACA,iCAAiC,uDAAW;AAC5C;AACA,iCAAiC,uDAAK;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,uDAAW;AAC5C,iCAAiC,0DAAK;AACtC;AACA;AACA;AACA;AACA;AACA,iCAAiC,uDAAW;AAC5C,oBAAoB,WAAW;AAC/B,eAAe,8BAA8B,QAAQ,4DAAO;AAC5D;AACA;AACA;AACA;AACA;AACA,iCAAiC,uDAAW;AAC5C,iCAAiC,uDAAK;AACtC;AACA;AACA;AACA;AACA;AACA,iCAAiC,uDAAW;AAC5C,oBAAoB,KAAK;AACzB,eAAe,8BAA8B,QAAQ,kDAAQ;AAC7D;AACA;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA;AACA,aAAa;AACb;AACA,+DAAe,oBAAoB,EAAC;;;;;;;;;;;;;ACtFpC,+DAAe,2CAA2C,EAAC;;;;;;;;;;;;;ACA3D,+DAAe;AACf,mCAAmC,KAAK;AACxC,yBAAyB,WAAW,SAAS,SAAS,aAAa,WAAW;AAC9E,CAAC,EAAC;;;;;;;;;;;;;;;;ACHF;AACA;AACA;AACA,8BAA8B,iBAAiB,OAAO,KAAK;AAC3D;AACA;AACA,8BAA8B,UAAU,KAAK,SAAS;AACtD;AACA;AACA,0BAA0B,SAAS;AACnC;AACA;AACA,4BAA4B,OAAO;AACnC;AACA;AACA,qCAAqC,YAAY;AACjD;AACA;AACA;AACA,+CAA+C,wBAAwB;AACvE;AACA;AACA;AACA;AACA,+DAAe;AACf;AACA,CAAC,EAAC;AACK;AACP,kCAAkC,KAAK;AACvC;;;;;;;;;;;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe,UAAU,EAAC;;;;;;;;;;;;;;;;ACrB1B;AACA;AACA;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACfqD;AACX;AACnC;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB,+BAA+B,IAAI;AACzE;AACA;AACA,+DAAe,SAAS,8DAAM,qCAAqC,EAAC;;;;;;;;;;;;;;;;;;ACnBiB;AACzC;AACb;AACF;AACS;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe,8CAA8C;AAC7D,YAAY,MAAM;AAClB;AACA;AACA;AACA,kBAAkB,qEAAwB;AAC1C;AACA;AACA;AACA,6BAA6B,qDAAO;AACpC;AACA;AACA;AACA,SAAS,yDAAQ;AACjB,kBAAkB,uDAAU;AAC5B;AACA,YAAY,8DAA8D;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,qEAAwB,sBAAsB,MAAM;AAC1E;AACA;AACA;AACA,kBAAkB,qEAAwB;AAC1C;AACA;AACA,kBAAkB,qEAAwB;AAC1C;AACA;AACA;AACA,kBAAkB,qEAAwB;AAC1C;AACA;AACA;AACA;AACA,wBAAwB,oDAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,cAAc;AAC1B,gBAAgB,qDAAK;AACrB;AACA,kBAAkB,qEAAwB;AAC1C;AACA;AACA;AACA,sBAAsB,qEAAwB;AAC9C;AACA;AACA,sBAAsB,qEAAwB;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,qEAAwB;AAC9C;AACA;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA;AACA;AACA,oEAAoE,oDAAI;AACxE;AACA,sBAAsB,uDAAU;AAChC;AACA;AACA,sBAAsB,qEAAwB;AAC9C;AACA;AACA;AACA,CAAC,EAAC;;;;;;;;;;;;;ACrGF;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAC;;;;;;;;;;;;;AC3CF;AACA;AACA;AACA,gCAAgC,OAAO;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe,kBAAkB,EAAC;;;;;;;;;;;;;;ACVmB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB,gCAAgC,UAAU;AAChF;AACA;AACA,yDAAyD,UAAU;AACnE;AACA;AACA,yDAAyD,UAAU;AACnE;AACA;AACA;AACA;AACA,+DAAe,YAAY,EAAC;;;;;;;;;;;;;;;;;;;;;;ACjCY;AACa;AACI;AACC;AACjB;AACzC;AACA;AACA,yDAAyD,IAAI;AAC7D;AACA;AACA;AACA,QAAQ,0DAAW;AACnB,QAAQ,qEAAiB;AACzB;AACA;AACA;AACA,eAAe,qDAAM;AACrB;AACA,wBAAwB,qEAAe,SAAS,kDAAK;AACrD;AACO;AACP;AACA;AACA,+BAA+B,qDAAM,iCAAiC,iDAAc;AACpF,gCAAgC,qDAAM;AACtC;AACO;AACP;AACA;AACA,+BAA+B,qDAAM,+DAA+D,iDAAc;AAClH,gCAAgC,qDAAM;AACtC;;;;;;;;;;;;;;;;;;;;;;;;;;AC/BqD;AACK;AACE;AACf;AACQ;AACZ;AACzC;AACA,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA;AACA;AACA;AACA;AACA,4CAA4C,SAAS;AACrD;AACA,WAAW,8DAAS,CAAC,2DAAY,sBAAsB,qDAAM,wCAAwC,uBAAuB;AAC5H;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,8BAA8B,cAAc;AACtE;AACA;AACA;AACA;AACA;AACA,0BAA0B,wCAAwC,cAAc;AAChF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iCAAiC;AAC9D;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,2BAA2B,IAAI;AACvF;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA,WAAW,qDAAM;AACjB;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,oBAAoB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,2DAAY;AACvB;AACA;AACA;AACA,gBAAgB,2DAAY;AAC5B,WAAW,8DAAS;AACpB;AACO;AACP;AACA;AACA;AACA;AACA;AACA,uEAAuE,OAAO;AAC9E;AACA;AACA;;;;;;;;;;;;;;;;;;;;ACzM0D;AACnD;AACP;AACA;AACA,oBAAoB,yDAAO;AAC3B;AACA;AACA;AACA,oBAAoB,sBAAsB;AAC1C;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,oBAAoB,mBAAmB;AACvC;AACA;AACA;AACA;AACO;AACP;AACA;AACA,kBAAkB,yDAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACpCA;AACA,MAAM,+BAA+B;AACrC;AACA;AACA;AACA,+DAAe,cAAc,EAAC;;;;;;;;;;;;;;ACLiB;AAC/C;AACA;AACA;AACA,kBAAkB,uDAAU,oDAAoD,UAAU,YAAY,QAAQ;AAC9G;AACA;AACA,+DAAe,cAAc,EAAC;;;;;;;;;;;;;ACP9B,+DAAe;AACf;AACA,gBAAgB,gBAAgB;AAChC;AACA,mCAAmC,KAAK;AACxC;AACA;AACA,CAAC,EAAC;;;;;;;;;;;;;;;;;;;;;;ACPwD;AACJ;AACH;AACE;AACqB;AACrB;AACI;AACC;AACjB;AACzC;AACA;AACA,4BAA4B,qEAAe;AAC3C;AACA;AACA,yBAAyB,qDAAM;AAC/B,yBAAyB,qDAAM;AAC/B,qBAAqB,aAAa;AAClC;AACA,KAAK;AACL,oBAAoB,4DAAM,sBAAsB,8DAAQ;AACxD,8CAA8C,qDAAM;AACpD;AACA;AACA,yBAAyB,iEAAe;AACxC;AACA;AACA;AACA;AACA,kBAAkB,gEAAmB;AACrC;AACA;AACA;AACA,yCAAyC,qDAAM,kBAAkB,qBAAqB;AACtF;AACA;AACA;AACA;AACA,kBAAkB,gEAAmB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qDAAM;AAC7B;AACA;AACA,QAAQ,qEAAiB;AACzB;AACA;AACA;AACA,oCAAoC,qDAAM;AAC1C;AACA;AACA;AACA;AACA,SAAS,UAAU,4DAAM;AACzB;AACA;AACA,kBAAkB,gEAAmB;AACrC;AACA;AACA;AACA,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA,IAAI,mEAAa;AACjB;AACA;AACA;AACA;AACA;AACA,gBAAgB,gEAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,gBAAgB,gEAAc;AAC9B;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA;AACA,+DAAe,OAAO,EAAC;;;;;;;;;;;;;;ACpFa;AACpC;AACA,gCAAgC,oBAAoB;AACpD,gCAAgC,qDAAM;AACtC;AACA,+DAAe,MAAM,EAAC;;;;;;;;;;;;;;;;;;;;;;;ACLwE;AACzC;AACI;AACC;AACjB;AAClC;AACP,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,eAAe,kDAAK;AAC/D;AACA,IAAI,qEAAiB;AACrB,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,gBAAgB,kDAAK;AAChE;AACA,IAAI,qEAAiB;AACrB,kBAAkB,4DAAM,CAAC,oEAAc,CAAC,yDAAO,qBAAqB,oEAAc,OAAO,oEAAc,OAAO,8DAAQ;AACtH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,qDAAM;AACpD;AACA;AACA,KAAK;AACL,WAAW,+DAAS;AACpB;AACO;AACP,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA,WAAW,qDAAM;AACjB;AACO;AACP,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;AC7C0D;AACJ;AACH;AACE;AACI;AACC;AACL;AACZ;AACzC;AACA;AACA,4BAA4B,qEAAe;AAC3C;AACA;AACA,yBAAyB,qDAAM;AAC/B,yBAAyB,qDAAM;AAC/B,qBAAqB,aAAa;AAClC;AACA,KAAK;AACL,4CAA4C,qDAAM;AAClD;AACA;AACA,KAAK;AACL,oBAAoB,4DAAM,sBAAsB,8DAAQ;AACxD,sCAAsC,qDAAM;AAC5C,aAAa;AACb;AACA;AACA;AACA;AACA,uBAAuB,qDAAM;AAC7B;AACA;AACA,QAAQ,qEAAiB;AACzB;AACA;AACA,2CAA2C,qDAAM;AACjD;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA,IAAI,mEAAa;AACjB;AACA;AACA;AACA;AACA;AACA,gBAAgB,gEAAc;AAC9B;AACA;AACA;AACA;AACA;AACA,gBAAgB,gEAAc;AAC9B;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA;AACA,+DAAe,OAAO,EAAC;;;;;;;;;;;;;;ACnEoC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,sBAAsB,wDAAW;AACjC;AACA,KAAK;AACL;AACA;AACA;AACA,kBAAkB,sDAAS;AAC3B;AACA;AACA;AACA;AACA;AACA,kBAAkB,sDAAS;AAC3B;AACA;AACA,+DAAe,SAAS,EAAC;;;;;;;;;;;;;;;;;;;;ACjCW;AACiB;AACpB;AAC1B;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,2BAA2B,OAAO;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,sDAAM;AACzB;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA,WAAW,qDAAM;AACjB;AACA;AACA;AACA;AACA;AACA,kBAAkB,6DAAgB;AAClC;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iCAAiC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA,8BAA8B,6DAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA,8BAA8B,6DAAgB;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA,YAAY,qDAAM;AAClB;;;;;;;;;;;;;;;;;;;;AC5IqD;AACI;AACC;AACjB;AAC1B;AACf,QAAQ,0DAAW;AACnB,QAAQ,qEAAiB;AACzB;AACA;AACA;AACA;AACA,gCAAgC,qEAAe,SAAS,kDAAK;AAC7D;AACA,eAAe,qDAAM,gCAAgC,aAAa,cAAc,iBAAiB;AACjG;AACA,wBAAwB,qEAAe,SAAS,kDAAK;AACrD;;;;;;;;;;;;;;;;;AChB6C;AAC7C,+DAAe;AACf,WAAW,0DAAW;AACtB,CAAC,EAAC;AACK;;;;;;;;;;;;;;;;ACJ6B;AACiB;AACA;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,2BAA2B,kBAAkB;AAC/E;AACA;AACA;AACA;AACA;AACA,8BAA8B,6DAAgB,IAAI,SAAS;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,8BAA8B,6DAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,8BAA8B,kBAAkB;AAClF;AACA;AACA;AACA;AACA;AACA,kCAAkC,wCAAwC,kBAAkB;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,qCAAqC;AAC1E;AACA;AACA;AACA;AACA,8BAA8B,6DAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,8BAA8B,6DAAgB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA,8BAA8B,6DAAgB;AAC9C;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB;AACtC;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,uBAAuB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,qDAAM,yBAAyB,qDAAS;AACvD;AACA,sBAAsB;AACtB;AACA;AACA,WAAW,qDAAM;AACjB;AACA,+DAAe,KAAK,EAAC;;;;;;;;;;;;;;;;;AC9IgC;AACK;AACL;AACZ;AACzC;AACA;AACA;AACA;AACA,eAAe,qDAAS;AACxB;AACA;AACA,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA;AACA;AACA;AACA,YAAY,iCAAiC,QAAQ,qDAAM;AAC3D;AACA;AACA,+DAAe,QAAQ,EAAC;;;;;;;;;;;;;;;;;;;;;;;;;;ACpBS;AAC0B;AACN;AACX;AACC;AACU;AACI;AACC;AACjB;AACzC;AACA;AACA,eAAe,qDAAM;AACrB;AACA,QAAQ,0DAAW;AACnB,QAAQ,qEAAiB;AACzB;AACA;AACA,wBAAwB,qEAAe,SAAS,kDAAK;AACrD;AACA;AACA,IAAI,6DAAQ;AACZ,iBAAiB,yDAAU;AAC3B;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,qDAAM;AAC1C;AACA;AACA,eAAe,qDAAM;AACrB;AACA;AACA;AACO,wDAAwD,sDAAM;AACrE;AACA,+BAA+B,+CAAI;AACnC,aAAa,wBAAwB,qDAAS;AAC9C;AACO;AACP;AACA,WAAW,iDAAM;AACjB;;;;;;;;;;;;;;AClDoC;AACpC,+DAAe,qDAAM,sBAAsB,qDAAM,CAAC,EAAC;;;;;;;;;;;;;;;;;;;;;;;;ACDH;AACR;AACa;AACI;AACN;AACO;AACjB;AAClC;AACP,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA,IAAI,qEAAiB;AACrB,IAAI,gEAAc;AAClB;AACA,oCAAoC,qDAAM,gBAAgB,4DAAe;AACzE;AACA;AACA,mCAAmC,qDAAM,iCAAiC,iDAAc;AACxF,oCAAoC,qDAAM,0CAA0C,4DAAe;AACnG;AACA;AACA;AACO;AACP,SAAS,0DAAW;AACpB,4BAA4B,qEAAe,SAAS,kDAAK;AACzD;AACA,IAAI,qEAAiB;AACrB,IAAI,gEAAc;AAClB;AACA,oCAAoC,qDAAM,gBAAgB,4DAAe;AACzE;AACA;AACA,mCAAmC,qDAAM,4CAA4C,4DAAe,UAAU,iDAAc;AAC5H,oCAAoC,qDAAM;AAC1C;AACA;AACA;;;;;;;;;;;;;ACpCA,+DAAe,cAAc,EAAC;;;;;;;;;;;;;;;;;ACAgB;AACV;AACe;AACD;AAClD;AACA,4BAA4B,mEAAU;AACtC,IAAI,gEAAc;AAClB,4BAA4B,qDAAM,aAAa,0DAAe;AAC9D;AACA;AACA,+DAAe,IAAI,EAAC;;;;;;;;;;;;;;;;;ACViC;AACtC;AACf,wBAAwB,cAAc;AACtC;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,qBAAqB;AACrB;AACA,qBAAqB;AACrB;AACA,sBAAsB,6DAAgB,QAAQ,KAAK;AACnD;AACA;;;;;;;;;;;;;;;;;ACzBqD;AACtC;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,6DAAgB,QAAQ,KAAK;AACnD;AACA;;;;;;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+DAAe,eAAe,EAAC;;;;;;;;;;;;;;;;;AClBe;AACV;AACe;AACC;AACpD;AACA,4BAA4B,mEAAY;AACxC,IAAI,gEAAc;AAClB,sBAAsB,0DAAe;AACrC;AACA,qBAAqB,qDAAM;AAC3B;AACA;AACA;AACA;AACA;AACA,+DAAe,MAAM,EAAC;;;;;;;;;;;;;;;;ACftB,+DAAe,MAAM,EAAC;AACf;;;;;;;;;;;;;;;;;;ACD8C;AAC9C;AACP,cAAc,6DAAgB;AAC9B;AACO;AACP,cAAc,6DAAgB;AAC9B;;;;;;;;;;;;;;;;;;ACNqD;AAC9C,eAAe,yDAAgB;AAC/B,eAAe,yDAAgB;;;;;;;;;;;;;;;;;;;;ACFe;AACJ;AACN;AACF;AAClC;AACP;AACA,kBAAkB,kDAAU;AAC5B,YAAY,qBAAqB;AACjC;AACA,kBAAkB,kDAAU;AAC5B;AACA,kBAAkB,kDAAU;AAC5B;AACA,kBAAkB,kDAAU;AAC5B;AACA;AACA,kBAAkB,qDAAS;AAC3B;AACA;AACA,kBAAkB,kDAAU;AAC5B;AACA;AACA;AACA,4BAA4B,yDAAO;AACnC;AACA;AACA,kBAAkB,kDAAU;AAC5B;AACA,SAAS,6DAAQ;AACjB,kBAAkB,kDAAU;AAC5B;AACA;;;;;;;;;;;;;;;;;;;AC/BqD;AACJ;AACN;AACpC;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,yDAAO,QAAQ,qDAAS;AAC1D,aAAa,6DAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjCO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACnJ0C;AAC1C,+DAAe,2DAAK,EAAC;;;;;;;UCDrB;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,GAAG;WACH;WACA;WACA,CAAC;;;;;WCPD,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;UENA;UACA;UACA;UACA","sources":["webpack://RemoteStorage/webpack/universalModuleDefinition","webpack://RemoteStorage/./node_modules/@bergos/jsonparse/jsonparse.js","webpack://RemoteStorage/./node_modules/@inrupt/oidc-client-ext/dist/index.es.js","webpack://RemoteStorage/./node_modules/@inrupt/oidc-client/lib/oidc-client.min.js","webpack://RemoteStorage/./node_modules/@inrupt/solid-client-authn-browser/dist/index.js","webpack://RemoteStorage/./node_modules/@inrupt/solid-client-authn-core/dist/index.js","webpack://RemoteStorage/./node_modules/@inrupt/solid-client-authn-core/dist/index.mjs","webpack://RemoteStorage/./node_modules/@inrupt/solid-client/dist/index.js","webpack://RemoteStorage/./node_modules/@inrupt/universal-fetch/dist/index-browser.js","webpack://RemoteStorage/./node_modules/@inrupt/universal-fetch/dist/index-browser.mjs","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/index.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/BlankNode.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/DataFactory.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/DefaultGraph.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/Literal.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/NamedNode.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/Quad.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/Variable.js","webpack://RemoteStorage/./node_modules/@rdfjs/data-model/lib/fromTerm.js","webpack://RemoteStorage/./node_modules/@rdfjs/dataset/DatasetCore.js","webpack://RemoteStorage/./node_modules/@rdfjs/dataset/index.js","webpack://RemoteStorage/./node_modules/abort-controller/browser.js","webpack://RemoteStorage/./node_modules/base64-js/index.js","webpack://RemoteStorage/./node_modules/blob/main.js","webpack://RemoteStorage/./node_modules/buffer/index.js","webpack://RemoteStorage/./node_modules/canonicalize/lib/canonicalize.js","webpack://RemoteStorage/./node_modules/cross-fetch/dist/browser-polyfill.js","webpack://RemoteStorage/./node_modules/events/events.js","webpack://RemoteStorage/./node_modules/http-link-header/lib/link.js","webpack://RemoteStorage/./node_modules/ieee754/index.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/index.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/lib/ContextParser.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/lib/ErrorCoded.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/lib/FetchDocumentLoader.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/lib/IDocumentLoader.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/lib/JsonLdContext.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/lib/JsonLdContextNormalized.js","webpack://RemoteStorage/./node_modules/jsonld-context-parser/lib/Util.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/index.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/ContextTree.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/JsonLdParser.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/ParsingContext.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/Util.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIdentifier.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerIndex.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerLanguage.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/containerhandler/ContainerHandlerType.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerArrayValue.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerContainer.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerInvalidFallback.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/EntryHandlerPredicate.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeyword.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordAnnotation.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordContext.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordGraph.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordId.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordIncluded.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordNest.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordType.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordUnknownFallback.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/lib/entryhandler/keyword/EntryHandlerKeywordValue.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/buffer_list.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/compose.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/destroy.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplex.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/duplexify.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/end-of-stream.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/from.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/legacy.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/operators.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/passthrough.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/pipeline.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/readable.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/state.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/transform.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/utils.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/streams/writable.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/internal/validators.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/browser.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/errors.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/primordials.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/ours/util.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/readable-stream/lib/stream/promises.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/safe-buffer/index.js","webpack://RemoteStorage/./node_modules/jsonld-streaming-parser/node_modules/string_decoder/lib/string_decoder.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/add-abort-signal.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/buffer_list.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/compose.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/destroy.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplex.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/duplexify.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/end-of-stream.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/from.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/legacy.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/operators.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/passthrough.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/pipeline.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/readable.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/state.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/transform.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/utils.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/streams/writable.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/internal/validators.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/ours/browser.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/ours/errors.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/ours/primordials.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/ours/util.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/stream.js","webpack://RemoteStorage/./node_modules/n3/node_modules/readable-stream/lib/stream/promises.js","webpack://RemoteStorage/./node_modules/n3/node_modules/safe-buffer/index.js","webpack://RemoteStorage/./node_modules/n3/node_modules/string_decoder/lib/string_decoder.js","webpack://RemoteStorage/./node_modules/n3/src/IRIs.js","webpack://RemoteStorage/./node_modules/n3/src/N3DataFactory.js","webpack://RemoteStorage/./node_modules/n3/src/N3Lexer.js","webpack://RemoteStorage/./node_modules/n3/src/N3Parser.js","webpack://RemoteStorage/./node_modules/n3/src/N3Store.js","webpack://RemoteStorage/./node_modules/n3/src/N3StreamParser.js","webpack://RemoteStorage/./node_modules/n3/src/N3StreamWriter.js","webpack://RemoteStorage/./node_modules/n3/src/N3Util.js","webpack://RemoteStorage/./node_modules/n3/src/N3Writer.js","webpack://RemoteStorage/./node_modules/n3/src/index.js","webpack://RemoteStorage/./node_modules/process/browser.js","webpack://RemoteStorage/./node_modules/queue-microtask/index.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/index.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/lib/BlankNode.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/lib/DataFactory.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/lib/DefaultGraph.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/lib/Literal.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/lib/NamedNode.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/lib/Quad.js","webpack://RemoteStorage/./node_modules/rdf-data-factory/lib/Variable.js","webpack://RemoteStorage/./node_modules/relative-to-absolute-iri/index.js","webpack://RemoteStorage/./node_modules/relative-to-absolute-iri/lib/Resolve.js","webpack://RemoteStorage/./src/access.ts","webpack://RemoteStorage/./src/authorize.ts","webpack://RemoteStorage/./src/baseclient.ts","webpack://RemoteStorage/./src/caching.ts","webpack://RemoteStorage/./src/cachinglayer.ts","webpack://RemoteStorage/./src/config.ts","webpack://RemoteStorage/./src/discover.ts","webpack://RemoteStorage/./src/dropbox.ts","webpack://RemoteStorage/./src/env.ts","webpack://RemoteStorage/./src/eventhandling.ts","webpack://RemoteStorage/./src/features.ts","webpack://RemoteStorage/./src/googledrive.ts","webpack://RemoteStorage/./src/indexeddb.ts","webpack://RemoteStorage/./src/inmemorystorage.ts","webpack://RemoteStorage/./src/localstorage.ts","webpack://RemoteStorage/./src/log.ts","webpack://RemoteStorage/./src/remote.ts","webpack://RemoteStorage/./src/remotestorage.ts","webpack://RemoteStorage/./src/requests.ts","webpack://RemoteStorage/./src/revisioncache.ts","webpack://RemoteStorage/./src/schema-not-found-error.ts","webpack://RemoteStorage/./src/solid.ts","webpack://RemoteStorage/./src/solidStorage.ts","webpack://RemoteStorage/./src/sync-error.ts","webpack://RemoteStorage/./src/sync.ts","webpack://RemoteStorage/./src/syncedgetputdelete.ts","webpack://RemoteStorage/./src/types.ts","webpack://RemoteStorage/./src/unauthorized-error.ts","webpack://RemoteStorage/./src/util.ts","webpack://RemoteStorage/./src/wireclient.ts","webpack://RemoteStorage/./node_modules/tv4/tv4.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/index.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/md5.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/native.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/nil.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/parse.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/regex.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/rng.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/sha1.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/stringify.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/v1.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/v3.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/v35.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/v4.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/v5.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/validate.js","webpack://RemoteStorage/./node_modules/uuid/dist/commonjs-browser/version.js","webpack://RemoteStorage/./node_modules/uuid/dist/esm-browser/native.js","webpack://RemoteStorage/./node_modules/uuid/dist/esm-browser/regex.js","webpack://RemoteStorage/./node_modules/uuid/dist/esm-browser/rng.js","webpack://RemoteStorage/./node_modules/uuid/dist/esm-browser/stringify.js","webpack://RemoteStorage/./node_modules/uuid/dist/esm-browser/v4.js","webpack://RemoteStorage/./node_modules/uuid/dist/esm-browser/validate.js","webpack://RemoteStorage/./node_modules/webfinger.js/src/webfinger.js","webpack://RemoteStorage/./node_modules/xhr2/lib/browser.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/index.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwe/compact/decrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwe/compact/encrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwe/flattened/decrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwe/flattened/encrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwe/general/decrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwe/general/encrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwk/embedded.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwk/thumbprint.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwks/local.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwks/remote.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jws/compact/sign.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jws/compact/verify.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jws/flattened/sign.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jws/flattened/verify.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jws/general/sign.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jws/general/verify.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwt/decrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwt/encrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwt/produce.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwt/sign.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwt/unsecured.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/jwt/verify.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/key/export.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/key/generate_key_pair.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/key/generate_secret.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/key/import.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/aesgcmkw.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/buffer_utils.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/cek.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/check_iv_length.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/check_key_type.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/check_p2s.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/crypto_key.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/decrypt_key_management.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/encrypt_key_management.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/epoch.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/format_pem.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/invalid_key_input.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/is_disjoint.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/is_object.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/iv.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/jwt_claims_set.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/secs.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/validate_algorithms.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/lib/validate_crit.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/aeskw.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/asn1.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/base64url.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/bogus.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/check_cek_length.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/check_key_length.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/decrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/digest.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/ecdhes.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/encrypt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/fetch_jwks.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/generate.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/get_sign_verify_key.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/is_key_like.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/jwk_to_key.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/key_to_jwk.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/pbes2kw.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/random.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/rsaes.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/runtime.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/sign.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/subtle_dsa.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/subtle_rsaes.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/timing_safe_equal.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/verify.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/webcrypto.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/runtime/zlib.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/util/base64url.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/util/decode_jwt.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/util/decode_protected_header.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/util/errors.js","webpack://RemoteStorage/./node_modules/jose/dist/browser/util/runtime.js","webpack://RemoteStorage/webpack/bootstrap","webpack://RemoteStorage/webpack/runtime/compat get default export","webpack://RemoteStorage/webpack/runtime/define property getters","webpack://RemoteStorage/webpack/runtime/global","webpack://RemoteStorage/webpack/runtime/hasOwnProperty shorthand","webpack://RemoteStorage/webpack/runtime/make namespace object","webpack://RemoteStorage/webpack/before-startup","webpack://RemoteStorage/webpack/startup","webpack://RemoteStorage/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"RemoteStorage\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"RemoteStorage\"] = factory();\n\telse\n\t\troot[\"RemoteStorage\"] = factory();\n})(this, function() {\nreturn ","var { Buffer } = require('buffer')\n// Named constants with unique integer values\nvar C = {};\n// Tokens\nvar LEFT_BRACE = C.LEFT_BRACE = 0x1;\nvar RIGHT_BRACE = C.RIGHT_BRACE = 0x2;\nvar LEFT_BRACKET = C.LEFT_BRACKET = 0x3;\nvar RIGHT_BRACKET = C.RIGHT_BRACKET = 0x4;\nvar COLON = C.COLON = 0x5;\nvar COMMA = C.COMMA = 0x6;\nvar TRUE = C.TRUE = 0x7;\nvar FALSE = C.FALSE = 0x8;\nvar NULL = C.NULL = 0x9;\nvar STRING = C.STRING = 0xa;\nvar NUMBER = C.NUMBER = 0xb;\n// Tokenizer States\nvar START = C.START = 0x11;\nvar STOP = C.STOP = 0x12;\nvar TRUE1 = C.TRUE1 = 0x21;\nvar TRUE2 = C.TRUE2 = 0x22;\nvar TRUE3 = C.TRUE3 = 0x23;\nvar FALSE1 = C.FALSE1 = 0x31;\nvar FALSE2 = C.FALSE2 = 0x32;\nvar FALSE3 = C.FALSE3 = 0x33;\nvar FALSE4 = C.FALSE4 = 0x34;\nvar NULL1 = C.NULL1 = 0x41;\nvar NULL2 = C.NULL2 = 0x42;\nvar NULL3 = C.NULL3 = 0x43;\nvar NUMBER1 = C.NUMBER1 = 0x51;\nvar NUMBER3 = C.NUMBER3 = 0x53;\nvar STRING1 = C.STRING1 = 0x61;\nvar STRING2 = C.STRING2 = 0x62;\nvar STRING3 = C.STRING3 = 0x63;\nvar STRING4 = C.STRING4 = 0x64;\nvar STRING5 = C.STRING5 = 0x65;\nvar STRING6 = C.STRING6 = 0x66;\n// Parser States\nvar VALUE = C.VALUE = 0x71;\nvar KEY = C.KEY = 0x72;\n// Parser Modes\nvar OBJECT = C.OBJECT = 0x81;\nvar ARRAY = C.ARRAY = 0x82;\n// Character constants\nvar BACK_SLASH = \"\\\\\".charCodeAt(0);\nvar FORWARD_SLASH = \"\\/\".charCodeAt(0);\nvar BACKSPACE = \"\\b\".charCodeAt(0);\nvar FORM_FEED = \"\\f\".charCodeAt(0);\nvar NEWLINE = \"\\n\".charCodeAt(0);\nvar CARRIAGE_RETURN = \"\\r\".charCodeAt(0);\nvar TAB = \"\\t\".charCodeAt(0);\n\nvar STRING_BUFFER_SIZE = 64 * 1024;\n\nfunction alloc(size) {\n return Buffer.alloc ? Buffer.alloc(size) : new Buffer(size);\n}\n\nfunction Parser() {\n this.tState = START;\n this.value = undefined;\n\n this.string = undefined; // string data\n this.stringBuffer = alloc(STRING_BUFFER_SIZE);\n this.stringBufferOffset = 0;\n this.unicode = undefined; // unicode escapes\n this.highSurrogate = undefined;\n\n this.key = undefined;\n this.mode = undefined;\n this.stack = [];\n this.state = VALUE;\n this.bytes_remaining = 0; // number of bytes remaining in multi byte utf8 char to read after split boundary\n this.bytes_in_sequence = 0; // bytes in multi byte utf8 char to read\n this.temp_buffs = { \"2\": alloc(2), \"3\": alloc(3), \"4\": alloc(4) }; // for rebuilding chars split before boundary is reached\n\n // Stream offset\n this.offset = -1;\n}\n\n// Slow code to string converter (only used when throwing syntax errors)\nParser.toknam = function (code) {\n var keys = Object.keys(C);\n for (var i = 0, l = keys.length; i < l; i++) {\n var key = keys[i];\n if (C[key] === code) { return key; }\n }\n return code && (\"0x\" + code.toString(16));\n};\n\nvar proto = Parser.prototype;\nproto.onError = function (err) { throw err; };\nproto.charError = function (buffer, i) {\n this.tState = STOP;\n this.onError(new Error(\"Unexpected \" + JSON.stringify(String.fromCharCode(buffer[i])) + \" at position \" + i + \" in state \" + Parser.toknam(this.tState)));\n};\nproto.appendStringChar = function (char) {\n if (this.stringBufferOffset >= STRING_BUFFER_SIZE) {\n this.string += this.stringBuffer.toString('utf8');\n this.stringBufferOffset = 0;\n }\n\n this.stringBuffer[this.stringBufferOffset++] = char;\n};\nproto.appendStringBuf = function (buf, start, end) {\n var size = buf.length;\n if (typeof start === 'number') {\n if (typeof end === 'number') {\n if (end < 0) {\n // adding a negative end decreeses the size\n size = buf.length - start + end;\n } else {\n size = end - start;\n }\n } else {\n size = buf.length - start;\n }\n }\n\n if (size < 0) {\n size = 0;\n }\n\n if (this.stringBufferOffset + size > STRING_BUFFER_SIZE) {\n this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset);\n this.stringBufferOffset = 0;\n }\n\n buf.copy(this.stringBuffer, this.stringBufferOffset, start, end);\n this.stringBufferOffset += size;\n};\nproto.write = function (buffer) {\n if (typeof buffer === \"string\") buffer = new Buffer(buffer);\n var n;\n for (var i = 0, l = buffer.length; i < l; i++) {\n if (this.tState === START){\n n = buffer[i];\n this.offset++;\n if(n === 0x7b){ this.onToken(LEFT_BRACE, \"{\"); // {\n }else if(n === 0x7d){ this.onToken(RIGHT_BRACE, \"}\"); // }\n }else if(n === 0x5b){ this.onToken(LEFT_BRACKET, \"[\"); // [\n }else if(n === 0x5d){ this.onToken(RIGHT_BRACKET, \"]\"); // ]\n }else if(n === 0x3a){ this.onToken(COLON, \":\"); // :\n }else if(n === 0x2c){ this.onToken(COMMA, \",\"); // ,\n }else if(n === 0x74){ this.tState = TRUE1; // t\n }else if(n === 0x66){ this.tState = FALSE1; // f\n }else if(n === 0x6e){ this.tState = NULL1; // n\n }else if(n === 0x22){ // \"\n this.string = \"\";\n this.stringBufferOffset = 0;\n this.tState = STRING1;\n }else if(n === 0x2d){ this.string = \"-\"; this.tState = NUMBER1; // -\n }else{\n if (n >= 0x30 && n < 0x40) { // 1-9\n this.string = String.fromCharCode(n); this.tState = NUMBER3;\n } else if (n === 0x20 || n === 0x09 || n === 0x0a || n === 0x0d) {\n // whitespace\n } else {\n return this.charError(buffer, i);\n }\n }\n }else if (this.tState === STRING1){ // After open quote\n n = buffer[i]; // get current byte from buffer\n // check for carry over of a multi byte char split between data chunks\n // & fill temp buffer it with start of this data chunk up to the boundary limit set in the last iteration\n if (this.bytes_remaining > 0) {\n for (var j = 0; j < this.bytes_remaining; j++) {\n this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence - this.bytes_remaining + j] = buffer[j];\n }\n\n this.appendStringBuf(this.temp_buffs[this.bytes_in_sequence]);\n this.bytes_in_sequence = this.bytes_remaining = 0;\n i = i + j - 1;\n } else if (this.bytes_remaining === 0 && n >= 128) { // else if no remainder bytes carried over, parse multi byte (>=128) chars one at a time\n if (n <= 193 || n > 244) {\n return this.onError(new Error(\"Invalid UTF-8 character at position \" + i + \" in state \" + Parser.toknam(this.tState)));\n }\n if ((n >= 194) && (n <= 223)) this.bytes_in_sequence = 2;\n if ((n >= 224) && (n <= 239)) this.bytes_in_sequence = 3;\n if ((n >= 240) && (n <= 244)) this.bytes_in_sequence = 4;\n if ((this.bytes_in_sequence + i) > buffer.length) { // if bytes needed to complete char fall outside buffer length, we have a boundary split\n for (var k = 0; k <= (buffer.length - 1 - i); k++) {\n this.temp_buffs[this.bytes_in_sequence][k] = buffer[i + k]; // fill temp buffer of correct size with bytes available in this chunk\n }\n this.bytes_remaining = (i + this.bytes_in_sequence) - buffer.length;\n i = buffer.length - 1;\n } else {\n this.appendStringBuf(buffer, i, i + this.bytes_in_sequence);\n i = i + this.bytes_in_sequence - 1;\n }\n } else if (n === 0x22) {\n this.tState = START;\n this.string += this.stringBuffer.toString('utf8', 0, this.stringBufferOffset);\n this.stringBufferOffset = 0;\n this.onToken(STRING, this.string);\n this.offset += Buffer.byteLength(this.string, 'utf8') + 1;\n this.string = undefined;\n }\n else if (n === 0x5c) {\n this.tState = STRING2;\n }\n else if (n >= 0x20) { this.appendStringChar(n); }\n else {\n return this.charError(buffer, i);\n }\n }else if (this.tState === STRING2){ // After backslash\n n = buffer[i];\n if(n === 0x22){ this.appendStringChar(n); this.tState = STRING1;\n }else if(n === 0x5c){ this.appendStringChar(BACK_SLASH); this.tState = STRING1;\n }else if(n === 0x2f){ this.appendStringChar(FORWARD_SLASH); this.tState = STRING1;\n }else if(n === 0x62){ this.appendStringChar(BACKSPACE); this.tState = STRING1;\n }else if(n === 0x66){ this.appendStringChar(FORM_FEED); this.tState = STRING1;\n }else if(n === 0x6e){ this.appendStringChar(NEWLINE); this.tState = STRING1;\n }else if(n === 0x72){ this.appendStringChar(CARRIAGE_RETURN); this.tState = STRING1;\n }else if(n === 0x74){ this.appendStringChar(TAB); this.tState = STRING1;\n }else if(n === 0x75){ this.unicode = \"\"; this.tState = STRING3;\n }else{\n return this.charError(buffer, i);\n }\n }else if (this.tState === STRING3 || this.tState === STRING4 || this.tState === STRING5 || this.tState === STRING6){ // unicode hex codes\n n = buffer[i];\n // 0-9 A-F a-f\n if ((n >= 0x30 && n < 0x40) || (n > 0x40 && n <= 0x46) || (n > 0x60 && n <= 0x66)) {\n this.unicode += String.fromCharCode(n);\n if (this.tState++ === STRING6) {\n var intVal = parseInt(this.unicode, 16);\n this.unicode = undefined;\n if (this.highSurrogate !== undefined && intVal >= 0xDC00 && intVal < (0xDFFF + 1)) { //<56320,57343> - lowSurrogate\n this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate, intVal)));\n this.highSurrogate = undefined;\n } else if (this.highSurrogate === undefined && intVal >= 0xD800 && intVal < (0xDBFF + 1)) { //<55296,56319> - highSurrogate\n this.highSurrogate = intVal;\n } else {\n if (this.highSurrogate !== undefined) {\n this.appendStringBuf(new Buffer(String.fromCharCode(this.highSurrogate)));\n this.highSurrogate = undefined;\n }\n this.appendStringBuf(new Buffer(String.fromCharCode(intVal)));\n }\n this.tState = STRING1;\n }\n } else {\n return this.charError(buffer, i);\n }\n } else if (this.tState === NUMBER1 || this.tState === NUMBER3) {\n n = buffer[i];\n\n switch (n) {\n case 0x30: // 0\n case 0x31: // 1\n case 0x32: // 2\n case 0x33: // 3\n case 0x34: // 4\n case 0x35: // 5\n case 0x36: // 6\n case 0x37: // 7\n case 0x38: // 8\n case 0x39: // 9\n case 0x2e: // .\n case 0x65: // e\n case 0x45: // E\n case 0x2b: // +\n case 0x2d: // -\n this.string += String.fromCharCode(n);\n this.tState = NUMBER3;\n break;\n default:\n this.tState = START;\n var error = this.numberReviver(this.string);\n if (error){\n return error;\n }\n\n this.offset += this.string.length - 1;\n this.string = undefined;\n i--;\n break;\n }\n }else if (this.tState === TRUE1){ // r\n if (buffer[i] === 0x72) { this.tState = TRUE2; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === TRUE2){ // u\n if (buffer[i] === 0x75) { this.tState = TRUE3; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === TRUE3){ // e\n if (buffer[i] === 0x65) { this.tState = START; this.onToken(TRUE, true); this.offset+= 3; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === FALSE1){ // a\n if (buffer[i] === 0x61) { this.tState = FALSE2; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === FALSE2){ // l\n if (buffer[i] === 0x6c) { this.tState = FALSE3; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === FALSE3){ // s\n if (buffer[i] === 0x73) { this.tState = FALSE4; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === FALSE4){ // e\n if (buffer[i] === 0x65) { this.tState = START; this.onToken(FALSE, false); this.offset+= 4; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === NULL1){ // u\n if (buffer[i] === 0x75) { this.tState = NULL2; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === NULL2){ // l\n if (buffer[i] === 0x6c) { this.tState = NULL3; }\n else { return this.charError(buffer, i); }\n }else if (this.tState === NULL3){ // l\n if (buffer[i] === 0x6c) { this.tState = START; this.onToken(NULL, null); this.offset += 3; }\n else { return this.charError(buffer, i); }\n }\n }\n};\nproto.onToken = function (token, value) {\n // Override this to get events\n};\n\nproto.parseError = function (token, value) {\n this.tState = STOP;\n this.onError(new Error(\"Unexpected \" + Parser.toknam(token) + (value ? (\"(\" + JSON.stringify(value) + \")\") : \"\") + \" in state \" + Parser.toknam(this.state)));\n};\nproto.push = function () {\n this.stack.push({value: this.value, key: this.key, mode: this.mode});\n};\nproto.pop = function () {\n var value = this.value;\n var parent = this.stack.pop();\n this.value = parent.value;\n this.key = parent.key;\n this.mode = parent.mode;\n this.emit(value);\n if (!this.mode) { this.state = VALUE; }\n};\nproto.emit = function (value) {\n if (this.mode) { this.state = COMMA; }\n this.onValue(value);\n};\nproto.onValue = function (value) {\n // Override me\n};\nproto.onToken = function (token, value) {\n if(this.state === VALUE){\n if(token === STRING || token === NUMBER || token === TRUE || token === FALSE || token === NULL){\n if (this.value) {\n this.value[this.key] = value;\n }\n this.emit(value);\n }else if(token === LEFT_BRACE){\n this.push();\n if (this.value) {\n this.value = this.value[this.key] = {};\n } else {\n this.value = {};\n }\n this.key = undefined;\n this.state = KEY;\n this.mode = OBJECT;\n }else if(token === LEFT_BRACKET){\n this.push();\n if (this.value) {\n this.value = this.value[this.key] = [];\n } else {\n this.value = [];\n }\n this.key = 0;\n this.mode = ARRAY;\n this.state = VALUE;\n }else if(token === RIGHT_BRACE){\n if (this.mode === OBJECT) {\n this.pop();\n } else {\n return this.parseError(token, value);\n }\n }else if(token === RIGHT_BRACKET){\n if (this.mode === ARRAY) {\n this.pop();\n } else {\n return this.parseError(token, value);\n }\n }else{\n return this.parseError(token, value);\n }\n }else if(this.state === KEY){\n if (token === STRING) {\n this.key = value;\n this.state = COLON;\n } else if (token === RIGHT_BRACE) {\n this.pop();\n } else {\n return this.parseError(token, value);\n }\n }else if(this.state === COLON){\n if (token === COLON) { this.state = VALUE; }\n else { return this.parseError(token, value); }\n }else if(this.state === COMMA){\n if (token === COMMA) {\n if (this.mode === ARRAY) { this.key++; this.state = VALUE; }\n else if (this.mode === OBJECT) { this.state = KEY; }\n\n } else if (token === RIGHT_BRACKET && this.mode === ARRAY || token === RIGHT_BRACE && this.mode === OBJECT) {\n this.pop();\n } else {\n return this.parseError(token, value);\n }\n }else{\n return this.parseError(token, value);\n }\n};\n\n// Override to implement your own number reviver.\n// Any value returned is treated as error and will interrupt parsing.\nproto.numberReviver = function (text) {\n var result = Number(text);\n\n if (isNaN(result)) {\n return this.charError(buffer, i);\n }\n\n if ((text.match(/[0-9]+/) == text) && (result.toString() != text)) {\n // Long string of digits which is an ID string and not valid and/or safe JavaScript integer Number\n this.onToken(STRING, text);\n } else {\n this.onToken(NUMBER, result);\n }\n}\n\nParser.C = C;\n\nmodule.exports = Parser;\n","import { OidcClient, WebStorageStateStore } from '@inrupt/oidc-client';\nexport { CordovaIFrameNavigator, CordovaPopupNavigator, InMemoryWebStorage, Log, OidcClient, SessionMonitor, User, UserManager, Version, WebStorageStateStore } from '@inrupt/oidc-client';\nimport { determineSigningAlg, PREFERRED_SIGNING_ALG, getWebidFromTokenPayload, OidcProviderError, InvalidResponseError, generateDpopKeyPair, createDpopHeader, DEFAULT_SCOPES, removeOpenIdParams } from '@inrupt/solid-client-authn-core';\nimport { fetch as fetch$1 } from '@inrupt/universal-fetch';\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction processErrorResponse(\n// The type is any here because the object is parsed from a JSON response\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nresponseBody, options) {\n var _a, _b, _c, _d;\n // The following errors are defined by the spec, and allow providing some context.\n // See https://tools.ietf.org/html/rfc7591#section-3.2.2 for more information\n if (responseBody.error === \"invalid_redirect_uri\") {\n throw new Error(`Dynamic client registration failed: the provided redirect uri [${(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()}] is invalid - ${(_b = responseBody.error_description) !== null && _b !== void 0 ? _b : \"\"}`);\n }\n if (responseBody.error === \"invalid_client_metadata\") {\n throw new Error(`Dynamic client registration failed: the provided client metadata ${JSON.stringify(options)} is invalid - ${(_c = responseBody.error_description) !== null && _c !== void 0 ? _c : \"\"}`);\n }\n // We currently don't support software statements, so no related error should happen.\n // If an error outside of the spec happens, no additional context can be provided\n throw new Error(`Dynamic client registration failed: ${responseBody.error} - ${(_d = responseBody.error_description) !== null && _d !== void 0 ? _d : \"\"}`);\n}\nfunction validateRegistrationResponse(\n// The type is any here because the object is parsed from a JSON response\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nresponseBody, options) {\n if (responseBody.client_id === undefined) {\n throw new Error(`Dynamic client registration failed: no client_id has been found on ${JSON.stringify(responseBody)}`);\n }\n if (options.redirectUrl &&\n (responseBody.redirect_uris === undefined ||\n responseBody.redirect_uris[0] !== options.redirectUrl.toString())) {\n throw new Error(`Dynamic client registration failed: the returned redirect URIs ${JSON.stringify(responseBody.redirect_uris)} don't match the provided ${JSON.stringify([\n options.redirectUrl.toString(),\n ])}`);\n }\n}\nasync function registerClient(options, issuerConfig) {\n var _a;\n if (!issuerConfig.registrationEndpoint) {\n throw new Error(\"Dynamic Registration could not be completed because the issuer has no registration endpoint.\");\n }\n if (!Array.isArray(issuerConfig.idTokenSigningAlgValuesSupported)) {\n throw new Error(\"The OIDC issuer discovery profile is missing the 'id_token_signing_alg_values_supported' value, which is mandatory.\");\n }\n const signingAlg = determineSigningAlg(issuerConfig.idTokenSigningAlgValuesSupported, PREFERRED_SIGNING_ALG);\n const config = {\n /* eslint-disable camelcase */\n client_name: options.clientName,\n application_type: \"web\",\n redirect_uris: [(_a = options.redirectUrl) === null || _a === void 0 ? void 0 : _a.toString()],\n subject_type: \"public\",\n token_endpoint_auth_method: \"client_secret_basic\",\n id_token_signed_response_alg: signingAlg,\n grant_types: [\"authorization_code\", \"refresh_token\"],\n /* eslint-enable camelcase */\n };\n const headers = {\n \"Content-Type\": \"application/json\",\n };\n const registerResponse = await fetch(issuerConfig.registrationEndpoint.toString(), {\n method: \"POST\",\n headers,\n body: JSON.stringify(config),\n });\n if (registerResponse.ok) {\n const responseBody = await registerResponse.json();\n validateRegistrationResponse(responseBody, options);\n return {\n clientId: responseBody.client_id,\n clientSecret: responseBody.client_secret,\n idTokenSignedResponseAlg: responseBody.id_token_signed_response_alg,\n clientType: \"dynamic\",\n };\n }\n if (registerResponse.status === 400) {\n processErrorResponse(await registerResponse.json(), options);\n }\n throw new Error(`Dynamic client registration failed: the server returned ${registerResponse.status} ${registerResponse.statusText} - ${await registerResponse.text()}`);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// Identifiers in camelcase are mandated by the OAuth spec.\n/* eslint-disable camelcase */\nfunction hasError(value) {\n return value.error !== undefined && typeof value.error === \"string\";\n}\nfunction hasErrorDescription(value) {\n return (value.error_description !== undefined &&\n typeof value.error_description === \"string\");\n}\nfunction hasErrorUri(value) {\n return value.error_uri !== undefined && typeof value.error_uri === \"string\";\n}\nfunction hasAccessToken(value) {\n return (value.access_token !== undefined && typeof value.access_token === \"string\");\n}\nfunction hasIdToken(value) {\n return value.id_token !== undefined && typeof value.id_token === \"string\";\n}\nfunction hasRefreshToken(value) {\n return (value.refresh_token !== undefined && typeof value.refresh_token === \"string\");\n}\nfunction hasTokenType(value) {\n return value.token_type !== undefined && typeof value.token_type === \"string\";\n}\nfunction hasExpiresIn(value) {\n return value.expires_in === undefined || typeof value.expires_in === \"number\";\n}\nfunction validatePreconditions(issuer, data) {\n if (data.grantType &&\n (!issuer.grantTypesSupported ||\n !issuer.grantTypesSupported.includes(data.grantType))) {\n throw new Error(`The issuer [${issuer.issuer}] does not support the [${data.grantType}] grant`);\n }\n if (!issuer.tokenEndpoint) {\n throw new Error(`This issuer [${issuer.issuer}] does not have a token endpoint`);\n }\n}\nfunction validateTokenEndpointResponse(tokenResponse, dpop) {\n if (hasError(tokenResponse)) {\n throw new OidcProviderError(`Token endpoint returned error [${tokenResponse.error}]${hasErrorDescription(tokenResponse)\n ? `: ${tokenResponse.error_description}`\n : \"\"}${hasErrorUri(tokenResponse) ? ` (see ${tokenResponse.error_uri})` : \"\"}`, tokenResponse.error, hasErrorDescription(tokenResponse)\n ? tokenResponse.error_description\n : undefined);\n }\n if (!hasAccessToken(tokenResponse)) {\n throw new InvalidResponseError([\"access_token\"]);\n }\n if (!hasIdToken(tokenResponse)) {\n throw new InvalidResponseError([\"id_token\"]);\n }\n if (!hasTokenType(tokenResponse)) {\n throw new InvalidResponseError([\"token_type\"]);\n }\n if (!hasExpiresIn(tokenResponse)) {\n throw new InvalidResponseError([\"expires_in\"]);\n }\n // TODO: Due to a bug in both the ESS ID broker AND NSS (what were the odds), a DPoP token is returned\n // with a token_type 'Bearer'. To work around this, this test is currently disabled.\n // https://github.com/solid/oidc-op/issues/26\n // Fixed, but unreleased for the ESS (current version: inrupt-oidc-server-0.5.2)\n // if (dpop && tokenResponse.token_type.toLowerCase() !== \"dpop\") {\n // throw new Error(\n // `Invalid token endpoint response: requested a [DPoP] token, but got a 'token_type' value of [${tokenResponse.token_type}].`\n // );\n // }\n if (!dpop && tokenResponse.token_type.toLowerCase() !== \"bearer\") {\n throw new Error(`Invalid token endpoint response: requested a [Bearer] token, but got a 'token_type' value of [${tokenResponse.token_type}].`);\n }\n return tokenResponse;\n}\nasync function getTokens(issuer, client, data, dpop) {\n validatePreconditions(issuer, data);\n const headers = {\n \"content-type\": \"application/x-www-form-urlencoded\",\n };\n let dpopKey;\n if (dpop) {\n dpopKey = await generateDpopKeyPair();\n headers.DPoP = await createDpopHeader(issuer.tokenEndpoint, \"POST\", dpopKey);\n }\n // TODO: Find out where this is specified.\n if (client.clientSecret) {\n headers.Authorization = `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`;\n }\n const requestBody = {\n /* eslint-disable camelcase */\n grant_type: data.grantType,\n redirect_uri: data.redirectUrl,\n code: data.code,\n code_verifier: data.codeVerifier,\n client_id: client.clientId,\n /* eslint-enable camelcase */\n };\n const tokenRequestInit = {\n method: \"POST\",\n headers,\n body: new URLSearchParams(requestBody).toString(),\n };\n const rawTokenResponse = await fetch$1(issuer.tokenEndpoint, tokenRequestInit);\n const jsonTokenResponse = (await rawTokenResponse.json());\n const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);\n const webId = await getWebidFromTokenPayload(tokenResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId);\n return {\n accessToken: tokenResponse.access_token,\n idToken: tokenResponse.id_token,\n refreshToken: hasRefreshToken(tokenResponse)\n ? tokenResponse.refresh_token\n : undefined,\n webId,\n dpopKey,\n expiresIn: tokenResponse.expires_in,\n };\n}\n/**\n * This function exchanges an authorization code for a bearer token.\n * Note that it is based on oidc-client-js, and assumes that the same client has\n * been used to issue the initial redirect.\n * @param redirectUrl The URL to which the user has been redirected\n */\nasync function getBearerToken(redirectUrl) {\n let signinResponse;\n try {\n const client = new OidcClient({\n // TODO: We should look at the various interfaces being used for storage,\n // i.e. between oidc-client-js (WebStorageStoreState), localStorage\n // (which has an interface Storage), and our own proprietary interface\n // IStorage - i.e. we should really just be using the browser Web Storage\n // API, e.g. \"stateStore: window.localStorage,\".\n // We are instantiating a new instance here, so the only value we need to\n // explicitly provide is the response mode (default otherwise will look\n // for a hash '#' fragment!).\n // eslint-disable-next-line camelcase\n response_mode: \"query\",\n // The userinfo endpoint on NSS fails, so disable this for now\n // Note that in Solid, information should be retrieved from the\n // profile referenced by the WebId.\n // TODO: Note that this is heavy-handed, and that this userinfo check\n // verifies that the `sub` claim in the id token you get along with the\n // access token matches the sub claim associated with the access token at\n // the userinfo endpoint.\n // That is a useful check, and in the future it should be only disabled\n // against NSS, and not in general.\n // Issue tracker: https://github.com/solid/node-solid-server/issues/1490\n loadUserInfo: false,\n });\n signinResponse = await client.processSigninResponse(redirectUrl);\n if (client.settings.metadata === undefined) {\n throw new Error(\"Cannot retrieve issuer metadata from client information in storage.\");\n }\n if (client.settings.metadata.jwks_uri === undefined) {\n throw new Error(\"Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined\");\n }\n if (client.settings.metadata.issuer === undefined) {\n throw new Error(\"Missing some issuer metadata from client information in storage: 'issuer' is undefined\");\n }\n if (client.settings.client_id === undefined) {\n throw new Error(\"Missing some client information in storage: 'client_id' is undefined\");\n }\n const webId = await getWebidFromTokenPayload(signinResponse.id_token, client.settings.metadata.jwks_uri, client.settings.metadata.issuer, client.settings.client_id);\n return {\n accessToken: signinResponse.access_token,\n idToken: signinResponse.id_token,\n webId,\n // Although not a field in the TypeScript response interface, the refresh\n // token (which can optionally come back with the access token (if, as per\n // the OAuth2 spec, we requested one using the scope of 'offline_access')\n // will be included in the signin response object.\n // eslint-disable-next-line camelcase\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n refreshToken: signinResponse.refresh_token,\n };\n }\n catch (err) {\n throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${redirectUrl}]: ${err}`);\n }\n}\nasync function getDpopToken(issuer, client, data) {\n return getTokens(issuer, client, data, true);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst isValidUrl = (url) => {\n try {\n // Here, the URL constructor is just called to parse the given string and\n // verify if it is a well-formed IRI.\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n }\n catch (_a) {\n return false;\n }\n};\n// Identifiers in snake_case are mandated by the OAuth spec.\n/* eslint-disable camelcase */\nasync function refresh(refreshToken, issuer, client, dpopKey) {\n if (client.clientId === undefined) {\n throw new Error(\"No client ID available when trying to refresh the access token.\");\n }\n const requestBody = {\n grant_type: \"refresh_token\",\n refresh_token: refreshToken,\n scope: DEFAULT_SCOPES,\n };\n let dpopHeader = {};\n if (dpopKey !== undefined) {\n dpopHeader = {\n DPoP: await createDpopHeader(issuer.tokenEndpoint, \"POST\", dpopKey),\n };\n }\n let authHeader = {};\n if (client.clientSecret !== undefined) {\n authHeader = {\n // We assume that client_secret_basic is the client authentication method.\n // TODO: Get the authentication method from the IClient configuration object.\n Authorization: `Basic ${btoa(`${client.clientId}:${client.clientSecret}`)}`,\n };\n }\n else if (isValidUrl(client.clientId)) {\n // If the client ID is an URL, and there is no client secret, the client\n // has a Solid-OIDC Client Identifier, and it should be present in the\n // request body.\n requestBody.client_id = client.clientId;\n }\n const rawResponse = await fetch$1(issuer.tokenEndpoint, {\n method: \"POST\",\n body: new URLSearchParams(requestBody).toString(),\n headers: {\n ...dpopHeader,\n ...authHeader,\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n });\n let response;\n try {\n response = await rawResponse.json();\n }\n catch (e) {\n // The response is left out of the error on purpose not to leak any sensitive information.\n throw new Error(`The token endpoint of issuer ${issuer.issuer} returned a malformed response.`);\n }\n const validatedResponse = validateTokenEndpointResponse(response, dpopKey !== undefined);\n const webId = await getWebidFromTokenPayload(validatedResponse.id_token, issuer.jwksUri, issuer.issuer, client.clientId);\n return {\n accessToken: validatedResponse.access_token,\n idToken: validatedResponse.id_token,\n refreshToken: typeof validatedResponse.refresh_token === \"string\"\n ? validatedResponse.refresh_token\n : undefined,\n webId,\n dpopKey,\n expiresIn: validatedResponse.expires_in,\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Removes OIDC-specific query parameters from a given URL (state, code...), and\n * sanitizes the URL (e.g. removes the hash fragment).\n * @param redirectUrl The URL to clean up.\n * @returns A copy of the URL, without OIDC-specific query params.\n */\nfunction normalizeCallbackUrl(redirectUrl) {\n const cleanedUrl = removeOpenIdParams(redirectUrl);\n // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL\n // must not include a hash fragment.\n cleanedUrl.hash = \"\";\n // Do not normalize the trailing slash, and respect the original redirect URL.\n if (\n // The trailing slash is present in the original redirect URL\n redirectUrl.includes(`${cleanedUrl.origin}/`)) {\n return cleanedUrl.href;\n }\n // Calling cleanedUrl.href appends a trailing slash to the origin, which may\n // create a redirect URL mismatch if it wasn't originally present.\n return `${cleanedUrl.origin}${cleanedUrl.href.substring(\n // Adds 1 to the origin length to remove the trailing slash\n cleanedUrl.origin.length + 1)}`;\n}\n/**\n * Clears any OIDC-related data lingering in the local storage.\n */\nasync function clearOidcPersistentStorage() {\n const client = new OidcClient({\n // TODO: We should look at the various interfaces being used for storage,\n // i.e. between oidc-client-js (WebStorageStoreState), localStorage\n // (which has an interface Storage), and our own proprietary interface\n // IStorage - i.e. we should really just be using the browser Web Storage\n // API, e.g. \"stateStore: window.localStorage,\".\n // We are instantiating a new instance here, so the only value we need to\n // explicitly provide is the response mode (default otherwise will look\n // for a hash '#' fragment!).\n // eslint-disable-next-line camelcase\n response_mode: \"query\",\n });\n await client.clearStaleState(new WebStorageStateStore({}));\n const myStorage = window.localStorage;\n const itemsToRemove = [];\n for (let i = 0; i <= myStorage.length; i += 1) {\n const key = myStorage.key(i);\n if (key &&\n (key.match(/^oidc\\..+$/) ||\n key.match(/^solidClientAuthenticationUser:.+$/))) {\n itemsToRemove.push(key);\n }\n }\n itemsToRemove.forEach((key) => myStorage.removeItem(key));\n}\n\nexport { clearOidcPersistentStorage, getBearerToken, getDpopToken, normalizeCallbackUrl, refresh, registerClient };\n","!function t(e,r){if(\"object\"==typeof exports&&\"object\"==typeof module)module.exports=r();else if(\"function\"==typeof define&&define.amd)define([],r);else{var n=r();for(var i in n)(\"object\"==typeof exports?exports:e)[i]=n[i]}}(this,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return r.d(e,\"a\",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p=\"\",r(r.s=22)}([function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var n=function(){function t(t,e){for(var r=0;r=4){for(var e=arguments.length,r=Array(e),n=0;n=3){for(var e=arguments.length,r=Array(e),n=0;n=2){for(var e=arguments.length,r=Array(e),n=0;n=1){for(var e=arguments.length,r=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(s(this,t),!e)throw i.Log.error(\"MetadataService: No settings passed to MetadataService\"),new Error(\"settings\");this._settings=e,this._jsonService=new r([\"application/jwk-set+json\"])}return t.prototype.resetSigningKeys=function t(){this._settings=this._settings||{},this._settings.signingKeys=void 0},t.prototype.getMetadata=function t(){var e=this;return this._settings.metadata?(i.Log.debug(\"MetadataService.getMetadata: Returning metadata from settings\"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(i.Log.debug(\"MetadataService.getMetadata: getting metadata from\",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(t){i.Log.debug(\"MetadataService.getMetadata: json received\");var r=e._settings.metadataSeed||{};return e._settings.metadata=Object.assign({},r,t),e._settings.metadata}))):(i.Log.error(\"MetadataService.getMetadata: No authority or metadataUrl configured on settings\"),Promise.reject(new Error(\"No authority or metadataUrl configured on settings\")))},t.prototype.getIssuer=function t(){return this._getMetadataProperty(\"issuer\")},t.prototype.getAuthorizationEndpoint=function t(){return this._getMetadataProperty(\"authorization_endpoint\")},t.prototype.getUserInfoEndpoint=function t(){return this._getMetadataProperty(\"userinfo_endpoint\")},t.prototype.getTokenEndpoint=function t(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty(\"token_endpoint\",e)},t.prototype.getCheckSessionIframe=function t(){return this._getMetadataProperty(\"check_session_iframe\",!0)},t.prototype.getEndSessionEndpoint=function t(){return this._getMetadataProperty(\"end_session_endpoint\",!0)},t.prototype.getRevocationEndpoint=function t(){return this._getMetadataProperty(\"revocation_endpoint\",!0)},t.prototype.getKeysEndpoint=function t(){return this._getMetadataProperty(\"jwks_uri\",!0)},t.prototype._getMetadataProperty=function t(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return i.Log.debug(\"MetadataService.getMetadataProperty for: \"+e),this.getMetadata().then((function(t){if(i.Log.debug(\"MetadataService.getMetadataProperty: metadata recieved\"),void 0===t[e]){if(!0===r)return void i.Log.warn(\"MetadataService.getMetadataProperty: Metadata does not contain optional property \"+e);throw i.Log.error(\"MetadataService.getMetadataProperty: Metadata does not contain property \"+e),new Error(\"Metadata does not contain property \"+e)}return t[e]}))},t.prototype.getSigningKeys=function t(){var e=this;return this._settings.signingKeys?(i.Log.debug(\"MetadataService.getSigningKeys: Returning signingKeys from settings\"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty(\"jwks_uri\").then((function(t){return i.Log.debug(\"MetadataService.getSigningKeys: jwks_uri received\",t),e._jsonService.getJson(t).then((function(t){if(i.Log.debug(\"MetadataService.getSigningKeys: key set received\",t),!t.keys)throw i.Log.error(\"MetadataService.getSigningKeys: Missing keys on keyset\"),new Error(\"Missing keys on keyset\");return e._settings.signingKeys=t.keys,e._settings.signingKeys}))}))},n(t,[{key:\"metadataUrl\",get:function t(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(a)<0&&(\"/\"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+=\"/\"),this._metadataUrl+=a))),this._metadataUrl}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UrlUtility=void 0;var n=r(0),i=r(1);e.UrlUtility=function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.addQueryParam=function t(e,r,n){return e.indexOf(\"?\")<0&&(e+=\"?\"),\"?\"!==e[e.length-1]&&(e+=\"&\"),e+=encodeURIComponent(r),e+=\"=\",e+=encodeURIComponent(n)},t.parseUrlFragment=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"#\",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.Global;\"string\"!=typeof e&&(e=o.location.href);var s=e.lastIndexOf(r);s>=0&&(e=e.substr(s+1)),\"?\"===r&&(s=e.indexOf(\"#\"))>=0&&(e=e.substr(0,s));for(var a,u={},c=/([^&=]+)=([^&]*)/g,h=0;a=c.exec(e);)if(u[decodeURIComponent(a[1])]=decodeURIComponent(a[2].replace(/\\+/g,\" \")),h++>50)return n.Log.error(\"UrlUtility.parseUrlFragment: response exceeded expected number of parameters\",e),{error:\"Response exceeded expected number of parameters\"};for(var l in u)return u;return{}},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.JoseUtil=void 0;var n=r(26),i=function o(t){return t&&t.__esModule?t:{default:t}}(r(33));e.JoseUtil=(0,i.default)({jws:n.jws,KeyUtil:n.KeyUtil,X509:n.X509,crypto:n.crypto,hextob64u:n.hextob64u,b64tohex:n.b64tohex,AllowedSigningAlgs:n.AllowedSigningAlgs})},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.OidcClientSettings=void 0;var n=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},i=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=e.authority,i=e.metadataUrl,o=e.metadata,l=e.signingKeys,p=e.metadataSeed,v=e.client_id,y=e.client_secret,m=e.response_type,_=void 0===m?f:m,S=e.scope,b=void 0===S?g:S,w=e.redirect_uri,F=e.post_logout_redirect_uri,E=e.client_authentication,x=void 0===E?d:E,A=e.prompt,k=e.display,P=e.max_age,C=e.ui_locales,T=e.acr_values,R=e.resource,I=e.response_mode,D=e.filterProtocolClaims,L=void 0===D||D,N=e.loadUserInfo,U=void 0===N||N,B=e.staleStateAge,O=void 0===B?900:B,j=e.clockSkew,M=void 0===j?300:j,H=e.clockService,V=void 0===H?new s.ClockService:H,K=e.userInfoJwtIssuer,q=void 0===K?\"OP\":K,J=e.mergeClaims,W=void 0!==J&&J,z=e.stateStore,Y=void 0===z?new a.WebStorageStateStore:z,G=e.ResponseValidatorCtor,X=void 0===G?u.ResponseValidator:G,$=e.MetadataServiceCtor,Q=void 0===$?c.MetadataService:$,Z=e.extraQueryParams,tt=void 0===Z?{}:Z,et=e.extraTokenParams,rt=void 0===et?{}:et;h(this,t),this._authority=r,this._metadataUrl=i,this._metadata=o,this._metadataSeed=p,this._signingKeys=l,this._client_id=v,this._client_secret=y,this._response_type=_,this._scope=b,this._redirect_uri=w,this._post_logout_redirect_uri=F,this._client_authentication=x,this._prompt=A,this._display=k,this._max_age=P,this._ui_locales=C,this._acr_values=T,this._resource=R,this._response_mode=I,this._filterProtocolClaims=!!L,this._loadUserInfo=!!U,this._staleStateAge=O,this._clockSkew=M,this._clockService=V,this._userInfoJwtIssuer=q,this._mergeClaims=!!W,this._stateStore=Y,this._validator=new X(this),this._metadataService=new Q(this),this._extraQueryParams=\"object\"===(void 0===tt?\"undefined\":n(tt))?tt:{},this._extraTokenParams=\"object\"===(void 0===rt?\"undefined\":n(rt))?rt:{}}return t.prototype.getEpochTime=function t(){return this._clockService.getEpochTime()},i(t,[{key:\"client_id\",get:function t(){return this._client_id},set:function t(e){if(this._client_id)throw o.Log.error(\"OidcClientSettings.set_client_id: client_id has already been assigned.\"),new Error(\"client_id has already been assigned.\");this._client_id=e}},{key:\"client_secret\",get:function t(){return this._client_secret}},{key:\"response_type\",get:function t(){return this._response_type}},{key:\"scope\",get:function t(){return this._scope}},{key:\"redirect_uri\",get:function t(){return this._redirect_uri}},{key:\"post_logout_redirect_uri\",get:function t(){return this._post_logout_redirect_uri}},{key:\"client_authentication\",get:function t(){return this._client_authentication}},{key:\"prompt\",get:function t(){return this._prompt}},{key:\"display\",get:function t(){return this._display}},{key:\"max_age\",get:function t(){return this._max_age}},{key:\"ui_locales\",get:function t(){return this._ui_locales}},{key:\"acr_values\",get:function t(){return this._acr_values}},{key:\"resource\",get:function t(){return this._resource}},{key:\"response_mode\",get:function t(){return this._response_mode}},{key:\"authority\",get:function t(){return this._authority},set:function t(e){if(this._authority)throw o.Log.error(\"OidcClientSettings.set_authority: authority has already been assigned.\"),new Error(\"authority has already been assigned.\");this._authority=e}},{key:\"metadataUrl\",get:function t(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(l)<0&&(\"/\"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+=\"/\"),this._metadataUrl+=l)),this._metadataUrl}},{key:\"metadata\",get:function t(){return this._metadata},set:function t(e){this._metadata=e}},{key:\"metadataSeed\",get:function t(){return this._metadataSeed},set:function t(e){this._metadataSeed=e}},{key:\"signingKeys\",get:function t(){return this._signingKeys},set:function t(e){this._signingKeys=e}},{key:\"filterProtocolClaims\",get:function t(){return this._filterProtocolClaims}},{key:\"loadUserInfo\",get:function t(){return this._loadUserInfo}},{key:\"staleStateAge\",get:function t(){return this._staleStateAge}},{key:\"clockSkew\",get:function t(){return this._clockSkew}},{key:\"userInfoJwtIssuer\",get:function t(){return this._userInfoJwtIssuer}},{key:\"mergeClaims\",get:function t(){return this._mergeClaims}},{key:\"stateStore\",get:function t(){return this._stateStore}},{key:\"validator\",get:function t(){return this._validator}},{key:\"metadataService\",get:function t(){return this._metadataService}},{key:\"extraQueryParams\",get:function t(){return this._extraQueryParams},set:function t(e){\"object\"===(void 0===e?\"undefined\":n(e))?this._extraQueryParams=e:this._extraQueryParams={}}},{key:\"extraTokenParams\",get:function t(){return this._extraTokenParams},set:function t(e){\"object\"===(void 0===e?\"undefined\":n(e))?this._extraTokenParams=e:this._extraTokenParams={}}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.WebStorageStateStore=void 0;var n=r(0),i=r(1);function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.WebStorageStateStore=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.prefix,n=void 0===r?\"oidc.\":r,s=e.store,a=void 0===s?i.Global.localStorage:s;o(this,t),this._store=a,this._prefix=n}return t.prototype.set=function t(e,r){return n.Log.debug(\"WebStorageStateStore.set\",e),e=this._prefix+e,this._store.setItem(e,r),Promise.resolve()},t.prototype.get=function t(e){n.Log.debug(\"WebStorageStateStore.get\",e),e=this._prefix+e;var r=this._store.getItem(e);return Promise.resolve(r)},t.prototype.remove=function t(e){n.Log.debug(\"WebStorageStateStore.remove\",e),e=this._prefix+e;var r=this._store.getItem(e);return this._store.removeItem(e),Promise.resolve(r)},t.prototype.getAllKeys=function t(){n.Log.debug(\"WebStorageStateStore.getAllKeys\");for(var e=[],r=0;r0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.Global.XMLHttpRequest,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t),e&&Array.isArray(e)?this._contentTypes=e.slice():this._contentTypes=[],this._contentTypes.push(\"application/json\"),n&&this._contentTypes.push(\"application/jwt\"),this._XMLHttpRequest=r,this._jwtHandler=n}return t.prototype.getJson=function t(e,r){var i=this;if(!e)throw n.Log.error(\"JsonService.getJson: No url passed\"),new Error(\"url\");return n.Log.debug(\"JsonService.getJson, url: \",e),new Promise((function(t,o){var s=new i._XMLHttpRequest;s.open(\"GET\",e);var a=i._contentTypes,u=i._jwtHandler;s.onload=function(){if(n.Log.debug(\"JsonService.getJson: HTTP response received, status\",s.status),200===s.status){var r=s.getResponseHeader(\"Content-Type\");if(r){var i=a.find((function(t){if(r.startsWith(t))return!0}));if(\"application/jwt\"==i)return void u(s).then(t,o);if(i)try{return void t(JSON.parse(s.responseText))}catch(t){return n.Log.error(\"JsonService.getJson: Error parsing JSON response\",t.message),void o(t)}}o(Error(\"Invalid response Content-Type: \"+r+\", from URL: \"+e))}else o(Error(s.statusText+\" (\"+s.status+\")\"))},s.onerror=function(){n.Log.error(\"JsonService.getJson: network error\"),o(Error(\"Network Error\"))},r&&(n.Log.debug(\"JsonService.getJson: token passed, setting Authorization header\"),s.setRequestHeader(\"Authorization\",\"Bearer \"+r)),s.send()}))},t.prototype.postForm=function t(e,r,i){var o=this;if(!e)throw n.Log.error(\"JsonService.postForm: No url passed\"),new Error(\"url\");return n.Log.debug(\"JsonService.postForm, url: \",e),new Promise((function(t,s){var a=new o._XMLHttpRequest;a.open(\"POST\",e);var u=o._contentTypes;a.onload=function(){if(n.Log.debug(\"JsonService.postForm: HTTP response received, status\",a.status),200!==a.status){if(400===a.status)if(i=a.getResponseHeader(\"Content-Type\"))if(u.find((function(t){if(i.startsWith(t))return!0})))try{var r=JSON.parse(a.responseText);if(r&&r.error)return n.Log.error(\"JsonService.postForm: Error from server: \",r.error),void s(new Error(r.error))}catch(t){return n.Log.error(\"JsonService.postForm: Error parsing JSON response\",t.message),void s(t)}s(Error(a.statusText+\" (\"+a.status+\")\"))}else{var i;if((i=a.getResponseHeader(\"Content-Type\"))&&u.find((function(t){if(i.startsWith(t))return!0})))try{return void t(JSON.parse(a.responseText))}catch(t){return n.Log.error(\"JsonService.postForm: Error parsing JSON response\",t.message),void s(t)}s(Error(\"Invalid response Content-Type: \"+i+\", from URL: \"+e))}},a.onerror=function(){n.Log.error(\"JsonService.postForm: network error\"),s(Error(\"Network Error\"))};var c=\"\";for(var h in r){var l=r[h];l&&(c.length>0&&(c+=\"&\"),c+=encodeURIComponent(h),c+=\"=\",c+=encodeURIComponent(l))}a.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),void 0!==i&&a.setRequestHeader(\"Authorization\",\"Basic \"+btoa(i)),a.send(c)}))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SigninRequest=void 0;var n=r(0),i=r(3),o=r(13);e.SigninRequest=function(){function t(e){var r=e.url,s=e.client_id,a=e.redirect_uri,u=e.response_type,c=e.scope,h=e.authority,l=e.data,f=e.prompt,g=e.display,d=e.max_age,p=e.ui_locales,v=e.id_token_hint,y=e.login_hint,m=e.acr_values,_=e.resource,S=e.response_mode,b=e.request,w=e.request_uri,F=e.extraQueryParams,E=e.request_type,x=e.client_secret,A=e.extraTokenParams,k=e.skipUserInfo;if(function P(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),!r)throw n.Log.error(\"SigninRequest.ctor: No url passed\"),new Error(\"url\");if(!s)throw n.Log.error(\"SigninRequest.ctor: No client_id passed\"),new Error(\"client_id\");if(!a)throw n.Log.error(\"SigninRequest.ctor: No redirect_uri passed\"),new Error(\"redirect_uri\");if(!u)throw n.Log.error(\"SigninRequest.ctor: No response_type passed\"),new Error(\"response_type\");if(!c)throw n.Log.error(\"SigninRequest.ctor: No scope passed\"),new Error(\"scope\");if(!h)throw n.Log.error(\"SigninRequest.ctor: No authority passed\"),new Error(\"authority\");var C=t.isOidc(u),T=t.isCode(u);S||(S=t.isCode(u)?\"query\":null),this.state=new o.SigninState({nonce:C,data:l,client_id:s,authority:h,redirect_uri:a,code_verifier:T,request_type:E,response_mode:S,client_secret:x,scope:c,extraTokenParams:A,skipUserInfo:k}),r=i.UrlUtility.addQueryParam(r,\"client_id\",s),r=i.UrlUtility.addQueryParam(r,\"redirect_uri\",a),r=i.UrlUtility.addQueryParam(r,\"response_type\",u),r=i.UrlUtility.addQueryParam(r,\"scope\",c),r=i.UrlUtility.addQueryParam(r,\"state\",this.state.id),C&&(r=i.UrlUtility.addQueryParam(r,\"nonce\",this.state.nonce)),T&&(r=i.UrlUtility.addQueryParam(r,\"code_challenge\",this.state.code_challenge),r=i.UrlUtility.addQueryParam(r,\"code_challenge_method\",\"S256\"));var R={prompt:f,display:g,max_age:d,ui_locales:p,id_token_hint:v,login_hint:y,acr_values:m,resource:_,request:b,request_uri:w,response_mode:S};for(var I in R)R[I]&&(r=i.UrlUtility.addQueryParam(r,I,R[I]));for(var D in F)r=i.UrlUtility.addQueryParam(r,D,F[D]);this.url=r}return t.isOidc=function t(e){return!!e.split(/\\s+/g).filter((function(t){return\"id_token\"===t}))[0]},t.isOAuth=function t(e){return!!e.split(/\\s+/g).filter((function(t){return\"token\"===t}))[0]},t.isCode=function t(e){return!!e.split(/\\s+/g).filter((function(t){return\"code\"===t}))[0]},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.State=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},r=e.id,n=e.data,i=e.created,s=e.request_type;a(this,t),this._id=r||(0,o.default)(),this._data=n,this._created=\"number\"==typeof i&&i>0?i:parseInt(Date.now()/1e3),this._request_type=s}return t.prototype.toStorageString=function t(){return i.Log.debug(\"State.toStorageString\"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},t.fromStorageString=function e(r){return i.Log.debug(\"State.fromStorageString\"),new t(JSON.parse(r))},t.clearStaleState=function e(r,n){var o=Date.now()/1e3-n;return r.getAllKeys().then((function(e){i.Log.debug(\"State.clearStaleState: got keys\",e);for(var n=[],s=function s(a){var c=e[a];u=r.get(c).then((function(e){var n=!1;if(e)try{var s=t.fromStorageString(e);i.Log.debug(\"State.clearStaleState: got item from key: \",c,s.created),s.created<=o&&(n=!0)}catch(t){i.Log.error(\"State.clearStaleState: Error parsing state for key\",c,t.message),n=!0}else i.Log.debug(\"State.clearStaleState: no item in storage for key: \",c),n=!0;if(n)return i.Log.debug(\"State.clearStaleState: removed item for key: \",c),r.remove(c)})),n.push(u)},a=0;a0&&void 0!==arguments[0]?arguments[0]:{};g(this,t),e instanceof o.OidcClientSettings?this._settings=e:this._settings=new o.OidcClientSettings(e)}return t.prototype.createSigninRequest=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.response_type,o=r.scope,s=r.redirect_uri,u=r.data,c=r.state,h=r.prompt,l=r.display,f=r.max_age,g=r.ui_locales,d=r.id_token_hint,p=r.login_hint,v=r.acr_values,y=r.resource,m=r.request,_=r.request_uri,S=r.response_mode,b=r.extraQueryParams,w=r.extraTokenParams,F=r.request_type,E=r.skipUserInfo,x=arguments[1];i.Log.debug(\"OidcClient.createSigninRequest\");var A=this._settings.client_id;n=n||this._settings.response_type,o=o||this._settings.scope,s=s||this._settings.redirect_uri,h=h||this._settings.prompt,l=l||this._settings.display,f=f||this._settings.max_age,g=g||this._settings.ui_locales,v=v||this._settings.acr_values,y=y||this._settings.resource,S=S||this._settings.response_mode,b=b||this._settings.extraQueryParams,w=w||this._settings.extraTokenParams;var k=this._settings.authority;return a.SigninRequest.isCode(n)&&\"code\"!==n?Promise.reject(new Error(\"OpenID Connect hybrid flow is not supported\")):this._metadataService.getAuthorizationEndpoint().then((function(t){i.Log.debug(\"OidcClient.createSigninRequest: Received authorization endpoint\",t);var r=new a.SigninRequest({url:t,client_id:A,redirect_uri:s,response_type:n,scope:o,data:u||c,authority:k,prompt:h,display:l,max_age:f,ui_locales:g,id_token_hint:d,login_hint:p,acr_values:v,resource:y,request:m,request_uri:_,extraQueryParams:b,extraTokenParams:w,request_type:F,response_mode:S,client_secret:e._settings.client_secret,skipUserInfo:E}),P=r.state;return(x=x||e._stateStore).set(P.id,P.toStorageString()).then((function(){return r}))}))},t.prototype.readSigninResponseState=function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug(\"OidcClient.readSigninResponseState\");var o=\"query\"===this._settings.response_mode||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type),s=o?\"?\":\"#\",c=new u.SigninResponse(e,s);if(!c.state)return i.Log.error(\"OidcClient.readSigninResponseState: No state in response\"),Promise.reject(new Error(\"No state in response\"));r=r||this._stateStore;var h=n?r.remove.bind(r):r.get.bind(r);return h(c.state).then((function(t){if(!t)throw i.Log.error(\"OidcClient.readSigninResponseState: No matching state found in storage\"),new Error(\"No matching state found in storage\");return{state:l.SigninState.fromStorageString(t),response:c}}))},t.prototype.processSigninResponse=function t(e,r){var n=this;return i.Log.debug(\"OidcClient.processSigninResponse\"),this.readSigninResponseState(e,r,!0).then((function(t){var e=t.state,r=t.response;return i.Log.debug(\"OidcClient.processSigninResponse: Received state from storage; validating response\"),n._validator.validateSigninResponse(e,r)}))},t.prototype.createSignoutRequest=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=r.id_token_hint,o=r.data,s=r.state,a=r.post_logout_redirect_uri,u=r.extraQueryParams,h=r.request_type,l=arguments[1];return i.Log.debug(\"OidcClient.createSignoutRequest\"),a=a||this._settings.post_logout_redirect_uri,u=u||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(t){if(!t)throw i.Log.error(\"OidcClient.createSignoutRequest: No end session endpoint url returned\"),new Error(\"no end session endpoint\");i.Log.debug(\"OidcClient.createSignoutRequest: Received end session endpoint\",t);var r=new c.SignoutRequest({url:t,id_token_hint:n,post_logout_redirect_uri:a,data:o||s,extraQueryParams:u,request_type:h}),f=r.state;return f&&(i.Log.debug(\"OidcClient.createSignoutRequest: Signout request has state to persist\"),(l=l||e._stateStore).set(f.id,f.toStorageString())),r}))},t.prototype.readSignoutResponseState=function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];i.Log.debug(\"OidcClient.readSignoutResponseState\");var o=new h.SignoutResponse(e);if(!o.state)return i.Log.debug(\"OidcClient.readSignoutResponseState: No state in response\"),o.error?(i.Log.warn(\"OidcClient.readSignoutResponseState: Response was error: \",o.error),Promise.reject(new s.ErrorResponse(o))):Promise.resolve({state:void 0,response:o});var a=o.state;r=r||this._stateStore;var u=n?r.remove.bind(r):r.get.bind(r);return u(a).then((function(t){if(!t)throw i.Log.error(\"OidcClient.readSignoutResponseState: No matching state found in storage\"),new Error(\"No matching state found in storage\");return{state:f.State.fromStorageString(t),response:o}}))},t.prototype.processSignoutResponse=function t(e,r){var n=this;return i.Log.debug(\"OidcClient.processSignoutResponse\"),this.readSignoutResponseState(e,r,!0).then((function(t){var e=t.state,r=t.response;return e?(i.Log.debug(\"OidcClient.processSignoutResponse: Received state from storage; validating response\"),n._validator.validateSignoutResponse(e,r)):(i.Log.debug(\"OidcClient.processSignoutResponse: No state from storage; skipping validating response\"),r)}))},t.prototype.clearStaleState=function t(e){return i.Log.debug(\"OidcClient.clearStaleState\"),e=e||this._stateStore,f.State.clearStaleState(e,this.settings.staleStateAge)},n(t,[{key:\"_stateStore\",get:function t(){return this.settings.stateStore}},{key:\"_validator\",get:function t(){return this.settings.validator}},{key:\"_metadataService\",get:function t(){return this.settings.metadataService}},{key:\"settings\",get:function t(){return this._settings}},{key:\"metadataService\",get:function t(){return this._metadataService}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.TokenClient=void 0;var n=r(7),i=r(2),o=r(0);function s(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.TokenClient=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw o.Log.error(\"TokenClient.ctor: No settings passed\"),new Error(\"settings\");this._settings=e,this._jsonService=new r,this._metadataService=new a(this._settings)}return t.prototype.exchangeCode=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).grant_type=r.grant_type||\"authorization_code\",r.client_id=r.client_id||this._settings.client_id,r.client_secret=r.client_secret||this._settings.client_secret,r.redirect_uri=r.redirect_uri||this._settings.redirect_uri;var n=void 0,i=r._client_authentication||this._settings._client_authentication;return delete r._client_authentication,r.code?r.redirect_uri?r.code_verifier?r.client_id?r.client_secret||\"client_secret_basic\"!=i?(\"client_secret_basic\"==i&&(n=r.client_id+\":\"+r.client_secret,delete r.client_id,delete r.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(t){return o.Log.debug(\"TokenClient.exchangeCode: Received token endpoint\"),e._jsonService.postForm(t,r,n).then((function(t){return o.Log.debug(\"TokenClient.exchangeCode: response received\"),t}))}))):(o.Log.error(\"TokenClient.exchangeCode: No client_secret passed\"),Promise.reject(new Error(\"A client_secret is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No client_id passed\"),Promise.reject(new Error(\"A client_id is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No code_verifier passed\"),Promise.reject(new Error(\"A code_verifier is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No redirect_uri passed\"),Promise.reject(new Error(\"A redirect_uri is required\"))):(o.Log.error(\"TokenClient.exchangeCode: No code passed\"),Promise.reject(new Error(\"A code is required\")))},t.prototype.exchangeRefreshToken=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).grant_type=r.grant_type||\"refresh_token\",r.client_id=r.client_id||this._settings.client_id,r.client_secret=r.client_secret||this._settings.client_secret;var n=void 0,i=r._client_authentication||this._settings._client_authentication;return delete r._client_authentication,r.refresh_token?r.client_id?(\"client_secret_basic\"==i&&(n=r.client_id+\":\"+r.client_secret,delete r.client_id,delete r.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(t){return o.Log.debug(\"TokenClient.exchangeRefreshToken: Received token endpoint\"),e._jsonService.postForm(t,r,n).then((function(t){return o.Log.debug(\"TokenClient.exchangeRefreshToken: response received\"),t}))}))):(o.Log.error(\"TokenClient.exchangeRefreshToken: No client_id passed\"),Promise.reject(new Error(\"A client_id is required\"))):(o.Log.error(\"TokenClient.exchangeRefreshToken: No refresh_token passed\"),Promise.reject(new Error(\"A refresh_token is required\")))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.ErrorResponse=void 0;var n=r(0);function i(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function o(t,e){if(!t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return!e||\"object\"!=typeof e&&\"function\"!=typeof e?t:e}e.ErrorResponse=function(t){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=r.error,a=r.error_description,u=r.error_uri,c=r.state,h=r.session_state;if(i(this,e),!s)throw n.Log.error(\"No error passed to ErrorResponse\"),new Error(\"error\");var l=o(this,t.call(this,a||s));return l.name=\"ErrorResponse\",l.error=s,l.error_description=a,l.error_uri=u,l.state=c,l.session_state=h,l}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(Error)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SigninState=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=r.nonce,i=r.authority,o=r.client_id,u=r.redirect_uri,l=r.code_verifier,f=r.response_mode,g=r.client_secret,d=r.scope,p=r.extraTokenParams,v=r.skipUserInfo;c(this,e);var y=h(this,t.call(this,arguments[0]));if(!0===n?y._nonce=(0,a.default)():n&&(y._nonce=n),!0===l?y._code_verifier=(0,a.default)()+(0,a.default)()+(0,a.default)():l&&(y._code_verifier=l),y.code_verifier){var m=s.JoseUtil.hashString(y.code_verifier,\"SHA256\");y._code_challenge=s.JoseUtil.hexToBase64Url(m)}return y._redirect_uri=u,y._authority=i,y._client_id=o,y._response_mode=f,y._client_secret=g,y._scope=d,y._extraTokenParams=p,y._skipUserInfo=v,y}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toStorageString=function t(){return i.Log.debug(\"SigninState.toStorageString\"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},e.fromStorageString=function t(r){return i.Log.debug(\"SigninState.fromStorageString\"),new e(JSON.parse(r))},n(e,[{key:\"nonce\",get:function t(){return this._nonce}},{key:\"authority\",get:function t(){return this._authority}},{key:\"client_id\",get:function t(){return this._client_id}},{key:\"redirect_uri\",get:function t(){return this._redirect_uri}},{key:\"code_verifier\",get:function t(){return this._code_verifier}},{key:\"code_challenge\",get:function t(){return this._code_challenge}},{key:\"response_mode\",get:function t(){return this._response_mode}},{key:\"client_secret\",get:function t(){return this._client_secret}},{key:\"scope\",get:function t(){return this._scope}},{key:\"extraTokenParams\",get:function t(){return this._extraTokenParams}},{key:\"skipUserInfo\",get:function t(){return this._skipUserInfo}}]),e}(o.State)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.default=function n(){return(\"undefined\"!=i&&null!==i&&void 0!==i.getRandomValues?o:s)().replace(/-/g,\"\")};var i=\"undefined\"!=typeof window?window.crypto||window.msCrypto:null;function o(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^i.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}function s(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^16*Math.random()>>t/4).toString(16)}))}t.exports=e.default},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.User=void 0;var n=function(){function t(t,e){for(var r=0;r0){var n=parseInt(Date.now()/1e3);this.expires_at=n+r}}},{key:\"expired\",get:function t(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:\"scopes\",get:function t(){return(this.scope||\"\").split(\" \")}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.AccessTokenEvents=void 0;var n=r(0),i=r(46);function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.AccessTokenEvents=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.accessTokenExpiringNotificationTime,n=void 0===r?60:r,s=e.accessTokenExpiringTimer,a=void 0===s?new i.Timer(\"Access token expiring\"):s,u=e.accessTokenExpiredTimer,c=void 0===u?new i.Timer(\"Access token expired\"):u;o(this,t),this._accessTokenExpiringNotificationTime=n,this._accessTokenExpiring=a,this._accessTokenExpired=c}return t.prototype.load=function t(e){if(e.access_token&&void 0!==e.expires_in){var r=e.expires_in;if(n.Log.debug(\"AccessTokenEvents.load: access token present, remaining duration:\",r),r>0){var i=r-this._accessTokenExpiringNotificationTime;i<=0&&(i=1),n.Log.debug(\"AccessTokenEvents.load: registering expiring timer in:\",i),this._accessTokenExpiring.init(i)}else n.Log.debug(\"AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration.\"),this._accessTokenExpiring.cancel();var o=r+1;n.Log.debug(\"AccessTokenEvents.load: registering expired timer in:\",o),this._accessTokenExpired.init(o)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function t(){n.Log.debug(\"AccessTokenEvents.unload: canceling existing access token timers\"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function t(e){this._accessTokenExpiring.addHandler(e)},t.prototype.removeAccessTokenExpiring=function t(e){this._accessTokenExpiring.removeHandler(e)},t.prototype.addAccessTokenExpired=function t(e){this._accessTokenExpired.addHandler(e)},t.prototype.removeAccessTokenExpired=function t(e){this._accessTokenExpired.removeHandler(e)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.Event=void 0;var n=r(0);e.Event=function(){function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function t(e){this._callbacks.push(e)},t.prototype.removeHandler=function t(e){var r=this._callbacks.findIndex((function(t){return t===e}));r>=0&&this._callbacks.splice(r,1)},t.prototype.raise=function t(){n.Log.debug(\"Event: Raising event: \"+this._name);for(var e=0;e1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(a(this,t),!e)throw i.Log.error(\"SessionMonitor.ctor: No user manager passed to SessionMonitor\"),new Error(\"userManager\");this._userManager=e,this._CheckSessionIFrameCtor=n,this._timer=u,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(t){t?r._start(t):r._settings.monitorAnonymousSession&&r._userManager.querySessionStatus().then((function(t){var e={session_state:t.session_state};t.sub&&t.sid&&(e.profile={sub:t.sub,sid:t.sid}),r._start(e)})).catch((function(t){i.Log.error(\"SessionMonitor ctor: error from querySessionStatus:\",t.message)}))})).catch((function(t){i.Log.error(\"SessionMonitor ctor: error from getUser:\",t.message)})))}return t.prototype._start=function t(e){var r=this,n=e.session_state;n&&(e.profile?(this._sub=e.profile.sub,this._sid=e.profile.sid,i.Log.debug(\"SessionMonitor._start: session_state:\",n,\", sub:\",this._sub)):(this._sub=void 0,this._sid=void 0,i.Log.debug(\"SessionMonitor._start: session_state:\",n,\", anonymous user\")),this._checkSessionIFrame?this._checkSessionIFrame.start(n):this._metadataService.getCheckSessionIframe().then((function(t){if(t){i.Log.debug(\"SessionMonitor._start: Initializing check session iframe\");var e=r._client_id,o=r._checkSessionInterval,s=r._stopCheckSessionOnError;r._checkSessionIFrame=new r._CheckSessionIFrameCtor(r._callback.bind(r),e,t,o,s),r._checkSessionIFrame.load().then((function(){r._checkSessionIFrame.start(n)}))}else i.Log.warn(\"SessionMonitor._start: No check session iframe found in the metadata\")})).catch((function(t){i.Log.error(\"SessionMonitor._start: Error from getCheckSessionIframe:\",t.message)})))},t.prototype._stop=function t(){var e=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(i.Log.debug(\"SessionMonitor._stop\"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var r=this._timer.setInterval((function(){e._timer.clearInterval(r),e._userManager.querySessionStatus().then((function(t){var r={session_state:t.session_state};t.sub&&t.sid&&(r.profile={sub:t.sub,sid:t.sid}),e._start(r)})).catch((function(t){i.Log.error(\"SessionMonitor: error from querySessionStatus:\",t.message)}))}),1e3)},t.prototype._callback=function t(){var e=this;this._userManager.querySessionStatus().then((function(t){var r=!0;t?t.sub===e._sub?(r=!1,e._checkSessionIFrame.start(t.session_state),t.sid===e._sid?i.Log.debug(\"SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:\",t.session_state):(i.Log.debug(\"SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:\",t.session_state),e._userManager.events._raiseUserSessionChanged())):i.Log.debug(\"SessionMonitor._callback: Different subject signed into OP:\",t.sub):i.Log.debug(\"SessionMonitor._callback: Subject no longer signed into OP\"),r&&(e._sub?(i.Log.debug(\"SessionMonitor._callback: SessionMonitor._callback; raising signed out event\"),e._userManager.events._raiseUserSignedOut()):(i.Log.debug(\"SessionMonitor._callback: SessionMonitor._callback; raising signed in event\"),e._userManager.events._raiseUserSignedIn()))})).catch((function(t){e._sub&&(i.Log.debug(\"SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event\",t.message),e._userManager.events._raiseUserSignedOut())}))},n(t,[{key:\"_settings\",get:function t(){return this._userManager.settings}},{key:\"_metadataService\",get:function t(){return this._userManager.metadataService}},{key:\"_client_id\",get:function t(){return this._settings.client_id}},{key:\"_checkSessionInterval\",get:function t(){return this._settings.checkSessionInterval}},{key:\"_stopCheckSessionOnError\",get:function t(){return this._settings.stopCheckSessionOnError}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.CheckSessionIFrame=void 0;var n=r(0);function i(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.CheckSessionIFrame=function(){function t(e,r,n,o){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];i(this,t),this._callback=e,this._client_id=r,this._url=n,this._interval=o||2e3,this._stopOnError=s;var a=n.indexOf(\"/\",n.indexOf(\"//\")+2);this._frame_origin=n.substr(0,a),this._frame=window.document.createElement(\"iframe\"),this._frame.style.visibility=\"hidden\",this._frame.style.position=\"absolute\",this._frame.style.display=\"none\",this._frame.width=0,this._frame.height=0,this._frame.src=n}return t.prototype.load=function t(){var e=this;return new Promise((function(t){e._frame.onload=function(){t()},window.document.body.appendChild(e._frame),e._boundMessageEvent=e._message.bind(e),window.addEventListener(\"message\",e._boundMessageEvent,!1)}))},t.prototype._message=function t(e){e.origin===this._frame_origin&&e.source===this._frame.contentWindow&&(\"error\"===e.data?(n.Log.error(\"CheckSessionIFrame: error message from check session op iframe\"),this._stopOnError&&this.stop()):\"changed\"===e.data?(n.Log.debug(\"CheckSessionIFrame: changed message from check session op iframe\"),this.stop(),this._callback()):n.Log.debug(\"CheckSessionIFrame: \"+e.data+\" message from check session op iframe\"))},t.prototype.start=function t(e){var r=this;if(this._session_state!==e){n.Log.debug(\"CheckSessionIFrame.start\"),this.stop(),this._session_state=e;var i=function t(){r._frame.contentWindow.postMessage(r._client_id+\" \"+r._session_state,r._frame_origin)};i(),this._timer=window.setInterval(i,this._interval)}},t.prototype.stop=function t(){this._session_state=null,this._timer&&(n.Log.debug(\"CheckSessionIFrame.stop\"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.TokenRevocationClient=void 0;var n=r(0),i=r(2),o=r(1);function s(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}var a=\"access_token\",u=\"refresh_token\";e.TokenRevocationClient=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService;if(s(this,t),!e)throw n.Log.error(\"TokenRevocationClient.ctor: No settings provided\"),new Error(\"No settings provided.\");this._settings=e,this._XMLHttpRequestCtor=r,this._metadataService=new a(this._settings)}return t.prototype.revoke=function t(e,r){var i=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:\"access_token\";if(!e)throw n.Log.error(\"TokenRevocationClient.revoke: No token provided\"),new Error(\"No token provided.\");if(o!==a&&o!=u)throw n.Log.error(\"TokenRevocationClient.revoke: Invalid token type\"),new Error(\"Invalid token type.\");return this._metadataService.getRevocationEndpoint().then((function(t){if(t){n.Log.debug(\"TokenRevocationClient.revoke: Revoking \"+o);var s=i._settings.client_id,a=i._settings.client_secret;return i._revoke(t,s,a,e,o)}if(r)throw n.Log.error(\"TokenRevocationClient.revoke: Revocation not supported\"),new Error(\"Revocation not supported\")}))},t.prototype._revoke=function t(e,r,i,o,s){var a=this;return new Promise((function(t,u){var c=new a._XMLHttpRequestCtor;c.open(\"POST\",e),c.onload=function(){n.Log.debug(\"TokenRevocationClient.revoke: HTTP response received, status\",c.status),200===c.status?t():u(Error(c.statusText+\" (\"+c.status+\")\"))},c.onerror=function(){n.Log.debug(\"TokenRevocationClient.revoke: Network Error.\"),u(\"Network Error\")};var h=\"client_id=\"+encodeURIComponent(r);i&&(h+=\"&client_secret=\"+encodeURIComponent(i)),h+=\"&token_type_hint=\"+encodeURIComponent(s),h+=\"&token=\"+encodeURIComponent(o),c.setRequestHeader(\"Content-Type\",\"application/x-www-form-urlencoded\"),c.send(h)}))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.CordovaPopupWindow=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.JoseUtil,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:a.TokenClient;if(h(this,t),!e)throw i.Log.error(\"ResponseValidator.ctor: No settings passed to ResponseValidator\"),new Error(\"settings\");this._settings=e,this._metadataService=new r(this._settings),this._userInfoService=new n(this._settings),this._joseUtil=u,this._tokenClient=new l(this._settings)}return t.prototype.validateSigninResponse=function t(e,r){var n=this;return i.Log.debug(\"ResponseValidator.validateSigninResponse\"),this._processSigninParams(e,r).then((function(t){return i.Log.debug(\"ResponseValidator.validateSigninResponse: state processed\"),n._validateTokens(e,t).then((function(t){return i.Log.debug(\"ResponseValidator.validateSigninResponse: tokens validated\"),n._processClaims(e,t).then((function(t){return i.Log.debug(\"ResponseValidator.validateSigninResponse: claims processed\"),t}))}))}))},t.prototype.validateSignoutResponse=function t(e,r){return e.id!==r.state?(i.Log.error(\"ResponseValidator.validateSignoutResponse: State does not match\"),Promise.reject(new Error(\"State does not match\"))):(i.Log.debug(\"ResponseValidator.validateSignoutResponse: state validated\"),r.state=e.data,r.error?(i.Log.warn(\"ResponseValidator.validateSignoutResponse: Response was error\",r.error),Promise.reject(new u.ErrorResponse(r))):Promise.resolve(r))},t.prototype._processSigninParams=function t(e,r){if(e.id!==r.state)return i.Log.error(\"ResponseValidator._processSigninParams: State does not match\"),Promise.reject(new Error(\"State does not match\"));if(!e.client_id)return i.Log.error(\"ResponseValidator._processSigninParams: No client_id on state\"),Promise.reject(new Error(\"No client_id on state\"));if(!e.authority)return i.Log.error(\"ResponseValidator._processSigninParams: No authority on state\"),Promise.reject(new Error(\"No authority on state\"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==e.authority)return i.Log.error(\"ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state\"),Promise.reject(new Error(\"authority mismatch on settings vs. signin state\"))}else this._settings.authority=e.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==e.client_id)return i.Log.error(\"ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state\"),Promise.reject(new Error(\"client_id mismatch on settings vs. signin state\"))}else this._settings.client_id=e.client_id;return i.Log.debug(\"ResponseValidator._processSigninParams: state validated\"),r.state=e.data,r.error?(i.Log.warn(\"ResponseValidator._processSigninParams: Response was error\",r.error),Promise.reject(new u.ErrorResponse(r))):e.nonce&&!r.id_token?(i.Log.error(\"ResponseValidator._processSigninParams: Expecting id_token in response\"),Promise.reject(new Error(\"No id_token in response\"))):!e.nonce&&r.id_token?(i.Log.error(\"ResponseValidator._processSigninParams: Not expecting id_token in response\"),Promise.reject(new Error(\"Unexpected id_token in response\"))):e.code_verifier&&!r.code?(i.Log.error(\"ResponseValidator._processSigninParams: Expecting code in response\"),Promise.reject(new Error(\"No code in response\"))):!e.code_verifier&&r.code?(i.Log.error(\"ResponseValidator._processSigninParams: Not expecting code in response\"),Promise.reject(new Error(\"Unexpected code in response\"))):(r.scope||(r.scope=e.scope),Promise.resolve(r))},t.prototype._processClaims=function t(e,r){var n=this;if(r.isOpenIdConnect){if(i.Log.debug(\"ResponseValidator._processClaims: response is OIDC, processing claims\"),r.profile=this._filterProtocolClaims(r.profile),!0!==e.skipUserInfo&&this._settings.loadUserInfo&&r.access_token)return i.Log.debug(\"ResponseValidator._processClaims: loading user info\"),this._userInfoService.getClaims(r.access_token).then((function(t){return i.Log.debug(\"ResponseValidator._processClaims: user info claims received from user info endpoint\"),t.sub!==r.profile.sub?(i.Log.error(\"ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token\"),Promise.reject(new Error(\"sub from user info endpoint does not match sub in id_token\"))):(r.profile=n._mergeClaims(r.profile,t),i.Log.debug(\"ResponseValidator._processClaims: user info claims received, updated profile:\",r.profile),r)}));i.Log.debug(\"ResponseValidator._processClaims: not loading user info\")}else i.Log.debug(\"ResponseValidator._processClaims: response is not OIDC, not processing claims\");return Promise.resolve(r)},t.prototype._mergeClaims=function t(e,r){var i=Object.assign({},e);for(var o in r){var s=r[o];Array.isArray(s)||(s=[s]);for(var a=0;a1)return i.Log.error(\"ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata\"),Promise.reject(new Error(\"No kid found in id_token and more than one key found in metadata\"));o=t[0]}return Promise.resolve(o)}))},t.prototype._getSigningKeyForJwtWithSingleRetry=function t(e){var r=this;return this._getSigningKeyForJwt(e).then((function(t){return t?Promise.resolve(t):(r._metadataService.resetSigningKeys(),r._getSigningKeyForJwt(e))}))},t.prototype._validateIdToken=function t(e,r){var n=this;if(!e.nonce)return i.Log.error(\"ResponseValidator._validateIdToken: No nonce on state\"),Promise.reject(new Error(\"No nonce on state\"));var o=this._joseUtil.parseJwt(r.id_token);return o&&o.header&&o.payload?e.nonce!==o.payload.nonce?(i.Log.error(\"ResponseValidator._validateIdToken: Invalid nonce in id_token\"),Promise.reject(new Error(\"Invalid nonce in id_token\"))):this._metadataService.getIssuer().then((function(t){return i.Log.debug(\"ResponseValidator._validateIdToken: Received issuer\"),n._getSigningKeyForJwtWithSingleRetry(o).then((function(s){if(!s)return i.Log.error(\"ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys\"),Promise.reject(new Error(\"No key matching kid or alg found in signing keys\"));var a=e.client_id,u=n._settings.clockSkew;return i.Log.debug(\"ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: \",u),n._joseUtil.validateJwt(r.id_token,s,t,a,u).then((function(){return i.Log.debug(\"ResponseValidator._validateIdToken: JWT validation successful\"),o.payload.sub?(r.profile=o.payload,r):(i.Log.error(\"ResponseValidator._validateIdToken: No sub present in id_token\"),Promise.reject(new Error(\"No sub present in id_token\")))}))}))})):(i.Log.error(\"ResponseValidator._validateIdToken: Failed to parse id_token\",o),Promise.reject(new Error(\"Failed to parse id_token\")))},t.prototype._filterByAlg=function t(e,r){var n=null;if(r.startsWith(\"RS\"))n=\"RSA\";else if(r.startsWith(\"PS\"))n=\"PS\";else{if(!r.startsWith(\"ES\"))return i.Log.debug(\"ResponseValidator._filterByAlg: alg not supported: \",r),[];n=\"EC\"}return i.Log.debug(\"ResponseValidator._filterByAlg: Looking for keys that match kty: \",n),e=e.filter((function(t){return t.kty===n})),i.Log.debug(\"ResponseValidator._filterByAlg: Number of keys that match kty: \",n,e.length),e},t.prototype._validateAccessToken=function t(e){if(!e.profile)return i.Log.error(\"ResponseValidator._validateAccessToken: No profile loaded from id_token\"),Promise.reject(new Error(\"No profile loaded from id_token\"));if(!e.profile.at_hash)return i.Log.error(\"ResponseValidator._validateAccessToken: No at_hash in id_token\"),Promise.reject(new Error(\"No at_hash in id_token\"));if(!e.id_token)return i.Log.error(\"ResponseValidator._validateAccessToken: No id_token\"),Promise.reject(new Error(\"No id_token\"));var r=this._joseUtil.parseJwt(e.id_token);if(!r||!r.header)return i.Log.error(\"ResponseValidator._validateAccessToken: Failed to parse id_token\",r),Promise.reject(new Error(\"Failed to parse id_token\"));var n=r.header.alg;if(!n||5!==n.length)return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\",n),Promise.reject(new Error(\"Unsupported alg: \"+n));var o=n.substr(2,3);if(!o)return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\",n,o),Promise.reject(new Error(\"Unsupported alg: \"+n));if(256!==(o=parseInt(o))&&384!==o&&512!==o)return i.Log.error(\"ResponseValidator._validateAccessToken: Unsupported alg:\",n,o),Promise.reject(new Error(\"Unsupported alg: \"+n));var s=\"sha\"+o,a=this._joseUtil.hashString(e.access_token,s);if(!a)return i.Log.error(\"ResponseValidator._validateAccessToken: access_token hash failed:\",s),Promise.reject(new Error(\"Failed to validate at_hash\"));var u=a.substr(0,a.length/2),c=this._joseUtil.hexToBase64Url(u);return c!==e.profile.at_hash?(i.Log.error(\"ResponseValidator._validateAccessToken: Failed to validate at_hash\",c,e.profile.at_hash),Promise.reject(new Error(\"Failed to validate at_hash\"))):(i.Log.debug(\"ResponseValidator._validateAccessToken: success\"),Promise.resolve(e))},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UserInfoService=void 0;var n=r(7),i=r(2),o=r(0),s=r(4);function a(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}e.UserInfoService=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.JsonService,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i.MetadataService,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(a(this,t),!e)throw o.Log.error(\"UserInfoService.ctor: No settings passed\"),new Error(\"settings\");this._settings=e,this._jsonService=new r(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new u(this._settings),this._joseUtil=c}return t.prototype.getClaims=function t(e){var r=this;return e?this._metadataService.getUserInfoEndpoint().then((function(t){return o.Log.debug(\"UserInfoService.getClaims: received userinfo url\",t),r._jsonService.getJson(t,e).then((function(t){return o.Log.debug(\"UserInfoService.getClaims: claims received\",t),t}))})):(o.Log.error(\"UserInfoService.getClaims: No token passed\"),Promise.reject(new Error(\"A token is required\")))},t.prototype._getClaimsFromJwt=function t(e){var r=this;try{var n=this._joseUtil.parseJwt(e.responseText);if(!n||!n.header||!n.payload)return o.Log.error(\"UserInfoService._getClaimsFromJwt: Failed to parse JWT\",n),Promise.reject(new Error(\"Failed to parse id_token\"));var i=n.header.kid,s=void 0;switch(this._settings.userInfoJwtIssuer){case\"OP\":s=this._metadataService.getIssuer();break;case\"ANY\":s=Promise.resolve(n.payload.iss);break;default:s=Promise.resolve(this._settings.userInfoJwtIssuer)}return s.then((function(t){return o.Log.debug(\"UserInfoService._getClaimsFromJwt: Received issuer:\"+t),r._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error(\"UserInfoService._getClaimsFromJwt: No signing keys from metadata\"),Promise.reject(new Error(\"No signing keys from metadata\"));o.Log.debug(\"UserInfoService._getClaimsFromJwt: Received signing keys\");var a=void 0;if(i)a=s.filter((function(t){return t.kid===i}))[0];else{if((s=r._filterByAlg(s,n.header.alg)).length>1)return o.Log.error(\"UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata\"),Promise.reject(new Error(\"No kid found in id_token and more than one key found in metadata\"));a=s[0]}if(!a)return o.Log.error(\"UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys\"),Promise.reject(new Error(\"No key matching kid or alg found in signing keys\"));var u=r._settings.client_id,c=r._settings.clockSkew;return o.Log.debug(\"UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: \",c),r._joseUtil.validateJwt(e.responseText,a,t,u,c,void 0,!0).then((function(){return o.Log.debug(\"UserInfoService._getClaimsFromJwt: JWT validation successful\"),n.payload}))}))}))}catch(t){return o.Log.error(\"UserInfoService._getClaimsFromJwt: Error parsing JWT response\",t.message),void reject(t)}},t.prototype._filterByAlg=function t(e,r){var n=null;if(r.startsWith(\"RS\"))n=\"RSA\";else if(r.startsWith(\"PS\"))n=\"PS\";else{if(!r.startsWith(\"ES\"))return o.Log.debug(\"UserInfoService._filterByAlg: alg not supported: \",r),[];n=\"EC\"}return o.Log.debug(\"UserInfoService._filterByAlg: Looking for keys that match kty: \",n),e=e.filter((function(t){return t.kty===n})),o.Log.debug(\"UserInfoService._filterByAlg: Number of keys that match kty: \",n,e.length),e},t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.AllowedSigningAlgs=e.b64tohex=e.hextob64u=e.crypto=e.X509=e.KeyUtil=e.jws=void 0;var n=r(27);e.jws=n.jws,e.KeyUtil=n.KEYUTIL,e.X509=n.X509,e.crypto=n.crypto,e.hextob64u=n.hextob64u,e.b64tohex=n.b64tohex,e.AllowedSigningAlgs=[\"RS256\",\"RS384\",\"RS512\",\"PS256\",\"PS384\",\"PS512\",\"ES256\",\"ES384\",\"ES512\"]},function(t,e,r){\"use strict\";(function(t){Object.defineProperty(e,\"__esModule\",{value:!0});var r,n,i,o,s,a,u,c,h,l,f,g=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},d={userAgent:!1},p={},v=v||(r=Math,i=(n={}).lib={},o=i.Base=function(){function t(){}return{extend:function e(r){t.prototype=this;var n=new t;return r&&n.mixIn(r),n.hasOwnProperty(\"init\")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function t(){var e=this.extend();return e.init.apply(e,arguments),e},init:function t(){},mixIn:function t(e){for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r]);e.hasOwnProperty(\"toString\")&&(this.toString=e.toString)},clone:function t(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=o.extend({init:function t(e,r){e=this.words=e||[],this.sigBytes=null!=r?r:4*e.length},toString:function t(e){return(e||u).stringify(this)},concat:function t(e){var r=this.words,n=e.words,i=this.sigBytes,o=e.sigBytes;if(this.clamp(),i%4)for(var s=0;s>>2]>>>24-s%4*8&255;r[i+s>>>2]|=a<<24-(i+s)%4*8}else for(s=0;s>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function t(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=r.ceil(n/4)},clone:function t(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function t(e){for(var n=[],i=0;i>>2]>>>24-o%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join(\"\")},parse:function t(e){for(var r=e.length,n=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new s.init(n,r/2)}},c=a.Latin1={stringify:function t(e){for(var r=e.words,n=e.sigBytes,i=[],o=0;o>>2]>>>24-o%4*8&255;i.push(String.fromCharCode(s))}return i.join(\"\")},parse:function t(e){for(var r=e.length,n=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new s.init(n,r)}},h=a.Utf8={stringify:function t(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(t){throw new Error(\"Malformed UTF-8 data\")}},parse:function t(e){return c.parse(unescape(encodeURIComponent(e)))}},l=i.BufferedBlockAlgorithm=o.extend({reset:function t(){this._data=new s.init,this._nDataBytes=0},_append:function t(e){\"string\"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function t(e){var n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,u=o/(4*a),c=(u=e?r.ceil(u):r.max((0|u)-this._minBufferSize,0))*a,h=r.min(4*c,o);if(c){for(var l=0;l>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;4>a&&o+.75*a>>6*(3-a)&63));if(r=i.charAt(64))for(;e.length%4;)e.push(r);return e.join(\"\")},parse:function t(r){var n=r.length,i=this._map;(o=i.charAt(64))&&(-1!=(o=r.indexOf(o))&&(n=o));for(var o=[],s=0,a=0;a>>6-a%4*2;o[s>>>2]|=(u|c)<<24-s%4*8,s++}return e.create(o,s)},_map:\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"}}(),function(t){for(var e=v,r=(i=e.lib).WordArray,n=i.Hasher,i=e.algo,o=[],s=[],a=function t(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var h;t:{h=u;for(var l=t.sqrt(h),f=2;f<=l;f++)if(!(h%f)){h=!1;break t}h=!0}h&&(8>c&&(o[c]=a(t.pow(u,.5))),s[c]=a(t.pow(u,1/3)),c++),u++}var g=[];i=i.SHA256=n.extend({_doReset:function t(){this._hash=new r.init(o.slice(0))},_doProcessBlock:function t(e,r){for(var n=this._hash.words,i=n[0],o=n[1],a=n[2],u=n[3],c=n[4],h=n[5],l=n[6],f=n[7],d=0;64>d;d++){if(16>d)g[d]=0|e[r+d];else{var p=g[d-15],v=g[d-2];g[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+g[d-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+g[d-16]}p=f+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&h^~c&l)+s[d]+g[d],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&o^i&a^o&a),f=l,l=h,h=c,c=u+p|0,u=a,a=o,o=i,i=p+v|0}n[0]=n[0]+i|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+u|0,n[4]=n[4]+c|0,n[5]=n[5]+h|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0},_doFinalize:function e(){var r=this._data,n=r.words,i=8*this._nDataBytes,o=8*r.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(i/4294967296),n[15+(o+64>>>9<<4)]=i,r.sigBytes=4*n.length,this._process(),this._hash},clone:function t(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA256=n._createHelper(i),e.HmacSHA256=n._createHmacHelper(i)}(Math),function(){function t(){return n.create.apply(n,arguments)}for(var e=v,r=e.lib.Hasher,n=(o=e.x64).Word,i=o.WordArray,o=e.algo,s=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();o=o.SHA512=r.extend({_doReset:function t(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function t(e,r){for(var n=(f=this._hash.words)[0],i=f[1],o=f[2],u=f[3],c=f[4],h=f[5],l=f[6],f=f[7],g=n.high,d=n.low,p=i.high,v=i.low,y=o.high,m=o.low,_=u.high,S=u.low,b=c.high,w=c.low,F=h.high,E=h.low,x=l.high,A=l.low,k=f.high,P=f.low,C=g,T=d,R=p,I=v,D=y,L=m,N=_,U=S,B=b,O=w,j=F,M=E,H=x,V=A,K=k,q=P,J=0;80>J;J++){var W=a[J];if(16>J)var z=W.high=0|e[r+2*J],Y=W.low=0|e[r+2*J+1];else{z=((Y=(z=a[J-15]).high)>>>1|(G=z.low)<<31)^(Y>>>8|G<<24)^Y>>>7;var G=(G>>>1|Y<<31)^(G>>>8|Y<<24)^(G>>>7|Y<<25),X=((Y=(X=a[J-2]).high)>>>19|($=X.low)<<13)^(Y<<3|$>>>29)^Y>>>6,$=($>>>19|Y<<13)^($<<3|Y>>>29)^($>>>6|Y<<26),Q=(Y=a[J-7]).high,Z=(tt=a[J-16]).high,tt=tt.low;z=(z=(z=z+Q+((Y=G+Y.low)>>>0>>0?1:0))+X+((Y=Y+$)>>>0<$>>>0?1:0))+Z+((Y=Y+tt)>>>0>>0?1:0);W.high=z,W.low=Y}Q=B&j^~B&H,tt=O&M^~O&V,W=C&R^C&D^R&D;var et=T&I^T&L^I&L,rt=(G=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),X=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),($=s[J]).high),nt=$.low;Z=K+((B>>>14|O<<18)^(B>>>18|O<<14)^(B<<23|O>>>9))+(($=q+((O>>>14|B<<18)^(O>>>18|B<<14)^(O<<23|B>>>9)))>>>0>>0?1:0),K=H,q=V,H=j,V=M,j=B,M=O,B=N+(Z=(Z=(Z=Z+Q+(($=$+tt)>>>0>>0?1:0))+rt+(($=$+nt)>>>0>>0?1:0))+z+(($=$+Y)>>>0>>0?1:0))+((O=U+$|0)>>>0>>0?1:0)|0,N=D,U=L,D=R,L=I,R=C,I=T,C=Z+(W=G+W+((Y=X+et)>>>0>>0?1:0))+((T=$+Y|0)>>>0<$>>>0?1:0)|0}d=n.low=d+T,n.high=g+C+(d>>>0>>0?1:0),v=i.low=v+I,i.high=p+R+(v>>>0>>0?1:0),m=o.low=m+L,o.high=y+D+(m>>>0>>0?1:0),S=u.low=S+U,u.high=_+N+(S>>>0>>0?1:0),w=c.low=w+O,c.high=b+B+(w>>>0>>0?1:0),E=h.low=E+M,h.high=F+j+(E>>>0>>0?1:0),A=l.low=A+V,l.high=x+H+(A>>>0>>0?1:0),P=f.low=P+q,f.high=k+K+(P>>>0>>0?1:0)},_doFinalize:function t(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),r[31+(i+128>>>10<<5)]=n,e.sigBytes=4*r.length,this._process(),this._hash.toX32()},clone:function t(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),e.SHA512=r._createHelper(o),e.HmacSHA512=r._createHmacHelper(o)}(),function(){var t=v,e=(i=t.x64).Word,r=i.WordArray,n=(i=t.algo).SHA512,i=i.SHA384=n.extend({_doReset:function t(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function t(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)}();\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nvar y,m=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";function _(t){var e,r,n=\"\";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=m.charAt(r>>6)+m.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=m.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=m.charAt(r>>2)+m.charAt((3&r)<<4)),\"=\";(3&n.length)>0;)n+=\"=\";return n}function S(t){var e,r,n,i=\"\",o=0;for(e=0;e>2),r=3&n,o=1):1==o?(i+=T(r<<2|n>>4),r=15&n,o=2):2==o?(i+=T(r),i+=T(n>>2),r=3&n,o=3):(i+=T(r<<2|n>>4),i+=T(15&n),o=0));return 1==o&&(i+=T(r<<2)),i}function b(t){var e,r=S(t),n=new Array;for(e=0;2*e>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i},y=30):\"Netscape\"!=d.appName?(w.prototype.am=function x(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},y=26):(w.prototype.am=function A(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i},y=28),w.prototype.DB=y,w.prototype.DM=(1<>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function L(t){this.m=t}function N(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function H(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function V(){}function K(t){return t}function q(t){this.r2=F(),this.q3=F(),w.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}L.prototype.convert=function J(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},L.prototype.revert=function W(t){return t},L.prototype.reduce=function z(t){t.divRemTo(this.m,null,t)},L.prototype.mulTo=function Y(t,e,r){t.multiplyTo(e,r),this.reduce(r)},L.prototype.sqrTo=function G(t,e){t.squareTo(e),this.reduce(e)},N.prototype.convert=function X(t){var e=F();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(w.ZERO)>0&&this.m.subTo(e,e),e},N.prototype.revert=function $(t){var e=F();return t.copyTo(e),this.reduce(e),e},N.prototype.reduce=function Q(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},N.prototype.mulTo=function Z(t,e,r){t.multiplyTo(e,r),this.reduce(r)},N.prototype.sqrTo=function tt(t,e){t.squareTo(e),this.reduce(e)},w.prototype.copyTo=function et(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},w.prototype.fromInt=function rt(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},w.prototype.fromString=function nt(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var s=8==r?255&t[n]:R(t,n);s<0?\"-\"==t.charAt(n)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-o):this[this.t-1]|=s<=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},w.prototype.dlShiftTo=function ot(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},w.prototype.drShiftTo=function st(t,e){for(var r=t;r=0;--r)e[r+s+1]=this[r]>>i|a,a=(this[r]&o)<=0;--r)e[r]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},w.prototype.rShiftTo=function ut(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(e[this.t-r-1]|=(this.s&o)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},w.prototype.multiplyTo=function ht(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},w.prototype.divRemTo=function ft(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,h=o[c-1];if(0!=h){var l=h*(1<1?o[c-2]>>this.F2:0),f=this.FV/l,g=(1<=0&&(r[r.t++]=1,r.subTo(y,r)),w.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t=0;){var m=r[--p]==h?this.DM:Math.floor(r[p]*f+(r[p-1]+d)*g);if((r[p]+=o.am(0,m,r,v,0,c))0&&r.rShiftTo(u,r),s<0&&w.ZERO.subTo(r,r)}}},w.prototype.invDigit=function gt(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},w.prototype.isEven=function dt(){return 0==(this.t>0?1&this[0]:this.s)},w.prototype.exp=function pt(t,e){if(t>4294967295||t<1)return w.ONE;var r=F(),n=F(),i=e.convert(this),o=D(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)},w.prototype.toString=function vt(t){if(this.s<0)return\"-\"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=T(r));s>=0;)a>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=T(r));return i?o:\"0\"},w.prototype.negate=function yt(){var t=F();return w.ZERO.subTo(this,t),t},w.prototype.abs=function mt(){return this.s<0?this.negate():this},w.prototype.compareTo=function _t(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},w.prototype.bitLength=function St(){return this.t<=0?0:this.DB*(this.t-1)+D(this[this.t-1]^this.s&this.DM)},w.prototype.mod=function bt(t){var e=F();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(w.ZERO)>0&&t.subTo(e,e),e},w.prototype.modPowInt=function wt(t,e){var r;return r=t<256||e.isEven()?new L(e):new N(e),this.exp(t,r)},w.ZERO=I(0),w.ONE=I(1),V.prototype.convert=K,V.prototype.revert=K,V.prototype.mulTo=function Ft(t,e,r){t.multiplyTo(e,r)},V.prototype.sqrTo=function Et(t,e){t.squareTo(e)},q.prototype.convert=function xt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=F();return t.copyTo(e),this.reduce(e),e},q.prototype.revert=function At(t){return t},q.prototype.reduce=function kt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},q.prototype.mulTo=function Pt(t,e,r){t.multiplyTo(e,r),this.reduce(r)},q.prototype.sqrTo=function Ct(t,e){t.squareTo(e),this.reduce(e)};var Tt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Rt=(1<<26)/Tt[Tt.length-1];\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nfunction It(){this.i=0,this.j=0,this.S=new Array}w.prototype.chunkSize=function Dt(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},w.prototype.toRadix=function Lt(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return\"0\";var e=this.chunkSize(t),r=Math.pow(t,e),n=I(r),i=F(),o=F(),s=\"\";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s},w.prototype.fromRadix=function Nt(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&w.ZERO.subTo(this,this)},w.prototype.fromNumber=function Ut(t,e,r){if(\"number\"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(w.ONE.shiftLeft(t-1),B,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(w.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},w.prototype.dMultiply=function Mt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},w.prototype.dAddOffset=function Ht(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},w.prototype.multiplyLowerTo=function Vt(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i=0;)r[n]=0;for(n=Math.max(e-this.t,0);n0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},w.prototype.millerRabin=function Jt(t){var e=this.subtract(w.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>Tt.length&&(t=Tt.length);for(var i=F(),o=0;o>24},w.prototype.shortValue=function Gt(){return 0==this.t?this.s:this[0]<<16>>16},w.prototype.signum=function Xt(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},w.prototype.toByteArray=function $t(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<=0;)n<8?(r=(this[t]&(1<>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},w.prototype.equals=function Qt(t){return 0==this.compareTo(t)},w.prototype.min=function Zt(t){return this.compareTo(t)<0?this:t},w.prototype.max=function te(t){return this.compareTo(t)>0?this:t},w.prototype.and=function ee(t){var e=F();return this.bitwiseTo(t,U,e),e},w.prototype.or=function re(t){var e=F();return this.bitwiseTo(t,B,e),e},w.prototype.xor=function ne(t){var e=F();return this.bitwiseTo(t,O,e),e},w.prototype.andNot=function ie(t){var e=F();return this.bitwiseTo(t,j,e),e},w.prototype.not=function oe(){for(var t=F(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var h=F();for(n.sqrTo(s[1],h);a<=c;)s[a]=F(),n.mulTo(h,s[a-2],s[a]),a+=2}var l,f,g=t.t-1,d=!0,p=F();for(i=D(t[g])-1;g>=0;){for(i>=u?l=t[g]>>i-u&c:(l=(t[g]&(1<0&&(l|=t[g-1]>>this.DB+i-u)),a=r;0==(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--g),d)s[l].copyTo(o),d=!1;else{for(;a>1;)n.sqrTo(o,p),n.sqrTo(p,o),a-=2;a>0?n.sqrTo(o,p):(f=o,o=p,p=f),n.mulTo(p,s[l],o)}for(;g>=0&&0==(t[g]&1<=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}return 0!=n.compareTo(w.ONE)?w.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},w.prototype.pow=function we(t){return this.exp(t,new V)},w.prototype.gcd=function Fe(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},w.prototype.isProbablePrime=function Ee(t){var e,r=this.abs();if(1==r.t&&r[0]<=Tt[Tt.length-1]){for(e=0;e>8&255,Ce[Te++]^=e>>16&255,Ce[Te++]^=e>>24&255,Te>=256&&(Te-=256)}((new Date).getTime())}if(null==Ce){var Ie;if(Ce=new Array,Te=0,void 0!==p&&(void 0!==p.crypto||void 0!==p.msCrypto)){var De=p.crypto||p.msCrypto;if(De.getRandomValues){var Le=new Uint8Array(32);for(De.getRandomValues(Le),Ie=0;Ie<32;++Ie)Ce[Te++]=Le[Ie]}else if(\"Netscape\"==d.appName&&d.appVersion<\"5\"){var Ne=p.crypto.random(32);for(Ie=0;Ie>>8,Ce[Te++]=255&Ie;Te=0,Re()}function Ue(){if(null==Pe){for(Re(),(Pe=function t(){return new It}()).init(Ce),Te=0;Te>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function Me(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}\n/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/\n */\nfunction He(t,e){this.x=e,this.q=t}function Ve(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=null==n?w.ONE:n,this.zinv=null}function Ke(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new Ve(this,null,null)}Be.prototype.nextBytes=function qe(t){var e;for(e=0;e0&&e.length>0))throw\"Invalid RSA public key\";this.n=Oe(t,16),this.e=parseInt(e,16)}},Me.prototype.encrypt=function ze(t){var e=function r(t,e){if(e=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new Be,s=new Array;e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new w(r)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var i=n.toString(16);return 0==(1&i.length)?i:\"0\"+i},Me.prototype.encryptOAEP=function Ye(t,e,r){var n=function i(t,e,r,n){var i=Sr.crypto.MessageDigest,o=Sr.crypto.Util,s=null;if(r||(r=\"sha1\"),\"string\"==typeof r&&(s=i.getCanonicalAlgName(r),n=i.getHashLength(s),r=function t(e){return Lr(o.hashHex(Nr(e),s))}),t.length+2*n+2>e)throw\"Message too long for RSA\";var a,u=\"\";for(a=0;a>3,e,r);if(null==n)return null;var o=this.doPublic(n);if(null==o)return null;var s=o.toString(16);return 0==(1&s.length)?s:\"0\"+s},Me.prototype.type=\"RSA\",He.prototype.equals=function Ge(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},He.prototype.toBigInteger=function Xe(){return this.x},He.prototype.negate=function $e(){return new He(this.q,this.x.negate().mod(this.q))},He.prototype.add=function Qe(t){return new He(this.q,this.x.add(t.toBigInteger()).mod(this.q))},He.prototype.subtract=function Ze(t){return new He(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},He.prototype.multiply=function tr(t){return new He(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},He.prototype.square=function er(){return new He(this.q,this.x.square().mod(this.q))},He.prototype.divide=function rr(t){return new He(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},Ve.prototype.getX=function nr(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ve.prototype.getY=function ir(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ve.prototype.equals=function or(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(w.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(w.ZERO))},Ve.prototype.isInfinity=function sr(){return null==this.x&&null==this.y||this.z.equals(w.ZERO)&&!this.y.toBigInteger().equals(w.ZERO)},Ve.prototype.negate=function ar(){return new Ve(this.curve,this.x,this.y.negate(),this.z)},Ve.prototype.add=function ur(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(w.ZERO.equals(r))return w.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new w(\"3\"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),a=s.multiply(r),u=i.multiply(s),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(r).mod(this.curve.q),l=u.multiply(n).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),f=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new Ve(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(l),f)},Ve.prototype.twice=function cr(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new w(\"3\"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);w.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=s.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Ve(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},Ve.prototype.multiply=function hr(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new w(\"3\")),i=this.negate(),o=this,s=this.curve.q.subtract(t),a=s.multiply(new w(\"3\")),u=new Ve(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>0;--e){o=o.twice();var h=n.testBit(e);h!=r.testBit(e)&&(o=o.add(h?this:i))}for(e=a.bitLength()-2;e>0;--e){u=u.twice();var l=a.testBit(e);l!=s.testBit(e)&&(u=u.add(l?u:c))}return o},Ve.prototype.multiplyTwo=function lr(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(o):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i},Ke.prototype.getQ=function fr(){return this.q},Ke.prototype.getA=function gr(){return this.a},Ke.prototype.getB=function dr(){return this.b},Ke.prototype.equals=function pr(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},Ke.prototype.getInfinity=function vr(){return this.infinity},Ke.prototype.fromBigInteger=function yr(t){return new He(this.q,t)},Ke.prototype.decodePointHex=function mr(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),n=t.substr(e+2,e);return new Ve(this,this.fromBigInteger(new w(r,16)),this.fromBigInteger(new w(n,16)));default:return null}},\n/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib\n */\nHe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},Ve.prototype.getEncoded=function(t){var e=function t(e,r){var n=e.toByteArrayUnsigned();if(rn.length;)n.unshift(0);return n},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},Ve.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var o=new w(n),s=new w(i);return new Ve(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ve.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),o=new w(n,16),s=new w(i,16);return new Ve(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ve.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y).divide(e),n=r.square().subtract(this.x).subtract(t.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ve(this.curve,n,i)},Ve.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(w.valueOf(2)),e=this.curve.fromBigInteger(w.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new Ve(this.curve,n,i)},Ve.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new w(\"3\")),i=this.negate(),o=this;for(e=n.bitLength()-2;e>0;--e){o=o.twice();var s=n.testBit(e);s!=r.testBit(e)&&(o=o.add2D(s?this:i))}return o},Ve.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),o=e.multiply(e).mod(i),s=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return o.equals(s)},Ve.prototype.toString=function(){return\"(\"+this.getX().toBigInteger().toString()+\",\"+this.getY().toBigInteger().toString()+\")\"},Ve.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error(\"Point is at infinity.\");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(w.ONE)<0||e.compareTo(t.subtract(w.ONE))>0)throw new Error(\"x coordinate out of bounds\");if(r.compareTo(w.ONE)<0||r.compareTo(t.subtract(w.ONE))>0)throw new Error(\"y coordinate out of bounds\");if(!this.isOnCurve())throw new Error(\"Point is not on the curve.\");if(this.multiply(t).isInfinity())throw new Error(\"Point is not a scalar multiple of G.\");return!0};\n/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval\n */\nvar _r=function(){var t=new RegExp('(?:false|true|null|[\\\\{\\\\}\\\\[\\\\]]|(?:-?\\\\b(?:0|[1-9][0-9]*)(?:\\\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\\\b)|(?:\"(?:[^\\\\0-\\\\x08\\\\x0a-\\\\x1f\"\\\\\\\\]|\\\\\\\\(?:[\"/\\\\\\\\bfnrt]|u[0-9A-Fa-f]{4}))*\"))',\"g\"),e=new RegExp(\"\\\\\\\\(?:([^u])|u(.{4}))\",\"g\"),r={'\"':'\"',\"/\":\"/\",\"\\\\\":\"\\\\\",b:\"\\b\",f:\"\\f\",n:\"\\n\",r:\"\\r\",t:\"\\t\"};function n(t,e,n){return e?r[e]:String.fromCharCode(parseInt(n,16))}var i=new String(\"\"),o=Object.hasOwnProperty;return function(r,s){var a,u,c=r.match(t),h=c[0],l=!1;\"{\"===h?a={}:\"[\"===h?a=[]:(a=[],l=!0);for(var f=[a],d=1-l,p=c.length;d=0;)delete n[i[c]]}return s.call(e,r,n)}({\"\":a},\"\")}return a}}();void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.asn1&&Sr.asn1||(Sr.asn1={}),Sr.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e=\"0\"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if(\"-\"!=e.substr(0,1))e.length%2==1?e=\"0\"+e:e.match(/^[0-7]/)||(e=\"00\"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n=\"\",i=0;i15)throw\"ASN.1 length too long to represent by 8x: n = \"+t.toString(16);return(128+r).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return\"\"},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},Sr.asn1.DERAbstractString=function(t){Sr.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=Ir(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(\"string\"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Zr(Sr.asn1.DERAbstractString,Sr.asn1.ASN1Object),Sr.asn1.DERAbstractTime=function(t){Sr.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());\"utc\"==e&&(o=o.substr(2,2));var s=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var u=n(String(a),3);s=s+\".\"+(u=u.replace(/[0]+$/,\"\"))}}return s+\"Z\"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join(\"0\")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=kr(t)},this.setByDateValue=function(t,e,r,n,i,o){var s=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},Zr(Sr.asn1.DERAbstractTime,Sr.asn1.ASN1Object),Sr.asn1.DERAbstractStructured=function(t){Sr.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Zr(Sr.asn1.DERAbstractStructured,Sr.asn1.ASN1Object),Sr.asn1.DERBoolean=function(t){Sr.asn1.DERBoolean.superclass.constructor.call(this),this.hT=\"01\",this.hTLV=0==t?\"010100\":\"0101ff\"},Zr(Sr.asn1.DERBoolean,Sr.asn1.ASN1Object),Sr.asn1.DERInteger=function(t){Sr.asn1.DERInteger.superclass.constructor.call(this),this.hT=\"02\",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Sr.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new w(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):\"number\"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Zr(Sr.asn1.DERInteger,Sr.asn1.ASN1Object),Sr.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Sr.asn1.ASN1Util.newObject(t.obj);t.hex=\"00\"+e.getEncodedHex()}Sr.asn1.DERBitString.superclass.constructor.call(this),this.hT=\"03\",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7i.length&&(i=n[r]);return(t=t.replace(i,\"::\")).slice(1,-1)}function zr(t){var e=\"malformed hex value\";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?Wr(t):t;try{return parseInt(t.substr(0,2),16)+\".\"+parseInt(t.substr(2,2),16)+\".\"+parseInt(t.substr(4,2),16)+\".\"+parseInt(t.substr(6,2),16)}catch(t){throw e}}function Yr(t){return t.match(/.{4}/g).map((function e(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return Dr((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return Dr((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))})).join(\"\")}function Gr(t){for(var e=encodeURIComponent(t),r=\"\",n=0;n\"7\"?\"00\"+t:t}Fr.getLblen=function(t,e){if(\"8\"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0=n)break}return s},Fr.getNthChildIdx=function(t,e,r){return Fr.getChildIdx(t,e)[r]},Fr.getIdxbyList=function(t,e,r,n){var i,o,s=Fr;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[i],r,n)},Fr.getIdxbyListEx=function(t,e,r,n){var i,o,s=Fr;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u=t.length?null:i.getTLV(t,o)},Fr.getTLVbyListEx=function(t,e,r,n){var i=Fr,o=i.getIdxbyListEx(t,e,r,n);return-1==o?null:i.getTLV(t,o)},Fr.getVbyList=function(t,e,r,n,i){var o,s,a=Fr;return-1==(o=a.getIdxbyList(t,e,r,n))||o>=t.length?null:(s=a.getV(t,o),!0===i&&(s=s.substr(2)),s)},Fr.getVbyListEx=function(t,e,r,n,i){var o,s,a=Fr;return-1==(o=a.getIdxbyListEx(t,e,r,n))?null:(s=a.getV(t,o),\"03\"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},Fr.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if(\"02\"!=n&&\"03\"!=n)return r;var i=Fr.getV(t,e);return\"02\"==n?parseInt(i,16):function o(t){try{var e=t.substr(0,2);if(\"00\"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16),n=t.substr(2),i=parseInt(n,16).toString(2);return\"0\"==i&&(i=\"00000000\"),i=i.slice(0,0-r),parseInt(i,2)}catch(t){return-1}}(i)}catch(t){return r}},Fr.getOID=function(t,e,r){null==r&&(r=null);try{return\"06\"!=t.substr(e,2)?r:function n(t){if(!Xr(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),o=[],s=0;s0&&(c=c+\".\"+a.join(\".\")),c}catch(t){return null}}(Fr.getV(t,e))}catch(t){return r}},Fr.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=Fr.getOID(t,e,r);if(n==r)return r;var i=Sr.asn1.x509.OID.oid2name(n);return\"\"==i?n:i}catch(t){return r}},Fr.getString=function(t,e,r){null==r&&(r=null);try{return Lr(Fr.getV(t,e))}catch(t){return r}},Fr.hextooidstr=function(t){var e=function t(e,r){return e.length>=r?e:new Array(r-e.length+1).join(\"0\")+e},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=t.substr(2),s=[],a=0;a0&&(h=h+\".\"+u.join(\".\")),h},Fr.dump=function(t,e,r,n){var i=Fr,o=i.getV,s=i.dump,a=i.getChildIdx,u=t;t instanceof Sr.asn1.ASN1Object&&(u=t.getEncodedHex());var c=function t(e,r){return e.length<=2*r?e:e.substr(0,r)+\"..(total \"+e.length/2+\"bytes)..\"+e.substr(e.length-r,r)};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n=\"\");var h,l=e.ommit_long_octet;if(\"01\"==(h=u.substr(r,2)))return\"00\"==(f=o(u,r))?n+\"BOOLEAN FALSE\\n\":n+\"BOOLEAN TRUE\\n\";if(\"02\"==h)return n+\"INTEGER \"+c(f=o(u,r),l)+\"\\n\";if(\"03\"==h){var f=o(u,r);if(i.isASN1HEX(f.substr(2))){var g=n+\"BITSTRING, encapsulates\\n\";return g+=s(f.substr(2),e,0,n+\" \")}return n+\"BITSTRING \"+c(f,l)+\"\\n\"}if(\"04\"==h){f=o(u,r);if(i.isASN1HEX(f)){g=n+\"OCTETSTRING, encapsulates\\n\";return g+=s(f,e,0,n+\" \")}return n+\"OCTETSTRING \"+c(f,l)+\"\\n\"}if(\"05\"==h)return n+\"NULL\\n\";if(\"06\"==h){var d=o(u,r),p=Sr.asn1.ASN1Util.oidHexToInt(d),v=Sr.asn1.x509.OID.oid2name(p),y=p.replace(/\\./g,\" \");return\"\"!=v?n+\"ObjectIdentifier \"+v+\" (\"+y+\")\\n\":n+\"ObjectIdentifier (\"+y+\")\\n\"}if(\"0a\"==h)return n+\"ENUMERATED \"+parseInt(o(u,r))+\"\\n\";if(\"0c\"==h)return n+\"UTF8String '\"+Dr(o(u,r))+\"'\\n\";if(\"13\"==h)return n+\"PrintableString '\"+Dr(o(u,r))+\"'\\n\";if(\"14\"==h)return n+\"TeletexString '\"+Dr(o(u,r))+\"'\\n\";if(\"16\"==h)return n+\"IA5String '\"+Dr(o(u,r))+\"'\\n\";if(\"17\"==h)return n+\"UTCTime \"+Dr(o(u,r))+\"\\n\";if(\"18\"==h)return n+\"GeneralizedTime \"+Dr(o(u,r))+\"\\n\";if(\"1a\"==h)return n+\"VisualString '\"+Dr(o(u,r))+\"'\\n\";if(\"1e\"==h)return n+\"BMPString '\"+Yr(o(u,r))+\"'\\n\";if(\"30\"==h){if(\"3000\"==u.substr(r,4))return n+\"SEQUENCE {}\\n\";g=n+\"SEQUENCE\\n\";var m=e;if((2==(b=a(u,r)).length||3==b.length)&&\"06\"==u.substr(b[0],2)&&\"04\"==u.substr(b[b.length-1],2)){v=i.oidname(o(u,b[0]));var _=JSON.parse(JSON.stringify(e));_.x509ExtName=v,m=_}for(var S=0;S31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},Fr.isASN1HEX=function(t){var e=Fr;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},Fr.checkStrictDER=function(t,e,r,n,i){var o=Fr;if(void 0===r){if(\"string\"!=typeof t)throw new Error(\"not hex string\");if(t=t.toLowerCase(),!Sr.lang.String.isHex(t))throw new Error(\"not hex string\");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(t,e).length>2*i)throw new Error(\"L of TLV too long: idx=\"+e);var s=o.getVblen(t,e);if(s>n)throw new Error(\"value of L too long than hex: idx=\"+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error(\"V string length and L's value not the same:\"+u+\"/\"+2*s);if(0===e&&t.length!=a.length)throw new Error(\"total length and TLV length unmatch:\"+t.length+\"!=\"+a.length);var c=t.substr(e,2);if(\"02\"===c){var h=o.getVidx(t,e);if(\"00\"==t.substr(h,2)&&t.charCodeAt(h+2)<56)throw new Error(\"not least zeros for DER INTEGER\")}if(32&parseInt(c,16)){for(var l=o.getVblen(t,e),f=0,g=o.getChildIdx(t,e),d=0;d=r?e:new Array(r-e.length+1).join(n)+e};function Zr(t,e){var r=function t(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.crypto&&Sr.crypto||(Sr.crypto={}),Sr.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:\"3021300906052b0e03021a05000414\",sha224:\"302d300d06096086480165030402040500041c\",sha256:\"3031300d060960864801650304020105000420\",sha384:\"3041300d060960864801650304020205000430\",sha512:\"3051300d060960864801650304020305000440\",md2:\"3020300c06082a864886f70d020205000410\",md5:\"3020300c06082a864886f70d020505000410\",ripemd160:\"3021300906052b2403020105000414\"},this.DEFAULTPROVIDER={md5:\"cryptojs\",sha1:\"cryptojs\",sha224:\"cryptojs\",sha256:\"cryptojs\",sha384:\"cryptojs\",sha512:\"cryptojs\",ripemd160:\"cryptojs\",hmacmd5:\"cryptojs\",hmacsha1:\"cryptojs\",hmacsha224:\"cryptojs\",hmacsha256:\"cryptojs\",hmacsha384:\"cryptojs\",hmacsha512:\"cryptojs\",hmacripemd160:\"cryptojs\",MD5withRSA:\"cryptojs/jsrsa\",SHA1withRSA:\"cryptojs/jsrsa\",SHA224withRSA:\"cryptojs/jsrsa\",SHA256withRSA:\"cryptojs/jsrsa\",SHA384withRSA:\"cryptojs/jsrsa\",SHA512withRSA:\"cryptojs/jsrsa\",RIPEMD160withRSA:\"cryptojs/jsrsa\",MD5withECDSA:\"cryptojs/jsrsa\",SHA1withECDSA:\"cryptojs/jsrsa\",SHA224withECDSA:\"cryptojs/jsrsa\",SHA256withECDSA:\"cryptojs/jsrsa\",SHA384withECDSA:\"cryptojs/jsrsa\",SHA512withECDSA:\"cryptojs/jsrsa\",RIPEMD160withECDSA:\"cryptojs/jsrsa\",SHA1withDSA:\"cryptojs/jsrsa\",SHA224withDSA:\"cryptojs/jsrsa\",SHA256withDSA:\"cryptojs/jsrsa\",MD5withRSAandMGF1:\"cryptojs/jsrsa\",SHAwithRSAandMGF1:\"cryptojs/jsrsa\",SHA1withRSAandMGF1:\"cryptojs/jsrsa\",SHA224withRSAandMGF1:\"cryptojs/jsrsa\",SHA256withRSAandMGF1:\"cryptojs/jsrsa\",SHA384withRSAandMGF1:\"cryptojs/jsrsa\",SHA512withRSAandMGF1:\"cryptojs/jsrsa\",RIPEMD160withRSAandMGF1:\"cryptojs/jsrsa\"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:v.algo.MD5,sha1:v.algo.SHA1,sha224:v.algo.SHA224,sha256:v.algo.SHA256,sha384:v.algo.SHA384,sha512:v.algo.SHA512,ripemd160:v.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw\"alg not supported in Util.DIGESTINFOHEAD: \"+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw\"key is too short for SigAlg: keylen=\"+r+\",\"+e;for(var o=\"0001\",s=\"00\"+n,a=\"\",u=i-o.length-s.length,c=0;c=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(o)>=0)return!1;var a=n.modInverse(o),u=t.multiply(a).mod(o),c=e.multiply(a).mod(o);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(o).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),n=e.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error(\"Signature not a valid DERSequence\");if(2!=t[e=2])throw new Error(\"First element in signature must be a DERInteger\");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error(\"Second element in signature must be a DERInteger\");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw\"Signature has the wrong length\";var e=t[0]-27;if(e<0||e>7)throw\"Invalid signature type\";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===c(t))throw new Error(\"not ASN.1 hex string\");var e,r,n;try{e=u(t,0,[\"[0]\",0],\"06\"),r=u(t,0,[1],\"04\");try{n=u(t,0,[\"[1]\",0],\"03\")}catch(t){}}catch(t){throw new Error(\"malformed PKCS#1/5 plain ECC private key\")}if(this.curveName=s(e),void 0===this.curveName)throw\"unsupported curve name\";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===c(t))throw new e(\"not ASN.1 hex string\");var r,n,i;try{u(t,0,[1,0],\"06\"),r=u(t,0,[1,1],\"06\"),n=u(t,0,[2,0,1],\"04\");try{i=u(t,0,[2,0,\"[1]\",0],\"03\")}catch(t){}}catch(t){throw new e(\"malformed PKCS#8 plain ECC private key\")}if(this.curveName=s(r),void 0===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===c(t))throw new e(\"not ASN.1 hex string\");var r,n;try{u(t,0,[0,0],\"06\"),r=u(t,0,[0,1],\"06\"),n=u(t,0,[1],\"03\")}catch(t){throw new e(\"malformed PKCS#8 ECC public key\")}if(this.curveName=s(r),null===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===c(t))throw new e(\"not ASN.1 hex string\");var n,i;try{n=u(t,0,[0,5,0,1],\"06\"),i=u(t,0,[0,5,1],\"03\")}catch(t){throw new e(\"malformed X.509 certificate ECC public key\")}if(this.curveName=s(n),null===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName=\"secp256r1\"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},Sr.crypto.ECDSA.parseSigHex=function(t){var e=Sr.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new w(e.r,16),s:new w(e.s,16)}},Sr.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=Fr,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),\"30\"!=t.substr(0,2))throw new Error(\"signature is not a ASN.1 sequence\");var i=r(t,0);if(2!=i.length)throw new Error(\"signature shall have two elements\");var o=i[0],s=i[1];if(\"02\"!=t.substr(o,2))throw new Error(\"1st item not ASN.1 integer\");if(\"02\"!=t.substr(s,2))throw new Error(\"2nd item not ASN.1 integer\");return{r:n(t,o),s:n(t,s)}},Sr.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=Sr.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if(\"00\"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),\"00\"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r=\"00\"+r),n.length%32==30&&(n=\"00\"+n),r.length%32!=0)throw\"unknown ECDSA sig r length error\";if(n.length%32!=0)throw\"unknown ECDSA sig s length error\";return r+n},Sr.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw\"unknown ECDSA concatinated r-s sig length error\";var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return Sr.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},Sr.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new w(t,16),n=new w(e,16);return Sr.crypto.ECDSA.biRSSigToASN1Sig(r,n)},Sr.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=Sr.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).getEncodedHex()},Sr.crypto.ECDSA.getName=function(t){return\"2b8104001f\"===t?\"secp192k1\":\"2a8648ce3d030107\"===t?\"secp256r1\":\"2b8104000a\"===t?\"secp256k1\":\"2b81040021\"===t?\"secp224r1\":\"2b81040022\"===t?\"secp384r1\":-1!==\"|secp256r1|NIST P-256|P-256|prime256v1|\".indexOf(t)?\"secp256r1\":-1!==\"|secp256k1|\".indexOf(t)?\"secp256k1\":-1!==\"|secp224r1|NIST P-224|P-224|\".indexOf(t)?\"secp224r1\":-1!==\"|secp384r1|NIST P-384|P-384|\".indexOf(t)?\"secp384r1\":null},void 0!==Sr&&Sr||(e.KJUR=Sr={}),void 0!==Sr.crypto&&Sr.crypto||(Sr.crypto={}),Sr.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new w(t,16)}this.getByName=function(r){var n=r;if(void 0!==e[n]&&(n=e[r]),void 0!==t[n])return t[n];throw\"unregistered EC curve name: \"+n},this.regist=function(n,i,o,s,a,u,c,h,l,f,g,d){t[n]={};var p=r(o),v=r(s),y=r(a),m=r(u),_=r(c),S=new Ke(p,v,y),b=S.decodePointHex(\"04\"+h+l);t[n].name=n,t[n].keylen=i,t[n].curve=S,t[n].G=b,t[n].n=m,t[n].h=_,t[n].oid=g,t[n].info=d;for(var w=0;w=2*u)break}var f={};return f.keyhex=c.substr(0,2*i[e].keylen),f.ivhex=c.substr(2*i[e].keylen,2*i[e].ivlen),f},a=function t(e,r,n,o){var s=v.enc.Base64.parse(e),a=v.enc.Hex.stringify(s);return(0,i[r].proc)(a,n,o)};return{version:\"1.0.0\",parsePKCS5PEM:function t(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function t(e,r,n){return s(e,r,n)},decryptKeyB64:function t(e,r,n,i){return a(e,r,n,i)},getDecryptedKeyHex:function t(e,r){var n=o(e),i=(n.type,n.cipher),u=n.ivsalt,c=n.data,h=s(i,r,u).keyhex;return a(c,i,h,u)},getEncryptedPKCS5PEMFromPrvKeyHex:function t(e,r,n,o,a){var u=\"\";if(void 0!==o&&null!=o||(o=\"AES-256-CBC\"),void 0===i[o])throw new Error(\"KEYUTIL unsupported algorithm: \"+o);void 0!==a&&null!=a||(a=function t(e){var r=v.lib.WordArray.random(e);return v.enc.Hex.stringify(r)}(i[o].ivlen).toUpperCase());var c=function t(e,r,n,o){return(0,i[r].eproc)(e,n,o)}(r,o,s(o,n,a).keyhex,a);u=\"-----BEGIN \"+e+\" PRIVATE KEY-----\\r\\n\";return u+=\"Proc-Type: 4,ENCRYPTED\\r\\n\",u+=\"DEK-Info: \"+o+\",\"+a+\"\\r\\n\",u+=\"\\r\\n\",u+=c.replace(/(.{64})/g,\"$1\\r\\n\"),u+=\"\\r\\n-----END \"+e+\" PRIVATE KEY-----\\r\\n\"},parseHexOfEncryptedPKCS8:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={},s=n(e,0);if(2!=s.length)throw new Error(\"malformed format: SEQUENCE(0).items != 2: \"+s.length);o.ciphertext=i(e,s[1]);var a=n(e,s[0]);if(2!=a.length)throw new Error(\"malformed format: SEQUENCE(0.0).items != 2: \"+a.length);if(\"2a864886f70d01050d\"!=i(e,a[0]))throw new Error(\"this only supports pkcs5PBES2\");var u=n(e,a[1]);if(2!=a.length)throw new Error(\"malformed format: SEQUENCE(0.0.1).items != 2: \"+u.length);var c=n(e,u[1]);if(2!=c.length)throw new Error(\"malformed format: SEQUENCE(0.0.1.1).items != 2: \"+c.length);if(\"2a864886f70d0307\"!=i(e,c[0]))throw\"this only supports TripleDES\";o.encryptionSchemeAlg=\"TripleDES\",o.encryptionSchemeIV=i(e,c[1]);var h=n(e,u[0]);if(2!=h.length)throw new Error(\"malformed format: SEQUENCE(0.0.1.0).items != 2: \"+h.length);if(\"2a864886f70d01050c\"!=i(e,h[0]))throw new Error(\"this only supports pkcs5PBKDF2\");var l=n(e,h[1]);if(l.length<2)throw new Error(\"malformed format: SEQUENCE(0.0.1.0.1).items < 2: \"+l.length);o.pbkdf2Salt=i(e,l[0]);var f=i(e,l[1]);try{o.pbkdf2Iter=parseInt(f,16)}catch(t){throw new Error(\"malformed format pbkdf2Iter: \"+f)}return o},getPBKDF2KeyHexFromParam:function t(e,r){var n=v.enc.Hex.parse(e.pbkdf2Salt),i=e.pbkdf2Iter,o=v.PBKDF2(r,n,{keySize:6,iterations:i});return v.enc.Hex.stringify(o)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function t(e,r){var n=Mr(e,\"ENCRYPTED PRIVATE KEY\"),i=this.parseHexOfEncryptedPKCS8(n),o=tn.getPBKDF2KeyHexFromParam(i,r),s={};s.ciphertext=v.enc.Hex.parse(i.ciphertext);var a=v.enc.Hex.parse(o),u=v.enc.Hex.parse(i.encryptionSchemeIV),c=v.TripleDES.decrypt(s,a,{iv:u});return v.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function t(e,r){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,r);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={algparam:null};if(\"30\"!=e.substr(0,2))throw new Error(\"malformed plain PKCS8 private key(code:001)\");var s=n(e,0);if(s.length<3)throw new Error(\"malformed plain PKCS8 private key(code:002)\");if(\"30\"!=e.substr(s[1],2))throw new Error(\"malformed PKCS8 private key(code:003)\");var a=n(e,s[1]);if(2!=a.length)throw new Error(\"malformed PKCS8 private key(code:004)\");if(\"06\"!=e.substr(a[0],2))throw new Error(\"malformed PKCS8 private key(code:005)\");if(o.algoid=i(e,a[0]),\"06\"==e.substr(a[1],2)&&(o.algparam=i(e,a[1])),\"04\"!=e.substr(s[2],2))throw new Error(\"malformed PKCS8 private key(code:006)\");return o.keyidx=r.getVidx(e,s[2]),o},getKeyFromPlainPrivatePKCS8PEM:function t(e){var r=Mr(e,\"PRIVATE KEY\");return this.getKeyFromPlainPrivatePKCS8Hex(r)},getKeyFromPlainPrivatePKCS8Hex:function t(e){var r,n=this.parsePlainPrivatePKCS8Hex(e);if(\"2a864886f70d010101\"==n.algoid)r=new Me;else if(\"2a8648ce380401\"==n.algoid)r=new Sr.crypto.DSA;else{if(\"2a8648ce3d0201\"!=n.algoid)throw new Error(\"unsupported private key algorithm\");r=new Sr.crypto.ECDSA}return r.readPKCS8PrvKeyHex(e),r},_getKeyFromPublicPKCS8Hex:function t(e){var r,n=Fr.getVbyList(e,0,[0,0],\"06\");if(\"2a864886f70d010101\"===n)r=new Me;else if(\"2a8648ce380401\"===n)r=new Sr.crypto.DSA;else{if(\"2a8648ce3d0201\"!==n)throw new Error(\"unsupported PKCS#8 public key hex\");r=new Sr.crypto.ECDSA}return r.readPKCS8PubKeyHex(e),r},parsePublicRawRSAKeyHex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={};if(\"30\"!=e.substr(0,2))throw new Error(\"malformed RSA key(code:001)\");var s=n(e,0);if(2!=s.length)throw new Error(\"malformed RSA key(code:002)\");if(\"02\"!=e.substr(s[0],2))throw new Error(\"malformed RSA key(code:003)\");if(o.n=i(e,s[0]),\"02\"!=e.substr(s[1],2))throw new Error(\"malformed RSA key(code:004)\");return o.e=i(e,s[1]),o},parsePublicPKCS8Hex:function t(e){var r=Fr,n=r.getChildIdx,i=r.getV,o={algparam:null},s=n(e,0);if(2!=s.length)throw new Error(\"outer DERSequence shall have 2 elements: \"+s.length);var a=s[0];if(\"30\"!=e.substr(a,2))throw new Error(\"malformed PKCS8 public key(code:001)\");var u=n(e,a);if(2!=u.length)throw new Error(\"malformed PKCS8 public key(code:002)\");if(\"06\"!=e.substr(u[0],2))throw new Error(\"malformed PKCS8 public key(code:003)\");if(o.algoid=i(e,u[0]),\"06\"==e.substr(u[1],2)?o.algparam=i(e,u[1]):\"30\"==e.substr(u[1],2)&&(o.algparam={},o.algparam.p=r.getVbyList(e,u[1],[0],\"02\"),o.algparam.q=r.getVbyList(e,u[1],[1],\"02\"),o.algparam.g=r.getVbyList(e,u[1],[2],\"02\")),\"03\"!=e.substr(s[1],2))throw new Error(\"malformed PKCS8 public key(code:004)\");return o.key=i(e,s[1]).substr(2),o}}}();tn.getKey=function(t,e,r){var n=(v=Fr).getChildIdx,i=(v.getV,v.getVbyList),o=Sr.crypto,s=o.ECDSA,a=o.DSA,u=Me,c=Mr,h=tn;if(void 0!==u&&t instanceof u)return t;if(void 0!==s&&t instanceof s)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new s({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new s({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(t.n,t.e),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(P=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(P=new u).setPrivate(t.n,t.e,t.d),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(P=new a).setPublic(t.p,t.q,t.g,t.y),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(P=new a).setPrivate(t.p,t.q,t.g,t.y,t.x),P;if(\"RSA\"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(Rr(t.n),Rr(t.e)),P;if(\"RSA\"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(P=new u).setPrivateEx(Rr(t.n),Rr(t.e),Rr(t.d),Rr(t.p),Rr(t.q),Rr(t.dp),Rr(t.dq),Rr(t.qi)),P;if(\"RSA\"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(P=new u).setPrivate(Rr(t.n),Rr(t.e),Rr(t.d)),P;if(\"EC\"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(k=new s({curve:t.crv})).ecparams.keylen/4,f=\"04\"+(\"0000000000\"+Rr(t.x)).slice(-l)+(\"0000000000\"+Rr(t.y)).slice(-l);return k.setPublicKeyHex(f),k}if(\"EC\"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(k=new s({curve:t.crv})).ecparams.keylen/4,f=\"04\"+(\"0000000000\"+Rr(t.x)).slice(-l)+(\"0000000000\"+Rr(t.y)).slice(-l);var g=(\"0000000000\"+Rr(t.d)).slice(-l);return k.setPublicKeyHex(f),k.setPrivateKeyHex(g),k}if(\"pkcs5prv\"===r){var d,p=t,v=Fr;if(9===(d=n(p,0)).length)(P=new u).readPKCS5PrvKeyHex(p);else if(6===d.length)(P=new a).readPKCS5PrvKeyHex(p);else{if(!(d.length>2&&\"04\"===p.substr(d[1],2)))throw new Error(\"unsupported PKCS#1/5 hexadecimal key\");(P=new s).readPKCS5PrvKeyHex(p)}return P}if(\"pkcs8prv\"===r)return P=h.getKeyFromPlainPrivatePKCS8Hex(t);if(\"pkcs8pub\"===r)return h._getKeyFromPublicPKCS8Hex(t);if(\"x509pub\"===r)return on.getPublicKeyFromCertHex(t);if(-1!=t.indexOf(\"-END CERTIFICATE-\",0)||-1!=t.indexOf(\"-END X509 CERTIFICATE-\",0)||-1!=t.indexOf(\"-END TRUSTED CERTIFICATE-\",0))return on.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf(\"-END PUBLIC KEY-\")){var y=Mr(t,\"PUBLIC KEY\");return h._getKeyFromPublicPKCS8Hex(y)}if(-1!=t.indexOf(\"-END RSA PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){var m=c(t,\"RSA PRIVATE KEY\");return h.getKey(m,null,\"pkcs5prv\")}if(-1!=t.indexOf(\"-END DSA PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){var _=i(R=c(t,\"DSA PRIVATE KEY\"),0,[1],\"02\"),S=i(R,0,[2],\"02\"),b=i(R,0,[3],\"02\"),F=i(R,0,[4],\"02\"),E=i(R,0,[5],\"02\");return(P=new a).setPrivate(new w(_,16),new w(S,16),new w(b,16),new w(F,16),new w(E,16)),P}if(-1!=t.indexOf(\"-END EC PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){m=c(t,\"EC PRIVATE KEY\");return h.getKey(m,null,\"pkcs5prv\")}if(-1!=t.indexOf(\"-END PRIVATE KEY-\"))return h.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf(\"-END RSA PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var x=h.getDecryptedKeyHex(t,e),A=new Me;return A.readPKCS5PrvKeyHex(x),A}if(-1!=t.indexOf(\"-END EC PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var k,P=i(R=h.getDecryptedKeyHex(t,e),0,[1],\"04\"),C=i(R,0,[2,0],\"06\"),T=i(R,0,[3,0],\"03\").substr(2);if(void 0===Sr.crypto.OID.oidhex2name[C])throw new Error(\"undefined OID(hex) in KJUR.crypto.OID: \"+C);return(k=new s({curve:Sr.crypto.OID.oidhex2name[C]})).setPublicKeyHex(T),k.setPrivateKeyHex(P),k.isPublic=!1,k}if(-1!=t.indexOf(\"-END DSA PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var R;_=i(R=h.getDecryptedKeyHex(t,e),0,[1],\"02\"),S=i(R,0,[2],\"02\"),b=i(R,0,[3],\"02\"),F=i(R,0,[4],\"02\"),E=i(R,0,[5],\"02\");return(P=new a).setPrivate(new w(_,16),new w(S,16),new w(b,16),new w(F,16),new w(E,16)),P}if(-1!=t.indexOf(\"-END ENCRYPTED PRIVATE KEY-\"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error(\"not supported argument\")},tn.generateKeypair=function(t,e){if(\"RSA\"==t){var r=e;(s=new Me).generate(r,\"10001\"),s.isPrivate=!0,s.isPublic=!0;var n=new Me,i=s.n.toString(16),o=s.e.toString(16);return n.setPublic(i,o),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}if(\"EC\"==t){var s,a,u=e,c=new Sr.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new Sr.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(n=new Sr.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}throw new Error(\"unknown algorithm: \"+t)},tn.getPEM=function(t,e,r,n,i,o){var s=Sr,a=s.asn1,u=a.DERObjectIdentifier,c=a.DERInteger,h=a.ASN1Util.newObject,l=a.x509.SubjectPublicKeyInfo,f=s.crypto,g=f.DSA,d=f.ECDSA,p=Me;function y(t){return h({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function m(t){return h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:[\"a0\",!0,{oid:{name:t.curveName}}]},{tag:[\"a1\",!0,{bitstr:{hex:\"00\"+t.pubKeyHex}}]}]})}function _(t){return h({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==p&&t instanceof p||void 0!==g&&t instanceof g||void 0!==d&&t instanceof d)&&1==t.isPublic&&(void 0===e||\"PKCS8PUB\"==e))return jr(F=new l(t).getEncodedHex(),\"PUBLIC KEY\");if(\"PKCS1PRV\"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return jr(F=y(t).getEncodedHex(),\"RSA PRIVATE KEY\");if(\"PKCS1PRV\"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate){var S=new u({name:t.curveName}).getEncodedHex(),b=m(t).getEncodedHex(),w=\"\";return w+=jr(S,\"EC PARAMETERS\"),w+=jr(b,\"EC PRIVATE KEY\")}if(\"PKCS1PRV\"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate)return jr(F=_(t).getEncodedHex(),\"DSA PRIVATE KEY\");if(\"PKCS5PRV\"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate){var F=y(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"RSA\",F,r,n,o)}if(\"PKCS5PRV\"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){F=m(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"EC\",F,r,n,o)}if(\"PKCS5PRV\"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate){F=_(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"DSA\",F,r,n,o)}var E=function t(e,r){var n=x(e,r);return new h({seq:[{seq:[{oid:{name:\"pkcs5PBES2\"}},{seq:[{seq:[{oid:{name:\"pkcs5PBKDF2\"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:\"des-EDE3-CBC\"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},x=function t(e,r){var n=v.lib.WordArray.random(8),i=v.lib.WordArray.random(8),o=v.PBKDF2(r,n,{keySize:6,iterations:100}),s=v.enc.Hex.parse(e),a=v.TripleDES.encrypt(s,o,{iv:i})+\"\",u={};return u.ciphertext=a,u.pbkdf2Salt=v.enc.Hex.stringify(n),u.pbkdf2Iter=100,u.encryptionSchemeAlg=\"DES-EDE3-CBC\",u.encryptionSchemeIV=v.enc.Hex.stringify(i),u};if(\"PKCS8PRV\"==e&&null!=p&&t instanceof p&&1==t.isPrivate){var A=y(t).getEncodedHex();F=h({seq:[{int:0},{seq:[{oid:{name:\"rsaEncryption\"}},{null:!0}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,\"PRIVATE KEY\"):jr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}if(\"PKCS8PRV\"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate){A=new h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:[\"a1\",!0,{bitstr:{hex:\"00\"+t.pubKeyHex}}]}]}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:\"ecPublicKey\"}},{oid:{name:t.curveName}}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,\"PRIVATE KEY\"):jr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}if(\"PKCS8PRV\"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){A=new c({bigint:t.x}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:\"dsa\"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?jr(F,\"PRIVATE KEY\"):jr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}throw new Error(\"unsupported object nor format\")},tn.getKeyFromCSRPEM=function(t){var e=Mr(t,\"CERTIFICATE REQUEST\");return tn.getKeyFromCSRHex(e)},tn.getKeyFromCSRHex=function(t){var e=tn.parseCSRHex(t);return tn.getKey(e.p8pubkeyhex,null,\"pkcs8pub\")},tn.parseCSRHex=function(t){var e=Fr,r=e.getChildIdx,n=e.getTLV,i={},o=t;if(\"30\"!=o.substr(0,2))throw new Error(\"malformed CSR(code:001)\");var s=r(o,0);if(s.length<1)throw new Error(\"malformed CSR(code:002)\");if(\"30\"!=o.substr(s[0],2))throw new Error(\"malformed CSR(code:003)\");var a=r(o,s[0]);if(a.length<3)throw new Error(\"malformed CSR(code:004)\");return i.p8pubkeyhex=n(o,a[2]),i},tn.getKeyID=function(t){var e=tn,r=Fr;\"string\"==typeof t&&-1!=t.indexOf(\"BEGIN \")&&(t=e.getKey(t));var n=Mr(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),o=r.getV(n,i).substring(2);return Sr.crypto.Util.hashHex(o,\"sha1\")},tn.getJWKFromKey=function(t){var e={};if(t instanceof Me&&t.isPrivate)return e.kty=\"RSA\",e.n=Tr(t.n.toString(16)),e.e=Tr(t.e.toString(16)),e.d=Tr(t.d.toString(16)),e.p=Tr(t.p.toString(16)),e.q=Tr(t.q.toString(16)),e.dp=Tr(t.dmp1.toString(16)),e.dq=Tr(t.dmq1.toString(16)),e.qi=Tr(t.coeff.toString(16)),e;if(t instanceof Me&&t.isPublic)return e.kty=\"RSA\",e.n=Tr(t.n.toString(16)),e.e=Tr(t.e.toString(16)),e;if(t instanceof Sr.crypto.ECDSA&&t.isPrivate){if(\"P-256\"!==(n=t.getShortNISTPCurveName())&&\"P-384\"!==n)throw new Error(\"unsupported curve name for JWT: \"+n);var r=t.getPublicKeyXYHex();return e.kty=\"EC\",e.crv=n,e.x=Tr(r.x),e.y=Tr(r.y),e.d=Tr(t.prvKeyHex),e}if(t instanceof Sr.crypto.ECDSA&&t.isPublic){var n;if(\"P-256\"!==(n=t.getShortNISTPCurveName())&&\"P-384\"!==n)throw new Error(\"unsupported curve name for JWT: \"+n);r=t.getPublicKeyXYHex();return e.kty=\"EC\",e.crv=n,e.x=Tr(r.x),e.y=Tr(r.y),e}throw new Error(\"not supported key object\")},Me.getPosArrayOfChildrenFromHex=function(t){return Fr.getChildIdx(t,0)},Me.getHexValueArrayOfChildrenFromHex=function(t){var e,r=Fr.getV,n=r(t,(e=Me.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),o=r(t,e[2]),s=r(t,e[3]),a=r(t,e[4]),u=r(t,e[5]),c=r(t,e[6]),h=r(t,e[7]),l=r(t,e[8]);return(e=new Array).push(n,i,o,s,a,u,c,h,l),e},Me.prototype.readPrivateKeyFromPEMString=function(t){var e=Mr(t),r=Me.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},Me.prototype.readPKCS5PrvKeyHex=function(t){var e=Me.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},Me.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,o,s,a,u,c=Fr,h=c.getVbyListEx;if(!1===c.isASN1HEX(t))throw new Error(\"not ASN.1 hex string\");try{e=h(t,0,[2,0,1],\"02\"),r=h(t,0,[2,0,2],\"02\"),n=h(t,0,[2,0,3],\"02\"),i=h(t,0,[2,0,4],\"02\"),o=h(t,0,[2,0,5],\"02\"),s=h(t,0,[2,0,6],\"02\"),a=h(t,0,[2,0,7],\"02\"),u=h(t,0,[2,0,8],\"02\")}catch(t){throw new Error(\"malformed PKCS#8 plain RSA private key\")}this.setPrivateEx(e,r,n,i,o,s,a,u)},Me.prototype.readPKCS5PubKeyHex=function(t){var e=Fr,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error(\"keyHex is not ASN.1 hex string\");var n=e.getChildIdx(t,0);if(2!==n.length||\"02\"!==t.substr(n[0],2)||\"02\"!==t.substr(n[1],2))throw new Error(\"wrong hex for PKCS#5 public key\");var i=r(t,n[0]),o=r(t,n[1]);this.setPublic(i,o)},Me.prototype.readPKCS8PubKeyHex=function(t){var e=Fr;if(!1===e.isASN1HEX(t))throw new Error(\"not ASN.1 hex string\");if(\"06092a864886f70d010101\"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error(\"not PKCS8 RSA public key\");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},Me.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new on).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};new RegExp(\"[^0-9a-f]\",\"gi\");function en(t,e){for(var r=\"\",n=e/4-t.length,i=0;i>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function nn(t){for(var e in Sr.crypto.Util.DIGESTINFOHEAD){var r=Sr.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function on(t){var e,r=Fr,n=r.getChildIdx,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getVbyListEx,u=r.getTLVbyList,c=r.getTLVbyListEx,h=r.getIdxbyList,l=r.getIdxbyListEx,f=r.getVidx,g=r.getInt,d=r.oidname,p=r.hextooidstr,v=Mr;try{e=Sr.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={\"0c\":\"utf8\",13:\"prn\",16:\"ia5\",\"1a\":\"vis\",\"1e\":\"bmp\"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=u(this.hex,0,[0,0]);if(\"a0\"==t.substr(0,2)){var e=u(t,0,[0]),r=g(e,0);if(r<0||21){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=o(t,s[2]);\"0101ff\"==c&&(i.reqauth=!0),\"010100\"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&(-1!=l(this.hex,0,[0,\"[3]\"])&&(t=c(this.hex,0,[0,\"[3]\",0],\"30\")));for(var e=[],r=n(t,0),i=0;i0&&(c=new Array(r),(new Be).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=Lr(u(Nr(\"\\0\\0\\0\\0\\0\\0\\0\\0\"+i+c))),l=[];for(n=0;n>8*a-s&255;for(d[0]&=~p,n=0;nn)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var o=nn(i.replace(/^1f+00/,\"\"));if(0==o.length)return!1;var s=o[0];return o[1]==function t(e){return Sr.crypto.Util.hashString(e,s)}(t)},Me.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=Oe(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=nn(this.doPublic(r).toString(16).replace(/^1f+00/,\"\"));if(0==n.length)return!1;n[0];return n[1]==t},Me.prototype.verifyPSS=function(t,e,r,n){var i=function t(e){return Sr.crypto.Util.hashHex(e,r)}(Nr(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(i,e,r,n)},Me.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new w(e,16),s=function t(e){return Sr.crypto.Util.hashHex(e,r)},a=Lr(t),u=a.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=h-u-2;else if(n<-2)throw new Error(\"invalid salt length\");if(h>8*h-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error(\"bits beyond keysize not zero\");var p=rn(g,f.length,s),v=[];for(i=0;i0)&&-1==(\":\"+r.join(\":\")+\":\").indexOf(\":\"+v+\":\"))throw\"algorithm '\"+v+\"' not accepted in the list\";if(\"none\"!=v&&null===e)throw\"key shall be specified to verify.\";if(\"string\"==typeof e&&-1!=e.indexOf(\"-----BEGIN \")&&(e=tn.getKey(e)),!(\"RS\"!=y&&\"PS\"!=y||e instanceof n))throw\"key shall be a RSAKey obj for RS* and PS* algs\";if(\"ES\"==y&&!(e instanceof u))throw\"key shall be a ECDSA obj for ES* algs\";var m=null;if(void 0===o.jwsalg2sigalg[p.alg])throw\"unsupported alg name: \"+v;if(\"none\"==(m=o.jwsalg2sigalg[v]))throw\"not supported\";if(\"Hmac\"==m.substr(0,4)){if(void 0===e)throw\"hexadecimal key shall be specified for HMAC\";var _=new c({alg:m,pass:e});return _.updateString(f),d==_.doFinal()}if(-1!=m.indexOf(\"withECDSA\")){var S,b=null;try{b=u.concatSigToASN1Sig(d)}catch(t){return!1}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(b)}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(d)},Sr.jws.JWS.parse=function(t){var e,r,n,i=t.split(\".\"),o={};if(2!=i.length&&3!=i.length)throw\"malformed sJWS: wrong number of '.' splitted elements\";return e=i[0],r=i[1],3==i.length&&(n=i[2]),o.headerObj=Sr.jws.JWS.readSafeJSONString(wr(e)),o.payloadObj=Sr.jws.JWS.readSafeJSONString(wr(r)),o.headerPP=JSON.stringify(o.headerObj,null,\" \"),null==o.payloadObj?o.payloadPP=wr(r):o.payloadPP=JSON.stringify(o.payloadObj,null,\" \"),void 0!==n&&(o.sigHex=Rr(n)),o},Sr.jws.JWS.verifyJWT=function(t,e,r){var n=Sr.jws,i=n.JWS,o=i.readSafeJSONString,s=i.inArray,a=i.includedArray,u=t.split(\".\"),c=u[0],h=u[1],l=(Rr(u[2]),o(wr(c))),f=o(wr(h));if(void 0===l.alg)return!1;if(void 0===r.alg)throw\"acceptField.alg shall be specified\";if(!s(l.alg,r.alg))return!1;if(void 0!==f.iss&&\"object\"===g(r.iss)&&!s(f.iss,r.iss))return!1;if(void 0!==f.sub&&\"object\"===g(r.sub)&&!s(f.sub,r.sub))return!1;if(void 0!==f.aud&&\"object\"===g(r.aud))if(\"string\"==typeof f.aud){if(!s(f.aud,r.aud))return!1}else if(\"object\"==g(f.aud)&&!a(f.aud,r.aud))return!1;var d=n.IntDate.getNow();return void 0!==r.verifyAt&&\"number\"==typeof r.verifyAt&&(d=r.verifyAt),void 0!==r.gracePeriod&&\"number\"==typeof r.gracePeriod||(r.gracePeriod=0),!(void 0!==f.exp&&\"number\"==typeof f.exp&&f.exp+r.gracePeriodr.length&&(n=r.length);for(var i=0;i\n * @license MIT\n */\nvar n=r(30),i=r(31),o=r(32);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+s().toString(16)+\" bytes\");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if(\"undefined\"!=typeof ArrayBuffer&&\"function\"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;\"string\"!=typeof t&&(t=\"\"+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":case void 0:return K(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return q(t).length;default:if(n)return K(t).length;e=(\"\"+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return I(this,e,r);case\"utf8\":case\"utf-8\":return A(this,e,r);case\"ascii\":return T(this,e,r);case\"latin1\":case\"binary\":return R(this,e,r);case\"base64\":return x(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return D(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if(\"string\"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if(\"number\"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&\"function\"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError(\"val must be string, number or Buffer\")}function m(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&(\"ucs2\"===(n=String(n).toLowerCase())||\"ucs-2\"===n||\"utf16le\"===n||\"utf-16le\"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var l=!0,f=0;fi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError(\"Invalid hex string\");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function f(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);var r=\"\",n=0;for(;n0&&(r=this.toString(\"hex\",0,n).match(/.{2}/g).join(\" \"),this.length>n&&(r+=\" ... \")),\"\"},u.prototype.compare=function t(e,r,n,i,o){if(!u.isBuffer(e))throw new TypeError(\"Argument must be a Buffer\");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError(\"out of range index\");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(n>>>=0)-(r>>>=0),c=Math.min(s,a),h=this.slice(i,o),l=e.slice(r,n),f=0;fo)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");i||(i=\"utf8\");for(var s=!1;;)switch(i){case\"hex\":return _(this,e,r,n);case\"utf8\":case\"utf-8\":return S(this,e,r,n);case\"ascii\":return b(this,e,r,n);case\"latin1\":case\"binary\":return w(this,e,r,n);case\"base64\":return F(this,e,r,n);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return E(this,e,r,n);default:if(s)throw new TypeError(\"Unknown encoding: \"+i);i=(\"\"+i).toLowerCase(),s=!0}},u.prototype.toJSON=function t(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function T(t,e,r){var n=\"\";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i=\"\",o=e;or)throw new RangeError(\"Trying to access beyond buffer length\")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError(\"Index out of range\")}function U(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function O(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"Index out of range\")}function j(t,e,r,n,o){return o||O(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return o||O(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function t(e,r){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(r=void 0===r?i:~~r)<0?(r+=i)<0&&(r=0):r>i&&(r=i),r0&&(o*=256);)i+=this[e+--r]*o;return i},u.prototype.readUInt8=function t(e,r){return r||L(e,1,this.length),this[e]},u.prototype.readUInt16LE=function t(e,r){return r||L(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function t(e,r){return r||L(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function t(e,r){return r||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function t(e,r){return r||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=this[e],o=1,s=0;++s=(o*=128)&&(i-=Math.pow(2,8*r)),i},u.prototype.readIntBE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*r)),s},u.prototype.readInt8=function t(e,r){return r||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function t(e,r){r||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function t(e,r){r||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function t(e,r){return r||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function t(e,r){return r||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function t(e,r,n,i){(e=+e,r|=0,n|=0,i)||N(this,e,r,n,Math.pow(2,8*n)-1,0);var o=1,s=0;for(this[r]=255&e;++s=0&&(s*=256);)this[r+o]=e/s&255;return r+n},u.prototype.writeUInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},u.prototype.writeUInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeUInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeUInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):B(this,e,r,!0),r+4},u.prototype.writeUInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeIntLE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&e;++s>0)-u&255;return r+n},u.prototype.writeIntBE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&e;--s>=0&&(a*=256);)e<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(e/a>>0)-u&255;return r+n},u.prototype.writeInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},u.prototype.writeInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):B(this,e,r,!0),r+4},u.prototype.writeInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeFloatLE=function t(e,r,n){return j(this,e,r,!0,n)},u.prototype.writeFloatBE=function t(e,r,n){return j(this,e,r,!1,n)},u.prototype.writeDoubleLE=function t(e,r,n){return M(this,e,r,!0,n)},u.prototype.writeDoubleBE=function t(e,r,n){return M(this,e,r,!1,n)},u.prototype.copy=function t(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError(\"sourceStart out of bounds\");if(i<0)throw new RangeError(\"sourceEnd out of bounds\");i>this.length&&(i=this.length),e.length-r=0;--o)e[o+r]=this[o+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),\"number\"==typeof e)for(s=r;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error(\"Invalid code point\");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(t){return n.toByteArray(function e(t){if((t=function e(t){return t.trim?t.trim():t.replace(/^\\s+|\\s+$/g,\"\")}(t).replace(H,\"\")).length<2)return\"\";for(;t.length%4!=0;)t+=\"=\";return t}(t))}function J(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(29))},function(t,e){var r;r=function(){return this}();try{r=r||new Function(\"return this\")()}catch(t){\"object\"==typeof window&&(r=window)}t.exports=r},function(t,e,r){\"use strict\";e.byteLength=function n(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function i(t){var e,r,n=f(t),i=n[0],o=n[1],s=new u(function c(t,e,r){return 3*(e+r)/4-r}(0,i,o)),h=0,l=o>0?i-4:i;for(r=0;r>16&255,s[h++]=e>>8&255,s[h++]=255&e;2===o&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,s[h++]=255&e);1===o&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,s[h++]=e>>8&255,s[h++]=255&e);return s},e.fromByteArray=function o(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,u=r-n;au?u:a+o));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+\"==\")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+\"=\"));return i.join(\"\")};for(var s=[],a=[],u=\"undefined\"!=typeof Uint8Array?Uint8Array:Array,c=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",h=0,l=c.length;h0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var r=t.indexOf(\"=\");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function g(t,e,r){for(var n,i,o=[],a=e;a>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join(\"\")}a[\"-\".charCodeAt(0)]=62,a[\"_\".charCodeAt(0)]=63},function(t,e){\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\ne.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,h=-7,l=r?i-1:0,f=r?-1:1,g=t[e+l];for(l+=f,o=g&(1<<-h)-1,g>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,n),o-=c}return(g?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,h=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,d=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+g]=255&a,g+=d,a/=256,i-=8);for(s=s<0;t[r+g]=255&s,g+=d,s/=256,c-=8);t[r+g-d]|=128*p}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return\"[object Array]\"==r.call(t)}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.default=function n(t){var e=t.jws,r=t.KeyUtil,n=t.X509,o=t.crypto,s=t.hextob64u,a=t.b64tohex,u=t.AllowedSigningAlgs;return function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.parseJwt=function t(r){i.Log.debug(\"JoseUtil.parseJwt\");try{var n=e.JWS.parse(r);return{header:n.headerObj,payload:n.payloadObj}}catch(t){i.Log.error(t)}},t.validateJwt=function e(o,s,u,c,h,l,f){i.Log.debug(\"JoseUtil.validateJwt\");try{if(\"RSA\"===s.kty)if(s.e&&s.n)s=r.getKey(s);else{if(!s.x5c||!s.x5c.length)return i.Log.error(\"JoseUtil.validateJwt: RSA key missing key material\",s),Promise.reject(new Error(\"RSA key missing key material\"));var g=a(s.x5c[0]);s=n.getPublicKeyFromCertHex(g)}else{if(\"EC\"!==s.kty)return i.Log.error(\"JoseUtil.validateJwt: Unsupported key type\",s&&s.kty),Promise.reject(new Error(s.kty));if(!(s.crv&&s.x&&s.y))return i.Log.error(\"JoseUtil.validateJwt: EC key missing key material\",s),Promise.reject(new Error(\"EC key missing key material\"));s=r.getKey(s)}return t._validateJwt(o,s,u,c,h,l,f)}catch(t){return i.Log.error(t&&t.message||t),Promise.reject(\"JWT validation failed\")}},t.validateJwtAttributes=function e(r,n,o,s,a,u){s||(s=0),a||(a=parseInt(Date.now()/1e3));var c=t.parseJwt(r).payload;if(!c.iss)return i.Log.error(\"JoseUtil._validateJwt: issuer was not provided\"),Promise.reject(new Error(\"issuer was not provided\"));if(c.iss!==n)return i.Log.error(\"JoseUtil._validateJwt: Invalid issuer in token\",c.iss),Promise.reject(new Error(\"Invalid issuer in token: \"+c.iss));if(!c.aud)return i.Log.error(\"JoseUtil._validateJwt: aud was not provided\"),Promise.reject(new Error(\"aud was not provided\"));if(!(c.aud===o||Array.isArray(c.aud)&&c.aud.indexOf(o)>=0))return i.Log.error(\"JoseUtil._validateJwt: Invalid audience in token\",c.aud),Promise.reject(new Error(\"Invalid audience in token: \"+c.aud));if(c.azp&&c.azp!==o)return i.Log.error(\"JoseUtil._validateJwt: Invalid azp in token\",c.azp),Promise.reject(new Error(\"Invalid azp in token: \"+c.azp));if(!u){var h=a+s,l=a-s;if(!c.iat)return i.Log.error(\"JoseUtil._validateJwt: iat was not provided\"),Promise.reject(new Error(\"iat was not provided\"));if(h1&&void 0!==arguments[1]?arguments[1]:\"#\";o(this,t);var n=i.UrlUtility.parseUrlFragment(e,r);this.error=n.error,this.error_description=n.error_description,this.error_uri=n.error_uri,this.code=n.code,this.state=n.state,this.id_token=n.id_token,this.session_state=n.session_state,this.access_token=n.access_token,this.token_type=n.token_type,this.scope=n.scope,this.profile=void 0,this.expires_in=n.expires_in}return n(t,[{key:\"expires_in\",get:function t(){if(this.expires_at){var e=parseInt(Date.now()/1e3);return this.expires_at-e}},set:function t(e){var r=parseInt(e);if(\"number\"==typeof r&&r>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+r}}},{key:\"expired\",get:function t(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:\"scopes\",get:function t(){return(this.scope||\"\").split(\" \")}},{key:\"isOpenIdConnect\",get:function t(){return this.scopes.indexOf(\"openid\")>=0||!!this.id_token}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SignoutRequest=void 0;var n=r(0),i=r(3),o=r(9);e.SignoutRequest=function t(e){var r=e.url,s=e.id_token_hint,a=e.post_logout_redirect_uri,u=e.data,c=e.extraQueryParams,h=e.request_type;if(function l(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),!r)throw n.Log.error(\"SignoutRequest.ctor: No url passed\"),new Error(\"url\");for(var f in s&&(r=i.UrlUtility.addQueryParam(r,\"id_token_hint\",s)),a&&(r=i.UrlUtility.addQueryParam(r,\"post_logout_redirect_uri\",a),u&&(this.state=new o.State({data:u,request_type:h}),r=i.UrlUtility.addQueryParam(r,\"state\",this.state.id))),c)r=i.UrlUtility.addQueryParam(r,f,c[f]);this.url=r}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SignoutResponse=void 0;var n=r(3);e.SignoutResponse=function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t);var i=n.UrlUtility.parseUrlFragment(e,\"?\");this.error=i.error,this.error_description=i.error_description,this.error_uri=i.error_uri,this.state=i.state}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.InMemoryWebStorage=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.TokenRevocationClient,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:g.TokenClient,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:d.JoseUtil;p(this,e),r instanceof s.UserManagerSettings||(r=new s.UserManagerSettings(r));var m=v(this,t.call(this,r));return m._events=new u.UserManagerEvents(r),m._silentRenewService=new n(m),m.settings.automaticSilentRenew&&(i.Log.debug(\"UserManager.ctor: automaticSilentRenew is configured, setting up silent renew\"),m.startSilentRenew()),m.settings.monitorSession&&(i.Log.debug(\"UserManager.ctor: monitorSession is configured, setting up session monitor\"),m._sessionMonitor=new o(m)),m._tokenRevocationClient=new a(m._settings),m._tokenClient=new l(m._settings),m._joseUtil=y,m}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUser=function t(){var e=this;return this._loadUser().then((function(t){return t?(i.Log.info(\"UserManager.getUser: user loaded\"),e._events.load(t,!1),t):(i.Log.info(\"UserManager.getUser: user not found in storage\"),null)}))},e.prototype.removeUser=function t(){var e=this;return this.storeUser(null).then((function(){i.Log.info(\"UserManager.removeUser: user removed from storage\"),e._events.unload()}))},e.prototype.signinRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"si:r\";var r={useReplaceToNavigate:e.useReplaceToNavigate};return this._signinStart(e,this._redirectNavigator,r).then((function(){i.Log.info(\"UserManager.signinRedirect: successful\")}))},e.prototype.signinRedirectCallback=function t(e){return this._signinEnd(e||this._redirectNavigator.url).then((function(t){return t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinRedirectCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinRedirectCallback: no sub\"),t}))},e.prototype.signinPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"si:p\";var r=e.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.display=\"popup\",this._signin(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinPopup: signinPopup successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinPopup: no sub\")),t}))):(i.Log.error(\"UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured\"),Promise.reject(new Error(\"No popup_redirect_uri or redirect_uri configured\")))},e.prototype.signinPopupCallback=function t(e){return this._signinCallback(e,this._popupNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinPopupCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinPopupCallback: no sub\")),t})).catch((function(t){i.Log.error(t.message)}))},e.prototype.signinSilent=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r=Object.assign({},r),this._loadUser().then((function(t){return t&&t.refresh_token?(r.refresh_token=t.refresh_token,e._useRefreshToken(r)):(r.request_type=\"si:s\",r.id_token_hint=r.id_token_hint||e.settings.includeIdTokenInSilentRenew&&t&&t.id_token,t&&e._settings.validateSubOnSilentRenew&&(i.Log.debug(\"UserManager.signinSilent, subject prior to silent renew: \",t.profile.sub),r.current_sub=t.profile.sub),e._signinSilentIframe(r))}))},e.prototype._useRefreshToken=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(r).then((function(t){return t?t.access_token?e._loadUser().then((function(r){if(r){var n=Promise.resolve();return t.id_token&&(n=e._validateIdTokenFromTokenRefreshToken(r.profile,t.id_token)),n.then((function(){return i.Log.debug(\"UserManager._useRefreshToken: refresh token response success\"),r.id_token=t.id_token||r.id_token,r.access_token=t.access_token,r.refresh_token=t.refresh_token||r.refresh_token,r.expires_in=t.expires_in,e.storeUser(r).then((function(){return e._events.load(r),r}))}))}return null})):(i.Log.error(\"UserManager._useRefreshToken: No access token returned from token endpoint\"),Promise.reject(\"No access token returned from token endpoint\")):(i.Log.error(\"UserManager._useRefreshToken: No response returned from token endpoint\"),Promise.reject(\"No response returned from token endpoint\"))}))},e.prototype._validateIdTokenFromTokenRefreshToken=function t(e,r){var n=this;return this._metadataService.getIssuer().then((function(t){return n.settings.getEpochTime().then((function(o){return n._joseUtil.validateJwtAttributes(r,t,n._settings.client_id,n._settings.clockSkew,o).then((function(t){return t?t.sub!==e.sub?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub\"),Promise.reject(new Error(\"sub in id_token does not match current sub\"))):t.auth_time&&t.auth_time!==e.auth_time?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time\"),Promise.reject(new Error(\"auth_time in id_token does not match original auth_time\"))):t.azp&&t.azp!==e.azp?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp\"),Promise.reject(new Error(\"azp in id_token does not match original azp\"))):!t.azp&&e.azp?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token\"),Promise.reject(new Error(\"azp not in id_token, but present in original id_token\"))):void 0:(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token\"),Promise.reject(new Error(\"Failed to validate id_token\")))}))}))}))},e.prototype._signinSilentIframe=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.prompt=e.prompt||\"none\",this._signin(e,this._iframeNavigator,{startUrl:r,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinSilent: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinSilent: no sub\")),t}))):(i.Log.error(\"UserManager.signinSilent: No silent_redirect_uri configured\"),Promise.reject(new Error(\"No silent_redirect_uri configured\")))},e.prototype.signinSilentCallback=function t(e){return this._signinCallback(e,this._iframeNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinSilentCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinSilentCallback: no sub\")),t}))},e.prototype.signinCallback=function t(e){var r=this;return this.readSigninResponseState(e).then((function(t){var n=t.state;t.response;return\"si:r\"===n.request_type?r.signinRedirectCallback(e):\"si:p\"===n.request_type?r.signinPopupCallback(e):\"si:s\"===n.request_type?r.signinSilentCallback(e):Promise.reject(new Error(\"invalid response_type in state\"))}))},e.prototype.signoutCallback=function t(e,r){var n=this;return this.readSignoutResponseState(e).then((function(t){var i=t.state,o=t.response;return i?\"so:r\"===i.request_type?n.signoutRedirectCallback(e):\"so:p\"===i.request_type?n.signoutPopupCallback(e,r):Promise.reject(new Error(\"invalid response_type in state\")):o}))},e.prototype.querySessionStatus=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).request_type=\"si:s\";var n=r.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return n?(r.redirect_uri=n,r.prompt=\"none\",r.response_type=r.response_type||this.settings.query_status_response_type,r.scope=r.scope||\"openid\",r.skipUserInfo=!0,this._signinStart(r,this._iframeNavigator,{startUrl:n,silentRequestTimeout:r.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return e.processSigninResponse(t.url).then((function(t){if(i.Log.debug(\"UserManager.querySessionStatus: got signin response\"),t.session_state&&t.profile.sub)return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for sub: \",t.profile.sub),{session_state:t.session_state,sub:t.profile.sub,sid:t.profile.sid};i.Log.info(\"querySessionStatus successful, user not authenticated\")})).catch((function(t){if(t.session_state&&e.settings.monitorAnonymousSession&&(\"login_required\"==t.message||\"consent_required\"==t.message||\"interaction_required\"==t.message||\"account_selection_required\"==t.message))return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for anonymous user\"),{session_state:t.session_state};throw t}))}))):(i.Log.error(\"UserManager.querySessionStatus: No silent_redirect_uri configured\"),Promise.reject(new Error(\"No silent_redirect_uri configured\")))},e.prototype._signin=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(e,r,i).then((function(t){return n._signinEnd(t.url,e)}))},e.prototype._signinStart=function t(e,r){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.prepare(o).then((function(t){return i.Log.debug(\"UserManager._signinStart: got navigator window handle\"),n.createSigninRequest(e).then((function(e){return i.Log.debug(\"UserManager._signinStart: got signin request\"),o.url=e.url,o.id=e.state.id,t.navigate(o)})).catch((function(e){throw t.close&&(i.Log.debug(\"UserManager._signinStart: Error after preparing navigator, closing navigator window\"),t.close()),e}))}))},e.prototype._signinEnd=function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.processSigninResponse(e).then((function(t){i.Log.debug(\"UserManager._signinEnd: got signin response\");var e=new a.User(t);if(n.current_sub){if(n.current_sub!==e.profile.sub)return i.Log.debug(\"UserManager._signinEnd: current user does not match user returned from signin. sub from signin: \",e.profile.sub),Promise.reject(new Error(\"login_required\"));i.Log.debug(\"UserManager._signinEnd: current user matches user returned from signin\")}return r.storeUser(e).then((function(){return i.Log.debug(\"UserManager._signinEnd: user stored\"),r._events.load(e),e}))}))},e.prototype._signinCallback=function t(e,r){i.Log.debug(\"UserManager._signinCallback\");var n=\"query\"===this._settings.response_mode||!this._settings.response_mode&&l.SigninRequest.isCode(this._settings.response_type)?\"?\":\"#\";return r.callback(e,void 0,n)},e.prototype.signoutRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"so:r\";var r=e.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;r&&(e.post_logout_redirect_uri=r);var n={useReplaceToNavigate:e.useReplaceToNavigate};return this._signoutStart(e,this._redirectNavigator,n).then((function(){i.Log.info(\"UserManager.signoutRedirect: successful\")}))},e.prototype.signoutRedirectCallback=function t(e){return this._signoutEnd(e||this._redirectNavigator.url).then((function(t){return i.Log.info(\"UserManager.signoutRedirectCallback: successful\"),t}))},e.prototype.signoutPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"so:p\";var r=e.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return e.post_logout_redirect_uri=r,e.display=\"popup\",e.post_logout_redirect_uri&&(e.state=e.state||{}),this._signout(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){i.Log.info(\"UserManager.signoutPopup: successful\")}))},e.prototype.signoutPopupCallback=function t(e,r){void 0===r&&\"boolean\"==typeof e&&(r=e,e=null);return this._popupNavigator.callback(e,r,\"?\").then((function(){i.Log.info(\"UserManager.signoutPopupCallback: successful\")}))},e.prototype._signout=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(e,r,i).then((function(t){return n._signoutEnd(t.url)}))},e.prototype._signoutStart=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this,n=arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.prepare(o).then((function(t){return i.Log.debug(\"UserManager._signoutStart: got navigator window handle\"),r._loadUser().then((function(n){return i.Log.debug(\"UserManager._signoutStart: loaded current user from storage\"),(r._settings.revokeAccessTokenOnSignout?r._revokeInternal(n):Promise.resolve()).then((function(){var s=e.id_token_hint||n&&n.id_token;return s&&(i.Log.debug(\"UserManager._signoutStart: Setting id_token into signout request\"),e.id_token_hint=s),r.removeUser().then((function(){return i.Log.debug(\"UserManager._signoutStart: user removed, creating signout request\"),r.createSignoutRequest(e).then((function(e){return i.Log.debug(\"UserManager._signoutStart: got signout request\"),o.url=e.url,e.state&&(o.id=e.state.id),t.navigate(o)}))}))}))})).catch((function(e){throw t.close&&(i.Log.debug(\"UserManager._signoutStart: Error after preparing navigator, closing navigator window\"),t.close()),e}))}))},e.prototype._signoutEnd=function t(e){return this.processSignoutResponse(e).then((function(t){return i.Log.debug(\"UserManager._signoutEnd: got signout response\"),t}))},e.prototype.revokeAccessToken=function t(){var e=this;return this._loadUser().then((function(t){return e._revokeInternal(t,!0).then((function(r){if(r)return i.Log.debug(\"UserManager.revokeAccessToken: removing token properties from user and re-storing\"),t.access_token=null,t.refresh_token=null,t.expires_at=null,t.token_type=null,e.storeUser(t).then((function(){i.Log.debug(\"UserManager.revokeAccessToken: user stored\"),e._events.load(t)}))}))})).then((function(){i.Log.info(\"UserManager.revokeAccessToken: access token revoked successfully\")}))},e.prototype._revokeInternal=function t(e,r){var n=this;if(e){var o=e.access_token,s=e.refresh_token;return this._revokeAccessTokenInternal(o,r).then((function(t){return n._revokeRefreshTokenInternal(s,r).then((function(e){return t||e||i.Log.debug(\"UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format\"),t||e}))}))}return Promise.resolve(!1)},e.prototype._revokeAccessTokenInternal=function t(e,r){return!e||e.indexOf(\".\")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(e,r).then((function(){return!0}))},e.prototype._revokeRefreshTokenInternal=function t(e,r){return e?this._tokenRevocationClient.revoke(e,r,\"refresh_token\").then((function(){return!0})):Promise.resolve(!1)},e.prototype.startSilentRenew=function t(){this._silentRenewService.start()},e.prototype.stopSilentRenew=function t(){this._silentRenewService.stop()},e.prototype._loadUser=function t(){return this._userStore.get(this._userStoreKey).then((function(t){return t?(i.Log.debug(\"UserManager._loadUser: user storageString loaded\"),a.User.fromStorageString(t)):(i.Log.debug(\"UserManager._loadUser: no user storageString\"),null)}))},e.prototype.storeUser=function t(e){if(e){i.Log.debug(\"UserManager.storeUser: storing user\");var r=e.toStorageString();return this._userStore.set(this._userStoreKey,r)}return i.Log.debug(\"storeUser.storeUser: removing user\"),this._userStore.remove(this._userStoreKey)},n(e,[{key:\"_redirectNavigator\",get:function t(){return this.settings.redirectNavigator}},{key:\"_popupNavigator\",get:function t(){return this.settings.popupNavigator}},{key:\"_iframeNavigator\",get:function t(){return this.settings.iframeNavigator}},{key:\"_userStore\",get:function t(){return this.settings.userStore}},{key:\"events\",get:function t(){return this._events}},{key:\"_userStoreKey\",get:function t(){return\"user:\"+this.settings.authority+\":\"+this.settings.client_id}}]),e}(o.OidcClient)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UserManagerSettings=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=r.popup_redirect_uri,i=r.popup_post_logout_redirect_uri,g=r.popupWindowFeatures,d=r.popupWindowTarget,p=r.silent_redirect_uri,v=r.silentRequestTimeout,y=r.automaticSilentRenew,m=void 0!==y&&y,_=r.validateSubOnSilentRenew,S=void 0!==_&&_,b=r.includeIdTokenInSilentRenew,w=void 0===b||b,F=r.monitorSession,E=void 0===F||F,x=r.monitorAnonymousSession,A=void 0!==x&&x,k=r.checkSessionInterval,P=void 0===k?2e3:k,C=r.stopCheckSessionOnError,T=void 0===C||C,R=r.query_status_response_type,I=r.revokeAccessTokenOnSignout,D=void 0!==I&&I,L=r.accessTokenExpiringNotificationTime,N=void 0===L?60:L,U=r.redirectNavigator,B=void 0===U?new o.RedirectNavigator:U,O=r.popupNavigator,j=void 0===O?new s.PopupNavigator:O,M=r.iframeNavigator,H=void 0===M?new a.IFrameNavigator:M,V=r.userStore,K=void 0===V?new u.WebStorageStateStore({store:c.Global.sessionStorage}):V;l(this,e);var q=f(this,t.call(this,arguments[0]));return q._popup_redirect_uri=n,q._popup_post_logout_redirect_uri=i,q._popupWindowFeatures=g,q._popupWindowTarget=d,q._silent_redirect_uri=p,q._silentRequestTimeout=v,q._automaticSilentRenew=m,q._validateSubOnSilentRenew=S,q._includeIdTokenInSilentRenew=w,q._accessTokenExpiringNotificationTime=N,q._monitorSession=E,q._monitorAnonymousSession=A,q._checkSessionInterval=P,q._stopCheckSessionOnError=T,R?q._query_status_response_type=R:arguments[0]&&arguments[0].response_type?q._query_status_response_type=h.SigninRequest.isOidc(arguments[0].response_type)?\"id_token\":\"code\":q._query_status_response_type=\"id_token\",q._revokeAccessTokenOnSignout=D,q._redirectNavigator=B,q._popupNavigator=j,q._iframeNavigator=H,q._userStore=K,q}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),n(e,[{key:\"popup_redirect_uri\",get:function t(){return this._popup_redirect_uri}},{key:\"popup_post_logout_redirect_uri\",get:function t(){return this._popup_post_logout_redirect_uri}},{key:\"popupWindowFeatures\",get:function t(){return this._popupWindowFeatures}},{key:\"popupWindowTarget\",get:function t(){return this._popupWindowTarget}},{key:\"silent_redirect_uri\",get:function t(){return this._silent_redirect_uri}},{key:\"silentRequestTimeout\",get:function t(){return this._silentRequestTimeout}},{key:\"automaticSilentRenew\",get:function t(){return this._automaticSilentRenew}},{key:\"validateSubOnSilentRenew\",get:function t(){return this._validateSubOnSilentRenew}},{key:\"includeIdTokenInSilentRenew\",get:function t(){return this._includeIdTokenInSilentRenew}},{key:\"accessTokenExpiringNotificationTime\",get:function t(){return this._accessTokenExpiringNotificationTime}},{key:\"monitorSession\",get:function t(){return this._monitorSession}},{key:\"monitorAnonymousSession\",get:function t(){return this._monitorAnonymousSession}},{key:\"checkSessionInterval\",get:function t(){return this._checkSessionInterval}},{key:\"stopCheckSessionOnError\",get:function t(){return this._stopCheckSessionOnError}},{key:\"query_status_response_type\",get:function t(){return this._query_status_response_type}},{key:\"revokeAccessTokenOnSignout\",get:function t(){return this._revokeAccessTokenOnSignout}},{key:\"redirectNavigator\",get:function t(){return this._redirectNavigator}},{key:\"popupNavigator\",get:function t(){return this._popupNavigator}},{key:\"iframeNavigator\",get:function t(){return this._iframeNavigator}},{key:\"userStore\",get:function t(){return this._userStore}}]),e}(i.OidcClientSettings)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.RedirectNavigator=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1])||arguments[1];n.Log.debug(\"UserManagerEvents.load\"),t.prototype.load.call(this,r),i&&this._userLoaded.raise(r)},e.prototype.unload=function e(){n.Log.debug(\"UserManagerEvents.unload\"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function t(e){this._userLoaded.addHandler(e)},e.prototype.removeUserLoaded=function t(e){this._userLoaded.removeHandler(e)},e.prototype.addUserUnloaded=function t(e){this._userUnloaded.addHandler(e)},e.prototype.removeUserUnloaded=function t(e){this._userUnloaded.removeHandler(e)},e.prototype.addSilentRenewError=function t(e){this._silentRenewError.addHandler(e)},e.prototype.removeSilentRenewError=function t(e){this._silentRenewError.removeHandler(e)},e.prototype._raiseSilentRenewError=function t(e){n.Log.debug(\"UserManagerEvents._raiseSilentRenewError\",e.message),this._silentRenewError.raise(e)},e.prototype.addUserSignedIn=function t(e){this._userSignedIn.addHandler(e)},e.prototype.removeUserSignedIn=function t(e){this._userSignedIn.removeHandler(e)},e.prototype._raiseUserSignedIn=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSignedIn\"),this._userSignedIn.raise()},e.prototype.addUserSignedOut=function t(e){this._userSignedOut.addHandler(e)},e.prototype.removeUserSignedOut=function t(e){this._userSignedOut.removeHandler(e)},e.prototype._raiseUserSignedOut=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSignedOut\"),this._userSignedOut.raise()},e.prototype.addUserSessionChanged=function t(e){this._userSessionChanged.addHandler(e)},e.prototype.removeUserSessionChanged=function t(e){this._userSessionChanged.removeHandler(e)},e.prototype._raiseUserSessionChanged=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSessionChanged\"),this._userSessionChanged.raise()},e}(i.AccessTokenEvents)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.Timer=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;a(this,e);var s=u(this,t.call(this,r));return s._timer=n,s._nowFunc=i||function(){return Date.now()/1e3},s}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.init=function t(e){e<=0&&(e=1),e=parseInt(e);var r=this.now+e;if(this.expiration===r&&this._timerHandle)i.Log.debug(\"Timer.init timer \"+this._name+\" skipping initialization since already initialized for expiration:\",this.expiration);else{this.cancel(),i.Log.debug(\"Timer.init timer \"+this._name+\" for duration:\",e),this._expiration=r;var n=5;e {\n var _a, _b;\n // In order to get a clean start, make sure that the session is logged out\n // on login.\n // But we may want to preserve our client application info, particularly if\n // we used Dynamic Client Registration to register (since we don't\n // necessarily want the user to have to register this app each time they\n // login).\n await this.sessionInfoManager.clear(options.sessionId);\n // In the case of the user hitting the 'back' button in their browser, they\n // could return to a previous redirect URL that contains OIDC params that\n // are now longer valid. To be safe, strip relevant params now.\n // If the user is providing a redirect IRI, it should not be modified, so\n // normalization only applies if we default to the current location (which is\n // a bad practice and should be discouraged).\n const redirectUrl = (_a = options.redirectUrl) !== null && _a !== void 0 ? _a : oidcClientExt.normalizeCallbackUrl(window.location.href);\n if (!solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) {\n throw new Error(`${redirectUrl} is not a valid redirect URL, it is either a malformed IRI, includes a hash fragment, or reserved query parameters ('code' or 'state').`);\n }\n await this.loginHandler.handle({\n ...options,\n redirectUrl,\n // If no clientName is provided, the clientId may be used instead.\n clientName: (_b = options.clientName) !== null && _b !== void 0 ? _b : options.clientId,\n eventEmitter,\n });\n };\n // Collects session information from storage, and returns them. Returns null\n // if the expected information cannot be found.\n // Note that the ID token is not stored, which means the session information\n // cannot be validated at this point.\n this.validateCurrentSession = async (currentSessionId) => {\n const sessionInfo = await this.sessionInfoManager.get(currentSessionId);\n if (sessionInfo === undefined ||\n sessionInfo.clientAppId === undefined ||\n sessionInfo.issuer === undefined) {\n return null;\n }\n return sessionInfo;\n };\n this.handleIncomingRedirect = async (url, eventEmitter) => {\n try {\n const redirectInfo = await this.redirectHandler.handle(url, eventEmitter);\n // The `FallbackRedirectHandler` directly returns the global `fetch` for\n // his value, so we should ensure it's bound to `window` rather than to\n // ClientAuthentication, to avoid the following error:\n // > 'fetch' called on an object that does not implement interface Window.\n this.fetch = redirectInfo.fetch.bind(window);\n this.boundLogout = redirectInfo.getLogoutUrl;\n // Strip the oauth params:\n await this.cleanUrlAfterRedirect(url);\n return {\n isLoggedIn: redirectInfo.isLoggedIn,\n webId: redirectInfo.webId,\n sessionId: redirectInfo.sessionId,\n expirationDate: redirectInfo.expirationDate,\n };\n }\n catch (err) {\n // Strip the oauth params:\n await this.cleanUrlAfterRedirect(url);\n // FIXME: EVENTS.ERROR should be errorCode, errorDescription\n //\n // I'm not sure if \"redirect\" is a good error code, and in theory `err`\n // maybe an Error object and not a string; Maybe we want to just hardcode\n // a description instead?\n eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, \"redirect\", err);\n return undefined;\n }\n };\n }\n async cleanUrlAfterRedirect(url) {\n const cleanedUpUrl = solidClientAuthnCore.removeOpenIdParams(url).href;\n // Remove OAuth-specific query params (since the login flow finishes with\n // the browser being redirected back with OAuth2 query params (e.g. for\n // 'code' and 'state'), and so if the user simply refreshes this page our\n // authentication library will be called again with what are now invalid\n // query parameters!).\n window.history.replaceState(null, \"\", cleanedUpUrl);\n while (window.location.href !== cleanedUpUrl) {\n // Poll the current URL every ms. Active polling is required because\n // window.history.replaceState is asynchronous, but the associated\n // 'popstate' event which should be listened to is only sent on active\n // navigation, which we will not have here.\n // See https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event#when_popstate_is_sent\n // eslint-disable-next-line no-await-in-loop\n await new Promise((resolve) => {\n setTimeout(() => resolve(), 1);\n });\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction hasIssuer(options) {\n return typeof options.oidcIssuer === \"string\";\n}\nfunction hasRedirectUrl(options) {\n return typeof options.redirectUrl === \"string\";\n}\n/**\n * @hidden\n */\nclass OidcLoginHandler {\n constructor(storageUtility, oidcHandler, issuerConfigFetcher, clientRegistrar) {\n this.storageUtility = storageUtility;\n this.oidcHandler = oidcHandler;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.storageUtility = storageUtility;\n this.oidcHandler = oidcHandler;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n }\n async canHandle(options) {\n return hasIssuer(options) && hasRedirectUrl(options);\n }\n async handle(options) {\n if (!hasIssuer(options)) {\n throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(options)}`);\n }\n if (!hasRedirectUrl(options)) {\n throw new solidClientAuthnCore.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(options)}`);\n }\n // Fetch issuer config.\n const issuerConfig = await this.issuerConfigFetcher.fetchConfig(options.oidcIssuer);\n const clientRegistration = await solidClientAuthnCore.handleRegistration(options, issuerConfig, this.storageUtility, this.clientRegistrar);\n // Construct OIDC Options\n const OidcOptions = {\n // Note that here, the issuer is not the one from the received options, but\n // from the issuer's config. This enforces the canonical URL is used and stored,\n // which is also the one present in the ID token, so storing a technically\n // valid, but different issuer URL (e.g. using a trailing slash or not) now\n // could prevent from validating the ID token later.\n issuer: issuerConfig.issuer,\n // TODO: differentiate if DPoP should be true\n dpop: options.tokenType.toLowerCase() === \"dpop\",\n ...options,\n issuerConfiguration: issuerConfig,\n client: clientRegistration,\n };\n // Call proper OIDC Handler\n return this.oidcHandler.handle(OidcOptions);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth\n * PKCE: https://tools.ietf.org/html/rfc7636\n */\nclass AuthorizationCodeWithPkceOidcHandler extends solidClientAuthnCore.AuthorizationCodeWithPkceOidcHandlerBase {\n async handle(oidcLoginOptions) {\n var _a;\n /* eslint-disable camelcase */\n const oidcOptions = {\n authority: oidcLoginOptions.issuer.toString(),\n client_id: oidcLoginOptions.client.clientId,\n client_secret: oidcLoginOptions.client.clientSecret,\n redirect_uri: oidcLoginOptions.redirectUrl.toString(),\n post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),\n response_type: \"code\",\n scope: solidClientAuthnCore.DEFAULT_SCOPES,\n filterProtocolClaims: true,\n // The userinfo endpoint on NSS fails, so disable this for now\n // Note that in Solid, information should be retrieved from the\n // profile referenced by the WebId.\n loadUserInfo: false,\n code_verifier: true,\n prompt: (_a = oidcLoginOptions.prompt) !== null && _a !== void 0 ? _a : \"consent\",\n };\n /* eslint-enable camelcase */\n const oidcClientLibrary = new oidcClientExt.OidcClient(oidcOptions);\n try {\n const signingRequest = await oidcClientLibrary.createSigninRequest();\n // Make sure to await the promise before returning so that the error is caught.\n return await this.handleRedirect({\n oidcLoginOptions,\n // eslint-disable-next-line no-underscore-dangle\n state: signingRequest.state._id,\n // eslint-disable-next-line no-underscore-dangle\n codeVerifier: signingRequest.state._code_verifier,\n targetUrl: signingRequest.url.toString(),\n });\n }\n catch (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n // The login is only completed AFTER redirect, so nothing to return here.\n return undefined;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst WELL_KNOWN_OPENID_CONFIG = \".well-known/openid-configuration\";\n/* eslint-disable camelcase */\nconst issuerConfigKeyMap = {\n issuer: {\n toKey: \"issuer\",\n convertToUrl: true,\n },\n authorization_endpoint: {\n toKey: \"authorizationEndpoint\",\n convertToUrl: true,\n },\n token_endpoint: {\n toKey: \"tokenEndpoint\",\n convertToUrl: true,\n },\n userinfo_endpoint: {\n toKey: \"userinfoEndpoint\",\n convertToUrl: true,\n },\n jwks_uri: {\n toKey: \"jwksUri\",\n convertToUrl: true,\n },\n registration_endpoint: {\n toKey: \"registrationEndpoint\",\n convertToUrl: true,\n },\n end_session_endpoint: {\n toKey: \"endSessionEndpoint\",\n convertToUrl: true,\n },\n scopes_supported: { toKey: \"scopesSupported\" },\n response_types_supported: { toKey: \"responseTypesSupported\" },\n response_modes_supported: { toKey: \"responseModesSupported\" },\n grant_types_supported: { toKey: \"grantTypesSupported\" },\n acr_values_supported: { toKey: \"acrValuesSupported\" },\n subject_types_supported: { toKey: \"subjectTypesSupported\" },\n id_token_signing_alg_values_supported: {\n toKey: \"idTokenSigningAlgValuesSupported\",\n },\n id_token_encryption_alg_values_supported: {\n toKey: \"idTokenEncryptionAlgValuesSupported\",\n },\n id_token_encryption_enc_values_supported: {\n toKey: \"idTokenEncryptionEncValuesSupported\",\n },\n userinfo_signing_alg_values_supported: {\n toKey: \"userinfoSigningAlgValuesSupported\",\n },\n userinfo_encryption_alg_values_supported: {\n toKey: \"userinfoEncryptionAlgValuesSupported\",\n },\n userinfo_encryption_enc_values_supported: {\n toKey: \"userinfoEncryptionEncValuesSupported\",\n },\n request_object_signing_alg_values_supported: {\n toKey: \"requestObjectSigningAlgValuesSupported\",\n },\n request_object_encryption_alg_values_supported: {\n toKey: \"requestObjectEncryptionAlgValuesSupported\",\n },\n request_object_encryption_enc_values_supported: {\n toKey: \"requestObjectEncryptionEncValuesSupported\",\n },\n token_endpoint_auth_methods_supported: {\n toKey: \"tokenEndpointAuthMethodsSupported\",\n },\n token_endpoint_auth_signing_alg_values_supported: {\n toKey: \"tokenEndpointAuthSigningAlgValuesSupported\",\n },\n display_values_supported: { toKey: \"displayValuesSupported\" },\n claim_types_supported: { toKey: \"claimTypesSupported\" },\n claims_supported: { toKey: \"claimsSupported\" },\n service_documentation: { toKey: \"serviceDocumentation\" },\n claims_locales_supported: { toKey: \"claimsLocalesSupported\" },\n ui_locales_supported: { toKey: \"uiLocalesSupported\" },\n claims_parameter_supported: { toKey: \"claimsParameterSupported\" },\n request_parameter_supported: { toKey: \"requestParameterSupported\" },\n request_uri_parameter_supported: { toKey: \"requestUriParameterSupported\" },\n require_request_uri_registration: { toKey: \"requireRequestUriRegistration\" },\n op_policy_uri: {\n toKey: \"opPolicyUri\",\n convertToUrl: true,\n },\n op_tos_uri: {\n toKey: \"opTosUri\",\n convertToUrl: true,\n },\n};\n/* eslint-enable camelcase */\nfunction processConfig(config) {\n const parsedConfig = {};\n Object.keys(config).forEach((key) => {\n if (issuerConfigKeyMap[key]) {\n // TODO: PMcB55: Validate URL if \"issuerConfigKeyMap[key].convertToUrl\"\n // if (issuerConfigKeyMap[key].convertToUrl) {\n // validateUrl(config[key]);\n // }\n parsedConfig[issuerConfigKeyMap[key].toKey] = config[key];\n }\n });\n if (!Array.isArray(parsedConfig.scopesSupported)) {\n parsedConfig.scopesSupported = [\"openid\"];\n }\n return parsedConfig;\n}\n/**\n * @hidden\n */\nclass IssuerConfigFetcher {\n constructor(storageUtility) {\n this.storageUtility = storageUtility;\n this.storageUtility = storageUtility;\n }\n // This method needs no state (so can be static), and can be exposed to allow\n // callers to know where this implementation puts state it needs.\n static getLocalStorageKey(issuer) {\n return `issuerConfig:${issuer}`;\n }\n async fetchConfig(issuer) {\n let issuerConfig;\n const openIdConfigUrl = new URL(WELL_KNOWN_OPENID_CONFIG, \n // Make sure to append a slash at issuer URL, so that the .well-known URL\n // includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.\n issuer.endsWith(\"/\") ? issuer : `${issuer}/`).href;\n const issuerConfigRequestBody = await universalFetch.fetch.call(globalThis, openIdConfigUrl);\n // Check the validity of the fetched config\n try {\n issuerConfig = processConfig(await issuerConfigRequestBody.json());\n }\n catch (err) {\n throw new solidClientAuthnCore.ConfigurationError(`[${issuer.toString()}] has an invalid configuration: ${err.message}`);\n }\n // Update store with fetched config\n await this.storageUtility.set(IssuerConfigFetcher.getLocalStorageKey(issuer), JSON.stringify(issuerConfig));\n return issuerConfig;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @param sessionId\n * @param storage\n * @hidden\n */\nasync function clear(sessionId, storage) {\n await solidClientAuthnCore.clear(sessionId, storage);\n await oidcClientExt.clearOidcPersistentStorage();\n}\n/**\n * @hidden\n */\nclass SessionInfoManager extends solidClientAuthnCore.SessionInfoManagerBase {\n async get(sessionId) {\n const [isLoggedIn, webId, clientId, clientSecret, redirectUrl, refreshToken, issuer, tokenType,] = await Promise.all([\n this.storageUtility.getForUser(sessionId, \"isLoggedIn\", {\n secure: true,\n }),\n this.storageUtility.getForUser(sessionId, \"webId\", {\n secure: true,\n }),\n this.storageUtility.getForUser(sessionId, \"clientId\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"clientSecret\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"redirectUrl\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"refreshToken\", {\n secure: true,\n }),\n this.storageUtility.getForUser(sessionId, \"issuer\", {\n secure: false,\n }),\n this.storageUtility.getForUser(sessionId, \"tokenType\", {\n secure: false,\n }),\n ]);\n if (typeof redirectUrl === \"string\" && !solidClientAuthnCore.isValidRedirectUrl(redirectUrl)) {\n // This resolves the issue for people experiencing https://github.com/inrupt/solid-client-authn-js/issues/2891.\n // An invalid redirect URL is present in the storage, and the session should\n // be cleared to get a fresh start. This will require the user to log back in.\n await Promise.all([\n this.storageUtility.deleteAllUserData(sessionId, { secure: false }),\n this.storageUtility.deleteAllUserData(sessionId, { secure: true }),\n ]);\n return undefined;\n }\n if (tokenType !== undefined && !solidClientAuthnCore.isSupportedTokenType(tokenType)) {\n throw new Error(`Tokens of type [${tokenType}] are not supported.`);\n }\n if (clientId === undefined &&\n isLoggedIn === undefined &&\n webId === undefined &&\n refreshToken === undefined) {\n return undefined;\n }\n return {\n sessionId,\n webId,\n isLoggedIn: isLoggedIn === \"true\",\n redirectUrl,\n refreshToken,\n issuer,\n clientAppId: clientId,\n clientAppSecret: clientSecret,\n // Default the token type to DPoP if unspecified.\n tokenType: tokenType !== null && tokenType !== void 0 ? tokenType : \"DPoP\",\n };\n }\n /**\n * This function removes all session-related information from storage.\n * @param sessionId the session identifier\n * @param storage the storage where session info is stored\n * @hidden\n */\n async clear(sessionId) {\n return clear(sessionId, this.storageUtility);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * This class handles redirect IRIs without any query params, and returns an unauthenticated\n * session. It serves as a fallback so that consuming libraries don't have to test\n * for the query params themselves, and can always try to use them as a redirect IRI.\n * @hidden\n */\nclass FallbackRedirectHandler {\n async canHandle(redirectUrl) {\n try {\n // The next URL object is built for validating it.\n // eslint-disable-next-line no-new\n new URL(redirectUrl);\n return true;\n }\n catch (e) {\n throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);\n }\n }\n async handle(\n // The argument is ignored, but must be present to implement the interface\n _redirectUrl) {\n return solidClientAuthnCore.getUnauthenticatedSession();\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n// FIXME: The following doesn't work in the browser, it results in all the fetches\n// being unauthenticated. This should be looked into when migrating to universal-fetch.\n// import { fetch } from \"cross-fetch\";\nconst globalFetch = (...args) => universalFetch.fetch.call(globalThis, ...args);\n/**\n * @hidden\n */\nclass AuthCodeRedirectHandler {\n constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {\n this.storageUtility = storageUtility;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.tokerRefresher = tokerRefresher;\n this.storageUtility = storageUtility;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.tokerRefresher = tokerRefresher;\n }\n async canHandle(redirectUrl) {\n try {\n const myUrl = new URL(redirectUrl);\n return (myUrl.searchParams.get(\"code\") !== null &&\n myUrl.searchParams.get(\"state\") !== null);\n }\n catch (e) {\n throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);\n }\n }\n async handle(redirectUrl, eventEmitter) {\n if (!(await this.canHandle(redirectUrl))) {\n throw new Error(`AuthCodeRedirectHandler cannot handle [${redirectUrl}]: it is missing one of [code, state].`);\n }\n const url = new URL(redirectUrl);\n const oauthState = url.searchParams.get(\"state\");\n const storedSessionId = (await this.storageUtility.getForUser(oauthState, \"sessionId\", {\n errorIfNull: true,\n }));\n const { issuerConfig, codeVerifier, redirectUrl: storedRedirectIri, dpop: isDpop, } = await solidClientAuthnCore.loadOidcContextFromStorage(storedSessionId, this.storageUtility, this.issuerConfigFetcher);\n const iss = url.searchParams.get(\"iss\");\n if (typeof iss === \"string\" && iss !== issuerConfig.issuer) {\n throw new Error(`The value of the iss parameter (${iss}) does not match the issuer identifier of the authorization server (${issuerConfig.issuer}). See [rfc9207](https://www.rfc-editor.org/rfc/rfc9207.html#section-2.3-3.1.1)`);\n }\n if (codeVerifier === undefined) {\n throw new Error(`The code verifier for session ${storedSessionId} is missing from storage.`);\n }\n if (storedRedirectIri === undefined) {\n throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`);\n }\n const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig);\n let tokens;\n const tokenCreatedAt = Date.now();\n if (isDpop) {\n tokens = await oidcClientExt.getDpopToken(issuerConfig, client, {\n grantType: \"authorization_code\",\n // We rely on our 'canHandle' function checking that the OAuth 'code'\n // parameter is present in our query string.\n code: url.searchParams.get(\"code\"),\n codeVerifier,\n redirectUrl: storedRedirectIri,\n });\n // Delete oidc-client-specific session information from storage. This is\n // done automatically when retrieving a bearer token, but since the DPoP\n // binding uses our custom code, this needs to be done manually.\n window.localStorage.removeItem(`oidc.${oauthState}`);\n }\n else {\n tokens = await oidcClientExt.getBearerToken(url.toString());\n }\n let refreshOptions;\n if (tokens.refreshToken !== undefined) {\n refreshOptions = {\n sessionId: storedSessionId,\n refreshToken: tokens.refreshToken,\n tokenRefresher: this.tokerRefresher,\n };\n }\n const authFetch = await solidClientAuthnCore.buildAuthenticatedFetch(globalFetch, tokens.accessToken, {\n dpopKey: tokens.dpopKey,\n refreshOptions,\n eventEmitter,\n expiresIn: tokens.expiresIn,\n });\n await this.storageUtility.setForUser(storedSessionId, {\n webId: tokens.webId,\n isLoggedIn: \"true\",\n }, { secure: true });\n const sessionInfo = await this.sessionInfoManager.get(storedSessionId);\n if (!sessionInfo) {\n throw new Error(`Could not retrieve session: [${storedSessionId}].`);\n }\n return Object.assign(sessionInfo, {\n fetch: authFetch,\n getLogoutUrl: solidClientAuthnCore.maybeBuildRpInitiatedLogout({\n idTokenHint: tokens.idToken,\n endSessionEndpoint: issuerConfig.endSessionEndpoint,\n }),\n expirationDate: typeof tokens.expiresIn === \"number\"\n ? tokenCreatedAt + tokens.expiresIn * 1000\n : undefined,\n });\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass AggregateRedirectHandler extends solidClientAuthnCore.AggregateHandler {\n constructor(redirectHandlers) {\n super(redirectHandlers);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass BrowserStorage {\n get storage() {\n return window.localStorage;\n }\n async get(key) {\n return this.storage.getItem(key) || undefined;\n }\n async set(key, value) {\n this.storage.setItem(key, value);\n }\n async delete(key) {\n this.storage.removeItem(key);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass Redirector {\n redirect(redirectUrl, options) {\n if (options && options.handleRedirect) {\n options.handleRedirect(redirectUrl);\n }\n else if (options && options.redirectByReplacingState) {\n window.history.replaceState({}, \"\", redirectUrl);\n }\n else {\n window.location.href = redirectUrl;\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass ClientRegistrar {\n constructor(storageUtility) {\n this.storageUtility = storageUtility;\n this.storageUtility = storageUtility;\n }\n async getClient(options, issuerConfig) {\n // If client secret and/or client id are stored in storage, use those.\n const [storedClientId, storedClientSecret,\n // storedClientName,\n ] = await Promise.all([\n this.storageUtility.getForUser(options.sessionId, \"clientId\", {\n secure: false,\n }),\n this.storageUtility.getForUser(options.sessionId, \"clientSecret\", {\n secure: false,\n }),\n // this.storageUtility.getForUser(options.sessionId, \"clientName\", {\n // // FIXME: figure out how to persist secure storage at reload\n // secure: false,\n // }),\n ]);\n if (storedClientId) {\n return {\n clientId: storedClientId,\n clientSecret: storedClientSecret,\n clientType: \"dynamic\",\n };\n }\n try {\n const registeredClient = await oidcClientExt.registerClient(options, issuerConfig);\n // Save info\n const infoToSave = {\n clientId: registeredClient.clientId,\n };\n if (registeredClient.clientSecret) {\n infoToSave.clientSecret = registeredClient.clientSecret;\n }\n if (registeredClient.idTokenSignedResponseAlg) {\n infoToSave.idTokenSignedResponseAlg =\n registeredClient.idTokenSignedResponseAlg;\n }\n await this.storageUtility.setForUser(options.sessionId, infoToSave, {\n // FIXME: figure out how to persist secure storage at reload\n // Otherwise, the client info cannot be retrieved from storage, and\n // the lib tries to re-register the client on each fetch\n secure: false,\n });\n return registeredClient;\n }\n catch (error) {\n throw new Error(`Client registration failed: [${error}]`);\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * This class handles redirect IRIs without any query params, and returns an unauthenticated\n * session. It serves as a fallback so that consuming libraries don't have to test\n * for the query params themselves, and can always try to use them as a redirect IRI.\n * @hidden\n */\nclass ErrorOidcHandler {\n async canHandle(redirectUrl) {\n try {\n // eslint-disable-next-line no-new\n return new URL(redirectUrl).searchParams.has(\"error\");\n }\n catch (e) {\n throw new Error(`[${redirectUrl}] is not a valid URL, and cannot be used as a redirect URL: ${e}`);\n }\n }\n async handle(redirectUrl, eventEmitter) {\n if (eventEmitter !== undefined) {\n const url = new URL(redirectUrl);\n const errorUrl = url.searchParams.get(\"error\");\n const errorDescriptionUrl = url.searchParams.get(\"error_description\");\n eventEmitter.emit(solidClientAuthnCore.EVENTS.ERROR, errorUrl, errorDescriptionUrl);\n }\n return solidClientAuthnCore.getUnauthenticatedSession();\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// Some identifiers are not in camelcase on purpose, as they are named using the\n// official names from the OIDC/OAuth2 specifications.\n/* eslint-disable camelcase */\n/**\n * @hidden\n */\nclass TokenRefresher {\n constructor(storageUtility, issuerConfigFetcher, clientRegistrar) {\n this.storageUtility = storageUtility;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n this.storageUtility = storageUtility;\n this.issuerConfigFetcher = issuerConfigFetcher;\n this.clientRegistrar = clientRegistrar;\n }\n async refresh(sessionId, refreshToken, dpopKey, eventEmitter) {\n const oidcContext = await solidClientAuthnCore.loadOidcContextFromStorage(sessionId, this.storageUtility, this.issuerConfigFetcher);\n // This should also retrieve the client from storage\n const clientInfo = await this.clientRegistrar.getClient({ sessionId }, oidcContext.issuerConfig);\n if (refreshToken === undefined) {\n // TODO: in a next PR, look up storage for a refresh token\n throw new Error(`Session [${sessionId}] has no refresh token to allow it to refresh its access token.`);\n }\n if (oidcContext.dpop && dpopKey === undefined) {\n throw new Error(`For session [${sessionId}], the key bound to the DPoP access token must be provided to refresh said access token.`);\n }\n const tokenSet = await oidcClientExt.refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);\n if (tokenSet.refreshToken !== undefined) {\n eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(solidClientAuthnCore.EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);\n await this.storageUtility.setForUser(sessionId, {\n refreshToken: tokenSet.refreshToken,\n });\n }\n return tokenSet;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n *\n * @param dependencies\n * @deprecated This function will be removed from the external API in an upcoming release.\n */\nfunction getClientAuthenticationWithDependencies(dependencies) {\n const inMemoryStorage = new solidClientAuthnCore.InMemoryStorage();\n const secureStorage = dependencies.secureStorage || inMemoryStorage;\n const insecureStorage = dependencies.insecureStorage || new BrowserStorage();\n const storageUtility = new StorageUtilityBrowser(secureStorage, insecureStorage);\n const issuerConfigFetcher = new IssuerConfigFetcher(storageUtility);\n const clientRegistrar = new ClientRegistrar(storageUtility);\n const sessionInfoManager = new SessionInfoManager(storageUtility);\n const tokenRefresher = new TokenRefresher(storageUtility, issuerConfigFetcher, clientRegistrar);\n const redirector = new Redirector();\n // make new handler for redirect and login\n const loginHandler = new OidcLoginHandler(storageUtility, new AuthorizationCodeWithPkceOidcHandler(storageUtility, redirector), issuerConfigFetcher, clientRegistrar);\n const redirectHandler = new AggregateRedirectHandler([\n new ErrorOidcHandler(),\n new AuthCodeRedirectHandler(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokenRefresher),\n // This catch-all class will always be able to handle the\n // redirect IRI, so it must be registered last.\n new FallbackRedirectHandler(),\n ]);\n return new ClientAuthentication(loginHandler, redirectHandler, new solidClientAuthnCore.IWaterfallLogoutHandler(sessionInfoManager, redirector), sessionInfoManager, issuerConfigFetcher);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst KEY_CURRENT_SESSION = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`;\nconst KEY_CURRENT_URL = `${solidClientAuthnCore.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`;\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nasync function silentlyAuthenticate(sessionId, clientAuthn, session) {\n var _a;\n const storedSessionInfo = await clientAuthn.validateCurrentSession(sessionId);\n if (storedSessionInfo !== null) {\n // It can be really useful to save the user's current browser location,\n // so that we can restore it after completing the silent authentication\n // on incoming redirect. This way, the user is eventually redirected back\n // to the page they were on and not to the app's redirect page.\n window.localStorage.setItem(KEY_CURRENT_URL, window.location.href);\n await clientAuthn.login({\n sessionId,\n prompt: \"none\",\n oidcIssuer: storedSessionInfo.issuer,\n redirectUrl: storedSessionInfo.redirectUrl,\n clientId: storedSessionInfo.clientAppId,\n clientSecret: storedSessionInfo.clientAppSecret,\n tokenType: (_a = storedSessionInfo.tokenType) !== null && _a !== void 0 ? _a : \"DPoP\",\n }, session.events);\n return true;\n }\n return false;\n}\nfunction isLoggedIn(sessionInfo) {\n return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);\n}\n/**\n * A {@link Session} object represents a user's session on an application. The session holds state, as it stores information enabling acces to private resources after login for instance.\n */\nclass Session extends EventEmitter {\n /**\n * Session object constructor. Typically called as follows:\n *\n * ```typescript\n * const session = new Session();\n * ```\n *\n * See also [getDefaultSession](https://docs.inrupt.com/developer-tools/api/javascript/solid-client-authn-browser/functions.html#getdefaultsession).\n *\n * @param sessionOptions The options enabling the correct instantiation of\n * the session. Either both storages or clientAuthentication are required. For\n * more information, see {@link ISessionOptions}.\n * @param sessionId A string uniquely identifying the session.\n *\n */\n constructor(sessionOptions = {}, sessionId = undefined) {\n super();\n this.tokenRequestInProgress = false;\n /**\n * Triggers the login process. Note that this method will redirect the user away from your app.\n *\n * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.\n * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by {@linkcode handleIncomingRedirect}.\n */\n // Define these functions as properties so that they don't get accidentally re-bound.\n // Isn't Javascript fun?\n this.login = async (options) => {\n var _a;\n await this.clientAuthentication.login({\n sessionId: this.info.sessionId,\n ...options,\n // Defaults the token type to DPoP\n tokenType: (_a = options.tokenType) !== null && _a !== void 0 ? _a : \"DPoP\",\n }, this.events);\n // `login` redirects the user away from the app,\n // so unless it throws an error, there is no code that should run afterwards\n // (since there is no \"after\" in the lifetime of the script).\n // Hence, this Promise never resolves:\n return new Promise(() => { });\n };\n /**\n * Fetches data using available login information. If the user is not logged in, this will behave as a regular `fetch`. The signature of this method is identical to the [canonical `fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).\n *\n * @param url The URL from which data should be fetched.\n * @param init Optional parameters customizing the request, by specifying an HTTP method, headers, a body, etc. Follows the [WHATWG Fetch Standard](https://fetch.spec.whatwg.org/).\n */\n this.fetch = (url, init) => this.clientAuthentication.fetch(url, init);\n /**\n * An internal logout function, to control whether or not the logout signal\n * should be sent, i.e. if the logout was user-initiated or is the result of\n * an external event.\n *\n * @hidden\n */\n this.internalLogout = async (emitSignal, options) => {\n // Clearing this value means that silent refresh will no longer be attempted.\n // In particular, in the case of a silent authentication error it prevents\n // from getting stuck in an authentication retries loop.\n window.localStorage.removeItem(KEY_CURRENT_SESSION);\n await this.clientAuthentication.logout(this.info.sessionId, options);\n this.info.isLoggedIn = false;\n if (emitSignal) {\n this.events.emit(solidClientAuthnCore.EVENTS.LOGOUT);\n }\n };\n /**\n * Logs the user out of the application.\n *\n * There are 2 types of logout supported by this library,\n * `app` logout and `idp` logout.\n *\n * App logout will log the user out within the application\n * by clearing any session data from the browser. It does\n * not log the user out of their Solid identity provider,\n * and should not redirect the user away.\n * App logout can be performed as follows:\n * ```typescript\n * await session.logout({ logoutType: 'app' });\n * ```\n *\n * IDP logout will log the user out of their Solid identity provider,\n * and will redirect the user away from the application to do so. In order\n * for users to be redirected back to `postLogoutUrl` you MUST include the\n * `postLogoutUrl` value in the `post_logout_redirect_uris` field in the\n * [Client ID Document](https://docs.inrupt.com/ess/latest/security/authentication/#client-identifier-client-id).\n * IDP logout can be performed as follows:\n * ```typescript\n * await session.logout({\n * logoutType: 'idp',\n * // An optional URL to redirect to after logout has completed;\n * // this MUST match a logout URL listed in the Client ID Document\n * // of the application that is logged in.\n * // If the application is logged in with a Client ID that is not\n * // a URI dereferencing to a Client ID Document then users will\n * // not be redirected back to the `postLogoutUrl` after logout.\n * postLogoutUrl: 'https://example.com/logout',\n * // An optional value to be included in the query parameters\n * // when the IDP provider redirects the user to the postLogoutRedirectUrl.\n * state: \"my-state\"\n * });\n * ```\n */\n this.logout = async (options) => this.internalLogout(true, options);\n /**\n * Completes the login process by processing the information provided by the\n * Solid identity provider through redirect.\n *\n * @param options See {@see IHandleIncomingRedirectOptions}.\n */\n this.handleIncomingRedirect = async (inputOptions = {}) => {\n var _a;\n if (this.info.isLoggedIn) {\n return this.info;\n }\n if (this.tokenRequestInProgress) {\n return undefined;\n }\n const options = typeof inputOptions === \"string\" ? { url: inputOptions } : inputOptions;\n const url = (_a = options.url) !== null && _a !== void 0 ? _a : window.location.href;\n this.tokenRequestInProgress = true;\n const sessionInfo = await this.clientAuthentication.handleIncomingRedirect(url, this.events);\n if (isLoggedIn(sessionInfo)) {\n this.setSessionInfo(sessionInfo);\n const currentUrl = window.localStorage.getItem(KEY_CURRENT_URL);\n if (currentUrl === null) {\n // The login event can only be triggered **after** the user has been\n // redirected from the IdP with access and ID tokens.\n this.events.emit(solidClientAuthnCore.EVENTS.LOGIN);\n }\n else {\n // If an URL is stored in local storage, we are being logged in after a\n // silent authentication, so remove our currently stored URL location\n // to clean up our state now that we are completing the re-login process.\n window.localStorage.removeItem(KEY_CURRENT_URL);\n this.events.emit(solidClientAuthnCore.EVENTS.SESSION_RESTORED, currentUrl);\n }\n }\n else if (options.restorePreviousSession === true) {\n // Silent authentication happens after a refresh, which means there are no\n // OAuth params in the current location IRI. It can only succeed if a session\n // was previously logged in, in which case its ID will be present with a known\n // identifier in local storage.\n // Check if we have a locally stored session ID...\n const storedSessionId = window.localStorage.getItem(KEY_CURRENT_SESSION);\n // ...if not, then there is no ID token, and so silent authentication cannot happen, but\n // if we do have a stored session ID, attempt to re-authenticate now silently.\n if (storedSessionId !== null) {\n const attemptedSilentAuthentication = await silentlyAuthenticate(storedSessionId, this.clientAuthentication, this);\n // At this point, we know that the main window will imminently be redirected.\n // However, this redirect is asynchronous and there is no way to halt execution\n // until it happens precisely. That's why the current Promise simply does not\n // resolve.\n if (attemptedSilentAuthentication) {\n return new Promise(() => { });\n }\n }\n }\n this.tokenRequestInProgress = false;\n return sessionInfo;\n };\n // Until Session no longer implements EventEmitter, this.events is just a proxy\n // to this (with some interface filtering). When we make the breaking change,\n // this.events will be a regular EventEmitter (implementing ISessionEventEmitter):\n // this.events = new EventEmitter();\n this.events = new Proxy(this, solidClientAuthnCore.buildProxyHandler(Session.prototype, \"events only implements ISessionEventListener\"));\n if (sessionOptions.clientAuthentication) {\n this.clientAuthentication = sessionOptions.clientAuthentication;\n }\n else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {\n this.clientAuthentication = getClientAuthenticationWithDependencies({\n secureStorage: sessionOptions.secureStorage,\n insecureStorage: sessionOptions.insecureStorage,\n });\n }\n else {\n this.clientAuthentication = getClientAuthenticationWithDependencies({});\n }\n if (sessionOptions.sessionInfo) {\n this.info = {\n sessionId: sessionOptions.sessionInfo.sessionId,\n isLoggedIn: false,\n webId: sessionOptions.sessionInfo.webId,\n };\n }\n else {\n this.info = {\n sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : uuid.v4(),\n isLoggedIn: false,\n };\n }\n // When a session is logged in, we want to track its ID in local storage to\n // enable silent refresh. The current session ID specifically stored in 'localStorage'\n // (as opposed to using our storage abstraction layer) because it is only\n // used in a browser-specific mechanism.\n this.events.on(solidClientAuthnCore.EVENTS.LOGIN, () => window.localStorage.setItem(KEY_CURRENT_SESSION, this.info.sessionId));\n this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));\n this.events.on(solidClientAuthnCore.EVENTS.ERROR, () => this.internalLogout(false));\n }\n /**\n * Register a callback function to be called when a user completes login.\n *\n * The callback is called when {@link handleIncomingRedirect} completes successfully.\n *\n * @param callback The function called when a user completes login.\n * @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)\n */\n onLogin(callback) {\n this.events.on(solidClientAuthnCore.EVENTS.LOGIN, callback);\n }\n /**\n * Register a callback function to be called when a user logs out:\n *\n * @param callback The function called when a user completes logout.\n * @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)\n */\n onLogout(callback) {\n this.events.on(solidClientAuthnCore.EVENTS.LOGOUT, callback);\n }\n /**\n * Register a callback function to be called when a user logs out:\n *\n * @param callback The function called when an error occurs.\n * @since 1.11.0\n * @deprecated Prefer session.events.on(EVENTS.ERROR, callback)\n */\n onError(callback) {\n this.events.on(solidClientAuthnCore.EVENTS.ERROR, callback);\n }\n /**\n * Register a callback function to be called when a session is restored.\n *\n * Note: the callback will be called with the saved value of the 'current URL'\n * at the time the session was restored.\n *\n * @param callback The function called when a user's already logged-in session is restored, e.g., after a silent authentication is completed after a page refresh.\n * @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)\n */\n onSessionRestore(callback) {\n this.events.on(solidClientAuthnCore.EVENTS.SESSION_RESTORED, callback);\n }\n /**\n * Register a callback that runs when the session expires and can no longer\n * make authenticated requests, but following a user logout.\n * @param callback The function that runs on session expiration.\n * @since 1.11.0\n * @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)\n */\n onSessionExpiration(callback) {\n this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXPIRED, callback);\n }\n setSessionInfo(sessionInfo) {\n this.info.isLoggedIn = sessionInfo.isLoggedIn;\n this.info.webId = sessionInfo.webId;\n this.info.sessionId = sessionInfo.sessionId;\n this.info.expirationDate = sessionInfo.expirationDate;\n this.events.on(solidClientAuthnCore.EVENTS.SESSION_EXTENDED, (expiresIn) => {\n this.info.expirationDate = Date.now() + expiresIn * 1000;\n });\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nlet defaultSession;\n/**\n * Obtain the {@link Session} used when not explicitly instantiating one yourself.\n *\n * When using the top-level exports {@link fetch}, {@link login}, {@link logout},\n * {@link handleIncomingRedirect}, {@link onLogin} and {@link onLogout}, these apply to an\n * implicitly-instantiated {@link Session}.\n * This function returns a reference to that Session in order to obtain e.g. the current user's\n * WebID.\n * @since 1.3.0\n */\nfunction getDefaultSession() {\n if (typeof defaultSession === \"undefined\") {\n defaultSession = new Session();\n }\n return defaultSession;\n}\n/**\n * This function's signature is equal to `window.fetch`, but if the current user is authenticated\n * (see [[login]] and [[handleIncomingRedirect]]), requests made using it will include that user's\n * credentials. If not, this will behave just like the regular `window.fetch`.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch}\n * @since 1.3.0\n */\n/* eslint-disable-next-line no-shadow */\nconst fetch = (...args) => {\n const session = getDefaultSession();\n return session.fetch(...args);\n};\n/**\n * Triggers the login process. Note that this method will redirect the user away from your app.\n *\n * @param options Parameter to customize the login behaviour. In particular, two options are mandatory: `options.oidcIssuer`, the user's identity provider, and `options.redirectUrl`, the URL to which the user will be redirected after logging in their identity provider.\n * @returns This method should redirect the user away from the app: it does not return anything. The login process is completed by [[handleIncomingRedirect]].\n * @since 1.3.0\n */\nconst login = (...args) => {\n const session = getDefaultSession();\n return session.login(...args);\n};\n/**\n * Logs the user out of the application.\n *\n * By default this does not log the user out of their Solid identity provider.\n * In order to do so, you must set the logoutType to `idp`. For usage details\n * see {@link Session.logout}.\n *\n * @since 1.3.0\n */\nconst logout = (...args) => {\n const session = getDefaultSession();\n return session.logout(...args);\n};\n/**\n * Completes the login process by processing the information provided by the Solid identity provider through redirect.\n *\n * @param url The URL of the page handling the redirect, including the query parameters — these contain the information to process the login.\n * @since 1.3.0\n */\nconst handleIncomingRedirect = (...args) => {\n const session = getDefaultSession();\n return session.handleIncomingRedirect(...args);\n};\n/**\n * Register a callback function to be called when a user completes login.\n *\n * The callback is called when {@link handleIncomingRedirect} completes successfully.\n * @since 1.3.0\n *\n * @param callback The function called when a user completes login.\n * @deprecated Prefer events.on(EVENTS.LOGIN, callback)\n\n */\nconst onLogin = (...args) => {\n const session = getDefaultSession();\n return session.onLogin(...args);\n};\n/**\n * Register a callback function to be called when a user logs out:\n *\n * @param callback The function called when a user completes logout.\n * @since 1.3.0\n * @deprecated Prefer events.on(EVENTS.LOGOUT, callback)\n *\n */\nconst onLogout = (...args) => {\n const session = getDefaultSession();\n return session.onLogout(...args);\n};\n/**\n * Register a callback function to be called when a session is restored:\n *\n * @param callback The function called when a session is restored.\n * @since 1.3.0\n * @deprecated Prefer events.on(EVENTS.SESSION_RESTORED, callback)\n */\nconst onSessionRestore = (...args) => {\n const session = getDefaultSession();\n return session.onSessionRestore(...args);\n};\n/**\n * {@link SessionEventEmitter} instance to subscribe to events by the default session.\n *\n * @since 1.14.0\n */\nconst events = () => {\n return getDefaultSession().events;\n};\n\nObject.defineProperty(exports, 'ConfigurationError', {\n enumerable: true,\n get: function () { return solidClientAuthnCore.ConfigurationError; }\n});\nObject.defineProperty(exports, 'EVENTS', {\n enumerable: true,\n get: function () { return solidClientAuthnCore.EVENTS; }\n});\nObject.defineProperty(exports, 'InMemoryStorage', {\n enumerable: true,\n get: function () { return solidClientAuthnCore.InMemoryStorage; }\n});\nObject.defineProperty(exports, 'NotImplementedError', {\n enumerable: true,\n get: function () { return solidClientAuthnCore.NotImplementedError; }\n});\nexports.Session = Session;\nexports.events = events;\nexports.fetch = fetch;\nexports.getClientAuthenticationWithDependencies = getClientAuthenticationWithDependencies;\nexports.getDefaultSession = getDefaultSession;\nexports.handleIncomingRedirect = handleIncomingRedirect;\nexports.login = login;\nexports.logout = logout;\nexports.onLogin = onLogin;\nexports.onLogout = onLogout;\nexports.onSessionRestore = onSessionRestore;\n//# sourceMappingURL=index.js.map\n","'use strict';\n\nvar events = require('events');\nvar universalFetch = require('@inrupt/universal-fetch');\nvar jose = require('jose');\nvar uuid = require('uuid');\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Intended to be used by dependent packages as a common prefix for keys into\n * storage mechanisms (so as to group all keys related to Solid Client Authn\n * within those storage mechanisms, e.g., window.localStorage).\n */\nconst SOLID_CLIENT_AUTHN_KEY_PREFIX = \"solidClientAuthn:\";\n/**\n * Ordered list of signature algorithms, from most preferred to least preferred.\n */\nconst PREFERRED_SIGNING_ALG = [\"ES256\", \"RS256\"];\nconst EVENTS = {\n // Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events.\n ERROR: \"error\",\n LOGIN: \"login\",\n LOGOUT: \"logout\",\n NEW_REFRESH_TOKEN: \"newRefreshToken\",\n SESSION_EXPIRED: \"sessionExpired\",\n SESSION_EXTENDED: \"sessionExtended\",\n SESSION_RESTORED: \"sessionRestore\",\n TIMEOUT_SET: \"timeoutSet\",\n};\n/**\n * We want to refresh a token 5 seconds before it expires.\n */\nconst REFRESH_BEFORE_EXPIRATION_SECONDS = 5;\n// The openid scope requests an OIDC ID token token to be returned.\nconst SCOPE_OPENID = \"openid\";\n// The offline_access scope requests a refresh token to be returned.\nconst SCOPE_OFFLINE = \"offline_access\";\n// The webid scope is required as per https://solid.github.io/solid-oidc/#webid-scope\nconst SCOPE_WEBID = \"webid\";\n// The scopes are expected as a space-separated list.\nconst DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(\" \");\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Temporary internal builder for safe proxying.\n */\nconst buildProxyHandler = (\n// The class to be excluded needs to be injected, because it is defined in a\n// dependency.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntoExclude, errorMessage) => ({\n // This proxy is only a temporary measure until Session no longer extends\n // SessionEventEmitter, and the proxying is no longer necessary.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(target, prop, receiver) {\n // Reject any calls to the proxy that isn't specific to the EventEmitter API\n if (!Object.getOwnPropertyNames(events.EventEmitter).includes(prop) &&\n Object.getOwnPropertyNames(toExclude).includes(prop)) {\n throw new Error(`${errorMessage}: [${prop}] is not supported`);\n }\n return Reflect.get(target, prop, receiver);\n },\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass AggregateHandler {\n constructor(handleables) {\n this.handleables = handleables;\n this.handleables = handleables;\n }\n /**\n * Helper function that will asynchronously determine the proper handler to use. If multiple\n * handlers can handle, it will choose the first one in the list\n * @param params Paramerters to feed to the handler\n */\n async getProperHandler(params) {\n // TODO : This function doesn't currently operate as described. Tests need to be written\n // return new Promise | null>((resolve, reject) => {\n // const resolvedValues: Array = Array(this.handleables.length).map(() => null)\n // let numberResolved = 0\n // this.handleables.forEach(async (handleable: IHandleable, index: number) => {\n // resolvedValues[index] = await handleable.canHandle(...params)\n // numberResolved++\n // let curResolvedValueIndex = 0\n // while (\n // resolvedValues[curResolvedValueIndex] !== null ||\n // resolvedValues[curResolvedValueIndex] !== undefined\n // ) {\n // if (resolvedValues[curResolvedValueIndex]) {\n // resolve(this.handleables[curResolvedValueIndex])\n // }\n // curResolvedValueIndex++\n // }\n // })\n // })\n const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params)));\n for (let i = 0; i < canHandleList.length; i += 1) {\n if (canHandleList[i]) {\n return this.handleables[i];\n }\n }\n return null;\n }\n async canHandle(...params) {\n return (await this.getProperHandler(params)) !== null;\n }\n async handle(...params) {\n const handler = await this.getProperHandler(params);\n if (handler) {\n return handler.handle(...params);\n }\n throw new Error(`[${this.constructor.name}] cannot find a suitable handler for: ${params\n .map((param) => {\n try {\n return JSON.stringify(param);\n }\n catch (err) {\n /* eslint-disable @typescript-eslint/no-explicit-any */\n return param.toString();\n }\n })\n .join(\", \")}`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// eslint-disable-next-line no-shadow\nasync function fetchJwks(jwksIri, issuerIri) {\n // FIXME: the following line works, but the underlying network calls don't seem\n // to be mocked properly by our test code. It would be nicer to replace calls to this\n // function by the following line and to fix the mocks.\n // const jwks = createRemoteJWKSet(new URL(jwksIri));\n const jwksResponse = await universalFetch.fetch.call(globalThis, jwksIri);\n if (jwksResponse.status !== 200) {\n throw new Error(`Could not fetch JWKS for [${issuerIri}] at [${jwksIri}]: ${jwksResponse.status} ${jwksResponse.statusText}`);\n }\n // The JWKS should only contain the current key for the issuer.\n let jwk;\n try {\n jwk = (await jwksResponse.json()).keys[0];\n }\n catch (e) {\n throw new Error(`Malformed JWKS for [${issuerIri}] at [${jwksIri}]: ${e.message}`);\n }\n return jwk;\n}\n/**\n * Extract a WebID from an ID token payload based on https://github.com/solid/webid-oidc-spec.\n * Note that this does not yet implement the user endpoint lookup, and only checks\n * for `webid` or IRI-like `sub` claims.\n *\n * @param idToken the payload of the ID token from which the WebID can be extracted.\n * @returns a WebID extracted from the ID token.\n * @internal\n */\nasync function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {\n const jwk = await fetchJwks(jwksIri, issuerIri);\n let payload;\n try {\n const { payload: verifiedPayload } = await jose.jwtVerify(idToken, await jose.importJWK(jwk), {\n issuer: issuerIri,\n audience: clientId,\n });\n payload = verifiedPayload;\n }\n catch (e) {\n throw new Error(`Token verification failed: ${e.stack}`);\n }\n if (typeof payload.webid === \"string\") {\n return payload.webid;\n }\n if (typeof payload.sub !== \"string\") {\n throw new Error(`The token ${JSON.stringify(payload)} is invalid: it has no 'webid' claim and no 'sub' claim.`);\n }\n try {\n // This parses the 'sub' claim to check if it is a well-formed IRI.\n // However, the normalized value isn't returned to make sure the WebID is returned\n // as specified by the Identity Provider.\n // eslint-disable-next-line no-new\n new URL(payload.sub);\n return payload.sub;\n }\n catch (e) {\n throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${payload.sub}] is invalid as a URL - error [${e}].`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isValidRedirectUrl(redirectUrl) {\n // If the redirect URL is not a valid URL, an error will be thrown.\n try {\n const urlObject = new URL(redirectUrl);\n const noReservedQuery = !urlObject.searchParams.has(\"code\") &&\n !urlObject.searchParams.has(\"state\");\n // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL\n // must not include a hash fragment.\n const noHash = urlObject.hash === \"\";\n return noReservedQuery && noHash;\n }\n catch (e) {\n return false;\n }\n}\nfunction removeOpenIdParams(redirectUrl) {\n const cleanedUpUrl = new URL(redirectUrl);\n // For auth code flow\n cleanedUpUrl.searchParams.delete(\"state\");\n cleanedUpUrl.searchParams.delete(\"code\");\n // For login error\n cleanedUpUrl.searchParams.delete(\"error\");\n cleanedUpUrl.searchParams.delete(\"error_description\");\n // For RFC9207\n cleanedUpUrl.searchParams.delete(\"iss\");\n return cleanedUpUrl;\n}\n\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * @hidden\n * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth\n * PKCE: https://tools.ietf.org/html/rfc7636\n */\nclass AuthorizationCodeWithPkceOidcHandlerBase {\n constructor(storageUtility, redirector) {\n this.storageUtility = storageUtility;\n this.redirector = redirector;\n this.storageUtility = storageUtility;\n this.redirector = redirector;\n }\n async canHandle(oidcLoginOptions) {\n return !!(oidcLoginOptions.issuerConfiguration.grantTypesSupported &&\n oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf(\"authorization_code\") > -1);\n }\n async handleRedirect({ oidcLoginOptions, state, codeVerifier, targetUrl, }) {\n await Promise.all([\n // We use the OAuth 'state' value (which should be crypto-random) as\n // the key in our storage to store our actual SessionID. We do this\n // 'cos we'll need to lookup our session information again when the\n // browser is redirected back to us (i.e. the OAuth client\n // application) from the Authorization Server.\n // We don't want to use our session ID as the OAuth 'state' value, as\n // that session ID can be any developer-specified value, and therefore\n // may not be appropriate (since the OAuth 'state' value should really\n // be an unguessable crypto-random value).\n // eslint-disable-next-line no-underscore-dangle\n this.storageUtility.setForUser(state, {\n sessionId: oidcLoginOptions.sessionId,\n }),\n // Store our login-process state using the session ID as the key.\n // Strictly speaking, this indirection from our OAuth state value to\n // our session ID is unnecessary, but it provides a slightly cleaner\n // separation of concerns.\n this.storageUtility.setForUser(oidcLoginOptions.sessionId, {\n // eslint-disable-next-line no-underscore-dangle\n codeVerifier,\n issuer: oidcLoginOptions.issuer.toString(),\n // The redirect URL is read after redirect, so it must be stored now.\n redirectUrl: oidcLoginOptions.redirectUrl,\n dpop: oidcLoginOptions.dpop ? \"true\" : \"false\",\n }),\n ]);\n this.redirector.redirect(targetUrl, {\n handleRedirect: oidcLoginOptions.handleRedirect,\n });\n return undefined;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass GeneralLogoutHandler {\n constructor(sessionInfoManager) {\n this.sessionInfoManager = sessionInfoManager;\n this.sessionInfoManager = sessionInfoManager;\n }\n async canHandle() {\n return true;\n }\n async handle(userId) {\n await this.sessionInfoManager.clear(userId);\n }\n}\n\nclass IRpLogoutHandler {\n constructor(redirector) {\n this.redirector = redirector;\n this.redirector = redirector;\n }\n async canHandle(userId, options) {\n return (options === null || options === void 0 ? void 0 : options.logoutType) === \"idp\";\n }\n async handle(userId, options) {\n if ((options === null || options === void 0 ? void 0 : options.logoutType) !== \"idp\") {\n throw new Error(\"Attempting to call idp logout handler to perform app logout\");\n }\n if (options.toLogoutUrl === undefined) {\n throw new Error(\"Cannot perform IDP logout. Did you log in using the OIDC authentication flow?\");\n }\n this.redirector.redirect(options.toLogoutUrl(options), {\n handleRedirect: options.handleRedirect,\n });\n }\n}\n\nclass IWaterfallLogoutHandler {\n constructor(sessionInfoManager, redirector) {\n this.handlers = [\n new GeneralLogoutHandler(sessionInfoManager),\n new IRpLogoutHandler(redirector),\n ];\n }\n async canHandle() {\n return true;\n }\n async handle(userId, options) {\n for (const handler of this.handlers) {\n /* eslint-disable no-await-in-loop */\n if (await handler.canHandle(userId, options))\n await handler.handle(userId, options);\n /* eslint-enable no-await-in-loop */\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\nfunction getUnauthenticatedSession() {\n return {\n isLoggedIn: false,\n sessionId: uuid.v4(),\n fetch: (...args) => universalFetch.fetch.call(globalThis, ...args),\n };\n}\n/**\n * @param sessionId\n * @param storage\n * @hidden\n */\nasync function clear(sessionId, storage) {\n await Promise.all([\n storage.deleteAllUserData(sessionId, { secure: false }),\n storage.deleteAllUserData(sessionId, { secure: true }),\n ]);\n}\n/**\n * @hidden\n */\nclass SessionInfoManagerBase {\n constructor(storageUtility) {\n this.storageUtility = storageUtility;\n this.storageUtility = storageUtility;\n }\n update(_sessionId, _options) {\n throw new Error(\"Not Implemented\");\n }\n get(_) {\n throw new Error(\"Not implemented\");\n }\n // eslint-disable-next-line class-methods-use-this\n async getAll() {\n throw new Error(\"Not implemented\");\n }\n /**\n * This function removes all session-related information from storage.\n * @param sessionId the session identifier\n * @param storage the storage where session info is stored\n * @hidden\n */\n async clear(sessionId) {\n return clear(sessionId, this.storageUtility);\n }\n /**\n * Registers a new session, so that its ID can be retrieved.\n * @param sessionId\n */\n async register(_sessionId) {\n throw new Error(\"Not implemented\");\n }\n /**\n * Returns all the registered session IDs. Differs from getAll, which also\n * returns additional session information.\n */\n async getRegisteredSessionIdAll() {\n throw new Error(\"Not implemented\");\n }\n /**\n * Deletes all information about all sessions, including their registrations.\n */\n async clearAll() {\n throw new Error(\"Not implemented\");\n }\n}\n\n/**\n * This function is designed to isomorphically capture the behavior in oidc-client-js and node-oidc-provider\n * - https://github.com/IdentityModel/oidc-client-js/blob/edec8f59897bdeedcb0b4167586d49626203c2c1/src/OidcClient.js#L138\n * - https://github.com/panva/node-openid-client/blob/35758419489ff751a71f5b66f5020087a63e1e88/lib/client.js#L284\n *\n * @param options IEndSessionOptions\n * @returns The URL to redirect to in order to perform RP Initiated Logout\n * @hidden\n */\nfunction getEndSessionUrl({ endSessionEndpoint, idTokenHint, postLogoutRedirectUri, state, }) {\n const url = new URL(endSessionEndpoint);\n if (idTokenHint !== undefined)\n url.searchParams.append(\"id_token_hint\", idTokenHint);\n if (postLogoutRedirectUri !== undefined) {\n url.searchParams.append(\"post_logout_redirect_uri\", postLogoutRedirectUri);\n if (state !== undefined)\n url.searchParams.append(\"state\", state);\n }\n return url.toString();\n}\n/**\n * @param options.endSessionEndpoint The end_session_endpoint advertised by the server\n * @param options.idTokenHint The idToken supplied by the server after logging in\n * Redirects the window to the location required to perform RP initiated logout\n *\n * @hidden\n */\nfunction maybeBuildRpInitiatedLogout({ endSessionEndpoint, idTokenHint, }) {\n if (endSessionEndpoint === undefined)\n return undefined;\n return function logout({ state, postLogoutUrl }) {\n return getEndSessionUrl({\n endSessionEndpoint,\n idTokenHint,\n state,\n postLogoutRedirectUri: postLogoutUrl,\n });\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isSupportedTokenType(token) {\n return typeof token === \"string\" && [\"DPoP\", \"Bearer\"].includes(token);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst USER_SESSION_PREFIX = \"solidClientAuthenticationUser\";\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isValidUrl(url) {\n try {\n // Here, the URL constructor is just called to parse the given string and\n // verify if it is a well-formed IRI.\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n }\n catch (_a) {\n return false;\n }\n}\nfunction determineSigningAlg(supported, preferred) {\n var _a;\n return ((_a = preferred.find((signingAlg) => {\n return supported.includes(signingAlg);\n })) !== null && _a !== void 0 ? _a : null);\n}\nfunction determineClientType(options, issuerConfig) {\n if (options.clientId !== undefined && !isValidUrl(options.clientId)) {\n return \"static\";\n }\n if (issuerConfig.scopesSupported.includes(\"webid\") &&\n options.clientId !== undefined &&\n isValidUrl(options.clientId)) {\n return \"solid-oidc\";\n }\n // If no client_id is provided, the client must go through Dynamic Client Registration.\n // If a client_id is provided and it looks like a URI, yet the Identity Provider\n // does *not* support Solid-OIDC, then we also perform DCR (and discard the\n // provided client_id).\n return \"dynamic\";\n}\nasync function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) {\n const clientType = determineClientType(options, issuerConfig);\n if (clientType === \"dynamic\") {\n return clientRegistrar.getClient({\n sessionId: options.sessionId,\n clientName: options.clientName,\n redirectUrl: options.redirectUrl,\n }, issuerConfig);\n }\n // If a client_id was provided, and the Identity Provider is Solid-OIDC compliant,\n // or it is not compliant but the client_id isn't an IRI (we assume it has already\n // been registered with the IdP), then the client registration information needs\n // to be stored so that it can be retrieved later after redirect.\n await storageUtility.setForUser(options.sessionId, {\n // If the client is either static or solid-oidc compliant, its client ID cannot be undefined.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clientId: options.clientId,\n });\n if (options.clientSecret) {\n await storageUtility.setForUser(options.sessionId, {\n clientSecret: options.clientSecret,\n });\n }\n if (options.clientName) {\n await storageUtility.setForUser(options.sessionId, {\n clientName: options.clientName,\n });\n }\n return {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clientId: options.clientId,\n clientSecret: options.clientSecret,\n clientName: options.clientName,\n clientType,\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n// By only referring to `window` at runtime, apps that do server-side rendering\n// won't run into errors when rendering code that instantiates a\n// ClientAuthentication:\nconst globalFetch = (request, init) => universalFetch.fetch.call(globalThis, request, init);\n/**\n * @hidden\n */\nclass ClientAuthentication {\n constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {\n this.loginHandler = loginHandler;\n this.redirectHandler = redirectHandler;\n this.logoutHandler = logoutHandler;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n // By default, our fetch() resolves to the environment fetch() function.\n this.fetch = globalFetch;\n this.logout = async (sessionId, options) => {\n // When doing IDP logout this will redirect away from the current page, so we should not expect\n // code after this condition to be run if it is true.\n // We also need to make sure that any other cleanup that we want to do for\n // our session takes place before this condition is run\n await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === \"idp\"\n ? {\n ...options,\n toLogoutUrl: this.boundLogout,\n }\n : options);\n // Restore our fetch() function back to the environment fetch(), effectively\n // leaving us with un-authenticated fetches from now on.\n this.fetch = globalFetch;\n // Delete the bound logout function, so that it can't be called after this.\n delete this.boundLogout;\n };\n this.getSessionInfo = async (sessionId) => {\n // TODO complete\n return this.sessionInfoManager.get(sessionId);\n };\n this.getAllSessionInfo = async () => {\n return this.sessionInfoManager.getAll();\n };\n this.loginHandler = loginHandler;\n this.redirectHandler = redirectHandler;\n this.logoutHandler = logoutHandler;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * A helper class that will validate items taken from local storage\n */\nasync function getSessionIdFromOauthState(storageUtility, oauthState) {\n return storageUtility.getForUser(oauthState, \"sessionId\");\n}\n/**\n * Based on the provided state, this looks up contextual information stored\n * before redirecting the user to the OIDC issuer.\n * @param sessionId The state (~ correlation ID) of the OIDC request\n * @param storageUtility\n * @param configFetcher\n * @returns Information stored about the client issuing the request\n */\nasync function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) {\n try {\n const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([\n storageUtility.getForUser(sessionId, \"issuer\", {\n errorIfNull: true,\n }),\n storageUtility.getForUser(sessionId, \"codeVerifier\"),\n storageUtility.getForUser(sessionId, \"redirectUrl\"),\n storageUtility.getForUser(sessionId, \"dpop\", { errorIfNull: true }),\n ]);\n // Clear the code verifier, which is one-time use.\n await storageUtility.deleteForUser(sessionId, \"codeVerifier\");\n // Unlike openid-client, this looks up the configuration from storage\n const issuerConfig = await configFetcher.fetchConfig(issuerIri);\n return {\n codeVerifier,\n redirectUrl: storedRedirectIri,\n issuerConfig,\n dpop: dpop === \"true\",\n };\n }\n catch (e) {\n throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);\n }\n}\n/**\n * Stores information about the session in the provided storage. Note that not\n * all storage are equally secure, and it is strongly advised not to store either\n * the refresh token or the DPoP key in the browser's local storage.\n *\n * @param storageUtility\n * @param sessionId\n * @param webId\n * @param isLoggedIn\n * @param refreshToken\n * @param secure\n * @param dpopKey\n */\nasync function saveSessionInfoToStorage(storageUtility, sessionId, webId, isLoggedIn, refreshToken, secure, dpopKey) {\n // TODO: Investigate why this does not work with a Promise.all\n if (refreshToken !== undefined) {\n await storageUtility.setForUser(sessionId, { refreshToken }, { secure });\n }\n if (webId !== undefined) {\n await storageUtility.setForUser(sessionId, { webId }, { secure });\n }\n if (isLoggedIn !== undefined) {\n await storageUtility.setForUser(sessionId, { isLoggedIn }, { secure });\n }\n if (dpopKey !== undefined) {\n await storageUtility.setForUser(sessionId, {\n publicKey: JSON.stringify(dpopKey.publicKey),\n privateKey: JSON.stringify(await jose.exportJWK(dpopKey.privateKey)),\n }, { secure });\n }\n}\n// TOTEST: this does not handle all possible bad inputs for example what if it's not proper JSON\n/**\n * @hidden\n */\nclass StorageUtility {\n constructor(secureStorage, insecureStorage) {\n this.secureStorage = secureStorage;\n this.insecureStorage = insecureStorage;\n this.secureStorage = secureStorage;\n this.insecureStorage = insecureStorage;\n }\n getKey(userId) {\n return `solidClientAuthenticationUser:${userId}`;\n }\n async getUserData(userId, secure) {\n const stored = await (secure\n ? this.secureStorage\n : this.insecureStorage).get(this.getKey(userId));\n if (stored === undefined) {\n return {};\n }\n try {\n return JSON.parse(stored);\n }\n catch (err) {\n throw new Error(`Data for user [${userId}] in [${secure ? \"secure\" : \"unsecure\"}] storage is corrupted - expected valid JSON, but got: ${stored}`);\n }\n }\n async setUserData(userId, data, secure) {\n await (secure ? this.secureStorage : this.insecureStorage).set(this.getKey(userId), JSON.stringify(data));\n }\n async get(key, options) {\n const value = await ((options === null || options === void 0 ? void 0 : options.secure)\n ? this.secureStorage\n : this.insecureStorage).get(key);\n if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) {\n throw new Error(`[${key}] is not stored`);\n }\n return value;\n }\n async set(key, value, options) {\n return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).set(key, value);\n }\n async delete(key, options) {\n return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(key);\n }\n async getForUser(userId, key, options) {\n const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure);\n let value;\n if (!userData || !userData[key]) {\n value = undefined;\n }\n value = userData[key];\n if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) {\n throw new Error(`Field [${key}] for user [${userId}] is not stored`);\n }\n return value || undefined;\n }\n async setForUser(userId, values, options) {\n let userData;\n try {\n userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure);\n }\n catch (_a) {\n // if reading the user data throws, the data is corrupted, and we want to write over it\n userData = {};\n }\n await this.setUserData(userId, { ...userData, ...values }, options === null || options === void 0 ? void 0 : options.secure);\n }\n async deleteForUser(userId, key, options) {\n const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure);\n delete userData[key];\n await this.setUserData(userId, userData, options === null || options === void 0 ? void 0 : options.secure);\n }\n async deleteAllUserData(userId, options) {\n await ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(this.getKey(userId));\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass InMemoryStorage {\n constructor() {\n this.map = {};\n }\n async get(key) {\n return this.map[key] || undefined;\n }\n async set(key, value) {\n this.map[key] = value;\n }\n async delete(key) {\n delete this.map[key];\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when a poor configuration is received\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass ConfigurationError extends Error {\n /* istanbul ignore next */\n constructor(message) {\n super(message);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered if a method is not implemented\n * @hidden\n */\nclass NotImplementedError extends Error {\n /* istanbul ignore next */\n constructor(methodName) {\n super(`[${methodName}] is not implemented`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when receiving a response missing mandatory elements\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass InvalidResponseError extends Error {\n /* istanbul ignore next */\n constructor(missingFields) {\n super(`Invalid response from OIDC provider: missing fields ${missingFields}`);\n this.missingFields = missingFields;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when receiving a response missing mandatory elements\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass OidcProviderError extends Error {\n /* istanbul ignore next */\n constructor(message, error, errorDescription) {\n super(message);\n this.error = error;\n this.errorDescription = errorDescription;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Normalizes a URL in order to generate the DPoP token based on a consistent scheme.\n *\n * @param audience The URL to normalize.\n * @returns The normalized URL as a string.\n * @hidden\n */\nfunction normalizeHTU(audience) {\n const audienceUrl = new URL(audience);\n return new URL(audienceUrl.pathname, audienceUrl.origin).toString();\n}\n/**\n * Creates a DPoP header according to https://tools.ietf.org/html/draft-fett-oauth-dpop-04,\n * based on the target URL and method, using the provided key.\n *\n * @param audience Target URL.\n * @param method HTTP method allowed.\n * @param key Key used to sign the token.\n * @returns A JWT that can be used as a DPoP Authorization header.\n */\nasync function createDpopHeader(audience, method, dpopKey) {\n return new jose.SignJWT({\n htu: normalizeHTU(audience),\n htm: method.toUpperCase(),\n jti: uuid.v4(),\n })\n .setProtectedHeader({\n alg: PREFERRED_SIGNING_ALG[0],\n jwk: dpopKey.publicKey,\n typ: \"dpop+jwt\",\n })\n .setIssuedAt()\n .sign(dpopKey.privateKey, {});\n}\nasync function generateDpopKeyPair() {\n const { privateKey, publicKey } = await jose.generateKeyPair(PREFERRED_SIGNING_ALG[0]);\n const dpopKeyPair = {\n privateKey,\n publicKey: await jose.exportJWK(publicKey),\n };\n // The alg property isn't set by exportJWK, so set it manually.\n [dpopKeyPair.publicKey.alg] = PREFERRED_SIGNING_ALG;\n return dpopKeyPair;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * If expires_in isn't specified for the access token, we assume its lifetime is\n * 10 minutes.\n */\nconst DEFAULT_EXPIRATION_TIME_SECONDS = 600;\nfunction isExpectedAuthError(statusCode) {\n // As per https://tools.ietf.org/html/rfc7235#section-3.1 and https://tools.ietf.org/html/rfc7235#section-3.1,\n // a response failing because the provided credentials aren't accepted by the\n // server can get a 401 or a 403 response.\n return [401, 403].includes(statusCode);\n}\nasync function buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions) {\n var _a;\n const headers = new universalFetch.Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers);\n // Any pre-existing Authorization header should be overriden.\n headers.set(\"Authorization\", `DPoP ${authToken}`);\n headers.set(\"DPoP\", await createDpopHeader(targetUrl, (_a = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.method) !== null && _a !== void 0 ? _a : \"get\", dpopKey));\n return {\n ...defaultOptions,\n headers,\n };\n}\nasync function buildAuthenticatedHeaders(targetUrl, authToken, dpopKey, defaultOptions) {\n if (dpopKey !== undefined) {\n return buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions);\n }\n const headers = new universalFetch.Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers);\n // Any pre-existing Authorization header should be overriden.\n headers.set(\"Authorization\", `Bearer ${authToken}`);\n return {\n ...defaultOptions,\n headers,\n };\n}\nasync function makeAuthenticatedRequest(unauthFetch, accessToken, url, defaultRequestInit, dpopKey) {\n return unauthFetch(url, await buildAuthenticatedHeaders(url.toString(), accessToken, dpopKey, defaultRequestInit));\n}\nasync function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {\n var _a;\n const tokenSet = await refreshOptions.tokenRefresher.refresh(refreshOptions.sessionId, refreshOptions.refreshToken, dpopKey);\n eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.SESSION_EXTENDED, (_a = tokenSet.expiresIn) !== null && _a !== void 0 ? _a : DEFAULT_EXPIRATION_TIME_SECONDS);\n if (typeof tokenSet.refreshToken === \"string\") {\n eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);\n }\n return {\n accessToken: tokenSet.accessToken,\n refreshToken: tokenSet.refreshToken,\n expiresIn: tokenSet.expiresIn,\n };\n}\n/**\n *\n * @param expiresIn Delay until the access token expires.\n * @returns a delay until the access token should be refreshed.\n */\nconst computeRefreshDelay = (expiresIn) => {\n if (expiresIn !== undefined) {\n return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0\n ? // We want to refresh the token 5 seconds before they actually expire.\n expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS\n : expiresIn;\n }\n return DEFAULT_EXPIRATION_TIME_SECONDS;\n};\n/**\n * @param unauthFetch a regular fetch function, compliant with the WHATWG spec.\n * @param authToken an access token, either a Bearer token or a DPoP one.\n * @param options The option object may contain two objects: the DPoP key token\n * is bound to if applicable, and options to customise token renewal behaviour.\n *\n * @returns A fetch function that adds an appropriate Authorization header with\n * the provided token, and adds a DPoP header if applicable.\n */\nasync function buildAuthenticatedFetch(unauthFetch, accessToken, options) {\n var _a;\n let currentAccessToken = accessToken;\n let latestTimeout;\n const currentRefreshOptions = options === null || options === void 0 ? void 0 : options.refreshOptions;\n // Setup the refresh timeout outside of the authenticated fetch, so that\n // an idle app will not get logged out if it doesn't issue a fetch before\n // the first expiration date.\n if (currentRefreshOptions !== undefined) {\n const proactivelyRefreshToken = async () => {\n var _a, _b, _c, _d;\n try {\n const { accessToken: refreshedAccessToken, refreshToken, expiresIn, } = await refreshAccessToken(currentRefreshOptions, \n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.dpopKey, \n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter);\n // Update the tokens in the closure if appropriate.\n currentAccessToken = refreshedAccessToken;\n if (refreshToken !== undefined) {\n currentRefreshOptions.refreshToken = refreshToken;\n }\n // Each time the access token is refreshed, we must plan fo the next\n // refresh iteration.\n clearTimeout(latestTimeout);\n latestTimeout = setTimeout(proactivelyRefreshToken, computeRefreshDelay(expiresIn) * 1000);\n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout);\n }\n catch (e) {\n // It is possible that an underlying library throws an error on refresh flow failure.\n // If we used a log framework, the error could be logged at the `debug` level,\n // but otherwise the failure of the refresh flow should not blow up in the user's\n // face, so we just swallow the error.\n if (e instanceof OidcProviderError) {\n // The OIDC provider refused to refresh the access token and returned an error instead.\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n (_b = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _b === void 0 ? void 0 : _b.emit(EVENTS.ERROR, e.error, e.errorDescription);\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n (_c = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _c === void 0 ? void 0 : _c.emit(EVENTS.SESSION_EXPIRED);\n }\n if (e instanceof InvalidResponseError &&\n e.missingFields.includes(\"access_token\")) {\n // In this case, the OIDC provider returned a non-standard response, but\n // did not specify that it was an error. We cannot refresh nonetheless.\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n (_d = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _d === void 0 ? void 0 : _d.emit(EVENTS.SESSION_EXPIRED);\n }\n }\n };\n latestTimeout = setTimeout(proactivelyRefreshToken, \n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n computeRefreshDelay(options.expiresIn) * 1000);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout);\n }\n else if (options !== undefined && options.eventEmitter !== undefined) {\n // If no refresh options are provided, the session expires when the access token does.\n const expirationTimeout = setTimeout(() => {\n // The event emitter is always defined in our code, and it would be tedious\n // to test for conditions when it is not.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter.emit(EVENTS.SESSION_EXPIRED);\n }, computeRefreshDelay(options.expiresIn) * 1000);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout);\n }\n return async (url, requestInit) => {\n let response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, url, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey);\n const failedButNotExpectedAuthError = !response.ok && !isExpectedAuthError(response.status);\n if (response.ok || failedButNotExpectedAuthError) {\n // If there hasn't been a redirection, or if there has been a non-auth related\n // issue, it should be handled at the application level\n return response;\n }\n const hasBeenRedirected = response.url !== url;\n if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== undefined) {\n // If the request failed for auth reasons, and has been redirected, we should\n // replay it generating a DPoP header for the rediration target IRI. This\n // doesn't apply to Bearer tokens, as the Bearer tokens aren't specific\n // to a given resource and method, while the DPoP header (associated to a\n // DPoP token) is.\n response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, \n // Replace the original target IRI (`url`) by the redirection target\n response.url, requestInit, options.dpopKey);\n }\n return response;\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst StorageUtilityGetResponse = \"getResponse\";\nconst StorageUtilityMock = {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n get: async (key, options) => StorageUtilityGetResponse,\n set: async (key, value) => {\n /* do nothing */\n },\n delete: async (key) => {\n /* do nothing */\n },\n getForUser: async (userId, key, options) => StorageUtilityGetResponse,\n setForUser: async (userId, values, options) => {\n /* do nothing */\n },\n deleteForUser: async (userId, key, options) => {\n /* do nothing */\n },\n deleteAllUserData: async (userId, options) => {\n /* do nothing */\n },\n};\nconst mockStorage = (stored) => {\n const store = stored;\n return {\n get: async (key) => {\n if (store[key] === undefined) {\n return undefined;\n }\n if (typeof store[key] === \"string\") {\n return store[key];\n }\n return JSON.stringify(store[key]);\n },\n set: async (key, value) => {\n store[key] = value;\n },\n delete: async (key) => {\n delete store[key];\n },\n };\n};\nconst mockStorageUtility = (stored, isSecure = false) => {\n if (isSecure) {\n return new StorageUtility(mockStorage(stored), mockStorage({}));\n }\n return new StorageUtility(mockStorage({}), mockStorage(stored));\n};\n\nexports.AggregateHandler = AggregateHandler;\nexports.AuthorizationCodeWithPkceOidcHandlerBase = AuthorizationCodeWithPkceOidcHandlerBase;\nexports.ClientAuthentication = ClientAuthentication;\nexports.ConfigurationError = ConfigurationError;\nexports.DEFAULT_SCOPES = DEFAULT_SCOPES;\nexports.EVENTS = EVENTS;\nexports.GeneralLogoutHandler = GeneralLogoutHandler;\nexports.IRpLogoutHandler = IRpLogoutHandler;\nexports.IWaterfallLogoutHandler = IWaterfallLogoutHandler;\nexports.InMemoryStorage = InMemoryStorage;\nexports.InvalidResponseError = InvalidResponseError;\nexports.NotImplementedError = NotImplementedError;\nexports.OidcProviderError = OidcProviderError;\nexports.PREFERRED_SIGNING_ALG = PREFERRED_SIGNING_ALG;\nexports.REFRESH_BEFORE_EXPIRATION_SECONDS = REFRESH_BEFORE_EXPIRATION_SECONDS;\nexports.SOLID_CLIENT_AUTHN_KEY_PREFIX = SOLID_CLIENT_AUTHN_KEY_PREFIX;\nexports.SessionInfoManagerBase = SessionInfoManagerBase;\nexports.StorageUtility = StorageUtility;\nexports.StorageUtilityGetResponse = StorageUtilityGetResponse;\nexports.StorageUtilityMock = StorageUtilityMock;\nexports.USER_SESSION_PREFIX = USER_SESSION_PREFIX;\nexports.buildAuthenticatedFetch = buildAuthenticatedFetch;\nexports.buildProxyHandler = buildProxyHandler;\nexports.clear = clear;\nexports.createDpopHeader = createDpopHeader;\nexports.determineSigningAlg = determineSigningAlg;\nexports.fetchJwks = fetchJwks;\nexports.generateDpopKeyPair = generateDpopKeyPair;\nexports.getEndSessionUrl = getEndSessionUrl;\nexports.getSessionIdFromOauthState = getSessionIdFromOauthState;\nexports.getUnauthenticatedSession = getUnauthenticatedSession;\nexports.getWebidFromTokenPayload = getWebidFromTokenPayload;\nexports.handleRegistration = handleRegistration;\nexports.isSupportedTokenType = isSupportedTokenType;\nexports.isValidRedirectUrl = isValidRedirectUrl;\nexports.loadOidcContextFromStorage = loadOidcContextFromStorage;\nexports.maybeBuildRpInitiatedLogout = maybeBuildRpInitiatedLogout;\nexports.mockStorage = mockStorage;\nexports.mockStorageUtility = mockStorageUtility;\nexports.removeOpenIdParams = removeOpenIdParams;\nexports.saveSessionInfoToStorage = saveSessionInfoToStorage;\n//# sourceMappingURL=index.js.map\n","import { EventEmitter } from 'events';\nimport { fetch, Headers } from '@inrupt/universal-fetch';\nimport { jwtVerify, importJWK, exportJWK, SignJWT, generateKeyPair } from 'jose';\nimport { v4 } from 'uuid';\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Intended to be used by dependent packages as a common prefix for keys into\n * storage mechanisms (so as to group all keys related to Solid Client Authn\n * within those storage mechanisms, e.g., window.localStorage).\n */\nconst SOLID_CLIENT_AUTHN_KEY_PREFIX = \"solidClientAuthn:\";\n/**\n * Ordered list of signature algorithms, from most preferred to least preferred.\n */\nconst PREFERRED_SIGNING_ALG = [\"ES256\", \"RS256\"];\nconst EVENTS = {\n // Note that an `error` events MUST be listened to: https://nodejs.org/dist/latest-v16.x/docs/api/events.html#error-events.\n ERROR: \"error\",\n LOGIN: \"login\",\n LOGOUT: \"logout\",\n NEW_REFRESH_TOKEN: \"newRefreshToken\",\n SESSION_EXPIRED: \"sessionExpired\",\n SESSION_EXTENDED: \"sessionExtended\",\n SESSION_RESTORED: \"sessionRestore\",\n TIMEOUT_SET: \"timeoutSet\",\n};\n/**\n * We want to refresh a token 5 seconds before it expires.\n */\nconst REFRESH_BEFORE_EXPIRATION_SECONDS = 5;\n// The openid scope requests an OIDC ID token token to be returned.\nconst SCOPE_OPENID = \"openid\";\n// The offline_access scope requests a refresh token to be returned.\nconst SCOPE_OFFLINE = \"offline_access\";\n// The webid scope is required as per https://solid.github.io/solid-oidc/#webid-scope\nconst SCOPE_WEBID = \"webid\";\n// The scopes are expected as a space-separated list.\nconst DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(\" \");\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Temporary internal builder for safe proxying.\n */\nconst buildProxyHandler = (\n// The class to be excluded needs to be injected, because it is defined in a\n// dependency.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntoExclude, errorMessage) => ({\n // This proxy is only a temporary measure until Session no longer extends\n // SessionEventEmitter, and the proxying is no longer necessary.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n get(target, prop, receiver) {\n // Reject any calls to the proxy that isn't specific to the EventEmitter API\n if (!Object.getOwnPropertyNames(EventEmitter).includes(prop) &&\n Object.getOwnPropertyNames(toExclude).includes(prop)) {\n throw new Error(`${errorMessage}: [${prop}] is not supported`);\n }\n return Reflect.get(target, prop, receiver);\n },\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass AggregateHandler {\n constructor(handleables) {\n this.handleables = handleables;\n this.handleables = handleables;\n }\n /**\n * Helper function that will asynchronously determine the proper handler to use. If multiple\n * handlers can handle, it will choose the first one in the list\n * @param params Paramerters to feed to the handler\n */\n async getProperHandler(params) {\n // TODO : This function doesn't currently operate as described. Tests need to be written\n // return new Promise | null>((resolve, reject) => {\n // const resolvedValues: Array = Array(this.handleables.length).map(() => null)\n // let numberResolved = 0\n // this.handleables.forEach(async (handleable: IHandleable, index: number) => {\n // resolvedValues[index] = await handleable.canHandle(...params)\n // numberResolved++\n // let curResolvedValueIndex = 0\n // while (\n // resolvedValues[curResolvedValueIndex] !== null ||\n // resolvedValues[curResolvedValueIndex] !== undefined\n // ) {\n // if (resolvedValues[curResolvedValueIndex]) {\n // resolve(this.handleables[curResolvedValueIndex])\n // }\n // curResolvedValueIndex++\n // }\n // })\n // })\n const canHandleList = await Promise.all(this.handleables.map((handleable) => handleable.canHandle(...params)));\n for (let i = 0; i < canHandleList.length; i += 1) {\n if (canHandleList[i]) {\n return this.handleables[i];\n }\n }\n return null;\n }\n async canHandle(...params) {\n return (await this.getProperHandler(params)) !== null;\n }\n async handle(...params) {\n const handler = await this.getProperHandler(params);\n if (handler) {\n return handler.handle(...params);\n }\n throw new Error(`[${this.constructor.name}] cannot find a suitable handler for: ${params\n .map((param) => {\n try {\n return JSON.stringify(param);\n }\n catch (err) {\n /* eslint-disable @typescript-eslint/no-explicit-any */\n return param.toString();\n }\n })\n .join(\", \")}`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// eslint-disable-next-line no-shadow\nasync function fetchJwks(jwksIri, issuerIri) {\n // FIXME: the following line works, but the underlying network calls don't seem\n // to be mocked properly by our test code. It would be nicer to replace calls to this\n // function by the following line and to fix the mocks.\n // const jwks = createRemoteJWKSet(new URL(jwksIri));\n const jwksResponse = await fetch.call(globalThis, jwksIri);\n if (jwksResponse.status !== 200) {\n throw new Error(`Could not fetch JWKS for [${issuerIri}] at [${jwksIri}]: ${jwksResponse.status} ${jwksResponse.statusText}`);\n }\n // The JWKS should only contain the current key for the issuer.\n let jwk;\n try {\n jwk = (await jwksResponse.json()).keys[0];\n }\n catch (e) {\n throw new Error(`Malformed JWKS for [${issuerIri}] at [${jwksIri}]: ${e.message}`);\n }\n return jwk;\n}\n/**\n * Extract a WebID from an ID token payload based on https://github.com/solid/webid-oidc-spec.\n * Note that this does not yet implement the user endpoint lookup, and only checks\n * for `webid` or IRI-like `sub` claims.\n *\n * @param idToken the payload of the ID token from which the WebID can be extracted.\n * @returns a WebID extracted from the ID token.\n * @internal\n */\nasync function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {\n const jwk = await fetchJwks(jwksIri, issuerIri);\n let payload;\n try {\n const { payload: verifiedPayload } = await jwtVerify(idToken, await importJWK(jwk), {\n issuer: issuerIri,\n audience: clientId,\n });\n payload = verifiedPayload;\n }\n catch (e) {\n throw new Error(`Token verification failed: ${e.stack}`);\n }\n if (typeof payload.webid === \"string\") {\n return payload.webid;\n }\n if (typeof payload.sub !== \"string\") {\n throw new Error(`The token ${JSON.stringify(payload)} is invalid: it has no 'webid' claim and no 'sub' claim.`);\n }\n try {\n // This parses the 'sub' claim to check if it is a well-formed IRI.\n // However, the normalized value isn't returned to make sure the WebID is returned\n // as specified by the Identity Provider.\n // eslint-disable-next-line no-new\n new URL(payload.sub);\n return payload.sub;\n }\n catch (e) {\n throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${payload.sub}] is invalid as a URL - error [${e}].`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isValidRedirectUrl(redirectUrl) {\n // If the redirect URL is not a valid URL, an error will be thrown.\n try {\n const urlObject = new URL(redirectUrl);\n const noReservedQuery = !urlObject.searchParams.has(\"code\") &&\n !urlObject.searchParams.has(\"state\");\n // As per https://tools.ietf.org/html/rfc6749#section-3.1.2, the redirect URL\n // must not include a hash fragment.\n const noHash = urlObject.hash === \"\";\n return noReservedQuery && noHash;\n }\n catch (e) {\n return false;\n }\n}\nfunction removeOpenIdParams(redirectUrl) {\n const cleanedUpUrl = new URL(redirectUrl);\n // For auth code flow\n cleanedUpUrl.searchParams.delete(\"state\");\n cleanedUpUrl.searchParams.delete(\"code\");\n // For login error\n cleanedUpUrl.searchParams.delete(\"error\");\n cleanedUpUrl.searchParams.delete(\"error_description\");\n // For RFC9207\n cleanedUpUrl.searchParams.delete(\"iss\");\n return cleanedUpUrl;\n}\n\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * @hidden\n * Authorization code flow spec: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth\n * PKCE: https://tools.ietf.org/html/rfc7636\n */\nclass AuthorizationCodeWithPkceOidcHandlerBase {\n constructor(storageUtility, redirector) {\n this.storageUtility = storageUtility;\n this.redirector = redirector;\n this.storageUtility = storageUtility;\n this.redirector = redirector;\n }\n async canHandle(oidcLoginOptions) {\n return !!(oidcLoginOptions.issuerConfiguration.grantTypesSupported &&\n oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf(\"authorization_code\") > -1);\n }\n async handleRedirect({ oidcLoginOptions, state, codeVerifier, targetUrl, }) {\n await Promise.all([\n // We use the OAuth 'state' value (which should be crypto-random) as\n // the key in our storage to store our actual SessionID. We do this\n // 'cos we'll need to lookup our session information again when the\n // browser is redirected back to us (i.e. the OAuth client\n // application) from the Authorization Server.\n // We don't want to use our session ID as the OAuth 'state' value, as\n // that session ID can be any developer-specified value, and therefore\n // may not be appropriate (since the OAuth 'state' value should really\n // be an unguessable crypto-random value).\n // eslint-disable-next-line no-underscore-dangle\n this.storageUtility.setForUser(state, {\n sessionId: oidcLoginOptions.sessionId,\n }),\n // Store our login-process state using the session ID as the key.\n // Strictly speaking, this indirection from our OAuth state value to\n // our session ID is unnecessary, but it provides a slightly cleaner\n // separation of concerns.\n this.storageUtility.setForUser(oidcLoginOptions.sessionId, {\n // eslint-disable-next-line no-underscore-dangle\n codeVerifier,\n issuer: oidcLoginOptions.issuer.toString(),\n // The redirect URL is read after redirect, so it must be stored now.\n redirectUrl: oidcLoginOptions.redirectUrl,\n dpop: oidcLoginOptions.dpop ? \"true\" : \"false\",\n }),\n ]);\n this.redirector.redirect(targetUrl, {\n handleRedirect: oidcLoginOptions.handleRedirect,\n });\n return undefined;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass GeneralLogoutHandler {\n constructor(sessionInfoManager) {\n this.sessionInfoManager = sessionInfoManager;\n this.sessionInfoManager = sessionInfoManager;\n }\n async canHandle() {\n return true;\n }\n async handle(userId) {\n await this.sessionInfoManager.clear(userId);\n }\n}\n\nclass IRpLogoutHandler {\n constructor(redirector) {\n this.redirector = redirector;\n this.redirector = redirector;\n }\n async canHandle(userId, options) {\n return (options === null || options === void 0 ? void 0 : options.logoutType) === \"idp\";\n }\n async handle(userId, options) {\n if ((options === null || options === void 0 ? void 0 : options.logoutType) !== \"idp\") {\n throw new Error(\"Attempting to call idp logout handler to perform app logout\");\n }\n if (options.toLogoutUrl === undefined) {\n throw new Error(\"Cannot perform IDP logout. Did you log in using the OIDC authentication flow?\");\n }\n this.redirector.redirect(options.toLogoutUrl(options), {\n handleRedirect: options.handleRedirect,\n });\n }\n}\n\nclass IWaterfallLogoutHandler {\n constructor(sessionInfoManager, redirector) {\n this.handlers = [\n new GeneralLogoutHandler(sessionInfoManager),\n new IRpLogoutHandler(redirector),\n ];\n }\n async canHandle() {\n return true;\n }\n async handle(userId, options) {\n for (const handler of this.handlers) {\n /* eslint-disable no-await-in-loop */\n if (await handler.canHandle(userId, options))\n await handler.handle(userId, options);\n /* eslint-enable no-await-in-loop */\n }\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\nfunction getUnauthenticatedSession() {\n return {\n isLoggedIn: false,\n sessionId: v4(),\n fetch: (...args) => fetch.call(globalThis, ...args),\n };\n}\n/**\n * @param sessionId\n * @param storage\n * @hidden\n */\nasync function clear(sessionId, storage) {\n await Promise.all([\n storage.deleteAllUserData(sessionId, { secure: false }),\n storage.deleteAllUserData(sessionId, { secure: true }),\n ]);\n}\n/**\n * @hidden\n */\nclass SessionInfoManagerBase {\n constructor(storageUtility) {\n this.storageUtility = storageUtility;\n this.storageUtility = storageUtility;\n }\n update(_sessionId, _options) {\n throw new Error(\"Not Implemented\");\n }\n get(_) {\n throw new Error(\"Not implemented\");\n }\n // eslint-disable-next-line class-methods-use-this\n async getAll() {\n throw new Error(\"Not implemented\");\n }\n /**\n * This function removes all session-related information from storage.\n * @param sessionId the session identifier\n * @param storage the storage where session info is stored\n * @hidden\n */\n async clear(sessionId) {\n return clear(sessionId, this.storageUtility);\n }\n /**\n * Registers a new session, so that its ID can be retrieved.\n * @param sessionId\n */\n async register(_sessionId) {\n throw new Error(\"Not implemented\");\n }\n /**\n * Returns all the registered session IDs. Differs from getAll, which also\n * returns additional session information.\n */\n async getRegisteredSessionIdAll() {\n throw new Error(\"Not implemented\");\n }\n /**\n * Deletes all information about all sessions, including their registrations.\n */\n async clearAll() {\n throw new Error(\"Not implemented\");\n }\n}\n\n/**\n * This function is designed to isomorphically capture the behavior in oidc-client-js and node-oidc-provider\n * - https://github.com/IdentityModel/oidc-client-js/blob/edec8f59897bdeedcb0b4167586d49626203c2c1/src/OidcClient.js#L138\n * - https://github.com/panva/node-openid-client/blob/35758419489ff751a71f5b66f5020087a63e1e88/lib/client.js#L284\n *\n * @param options IEndSessionOptions\n * @returns The URL to redirect to in order to perform RP Initiated Logout\n * @hidden\n */\nfunction getEndSessionUrl({ endSessionEndpoint, idTokenHint, postLogoutRedirectUri, state, }) {\n const url = new URL(endSessionEndpoint);\n if (idTokenHint !== undefined)\n url.searchParams.append(\"id_token_hint\", idTokenHint);\n if (postLogoutRedirectUri !== undefined) {\n url.searchParams.append(\"post_logout_redirect_uri\", postLogoutRedirectUri);\n if (state !== undefined)\n url.searchParams.append(\"state\", state);\n }\n return url.toString();\n}\n/**\n * @param options.endSessionEndpoint The end_session_endpoint advertised by the server\n * @param options.idTokenHint The idToken supplied by the server after logging in\n * Redirects the window to the location required to perform RP initiated logout\n *\n * @hidden\n */\nfunction maybeBuildRpInitiatedLogout({ endSessionEndpoint, idTokenHint, }) {\n if (endSessionEndpoint === undefined)\n return undefined;\n return function logout({ state, postLogoutUrl }) {\n return getEndSessionUrl({\n endSessionEndpoint,\n idTokenHint,\n state,\n postLogoutRedirectUri: postLogoutUrl,\n });\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isSupportedTokenType(token) {\n return typeof token === \"string\" && [\"DPoP\", \"Bearer\"].includes(token);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst USER_SESSION_PREFIX = \"solidClientAuthenticationUser\";\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction isValidUrl(url) {\n try {\n // Here, the URL constructor is just called to parse the given string and\n // verify if it is a well-formed IRI.\n // eslint-disable-next-line no-new\n new URL(url);\n return true;\n }\n catch (_a) {\n return false;\n }\n}\nfunction determineSigningAlg(supported, preferred) {\n var _a;\n return ((_a = preferred.find((signingAlg) => {\n return supported.includes(signingAlg);\n })) !== null && _a !== void 0 ? _a : null);\n}\nfunction determineClientType(options, issuerConfig) {\n if (options.clientId !== undefined && !isValidUrl(options.clientId)) {\n return \"static\";\n }\n if (issuerConfig.scopesSupported.includes(\"webid\") &&\n options.clientId !== undefined &&\n isValidUrl(options.clientId)) {\n return \"solid-oidc\";\n }\n // If no client_id is provided, the client must go through Dynamic Client Registration.\n // If a client_id is provided and it looks like a URI, yet the Identity Provider\n // does *not* support Solid-OIDC, then we also perform DCR (and discard the\n // provided client_id).\n return \"dynamic\";\n}\nasync function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) {\n const clientType = determineClientType(options, issuerConfig);\n if (clientType === \"dynamic\") {\n return clientRegistrar.getClient({\n sessionId: options.sessionId,\n clientName: options.clientName,\n redirectUrl: options.redirectUrl,\n }, issuerConfig);\n }\n // If a client_id was provided, and the Identity Provider is Solid-OIDC compliant,\n // or it is not compliant but the client_id isn't an IRI (we assume it has already\n // been registered with the IdP), then the client registration information needs\n // to be stored so that it can be retrieved later after redirect.\n await storageUtility.setForUser(options.sessionId, {\n // If the client is either static or solid-oidc compliant, its client ID cannot be undefined.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clientId: options.clientId,\n });\n if (options.clientSecret) {\n await storageUtility.setForUser(options.sessionId, {\n clientSecret: options.clientSecret,\n });\n }\n if (options.clientName) {\n await storageUtility.setForUser(options.sessionId, {\n clientName: options.clientName,\n });\n }\n return {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clientId: options.clientId,\n clientSecret: options.clientSecret,\n clientName: options.clientName,\n clientType,\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n// By only referring to `window` at runtime, apps that do server-side rendering\n// won't run into errors when rendering code that instantiates a\n// ClientAuthentication:\nconst globalFetch = (request, init) => fetch.call(globalThis, request, init);\n/**\n * @hidden\n */\nclass ClientAuthentication {\n constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {\n this.loginHandler = loginHandler;\n this.redirectHandler = redirectHandler;\n this.logoutHandler = logoutHandler;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n // By default, our fetch() resolves to the environment fetch() function.\n this.fetch = globalFetch;\n this.logout = async (sessionId, options) => {\n // When doing IDP logout this will redirect away from the current page, so we should not expect\n // code after this condition to be run if it is true.\n // We also need to make sure that any other cleanup that we want to do for\n // our session takes place before this condition is run\n await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === \"idp\"\n ? {\n ...options,\n toLogoutUrl: this.boundLogout,\n }\n : options);\n // Restore our fetch() function back to the environment fetch(), effectively\n // leaving us with un-authenticated fetches from now on.\n this.fetch = globalFetch;\n // Delete the bound logout function, so that it can't be called after this.\n delete this.boundLogout;\n };\n this.getSessionInfo = async (sessionId) => {\n // TODO complete\n return this.sessionInfoManager.get(sessionId);\n };\n this.getAllSessionInfo = async () => {\n return this.sessionInfoManager.getAll();\n };\n this.loginHandler = loginHandler;\n this.redirectHandler = redirectHandler;\n this.logoutHandler = logoutHandler;\n this.sessionInfoManager = sessionInfoManager;\n this.issuerConfigFetcher = issuerConfigFetcher;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * A helper class that will validate items taken from local storage\n */\nasync function getSessionIdFromOauthState(storageUtility, oauthState) {\n return storageUtility.getForUser(oauthState, \"sessionId\");\n}\n/**\n * Based on the provided state, this looks up contextual information stored\n * before redirecting the user to the OIDC issuer.\n * @param sessionId The state (~ correlation ID) of the OIDC request\n * @param storageUtility\n * @param configFetcher\n * @returns Information stored about the client issuing the request\n */\nasync function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) {\n try {\n const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([\n storageUtility.getForUser(sessionId, \"issuer\", {\n errorIfNull: true,\n }),\n storageUtility.getForUser(sessionId, \"codeVerifier\"),\n storageUtility.getForUser(sessionId, \"redirectUrl\"),\n storageUtility.getForUser(sessionId, \"dpop\", { errorIfNull: true }),\n ]);\n // Clear the code verifier, which is one-time use.\n await storageUtility.deleteForUser(sessionId, \"codeVerifier\");\n // Unlike openid-client, this looks up the configuration from storage\n const issuerConfig = await configFetcher.fetchConfig(issuerIri);\n return {\n codeVerifier,\n redirectUrl: storedRedirectIri,\n issuerConfig,\n dpop: dpop === \"true\",\n };\n }\n catch (e) {\n throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);\n }\n}\n/**\n * Stores information about the session in the provided storage. Note that not\n * all storage are equally secure, and it is strongly advised not to store either\n * the refresh token or the DPoP key in the browser's local storage.\n *\n * @param storageUtility\n * @param sessionId\n * @param webId\n * @param isLoggedIn\n * @param refreshToken\n * @param secure\n * @param dpopKey\n */\nasync function saveSessionInfoToStorage(storageUtility, sessionId, webId, isLoggedIn, refreshToken, secure, dpopKey) {\n // TODO: Investigate why this does not work with a Promise.all\n if (refreshToken !== undefined) {\n await storageUtility.setForUser(sessionId, { refreshToken }, { secure });\n }\n if (webId !== undefined) {\n await storageUtility.setForUser(sessionId, { webId }, { secure });\n }\n if (isLoggedIn !== undefined) {\n await storageUtility.setForUser(sessionId, { isLoggedIn }, { secure });\n }\n if (dpopKey !== undefined) {\n await storageUtility.setForUser(sessionId, {\n publicKey: JSON.stringify(dpopKey.publicKey),\n privateKey: JSON.stringify(await exportJWK(dpopKey.privateKey)),\n }, { secure });\n }\n}\n// TOTEST: this does not handle all possible bad inputs for example what if it's not proper JSON\n/**\n * @hidden\n */\nclass StorageUtility {\n constructor(secureStorage, insecureStorage) {\n this.secureStorage = secureStorage;\n this.insecureStorage = insecureStorage;\n this.secureStorage = secureStorage;\n this.insecureStorage = insecureStorage;\n }\n getKey(userId) {\n return `solidClientAuthenticationUser:${userId}`;\n }\n async getUserData(userId, secure) {\n const stored = await (secure\n ? this.secureStorage\n : this.insecureStorage).get(this.getKey(userId));\n if (stored === undefined) {\n return {};\n }\n try {\n return JSON.parse(stored);\n }\n catch (err) {\n throw new Error(`Data for user [${userId}] in [${secure ? \"secure\" : \"unsecure\"}] storage is corrupted - expected valid JSON, but got: ${stored}`);\n }\n }\n async setUserData(userId, data, secure) {\n await (secure ? this.secureStorage : this.insecureStorage).set(this.getKey(userId), JSON.stringify(data));\n }\n async get(key, options) {\n const value = await ((options === null || options === void 0 ? void 0 : options.secure)\n ? this.secureStorage\n : this.insecureStorage).get(key);\n if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) {\n throw new Error(`[${key}] is not stored`);\n }\n return value;\n }\n async set(key, value, options) {\n return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).set(key, value);\n }\n async delete(key, options) {\n return ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(key);\n }\n async getForUser(userId, key, options) {\n const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure);\n let value;\n if (!userData || !userData[key]) {\n value = undefined;\n }\n value = userData[key];\n if (value === undefined && (options === null || options === void 0 ? void 0 : options.errorIfNull)) {\n throw new Error(`Field [${key}] for user [${userId}] is not stored`);\n }\n return value || undefined;\n }\n async setForUser(userId, values, options) {\n let userData;\n try {\n userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure);\n }\n catch (_a) {\n // if reading the user data throws, the data is corrupted, and we want to write over it\n userData = {};\n }\n await this.setUserData(userId, { ...userData, ...values }, options === null || options === void 0 ? void 0 : options.secure);\n }\n async deleteForUser(userId, key, options) {\n const userData = await this.getUserData(userId, options === null || options === void 0 ? void 0 : options.secure);\n delete userData[key];\n await this.setUserData(userId, userData, options === null || options === void 0 ? void 0 : options.secure);\n }\n async deleteAllUserData(userId, options) {\n await ((options === null || options === void 0 ? void 0 : options.secure) ? this.secureStorage : this.insecureStorage).delete(this.getKey(userId));\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n */\nclass InMemoryStorage {\n constructor() {\n this.map = {};\n }\n async get(key) {\n return this.map[key] || undefined;\n }\n async set(key, value) {\n this.map[key] = value;\n }\n async delete(key) {\n delete this.map[key];\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when a poor configuration is received\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass ConfigurationError extends Error {\n /* istanbul ignore next */\n constructor(message) {\n super(message);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered if a method is not implemented\n * @hidden\n */\nclass NotImplementedError extends Error {\n /* istanbul ignore next */\n constructor(methodName) {\n super(`[${methodName}] is not implemented`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when receiving a response missing mandatory elements\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass InvalidResponseError extends Error {\n /* istanbul ignore next */\n constructor(missingFields) {\n super(`Invalid response from OIDC provider: missing fields ${missingFields}`);\n this.missingFields = missingFields;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n * @packageDocumentation\n */\n/**\n * Error to be triggered when receiving a response missing mandatory elements\n */\n// NOTE: There's a bug with istanbul and typescript that prevents full branch coverages\n// https://github.com/gotwarlost/istanbul/issues/690\n// The workaround is to put istanbul ignore on the constructor\n/**\n * @hidden\n */\nclass OidcProviderError extends Error {\n /* istanbul ignore next */\n constructor(message, error, errorDescription) {\n super(message);\n this.error = error;\n this.errorDescription = errorDescription;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Normalizes a URL in order to generate the DPoP token based on a consistent scheme.\n *\n * @param audience The URL to normalize.\n * @returns The normalized URL as a string.\n * @hidden\n */\nfunction normalizeHTU(audience) {\n const audienceUrl = new URL(audience);\n return new URL(audienceUrl.pathname, audienceUrl.origin).toString();\n}\n/**\n * Creates a DPoP header according to https://tools.ietf.org/html/draft-fett-oauth-dpop-04,\n * based on the target URL and method, using the provided key.\n *\n * @param audience Target URL.\n * @param method HTTP method allowed.\n * @param key Key used to sign the token.\n * @returns A JWT that can be used as a DPoP Authorization header.\n */\nasync function createDpopHeader(audience, method, dpopKey) {\n return new SignJWT({\n htu: normalizeHTU(audience),\n htm: method.toUpperCase(),\n jti: v4(),\n })\n .setProtectedHeader({\n alg: PREFERRED_SIGNING_ALG[0],\n jwk: dpopKey.publicKey,\n typ: \"dpop+jwt\",\n })\n .setIssuedAt()\n .sign(dpopKey.privateKey, {});\n}\nasync function generateDpopKeyPair() {\n const { privateKey, publicKey } = await generateKeyPair(PREFERRED_SIGNING_ALG[0]);\n const dpopKeyPair = {\n privateKey,\n publicKey: await exportJWK(publicKey),\n };\n // The alg property isn't set by exportJWK, so set it manually.\n [dpopKeyPair.publicKey.alg] = PREFERRED_SIGNING_ALG;\n return dpopKeyPair;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * If expires_in isn't specified for the access token, we assume its lifetime is\n * 10 minutes.\n */\nconst DEFAULT_EXPIRATION_TIME_SECONDS = 600;\nfunction isExpectedAuthError(statusCode) {\n // As per https://tools.ietf.org/html/rfc7235#section-3.1 and https://tools.ietf.org/html/rfc7235#section-3.1,\n // a response failing because the provided credentials aren't accepted by the\n // server can get a 401 or a 403 response.\n return [401, 403].includes(statusCode);\n}\nasync function buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions) {\n var _a;\n const headers = new Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers);\n // Any pre-existing Authorization header should be overriden.\n headers.set(\"Authorization\", `DPoP ${authToken}`);\n headers.set(\"DPoP\", await createDpopHeader(targetUrl, (_a = defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.method) !== null && _a !== void 0 ? _a : \"get\", dpopKey));\n return {\n ...defaultOptions,\n headers,\n };\n}\nasync function buildAuthenticatedHeaders(targetUrl, authToken, dpopKey, defaultOptions) {\n if (dpopKey !== undefined) {\n return buildDpopFetchOptions(targetUrl, authToken, dpopKey, defaultOptions);\n }\n const headers = new Headers(defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.headers);\n // Any pre-existing Authorization header should be overriden.\n headers.set(\"Authorization\", `Bearer ${authToken}`);\n return {\n ...defaultOptions,\n headers,\n };\n}\nasync function makeAuthenticatedRequest(unauthFetch, accessToken, url, defaultRequestInit, dpopKey) {\n return unauthFetch(url, await buildAuthenticatedHeaders(url.toString(), accessToken, dpopKey, defaultRequestInit));\n}\nasync function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {\n var _a;\n const tokenSet = await refreshOptions.tokenRefresher.refresh(refreshOptions.sessionId, refreshOptions.refreshToken, dpopKey);\n eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.SESSION_EXTENDED, (_a = tokenSet.expiresIn) !== null && _a !== void 0 ? _a : DEFAULT_EXPIRATION_TIME_SECONDS);\n if (typeof tokenSet.refreshToken === \"string\") {\n eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);\n }\n return {\n accessToken: tokenSet.accessToken,\n refreshToken: tokenSet.refreshToken,\n expiresIn: tokenSet.expiresIn,\n };\n}\n/**\n *\n * @param expiresIn Delay until the access token expires.\n * @returns a delay until the access token should be refreshed.\n */\nconst computeRefreshDelay = (expiresIn) => {\n if (expiresIn !== undefined) {\n return expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS > 0\n ? // We want to refresh the token 5 seconds before they actually expire.\n expiresIn - REFRESH_BEFORE_EXPIRATION_SECONDS\n : expiresIn;\n }\n return DEFAULT_EXPIRATION_TIME_SECONDS;\n};\n/**\n * @param unauthFetch a regular fetch function, compliant with the WHATWG spec.\n * @param authToken an access token, either a Bearer token or a DPoP one.\n * @param options The option object may contain two objects: the DPoP key token\n * is bound to if applicable, and options to customise token renewal behaviour.\n *\n * @returns A fetch function that adds an appropriate Authorization header with\n * the provided token, and adds a DPoP header if applicable.\n */\nasync function buildAuthenticatedFetch(unauthFetch, accessToken, options) {\n var _a;\n let currentAccessToken = accessToken;\n let latestTimeout;\n const currentRefreshOptions = options === null || options === void 0 ? void 0 : options.refreshOptions;\n // Setup the refresh timeout outside of the authenticated fetch, so that\n // an idle app will not get logged out if it doesn't issue a fetch before\n // the first expiration date.\n if (currentRefreshOptions !== undefined) {\n const proactivelyRefreshToken = async () => {\n var _a, _b, _c, _d;\n try {\n const { accessToken: refreshedAccessToken, refreshToken, expiresIn, } = await refreshAccessToken(currentRefreshOptions, \n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.dpopKey, \n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter);\n // Update the tokens in the closure if appropriate.\n currentAccessToken = refreshedAccessToken;\n if (refreshToken !== undefined) {\n currentRefreshOptions.refreshToken = refreshToken;\n }\n // Each time the access token is refreshed, we must plan fo the next\n // refresh iteration.\n clearTimeout(latestTimeout);\n latestTimeout = setTimeout(proactivelyRefreshToken, computeRefreshDelay(expiresIn) * 1000);\n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout);\n }\n catch (e) {\n // It is possible that an underlying library throws an error on refresh flow failure.\n // If we used a log framework, the error could be logged at the `debug` level,\n // but otherwise the failure of the refresh flow should not blow up in the user's\n // face, so we just swallow the error.\n if (e instanceof OidcProviderError) {\n // The OIDC provider refused to refresh the access token and returned an error instead.\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n (_b = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _b === void 0 ? void 0 : _b.emit(EVENTS.ERROR, e.error, e.errorDescription);\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n (_c = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _c === void 0 ? void 0 : _c.emit(EVENTS.SESSION_EXPIRED);\n }\n if (e instanceof InvalidResponseError &&\n e.missingFields.includes(\"access_token\")) {\n // In this case, the OIDC provider returned a non-standard response, but\n // did not specify that it was an error. We cannot refresh nonetheless.\n /* istanbul ignore next 100% coverage would require testing that nothing\n happens here if the emitter is undefined, which is more cumbersome\n than what it's worth. */\n (_d = options === null || options === void 0 ? void 0 : options.eventEmitter) === null || _d === void 0 ? void 0 : _d.emit(EVENTS.SESSION_EXPIRED);\n }\n }\n };\n latestTimeout = setTimeout(proactivelyRefreshToken, \n // If currentRefreshOptions is defined, options is necessarily defined too.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n computeRefreshDelay(options.expiresIn) * 1000);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n (_a = options.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(EVENTS.TIMEOUT_SET, latestTimeout);\n }\n else if (options !== undefined && options.eventEmitter !== undefined) {\n // If no refresh options are provided, the session expires when the access token does.\n const expirationTimeout = setTimeout(() => {\n // The event emitter is always defined in our code, and it would be tedious\n // to test for conditions when it is not.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter.emit(EVENTS.SESSION_EXPIRED);\n }, computeRefreshDelay(options.expiresIn) * 1000);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout);\n }\n return async (url, requestInit) => {\n let response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, url, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey);\n const failedButNotExpectedAuthError = !response.ok && !isExpectedAuthError(response.status);\n if (response.ok || failedButNotExpectedAuthError) {\n // If there hasn't been a redirection, or if there has been a non-auth related\n // issue, it should be handled at the application level\n return response;\n }\n const hasBeenRedirected = response.url !== url;\n if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== undefined) {\n // If the request failed for auth reasons, and has been redirected, we should\n // replay it generating a DPoP header for the rediration target IRI. This\n // doesn't apply to Bearer tokens, as the Bearer tokens aren't specific\n // to a given resource and method, while the DPoP header (associated to a\n // DPoP token) is.\n response = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, \n // Replace the original target IRI (`url`) by the redirection target\n response.url, requestInit, options.dpopKey);\n }\n return response;\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst StorageUtilityGetResponse = \"getResponse\";\nconst StorageUtilityMock = {\n /* eslint-disable @typescript-eslint/no-unused-vars */\n get: async (key, options) => StorageUtilityGetResponse,\n set: async (key, value) => {\n /* do nothing */\n },\n delete: async (key) => {\n /* do nothing */\n },\n getForUser: async (userId, key, options) => StorageUtilityGetResponse,\n setForUser: async (userId, values, options) => {\n /* do nothing */\n },\n deleteForUser: async (userId, key, options) => {\n /* do nothing */\n },\n deleteAllUserData: async (userId, options) => {\n /* do nothing */\n },\n};\nconst mockStorage = (stored) => {\n const store = stored;\n return {\n get: async (key) => {\n if (store[key] === undefined) {\n return undefined;\n }\n if (typeof store[key] === \"string\") {\n return store[key];\n }\n return JSON.stringify(store[key]);\n },\n set: async (key, value) => {\n store[key] = value;\n },\n delete: async (key) => {\n delete store[key];\n },\n };\n};\nconst mockStorageUtility = (stored, isSecure = false) => {\n if (isSecure) {\n return new StorageUtility(mockStorage(stored), mockStorage({}));\n }\n return new StorageUtility(mockStorage({}), mockStorage(stored));\n};\n\nexport { AggregateHandler, AuthorizationCodeWithPkceOidcHandlerBase, ClientAuthentication, ConfigurationError, DEFAULT_SCOPES, EVENTS, GeneralLogoutHandler, IRpLogoutHandler, IWaterfallLogoutHandler, InMemoryStorage, InvalidResponseError, NotImplementedError, OidcProviderError, PREFERRED_SIGNING_ALG, REFRESH_BEFORE_EXPIRATION_SECONDS, SOLID_CLIENT_AUTHN_KEY_PREFIX, SessionInfoManagerBase, StorageUtility, StorageUtilityGetResponse, StorageUtilityMock, USER_SESSION_PREFIX, buildAuthenticatedFetch, buildProxyHandler, clear, createDpopHeader, determineSigningAlg, fetchJwks, generateDpopKeyPair, getEndSessionUrl, getSessionIdFromOauthState, getUnauthenticatedSession, getWebidFromTokenPayload, handleRegistration, isSupportedTokenType, isValidRedirectUrl, loadOidcContextFromStorage, maybeBuildRpInitiatedLogout, mockStorage, mockStorageUtility, removeOpenIdParams, saveSessionInfoToStorage };\n//# sourceMappingURL=index.mjs.map\n","'use strict';\n\nvar jsonldStreamingParser = require('jsonld-streaming-parser');\nvar jsonldContextParser = require('jsonld-context-parser');\nvar universalFetch = require('@inrupt/universal-fetch');\nvar LinkHeader = require('http-link-header');\nvar n3 = require('n3');\nvar RdfJsDataFactory = require('@rdfjs/data-model');\nvar rdfJsDatasetModule = require('@rdfjs/dataset');\nvar uuid = require('uuid');\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Verify whether a given SolidDataset includes metadata about where it was sent to.\n *\n * @param dataset A [[SolidDataset]] that may have metadata attached about the Resource it was retrieved from.\n * @returns True if `dataset` includes metadata about the Resource it was sent to, false if not.\n * @since 0.2.0\n */\nfunction hasResourceInfo(resource) {\n const potentialResourceInfo = resource;\n return (typeof potentialResourceInfo === \"object\" &&\n typeof potentialResourceInfo.internal_resourceInfo === \"object\");\n}\n/**\n * Verify whether a given SolidDataset includes metadata about where it was retrieved from.\n *\n * @param dataset A [[SolidDataset]] that may have metadata attached about the Resource it was retrieved from.\n * @returns True if `dataset` includes metadata about the Resource it was retrieved from, false if not.\n * @since 0.6.0\n */\nfunction hasServerResourceInfo(resource) {\n const potentialResourceInfo = resource;\n return (typeof potentialResourceInfo === \"object\" &&\n typeof potentialResourceInfo.internal_resourceInfo === \"object\" &&\n typeof potentialResourceInfo.internal_resourceInfo.linkedResources ===\n \"object\");\n}\n/** @internal */\nfunction hasChangelog(dataset) {\n const potentialChangeLog = dataset;\n return (typeof potentialChangeLog.internal_changeLog === \"object\" &&\n Array.isArray(potentialChangeLog.internal_changeLog.additions) &&\n Array.isArray(potentialChangeLog.internal_changeLog.deletions));\n}\n/**\n * Errors thrown by solid-client extend this class, and can thereby be distinguished from errors\n * thrown in lower-level libraries.\n * @since 1.2.0\n */\nclass SolidClientError extends Error {\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @internal */\nfunction internal_toIriString(iri) {\n return typeof iri === \"string\" ? iri : iri.value;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// Make sure fetch can't be rebound, because it can cause errors in the browser.\n// Namely, it causes the issue discussed in https://stackoverflow.com/questions/71822422/uncaught-in-promise-typeerror-fetch-called-on-an-object-that-does-not-imple.\n// @see https://github.com/inrupt/solid-client-js/pull/1884#discussion_r1153872418\nconst fetch = universalFetch.fetch.bind(globalThis);\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @internal\n */\nfunction internal_parseResourceInfo(response) {\n var _a, _b, _c, _d, _e;\n const contentTypeParts = (_b = (_a = response.headers.get(\"Content-Type\")) === null || _a === void 0 ? void 0 : _a.split(\";\")) !== null && _b !== void 0 ? _b : [];\n // If the server offers a Turtle or JSON-LD serialisation on its own accord,\n // that tells us whether it is RDF data that the server can understand\n // (and hence can be updated with a PATCH request with SPARQL INSERT and DELETE statements),\n // in which case our SolidDataset-related functions should handle it.\n // For more context, see https://github.com/inrupt/solid-client-js/pull/214.\n const isSolidDataset = contentTypeParts.length > 0 &&\n [\"text/turtle\", \"application/ld+json\"].includes(contentTypeParts[0]);\n const resourceInfo = {\n sourceIri: response.url,\n isRawData: !isSolidDataset,\n contentLocation: (_c = response.headers.get(\"Content-Location\")) !== null && _c !== void 0 ? _c : undefined,\n contentType: (_d = response.headers.get(\"Content-Type\")) !== null && _d !== void 0 ? _d : undefined,\n linkedResources: {},\n location: (_e = response.headers.get(\"Location\")) !== null && _e !== void 0 ? _e : undefined,\n };\n const linkHeader = response.headers.get(\"Link\");\n if (linkHeader) {\n const parsedLinks = LinkHeader.parse(linkHeader);\n // Set ACL link\n const aclLinks = parsedLinks.get(\"rel\", \"acl\");\n if (aclLinks.length === 1) {\n resourceInfo.aclUrl = new URL(aclLinks[0].uri, resourceInfo.sourceIri).href;\n }\n // Parse all link headers and expose them in a standard way\n // (this can replace the parsing of the ACL link above):\n resourceInfo.linkedResources = parsedLinks.refs.reduce((rels, ref) => {\n var _a;\n var _b;\n (_a = rels[_b = ref.rel]) !== null && _a !== void 0 ? _a : (rels[_b] = []);\n rels[ref.rel].push(new URL(ref.uri, resourceInfo.sourceIri).href);\n return rels;\n }, resourceInfo.linkedResources);\n }\n const wacAllowHeader = response.headers.get(\"WAC-Allow\");\n if (wacAllowHeader) {\n resourceInfo.permissions = parseWacAllowHeader(wacAllowHeader);\n }\n return resourceInfo;\n}\n/**\n * Parse a WAC-Allow header into user and public access booleans.\n *\n * @param wacAllowHeader A WAC-Allow header in the format `user=\"read append write control\",public=\"read\"`\n * @see https://github.com/solid/solid-spec/blob/cb1373a369398d561b909009bd0e5a8c3fec953b/api-rest.md#wac-allow-headers\n */\nfunction parseWacAllowHeader(wacAllowHeader) {\n function parsePermissionStatement(permissionStatement) {\n const permissions = permissionStatement.split(\" \");\n const writePermission = permissions.includes(\"write\");\n return writePermission\n ? {\n read: permissions.includes(\"read\"),\n append: true,\n write: true,\n control: permissions.includes(\"control\"),\n }\n : {\n read: permissions.includes(\"read\"),\n append: permissions.includes(\"append\"),\n write: false,\n control: permissions.includes(\"control\"),\n };\n }\n function getStatementFor(header, scope) {\n const relevantEntries = header\n .split(\",\")\n .map((rawEntry) => rawEntry.split(\"=\"))\n .filter((parts) => parts.length === 2 && parts[0].trim() === scope);\n // There should only be one statement with the given scope:\n if (relevantEntries.length !== 1) {\n return \"\";\n }\n const relevantStatement = relevantEntries[0][1].trim();\n // The given statement should be wrapped in double quotes to be valid:\n if (relevantStatement.charAt(0) !== '\"' ||\n relevantStatement.charAt(relevantStatement.length - 1) !== '\"') {\n return \"\";\n }\n // Return the statment without the wrapping quotes, e.g.: read append write control\n return relevantStatement.substring(1, relevantStatement.length - 1);\n }\n return {\n user: parsePermissionStatement(getStatementFor(wacAllowHeader, \"user\")),\n public: parsePermissionStatement(getStatementFor(wacAllowHeader, \"public\")),\n };\n}\n/** @hidden Used to instantiate a separate instance from input parameters */\nfunction internal_cloneResource(resource) {\n let clonedResource;\n if (typeof resource.slice === \"function\") {\n // If given Resource is a File:\n clonedResource = Object.assign(resource.slice(), { ...resource });\n }\n else {\n // If it is just a plain object containing metadata:\n clonedResource = { ...resource };\n }\n return clonedResource;\n}\n/** @internal */\nfunction internal_isUnsuccessfulResponse(response) {\n return !response.ok;\n}\nfunction internal_isAuthenticationFailureResponse(response) {\n return response.status === 401 || response.status === 403;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// TODO: These should be replaced by auto-generated constants,\n// if we can ensure that unused constants will be excluded from bundles.\n/** @hidden */\nconst acl = {\n Authorization: \"http://www.w3.org/ns/auth/acl#Authorization\",\n AuthenticatedAgent: \"http://www.w3.org/ns/auth/acl#AuthenticatedAgent\",\n accessTo: \"http://www.w3.org/ns/auth/acl#accessTo\",\n agent: \"http://www.w3.org/ns/auth/acl#agent\",\n agentGroup: \"http://www.w3.org/ns/auth/acl#agentGroup\",\n agentClass: \"http://www.w3.org/ns/auth/acl#agentClass\",\n default: \"http://www.w3.org/ns/auth/acl#default\",\n defaultForNew: \"http://www.w3.org/ns/auth/acl#defaultForNew\",\n mode: \"http://www.w3.org/ns/auth/acl#mode\",\n origin: \"http://www.w3.org/ns/auth/acl#origin\",\n};\n/** @hidden */\nconst rdf = {\n type: \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n};\n/** @hidden */\nconst rdfs = {\n seeAlso: \"http://www.w3.org/2000/01/rdf-schema#seeAlso\",\n};\n/** @hidden */\nconst ldp = {\n BasicContainer: \"http://www.w3.org/ns/ldp#BasicContainer\",\n Container: \"http://www.w3.org/ns/ldp#Container\",\n Resource: \"http://www.w3.org/ns/ldp#Resource\",\n contains: \"http://www.w3.org/ns/ldp#contains\",\n};\n/** @hidden */\nconst foaf = {\n Agent: \"http://xmlns.com/foaf/0.1/Agent\",\n primaryTopic: \"http://xmlns.com/foaf/0.1/primaryTopic\",\n isPrimaryTopicOf: \"http://xmlns.com/foaf/0.1/isPrimaryTopicOf\",\n};\n/** @hidden */\nconst acp = {\n AccessControlResource: \"http://www.w3.org/ns/solid/acp#AccessControlResource\",\n Policy: \"http://www.w3.org/ns/solid/acp#Policy\",\n AccessControl: \"http://www.w3.org/ns/solid/acp#AccessControl\",\n Read: \"http://www.w3.org/ns/solid/acp#Read\",\n Append: \"http://www.w3.org/ns/solid/acp#Append\",\n Write: \"http://www.w3.org/ns/solid/acp#Write\",\n /** @deprecated Removed from the ACP proposal, to be replaced by Matchers. */\n Rule: \"http://www.w3.org/ns/solid/acp#Rule\",\n Matcher: \"http://www.w3.org/ns/solid/acp#Matcher\",\n accessControl: \"http://www.w3.org/ns/solid/acp#accessControl\",\n memberAccessControl: \"http://www.w3.org/ns/solid/acp#memberAccessControl\",\n apply: \"http://www.w3.org/ns/solid/acp#apply\",\n /** @deprecated Removed from the ACP proposal, to be replaced by memberAccessControls. */\n applyMembers: \"http://www.w3.org/ns/solid/acp#applyMembers\",\n allow: \"http://www.w3.org/ns/solid/acp#allow\",\n deny: \"http://www.w3.org/ns/solid/acp#deny\",\n allOf: \"http://www.w3.org/ns/solid/acp#allOf\",\n anyOf: \"http://www.w3.org/ns/solid/acp#anyOf\",\n noneOf: \"http://www.w3.org/ns/solid/acp#noneOf\",\n access: \"http://www.w3.org/ns/solid/acp#access\",\n /** @deprecated Removed from the ACP proposal, to be replaced by memberAccessControls. */\n accessMembers: \"http://www.w3.org/ns/solid/acp#accessMembers\",\n agent: \"http://www.w3.org/ns/solid/acp#agent\",\n group: \"http://www.w3.org/ns/solid/acp#group\",\n client: \"http://www.w3.org/ns/solid/acp#client\",\n PublicAgent: \"http://www.w3.org/ns/solid/acp#PublicAgent\",\n AuthenticatedAgent: \"http://www.w3.org/ns/solid/acp#AuthenticatedAgent\",\n CreatorAgent: \"http://www.w3.org/ns/solid/acp#CreatorAgent\",\n};\n/** @hidden */\nconst solid = {\n PublicOidcClient: \"http://www.w3.org/ns/solid/terms#PublicOidcClient\",\n};\n/** @hidden */\nconst security = {\n publicKey: \"https://w3id.org/security#publicKey\",\n};\n/** @hidden */\nconst pim = {\n storage: \"http://www.w3.org/ns/pim/space#storage\",\n};\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @ignore For internal use only. */\nconst internal_defaultFetchOptions = {\n fetch,\n};\n/**\n * Retrieve the information about a resource (e.g. access permissions) without\n * fetching the resource itself.\n *\n * @param url URL to fetch Resource metadata from.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters).\n * @returns Promise resolving to the metadata describing the given Resource, or rejecting if fetching it failed.\n * @since 0.4.0\n */\nasync function getResourceInfo(url, options = { ...internal_defaultFetchOptions, ignoreAuthenticationErrors: false }) {\n var _a;\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const response = await config.fetch(url, { method: \"HEAD\" });\n return responseToResourceInfo(response, {\n ignoreAuthenticationErrors: (_a = options.ignoreAuthenticationErrors) !== null && _a !== void 0 ? _a : false,\n });\n}\n/**\n * Parse Solid metadata from a Response obtained by fetching a Resource from a Solid Pod,\n *\n * @param response A Fetch API Response. See {@link https://developer.mozilla.org/en-US/docs/Web/API/Response MDN}.\n * @returns Resource metadata readable by functions such as [[getSourceUrl]].\n * @hidden This interface is not exposed yet until we've tried it out in practice.\n */\nfunction responseToResourceInfo(response, options = { ignoreAuthenticationErrors: false }) {\n if (internal_isUnsuccessfulResponse(response) &&\n (!internal_isAuthenticationFailureResponse(response) ||\n !options.ignoreAuthenticationErrors)) {\n throw new FetchError(`Fetching the metadata of the Resource at [${response.url}] failed: [${response.status}] [${response.statusText}].`, response);\n }\n const resourceInfo = internal_parseResourceInfo(response);\n return { internal_resourceInfo: resourceInfo };\n}\n/**\n * @param resource Resource for which to check whether it is a Container.\n * @returns Whether `resource` is a Container.\n */\nfunction isContainer(resource) {\n const containerUrl = hasResourceInfo(resource)\n ? getSourceUrl(resource)\n : internal_toIriString(resource);\n return containerUrl.endsWith(\"/\");\n}\n/**\n * This function will tell you whether a given Resource contains raw data, or a SolidDataset.\n *\n * @param resource Resource for which to check whether it contains raw data.\n * @return Whether `resource` contains raw data.\n */\nfunction isRawData(resource) {\n return resource.internal_resourceInfo.isRawData;\n}\n/**\n * @param resource Resource for which to determine the Content Type.\n * @returns The Content Type, if known, or null if not known.\n */\nfunction getContentType$1(resource) {\n var _a;\n return (_a = resource.internal_resourceInfo.contentType) !== null && _a !== void 0 ? _a : null;\n}\nfunction getSourceUrl(resource) {\n if (hasResourceInfo(resource)) {\n return resource.internal_resourceInfo.sourceIri;\n }\n return null;\n}\n/** @hidden Alias of getSourceUrl for those who prefer to use IRI terminology. */\nconst getSourceIri = getSourceUrl;\n/**\n * Given a Resource that exposes information about the owner of the Pod it is in, returns the WebID of that owner.\n *\n * Data about the owner of the Pod is exposed when the following conditions hold:\n * - The Pod server supports exposing the Pod owner\n * - The current user is allowed to see who the Pod owner is.\n *\n * If one or more of those conditions are false, this function will return `null`.\n *\n * @param resource A Resource that contains information about the owner of the Pod it is in.\n * @returns The WebID of the owner of the Pod the Resource is in, if provided, or `null` if not.\n * @since 0.6.0\n */\nfunction getPodOwner(resource) {\n var _a;\n if (!hasServerResourceInfo(resource)) {\n return null;\n }\n const podOwners = (_a = getLinkedResourceUrlAll(resource)[\"http://www.w3.org/ns/solid/terms#podOwner\"]) !== null && _a !== void 0 ? _a : [];\n return podOwners.length === 1 ? podOwners[0] : null;\n}\n/**\n * Given a WebID and a Resource that exposes information about the owner of the Pod it is in, returns whether the given WebID is the owner of the Pod.\n *\n * Data about the owner of the Pod is exposed when the following conditions hold:\n * - The Pod server supports exposing the Pod owner\n * - The current user is allowed to see who the Pod owner is.\n *\n * If one or more of those conditions are false, this function will return `null`.\n *\n * @param webId The WebID of which to check whether it is the Pod Owner's.\n * @param resource A Resource that contains information about the owner of the Pod it is in.\n * @returns Whether the given WebID is the Pod Owner's, if the Pod Owner is exposed, or `null` if it is not exposed.\n * @since 0.6.0\n */\nfunction isPodOwner(webId, resource) {\n const podOwner = getPodOwner(resource);\n if (typeof podOwner !== \"string\") {\n return null;\n }\n return podOwner === webId;\n}\n/**\n * Get the URLs of Resources linked to the given Resource.\n *\n * Solid servers can link Resources to each other. For example, in servers\n * implementing Web Access Control, Resources can have an Access Control List\n * Resource linked to it via the `acl` relation.\n *\n * @param resource A Resource fetched from a Solid Pod.\n * @returns The URLs of Resources linked to the given Resource, indexed by the key that links them.\n * @since 1.7.0\n */\nfunction getLinkedResourceUrlAll(resource) {\n return resource.internal_resourceInfo.linkedResources;\n}\n/**\n * Get what access the current user has to the given Resource.\n *\n * This function can tell you what access the current user has for the given\n * Resource, allowing you to e.g. determine that changes to it will be rejected\n * before attempting to do so.\n * Additionally, for servers adhering to the Web Access Control specification,\n * it will tell you what access unauthenticated users have to the given Resource.\n *\n * @param resource A Resource fetched from a Solid Pod.\n * @returns What access the current user and, if supported by the server, unauthenticated users have to the given Resource.\n * @since 1.7.0\n */\nfunction getEffectiveAccess(resource) {\n var _a, _b, _c, _d, _e, _f, _g;\n if (typeof resource.internal_resourceInfo.permissions === \"object\") {\n return {\n user: {\n read: resource.internal_resourceInfo.permissions.user.read,\n append: resource.internal_resourceInfo.permissions.user.append,\n write: resource.internal_resourceInfo.permissions.user.write,\n },\n public: {\n read: resource.internal_resourceInfo.permissions.public.read,\n append: resource.internal_resourceInfo.permissions.public.append,\n write: resource.internal_resourceInfo.permissions.public.write,\n },\n };\n }\n const linkedResourceUrls = getLinkedResourceUrlAll(resource);\n return {\n user: {\n read: (_b = (_a = linkedResourceUrls[acp.allow]) === null || _a === void 0 ? void 0 : _a.includes(acp.Read)) !== null && _b !== void 0 ? _b : false,\n append: (_e = (((_c = linkedResourceUrls[acp.allow]) === null || _c === void 0 ? void 0 : _c.includes(acp.Append)) ||\n ((_d = linkedResourceUrls[acp.allow]) === null || _d === void 0 ? void 0 : _d.includes(acp.Write)))) !== null && _e !== void 0 ? _e : false,\n write: (_g = (_f = linkedResourceUrls[acp.allow]) === null || _f === void 0 ? void 0 : _f.includes(acp.Write)) !== null && _g !== void 0 ? _g : false,\n },\n };\n}\n/**\n * Extends the regular JavaScript error object with access to the status code and status message.\n * @since 1.2.0\n */\nclass FetchError extends SolidClientError {\n get statusCode() {\n return this.response.status;\n }\n get statusText() {\n return this.response.statusText;\n }\n constructor(message, errorResponse) {\n super(message);\n this.response = errorResponse;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note} This function is still experimental and subject to change, even\n * in a non-major release.\n * ```\n * This returns a parser that transforms a JSON-LD string into a set of RDFJS quads.\n *\n * @returns A Parser object.\n * @since 1.15.0\n */\nconst getJsonLdParser$1 = () => {\n const onQuadCallbacks = [];\n const onCompleteCallbacks = [];\n const onErrorCallbacks = [];\n return {\n onQuad: (callback) => {\n onQuadCallbacks.push(callback);\n },\n onError: (callback) => {\n onErrorCallbacks.push(callback);\n },\n onComplete: (callback) => {\n onCompleteCallbacks.push(callback);\n },\n // The following returns a Promise that can be awaited, which is undocumented\n // behavior that doesn't match the type signature. It prevents a potentially\n // breaking change, and will be updated on the next major release.\n parse: async (source, resourceInfo) => new Promise((res) => {\n const parser = new jsonldStreamingParser.JsonLdParser({\n baseIRI: getSourceUrl(resourceInfo),\n documentLoader: new jsonldContextParser.FetchDocumentLoader(fetch),\n });\n let endCalled = false;\n function end() {\n if (!endCalled) {\n endCalled = true;\n onCompleteCallbacks.forEach((callback) => callback());\n res();\n }\n }\n parser.on(\"end\", end);\n parser.on(\"error\", (err) => {\n onErrorCallbacks.forEach((callback) => callback(err));\n end();\n });\n onQuadCallbacks.forEach((callback) => parser.on(\"data\", callback));\n parser.write(source);\n parser.end();\n }),\n };\n};\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// @rdfjs/dataset is a CommonJS module, so named imports break in Node.\n// Thus, import the default export, then obtain the `dataset` property from there.\nrdfJsDatasetModule.dataset;\nconst localNodeSkolemPrefix = \"https://inrupt.com/.well-known/sdk-local-node/\";\n/**\n * Runtime freezing might be too much overhead;\n * if so, this function allows us to replace it by a function\n * that merely marks its input as Readonly<> for static analysis.\n */\nconst { freeze } = Object;\nfunction isLocalNodeIri(iri) {\n return (iri.substring(0, localNodeSkolemPrefix.length) === localNodeSkolemPrefix);\n}\nfunction getLocalNodeName(localNodeIri) {\n return localNodeIri.substring(localNodeSkolemPrefix.length);\n}\nfunction getLocalNodeIri(localNodeName) {\n return `${localNodeSkolemPrefix}${localNodeName}`;\n}\nfunction isBlankNodeId(value) {\n return typeof value === \"string\" && value.substring(0, 2) === \"_:\";\n}\nfunction getBlankNodeValue(blankNodeId) {\n return blankNodeId.substring(2);\n}\nfunction getBlankNodeId(blankNode) {\n return `_:${blankNode.value}`;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * IRIs of the XML Schema data types we support\n */\nconst xmlSchemaTypes = {\n boolean: \"http://www.w3.org/2001/XMLSchema#boolean\",\n dateTime: \"http://www.w3.org/2001/XMLSchema#dateTime\",\n date: \"http://www.w3.org/2001/XMLSchema#date\",\n time: \"http://www.w3.org/2001/XMLSchema#time\",\n decimal: \"http://www.w3.org/2001/XMLSchema#decimal\",\n integer: \"http://www.w3.org/2001/XMLSchema#integer\",\n string: \"http://www.w3.org/2001/XMLSchema#string\",\n langString: \"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString\",\n};\n/**\n * @internal\n * @param value Value to serialise.\n * @returns String representation of `value`.\n * @see https://www.w3.org/TR/xmlschema-2/#boolean-lexical-representation\n */\nfunction serializeBoolean(value) {\n return value ? \"true\" : \"false\";\n}\n/**\n * @internal\n * @param value Value to deserialise.\n * @returns Deserialized boolean, or null if the given value is not a valid serialised boolean.\n * @see https://www.w3.org/TR/xmlschema-2/#boolean-lexical-representation\n */\nfunction deserializeBoolean(value) {\n if (value === \"true\" || value === \"1\") {\n return true;\n }\n if (value === \"false\" || value === \"0\") {\n return false;\n }\n return null;\n}\n/**\n * @internal\n * @param value Value to serialise.\n * @returns String representation of `value` in UTC.\n * @see https://www.w3.org/TR/xmlschema-2/#time-lexical-repr\n */\nfunction serializeTime(value) {\n let millisecondString;\n let timezoneString;\n if (value.millisecond) {\n if (value.millisecond < 10) {\n millisecondString = `00${value.millisecond}`;\n }\n else if (value.millisecond < 100) {\n millisecondString = `0${value.millisecond}`;\n }\n else {\n millisecondString = value.millisecond;\n }\n }\n if (typeof value.timezoneHourOffset === \"number\") {\n const timezoneFormatted = Math.abs(value.timezoneHourOffset) < 10\n ? `0${Math.abs(value.timezoneHourOffset)}`\n : Math.abs(value.timezoneHourOffset);\n timezoneString =\n value.timezoneHourOffset >= 0\n ? `+${timezoneFormatted}`\n : `-${timezoneFormatted}`;\n if (value.timezoneMinuteOffset) {\n timezoneString = `${timezoneString}:${value.timezoneMinuteOffset < 10\n ? `0${value.timezoneMinuteOffset}`\n : value.timezoneMinuteOffset}`;\n }\n else {\n timezoneString += \":00\";\n }\n }\n return `${value.hour < 10 ? `0${value.hour}` : value.hour}:${value.minute < 10 ? `0${value.minute}` : value.minute}:${value.second < 10 ? `0${value.second}` : value.second}${value.millisecond ? `.${millisecondString}` : \"\"}${timezoneString || \"\"}`;\n}\n/**\n * @internal\n * @param literalString Value to deserialise.\n * @returns Deserialized time, or null if the given value is not a valid serialised datetime.\n * @see https://www.w3.org/TR/xmlschema-2/#time-lexical-repr\n */\nfunction deserializeTime(literalString) {\n // Time in the format described at\n // https://www.w3.org/TR/xmlschema-2/#time-lexical-repr\n // \\d\\d:\\d\\d:\\d\\d - Two digits for the hour, minute and second, respectively, separated by a `:`.\n // Example: \"13:37:42\".\n // (\\.\\d+)? - Optionally a `.` followed by one or more digits representing milliseconds.\n // Example: \".1337\".\n // (Z|(\\+|-)\\d\\d:\\d\\d) - The letter Z indicating UTC, or a `+` or `-` followed by two digits for\n // the hour offset and two for the minute offset, separated by a `:`.\n // Example: \"+13:37\".\n const timeRegEx = /\\d\\d:\\d\\d:\\d\\d(\\.\\d+)?(Z|(\\+|-)\\d\\d:\\d\\d)?/;\n if (!timeRegEx.test(literalString)) {\n return null;\n }\n const [timeString, timezoneString] = splitTimeFromTimezone(literalString);\n const [hourString, minuteString, timeRest] = timeString.split(\":\");\n let utcHours = Number.parseInt(hourString, 10);\n let utcMinutes = Number.parseInt(minuteString, 10);\n const [secondString, optionalMillisecondString] = timeRest.split(\".\");\n const utcSeconds = Number.parseInt(secondString, 10);\n const utcMilliseconds = optionalMillisecondString\n ? Number.parseInt(optionalMillisecondString, 10)\n : undefined;\n if (utcMinutes >= 60) {\n utcHours += 1;\n utcMinutes -= 60;\n }\n const deserializedTime = {\n hour: utcHours,\n minute: utcMinutes,\n second: utcSeconds,\n };\n if (typeof utcMilliseconds === \"number\") {\n deserializedTime.millisecond = utcMilliseconds;\n }\n if (typeof timezoneString === \"string\") {\n const [hourOffset, minuteOffset] = getTimezoneOffsets(timezoneString);\n if (typeof hourOffset !== \"number\" ||\n hourOffset > 24 ||\n typeof minuteOffset !== \"number\" ||\n minuteOffset > 59) {\n return null;\n }\n deserializedTime.timezoneHourOffset = hourOffset;\n deserializedTime.timezoneMinuteOffset = minuteOffset;\n }\n return deserializedTime;\n}\n/**\n * @internal\n * @param value Value to serialise.\n * @returns String representation of `value`.\n * @see https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation\n */\nfunction serializeDatetime(value) {\n // Although the XML Schema DateTime is not _exactly_ an ISO 8601 string\n // (see https://www.w3.org/TR/xmlschema-2/#deviantformats),\n // the deviations only affect the parsing, not the serialisation.\n // Therefore, we can just use .toISOString():\n return value.toISOString();\n}\n/**\n * @internal\n * @param value Value to deserialise.\n * @returns Deserialized datetime, or null if the given value is not a valid serialised datetime.\n * @see https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation\n */\nfunction deserializeDatetime(literalString) {\n // DateTime in the format described at\n // https://www.w3.org/TR/xmlschema-2/#dateTime-lexical-representation\n // (without constraints on the value).\n // -? - An optional leading `-`.\n // \\d{4,}- - Four or more digits followed by a `-` representing the year. Example: \"3000-\".\n // \\d\\d-\\d\\d - Two digits representing the month and two representing the day of the month,\n // separated by a `-`. Example: \"11-03\".\n // T - The letter T, separating the date from the time.\n // \\d\\d:\\d\\d:\\d\\d - Two digits for the hour, minute and second, respectively, separated by a `:`.\n // Example: \"13:37:42\".\n // (\\.\\d+)? - Optionally a `.` followed by one or more digits representing milliseconds.\n // Example: \".1337\".\n // (Z|(\\+|-)\\d\\d:\\d\\d) - The letter Z indicating UTC, or a `+` or `-` followed by two digits for\n // the hour offset and two for the minute offset, separated by a `:`.\n // Example: \"+13:37\".\n const datetimeRegEx = /-?\\d{4,}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(\\.\\d+)?(Z|(\\+|-)\\d\\d:\\d\\d)?/;\n if (!datetimeRegEx.test(literalString)) {\n return null;\n }\n const [signedDateString, rest] = literalString.split(\"T\");\n // The date string can optionally be prefixed with `-`,\n // in which case the year is negative:\n const [yearMultiplier, dateString] = signedDateString.charAt(0) === \"-\"\n ? [-1, signedDateString.substring(1)]\n : [1, signedDateString];\n const [yearString, monthString, dayString] = dateString.split(\"-\");\n const utcFullYear = Number.parseInt(yearString, 10) * yearMultiplier;\n const utcMonth = Number.parseInt(monthString, 10) - 1;\n const utcDate = Number.parseInt(dayString, 10);\n const [timeString, timezoneString] = splitTimeFromTimezone(rest);\n const [hourOffset, minuteOffset] = typeof timezoneString === \"string\"\n ? getTimezoneOffsets(timezoneString)\n : [0, 0];\n const [hourString, minuteString, timeRest] = timeString.split(\":\");\n const utcHours = Number.parseInt(hourString, 10) + hourOffset;\n const utcMinutes = Number.parseInt(minuteString, 10) + minuteOffset;\n const [secondString, optionalMillisecondString] = timeRest.split(\".\");\n const utcSeconds = Number.parseInt(secondString, 10);\n const utcMilliseconds = optionalMillisecondString\n ? Number.parseInt(optionalMillisecondString, 10)\n : 0;\n const date = new Date(Date.UTC(utcFullYear, utcMonth, utcDate, utcHours, utcMinutes, utcSeconds, utcMilliseconds));\n // For the year, values from 0 to 99 map to the years 1900 to 1999. Since the serialisation\n // always writes out the years fully, we should correct this to actually map to the years 0 to 99.\n // See\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#Individual_date_and_time_component_values\n if (utcFullYear >= 0 && utcFullYear < 100) {\n // Note that we base it on the calculated year, rather than the year that was actually read.\n // This is because the year might actually differ from the value listed in the serialisation,\n // i.e. when moving the timezone offset to UTC pushes it into a different year:\n date.setUTCFullYear(date.getUTCFullYear() - 1900);\n }\n return date;\n}\n/**\n * @internal\n * @param value Value to serialise.\n * @returns String representation of `value`.\n * @see https://www.w3.org/TR/xmlschema-2/#date-lexical-representation\n */\nfunction serializeDate(value) {\n const year = value.getFullYear();\n const month = value.getMonth() + 1;\n const day = value.getDate();\n const [, timezone] = splitTimeFromTimezone(value.toISOString());\n return `${year}-${String(month).padStart(2, \"0\")}-${String(day).padStart(2, \"0\")}${timezone}`;\n}\n/**\n * @internal\n * @param value Value to deserialise.\n * @returns Deserialized datetime, or null if the given value is not a valid serialised datetime.\n * @see https://www.w3.org/TR/xmlschema-2/#date-lexical-representation\n */\nfunction deserializeDate(literalString) {\n // Date in the format described at\n // https://www.w3.org/TR/xmlschema-2/#date-lexical-representation\n // (without constraints on the value).\n // -? - An optional leading `-`.\n // \\d{4,}- - Four or more digits followed by a `-` representing the year. Example: \"3000-\".\n // \\d\\d-\\d\\d - Two digits representing the month and two representing the day of the month,\n // separated by a `-`. Example: \"11-03\".\n // (Z|(\\+|-)\\d\\d:\\d\\d) - Optionally, the letter Z indicating UTC, or a `+` or `-` followed by two digits for\n // the hour offset and two for the minute offset, separated by a `:`.\n // Example: \"+13:37\".\n const dateRegEx = /-?\\d{4,}-\\d\\d-\\d\\d(Z|(\\+|-)\\d\\d:\\d\\d)?/;\n if (!dateRegEx.test(literalString)) {\n return null;\n }\n const signedDateString = literalString;\n // The date string can optionally be prefixed with `-`,\n // in which case the year is negative:\n const [yearMultiplier, dateString] = signedDateString.charAt(0) === \"-\"\n ? [-1, signedDateString.substring(1)]\n : [1, signedDateString];\n const [yearString, monthString, dayAndTimezoneString] = dateString.split(\"-\");\n const dayString = dayAndTimezoneString.length > 2\n ? dayAndTimezoneString.substring(0, 2)\n : dayAndTimezoneString;\n const utcFullYear = Number.parseInt(yearString, 10) * yearMultiplier;\n const utcMonth = Number.parseInt(monthString, 10) - 1;\n const utcDate = Number.parseInt(dayString, 10);\n const hour = 12;\n // setting at 12:00 avoids all timezones\n const date = new Date(Date.UTC(utcFullYear, utcMonth, utcDate, hour));\n // For the year, values from 0 to 99 map to the years 1900 to 1999. Since the serialisation\n // always writes out the years fully, we should correct this to actually map to the years 0 to 99.\n // See\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#Individual_date_and_time_component_values\n if (utcFullYear >= 0 && utcFullYear < 100) {\n date.setUTCFullYear(date.getUTCFullYear() - 1900);\n }\n return date;\n}\n/**\n * @param timeString An XML Schema time string.\n * @returns A tuple [timeString, timezoneString].\n * @see https://www.w3.org/TR/xmlschema-2/#time-lexical-repr\n */\nfunction splitTimeFromTimezone(timeString) {\n if (timeString.endsWith(\"Z\")) {\n return [timeString.substring(0, timeString.length - 1), \"Z\"];\n }\n const splitOnPlus = timeString.split(\"+\");\n const splitOnMinus = timeString.split(\"-\");\n if (splitOnPlus.length === 1 && splitOnMinus.length === 1) {\n return [splitOnPlus[0], undefined];\n }\n return splitOnPlus.length > splitOnMinus.length\n ? [splitOnPlus[0], `+${splitOnPlus[1]}`]\n : [splitOnMinus[0], `-${splitOnMinus[1]}`];\n}\n/**\n * @param timezoneString Lexical representation of a time zone in XML Schema.\n * @returns A tuple of the hour and minute offset of the time zone.\n * @see https://www.w3.org/TR/xmlschema-2/#dateTime-timezones\n */\nfunction getTimezoneOffsets(timezoneString) {\n if (timezoneString === \"Z\") {\n return [0, 0];\n }\n const multiplier = timezoneString.charAt(0) === \"+\" ? 1 : -1;\n const [hourString, minuteString] = timezoneString.substring(1).split(\":\");\n const hours = Number.parseInt(hourString, 10);\n const minutes = Number.parseInt(minuteString, 10);\n return [hours * multiplier, minutes * multiplier];\n}\n/**\n * @internal\n * @param value Value to serialise.\n * @returns String representation of `value`.\n * @see https://www.w3.org/TR/xmlschema-2/#decimal-lexical-representation\n */\nfunction serializeDecimal(value) {\n return value.toString();\n}\n/**\n * @internal\n * @param value Value to deserialise.\n * @returns Deserialized decimal, or null if the given value is not a valid serialised decimal.\n * @see https://www.w3.org/TR/xmlschema-2/#decimal-lexical-representation\n */\nfunction deserializeDecimal(literalString) {\n const deserialized = Number.parseFloat(literalString);\n if (Number.isNaN(deserialized)) {\n return null;\n }\n return deserialized;\n}\n/**\n * @internal\n * @param value Value to serialise.\n * @returns String representation of `value`.\n */\nfunction serializeInteger(value) {\n return value.toString();\n}\n/**\n * @internal\n * @param value Value to deserialise.\n * @returns Deserialized integer, or null if the given value is not a valid serialised integer.\n */\nfunction deserializeInteger(literalString) {\n const deserialized = Number.parseInt(literalString, 10);\n if (Number.isNaN(deserialized)) {\n return null;\n }\n return deserialized;\n}\n/**\n * @internal\n * @param locale Locale to transform into a consistent format.\n */\nfunction normalizeLocale(locale) {\n return locale.toLowerCase();\n}\n/**\n * @internal Library users shouldn't need to be exposed to raw NamedNodes.\n * @param value The value that might or might not be a Named Node.\n * @returns Whether `value` is a Named Node.\n */\nfunction isNamedNode(value) {\n return isTerm(value) && value.termType === \"NamedNode\";\n}\n/**\n * @internal Library users shouldn't need to be exposed to raw Literals.\n * @param value The value that might or might not be a Literal.\n * @returns Whether `value` is a Literal.\n */\nfunction isLiteral(value) {\n return isTerm(value) && value.termType === \"Literal\";\n}\n/**\n * @internal Library users shouldn't need to be exposed to raw Terms.\n * @param value The value that might or might not be a Term.\n * @returns Whether `value` is a Term.\n */\nfunction isTerm(value) {\n return (value !== null &&\n typeof value === \"object\" &&\n typeof value.termType === \"string\" &&\n typeof value.value === \"string\" &&\n typeof value.equals === \"function\");\n}\n/**\n * @internal Library users shouldn't need to be exposed to LocalNodes.\n * @param value The value that might or might not be a Node with no known IRI yet.\n * @returns Whether `value` is a Node with no known IRI yet.\n */\nfunction isLocalNode(value) {\n return isNamedNode(value) && isLocalNodeIri(value.value);\n}\n/**\n * Ensure that a given value is a valid URL.\n *\n * @internal Library users shouldn't need to be exposed to raw URLs.\n * @param iri The value of which to verify that it is a valid URL.\n */\nfunction internal_isValidUrl(iri) {\n const iriString = internal_toIriString(iri);\n // If the runtime environment supports URL, instantiate one.\n // If the given IRI is not a valid URL, it will throw an error.\n // See: https://developer.mozilla.org/en-US/docs/Web/API/URL\n /* istanbul ignore if [URL is available in our testing environment, so we cannot test the alternative] */\n if (typeof URL !== \"function\") {\n // If we can't validate the URL, do not throw an error:\n return true;\n }\n try {\n // eslint-disable-next-line no-new\n new URL(iriString);\n return true;\n }\n catch (_a) {\n return false;\n }\n}\n/**\n * @internal Utility method; library users should not need to interact with LocalNodes directly.\n * @param localNode The LocalNode to resolve to a NamedNode.\n * @param resourceIri The Resource in which the Node will be saved.\n */\nfunction resolveIriForLocalNode(localNode, resourceIri) {\n return DataFactory.namedNode(resolveLocalIri(getLocalNodeName(localNode.value), resourceIri));\n}\n/**\n * @internal API for internal use only.\n * @param name The name identifying a Thing.\n * @param resourceIri The Resource in which the Thing can be found.\n */\nfunction resolveLocalIri(name, resourceIri) {\n /* istanbul ignore if [The URL interface is available in the testing environment, so we cannot test this] */\n if (typeof URL !== \"function\") {\n throw new Error(\"The URL interface is not available, so an IRI cannot be determined.\");\n }\n const thingIri = new URL(resourceIri);\n thingIri.hash = name;\n return thingIri.href;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst DataFactory = RdfJsDataFactory;\nfunction addRdfJsQuadToDataset(dataset, quad, quadParseOptions = {}) {\n var _a;\n const supportedGraphTypes = [\n \"NamedNode\",\n \"DefaultGraph\",\n ];\n if (!supportedGraphTypes.includes(quad.graph.termType)) {\n throw new Error(`Cannot parse Quads with nodes of type [${quad.graph.termType}] as their Graph node.`);\n }\n const graphId = quad.graph.termType === \"DefaultGraph\" ? \"default\" : quad.graph.value;\n const graph = (_a = dataset.graphs[graphId]) !== null && _a !== void 0 ? _a : {};\n return freeze({\n ...dataset,\n graphs: freeze({\n ...dataset.graphs,\n [graphId]: addRdfJsQuadToGraph(graph, quad, quadParseOptions),\n }),\n });\n}\nfunction addRdfJsQuadToGraph(graph, quad, quadParseOptions) {\n var _a;\n const supportedSubjectTypes = [\n \"NamedNode\",\n \"BlankNode\",\n ];\n if (!supportedSubjectTypes.includes(quad.subject.termType)) {\n throw new Error(`Cannot parse Quads with nodes of type [${quad.subject.termType}] as their Subject node.`);\n }\n const subjectIri = quad.subject.termType === \"BlankNode\"\n ? `_:${quad.subject.value}`\n : quad.subject.value;\n const subject = (_a = graph[subjectIri]) !== null && _a !== void 0 ? _a : {\n type: \"Subject\",\n url: subjectIri,\n predicates: {},\n };\n return freeze({\n ...graph,\n [subjectIri]: addRdfJsQuadToSubject(subject, quad, quadParseOptions),\n });\n}\nfunction addRdfJsQuadToSubject(subject, quad, quadParseOptions) {\n return freeze({\n ...subject,\n predicates: addRdfJsQuadToPredicates(subject.predicates, quad, quadParseOptions),\n });\n}\nfunction addRdfJsQuadToPredicates(predicates, quad, quadParseOptions) {\n var _a;\n const supportedPredicateTypes = [\n \"NamedNode\",\n ];\n if (!supportedPredicateTypes.includes(quad.predicate.termType)) {\n throw new Error(`Cannot parse Quads with nodes of type [${quad.predicate.termType}] as their Predicate node.`);\n }\n const predicateIri = quad.predicate.value;\n const objects = (_a = predicates[predicateIri]) !== null && _a !== void 0 ? _a : {};\n return freeze({\n ...predicates,\n [predicateIri]: addRdfJsQuadToObjects(objects, quad, quadParseOptions),\n });\n}\nfunction addRdfJsQuadToObjects(objects, quad, quadParseOptions) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (quad.object.termType === \"NamedNode\") {\n const namedNodes = freeze([\n ...((_a = objects.namedNodes) !== null && _a !== void 0 ? _a : []),\n quad.object.value,\n ]);\n return freeze({\n ...objects,\n namedNodes,\n });\n }\n if (quad.object.termType === \"Literal\") {\n if (quad.object.datatype.value === xmlSchemaTypes.langString) {\n const locale = quad.object.language.toLowerCase();\n const thisLocaleStrings = freeze([\n ...((_c = (_b = objects.langStrings) === null || _b === void 0 ? void 0 : _b[locale]) !== null && _c !== void 0 ? _c : []),\n quad.object.value,\n ]);\n const langStrings = freeze({\n ...((_d = objects.langStrings) !== null && _d !== void 0 ? _d : {}),\n [locale]: thisLocaleStrings,\n });\n return freeze({\n ...objects,\n langStrings,\n });\n }\n // If the Object is a non-langString Literal\n const thisTypeValues = freeze([\n ...((_f = (_e = objects.literals) === null || _e === void 0 ? void 0 : _e[quad.object.datatype.value]) !== null && _f !== void 0 ? _f : []),\n quad.object.value,\n ]);\n const literals = freeze({\n ...((_g = objects.literals) !== null && _g !== void 0 ? _g : {}),\n [quad.object.datatype.value]: thisTypeValues,\n });\n return freeze({\n ...objects,\n literals,\n });\n }\n if (quad.object.termType === \"BlankNode\") {\n const blankNodePredicates = getPredicatesForBlankNode(quad.object, quadParseOptions);\n const blankNodes = freeze([\n ...((_h = objects.blankNodes) !== null && _h !== void 0 ? _h : []),\n blankNodePredicates,\n ]);\n return freeze({\n ...objects,\n blankNodes,\n });\n }\n throw new Error(`Objects of type [${quad.object.termType}] are not supported.`);\n}\nfunction getPredicatesForBlankNode(node, quadParseOptions) {\n var _a, _b;\n const chainBlankNodes = (_a = quadParseOptions.chainBlankNodes) !== null && _a !== void 0 ? _a : [];\n if (chainBlankNodes.find((chainBlankNode) => chainBlankNode.equals(node)) ===\n undefined) {\n // If this Blank Node is not used to provide nested values for another Subject,\n // just return its identifier.\n // That identifier will also be listed among the Subjects in the Graph.\n return getBlankNodeId(node);\n }\n /* istanbul ignore next: If there are chain nodes, there will always be other Quads, so the `?? []` can't be reached: */\n const quads = (_b = quadParseOptions.otherQuads) !== null && _b !== void 0 ? _b : [];\n const quadsWithNodeAsSubject = quads.filter((quad) => quad.subject.equals(node));\n // First add the Quads with regular Objects\n const predicates = quadsWithNodeAsSubject\n .filter((quad) => !isBlankNode(quad.object))\n .reduce((predicatesAcc, quad) => {\n var _a;\n const supportedPredicateTypes = [\n \"NamedNode\",\n ];\n if (!supportedPredicateTypes.includes(quad.predicate.termType)) {\n throw new Error(`Cannot parse Quads with nodes of type [${quad.predicate.termType}] as their Predicate node.`);\n }\n const objects = (_a = predicatesAcc[quad.predicate.value]) !== null && _a !== void 0 ? _a : {};\n return freeze({\n ...predicatesAcc,\n [quad.predicate.value]: addRdfJsQuadToObjects(objects, quad, quadParseOptions),\n });\n }, {});\n // And then also add the Quads that have another Blank Node as the Object\n // in addition to the Blank Node `node` as the Subject:\n const blankNodeObjectQuads = quadsWithNodeAsSubject.filter((quad) => isBlankNode(quad.object));\n return blankNodeObjectQuads.reduce((predicatesAcc, quad) => {\n var _a, _b;\n const supportedPredicateTypes = [\n \"NamedNode\",\n ];\n if (!supportedPredicateTypes.includes(quad.predicate.termType)) {\n throw new Error(`Cannot parse Quads with nodes of type [${quad.predicate.termType}] as their Predicate node.`);\n }\n /* istanbul ignore next: The `?? {}` doesn't get hit; presumably it's initialised above. */\n const objects = (_a = predicatesAcc[quad.predicate.value]) !== null && _a !== void 0 ? _a : {};\n /* istanbul ignore next: The `?? []` doesn't get hit; presumably it's initialised above. */\n const blankNodes = (_b = objects.blankNodes) !== null && _b !== void 0 ? _b : [];\n return freeze({\n ...predicatesAcc,\n // The BlankNode assertions are valid because we filtered on BlankNodes above:\n [quad.predicate.value]: {\n ...objects,\n blankNodes: [\n ...blankNodes,\n getPredicatesForBlankNode(quad.object, quadParseOptions),\n ],\n },\n });\n }, predicates);\n}\n/**\n * Given an array of Quads, returns all Blank Nodes that are used in a single chain of Nodes.\n *\n * This allows you to obtain which Blank Nodes are involved in e.g. RDF lists.\n * This is useful because those can be represented as nested data that will have\n * a deterministic structure, whereas a representation of Blank Nodes that\n * create a cycle or are re-used will need ad-hoc, non-deterministic identifiers\n * to allow for representation without inifinite nesting.\n */\nfunction getChainBlankNodes(quads) {\n // All Blank Nodes that occur in Subject position:\n const blankNodeSubjects = quads\n .map((quad) => quad.subject)\n .filter(isBlankNode);\n // All Blank Nodes that occur in Object position:\n const blankNodeObjects = quads.map((quad) => quad.object).filter(isBlankNode);\n // Makes sure that all given Nodes are the same,\n // which will be used to verify that a set of Quads all have the same Subject:\n function everyNodeTheSame(nodes) {\n // This could potentially be made more performant by mapping every term\n // to their value and using native JS comparisons, assuming every node is\n // either a Blank or a Named Node.\n return nodes.every((otherNode) => nodes.every((anotherNode) => otherNode.equals(anotherNode)));\n }\n // Get all Blank Nodes that are part of a cycle in the graph:\n const cycleBlankNodes = [];\n blankNodeObjects.forEach((blankNodeObject) => {\n cycleBlankNodes.push(...getCycleBlankNodes(blankNodeObject, quads));\n });\n // Get Blank Nodes that are used to provide nested values for a single Subject,\n // which we'll represent as nested values as well\n // (this allows us to avoid generating a non-deterministic, ad-hoc identifier\n // for those Blank Nodes).\n // We'll do this by taking all Blank Nodes in the given Quads...\n const chainBlankNodes = blankNodeSubjects\n .concat(blankNodeObjects)\n .filter((blankNode) => {\n // ....removing those Blank Nodes that are part of a cycle...\n if (cycleBlankNodes.some((cycleBlankNode) => cycleBlankNode.equals(blankNode))) {\n return false;\n }\n // ...and then returning only those Blank Nodes that only occur in the\n // Object position for a single Subject, i.e. that are part of a single\n // chain:\n const subjectsWithThisNodeAsObject = quads\n .filter((quad) => quad.object.equals(blankNode))\n .map((quad) => quad.subject);\n return (subjectsWithThisNodeAsObject.length > 0 &&\n everyNodeTheSame(subjectsWithThisNodeAsObject));\n });\n return chainBlankNodes;\n}\nfunction toRdfJsQuads(dataset, options = {}) {\n var _a;\n const quads = [];\n const dataFactory = (_a = options.dataFactory) !== null && _a !== void 0 ? _a : RdfJsDataFactory;\n Object.keys(dataset.graphs).forEach((graphIri) => {\n const graph = dataset.graphs[graphIri];\n const graphNode = graphIri === \"default\"\n ? dataFactory.defaultGraph()\n : dataFactory.namedNode(graphIri);\n Object.keys(graph).forEach((subjectIri) => {\n const { predicates } = graph[subjectIri];\n const subjectNode = isBlankNodeId(subjectIri)\n ? dataFactory.blankNode(getBlankNodeValue(subjectIri))\n : dataFactory.namedNode(subjectIri);\n quads.push(...subjectToRdfJsQuads(predicates, subjectNode, graphNode, options));\n });\n });\n return quads;\n}\nfunction subjectToRdfJsQuads(predicates, subjectNode, graphNode, options = {}) {\n var _a;\n const quads = [];\n const dataFactory = (_a = options.dataFactory) !== null && _a !== void 0 ? _a : RdfJsDataFactory;\n Object.keys(predicates).forEach((predicateIri) => {\n var _a, _b, _c, _d;\n const predicateNode = dataFactory.namedNode(predicateIri);\n const langStrings = (_a = predicates[predicateIri].langStrings) !== null && _a !== void 0 ? _a : {};\n const namedNodes = (_b = predicates[predicateIri].namedNodes) !== null && _b !== void 0 ? _b : [];\n const literals = (_c = predicates[predicateIri].literals) !== null && _c !== void 0 ? _c : {};\n const blankNodes = (_d = predicates[predicateIri].blankNodes) !== null && _d !== void 0 ? _d : [];\n const literalTypes = Object.keys(literals);\n literalTypes.forEach((typeIri) => {\n const typeNode = dataFactory.namedNode(typeIri);\n const literalValues = literals[typeIri];\n literalValues.forEach((value) => {\n const literalNode = dataFactory.literal(value, typeNode);\n quads.push(dataFactory.quad(subjectNode, predicateNode, literalNode, graphNode));\n });\n });\n const locales = Object.keys(langStrings);\n locales.forEach((locale) => {\n const localeValues = langStrings[locale];\n localeValues.forEach((value) => {\n const langStringNode = dataFactory.literal(value, locale);\n quads.push(dataFactory.quad(subjectNode, predicateNode, langStringNode, graphNode));\n });\n });\n namedNodes.forEach((namedNodeIri) => {\n const node = dataFactory.namedNode(namedNodeIri);\n quads.push(dataFactory.quad(subjectNode, predicateNode, node, graphNode));\n });\n blankNodes.forEach((blankNodeIdOrPredicates) => {\n if (isBlankNodeId(blankNodeIdOrPredicates)) {\n const blankNode = dataFactory.blankNode(getBlankNodeValue(blankNodeIdOrPredicates));\n quads.push(dataFactory.quad(subjectNode, predicateNode, blankNode, graphNode));\n }\n else {\n const node = dataFactory.blankNode();\n const blankNodeObjectQuad = dataFactory.quad(subjectNode, predicateNode, node, graphNode);\n const blankNodeSubjectQuads = subjectToRdfJsQuads(blankNodeIdOrPredicates, node, graphNode);\n quads.push(blankNodeObjectQuad);\n quads.push(...blankNodeSubjectQuads);\n }\n });\n });\n return quads;\n}\n/**\n * A recursive function that finds all Blank Nodes in an array of Quads that create a cycle in the graph.\n *\n * This function will traverse the graph starting from `currentNode`, keeping\n * track of all the Blank Nodes it encounters twice while doing so, and\n * returning those.\n */\nfunction getCycleBlankNodes(currentNode, quads, traversedBlankNodes = []) {\n // If we've encountered `currentNode` before, all the Blank Nodes we've\n // encountered so far are part of a cycle. Return those.\n if (traversedBlankNodes.find((traversedBlankNode) => traversedBlankNode.equals(currentNode)) !== undefined) {\n return traversedBlankNodes;\n }\n // Find all Blank Nodes that are connected to `currentNode`:\n const blankNodeObjects = quads\n .filter((quad) => quad.subject.equals(currentNode) && isBlankNode(quad.object))\n .map((quad) => quad.object);\n // If no Blank Nodes are connected to `currentNode`, and `currentNode` is not\n // part of a cycle, we're done; the currently traversed Nodes do not form a\n // cycle:\n if (blankNodeObjects.length === 0) {\n return [];\n }\n // Store that we've traversed `currentNode`, then move on to all the Blank\n // Nodes connected to it, which will then take up the role of `currentNode`:\n const nextTraversedNodes = [...traversedBlankNodes, currentNode];\n const cycleBlankNodeArrays = blankNodeObjects.map((nextNode) => getCycleBlankNodes(nextNode, quads, nextTraversedNodes));\n // Collect all the cycle Blank Nodes found in those traverals,\n // then return them:\n const allCycleBlankNodes = [];\n for (const cycleBlankNodes of cycleBlankNodeArrays) {\n allCycleBlankNodes.push(...cycleBlankNodes);\n }\n return allCycleBlankNodes;\n}\nfunction isBlankNode(term) {\n return term.termType === \"BlankNode\";\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note} This function is still experimental and subject to change, even\n * in a non-major release.\n * ```\n * This returns a parser that transforms a JSON-LD string into a set of RDFJS quads.\n *\n * @returns A Parser object.\n * @since 1.15.0\n */\nconst getTurtleParser$1 = () => {\n const onQuadCallbacks = [];\n const onCompleteCallbacks = [];\n const onErrorCallbacks = [];\n return {\n onQuad: (callback) => {\n onQuadCallbacks.push(callback);\n },\n onError: (callback) => {\n onErrorCallbacks.push(callback);\n },\n onComplete: (callback) => {\n onCompleteCallbacks.push(callback);\n },\n parse: async (source, resourceInfo) => {\n const parser = await getParser(getSourceUrl(resourceInfo));\n parser.parse(source, (error, quad) => {\n if (error) {\n onErrorCallbacks.forEach((callback) => callback(error));\n }\n else if (quad) {\n onQuadCallbacks.forEach((callback) => callback(quad));\n }\n else {\n onCompleteCallbacks.forEach((callback) => callback());\n }\n });\n },\n };\n};\nasync function getParser(baseIri) {\n return new n3.Parser({ format: \"text/turtle\", baseIRI: baseIri });\n}\n/**\n * @param quads Triples that should be serialised to Turtle\n * @internal Utility method for internal use; not part of the public API.\n */\nasync function triplesToTurtle(quads, options) {\n const format = \"text/turtle\";\n const writer = new n3.Writer({ format, prefixes: options === null || options === void 0 ? void 0 : options.prefixes });\n // Remove any potentially lingering references to Named Graphs in Quads;\n // they'll be determined by the URL the Turtle will be sent to:\n const triples = quads.map((quad) => DataFactory.quad(quad.subject, quad.predicate, quad.object, undefined));\n writer.addQuads(triples);\n const writePromise = new Promise((resolve, reject) => {\n writer.end((error, result) => {\n /* istanbul ignore if [n3.js doesn't actually pass an error nor a result, apparently: https://github.com/rdfjs/N3.js/blob/62682e48c02d8965b4d728cb5f2cbec6b5d1b1b8/src/N3Writer.js#L290] */\n if (error) {\n reject(error);\n }\n else {\n resolve(result);\n }\n });\n });\n const rawTurtle = await writePromise;\n return rawTurtle;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst prefixes = {\n acl: \"http://www.w3.org/ns/auth/acl#\",\n acp: \"http://www.w3.org/ns/solid/acp#\",\n cc: \"http://creativecommons.org/ns#\",\n cert: \"http://www.w3.org/ns/auth/cert#\",\n csvw: \"http://www.w3.org/ns/csvw#\",\n current: \"#\",\n dc: \"http://purl.org/dc/terms/\",\n dcam: \"http://purl.org/dc/dcam/\",\n dcat: \"http://www.w3.org/ns/dcat#\",\n dctype: \"http://purl.org/dc/dcmitype/\",\n foaf: \"http://xmlns.com/foaf/0.1/\",\n ldp: \"http://www.w3.org/ns/ldp#\",\n owl: \"http://www.w3.org/2002/07/owl#\",\n posixstat: \"http://www.w3.org/ns/posix/stat#\",\n rdf: \"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",\n rdfs: \"http://www.w3.org/2000/01/rdf-schema#\",\n schema: \"https://schema.org/\",\n shacl: \"http://www.w3.org/ns/shacl#\",\n skos: \"http://www.w3.org/2004/02/skos/core#\",\n skosxl: \"http://www.w3.org/2008/05/skos-xl#\",\n solid: \"http://www.w3.org/ns/solid/terms#\",\n swapdoc: \"http://www.w3.org/2000/10/swap/pim/doc#\",\n ui: \"http://www.w3.org/ns/ui#\",\n vann: \"http://purl.org/vocab/vann/\",\n vcard: \"http://www.w3.org/2006/vcard/ns#\",\n ws: \"http://www.w3.org/ns/pim/space#\",\n xsd: \"http://www.w3.org/2001/XMLSchema#\",\n};\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst rdfJsDataset = rdfJsDatasetModule.dataset;\n/**\n * Convert an RDF/JS Dataset into a [[SolidDataset]]\n *\n * Parse an RDF/JS\n * {@link https://rdf.js.org/dataset-spec/#datasetcore-interface DatasetCore},\n * into a [[SolidDataset]]. Note that, when saving the returned SolidDataset to\n * a Solid Pod, only Quads in the Default Graph will be stored.\n *\n * @param rdfJsDataset The source RDF/JS Dataset.\n * @returns A [[SolidDataset]] containing the same data as the given RDF/JS Dataset.\n * @since 1.9.0\n */\nfunction fromRdfJsDataset(rdfJsDataset) {\n const dataset = {\n graphs: { default: {} },\n type: \"Dataset\",\n };\n const quads = Array.from(rdfJsDataset);\n const chainBlankNodes = getChainBlankNodes(quads);\n // Quads with chain Blank Nodes as their Subject will be parsed when those\n // Blank Nodes are referred to in an Object. See `addRdfJsQuadToObjects`.\n const quadsWithoutChainBlankNodeSubjects = quads.filter((quad) => chainBlankNodes.every((chainBlankNode) => !chainBlankNode.equals(quad.subject)));\n return quadsWithoutChainBlankNodeSubjects.reduce((datasetAcc, quad) => addRdfJsQuadToDataset(datasetAcc, quad, {\n otherQuads: quads,\n chainBlankNodes,\n }), dataset);\n}\n/**\n * Convert a [[SolidDataset]] into an RDF/JS Dataset\n *\n * Export a [[SolidDataset]] into an RDF/JS\n * {@link https://rdf.js.org/dataset-spec/#datasetcore-interface DatasetCore}.\n *\n * @param set A [[SolidDataset]] to export into an RDF/JS Dataset.\n * @param options Optional parameter that allows you to pass in your own RDF/JS DataFactory or DatasetCoreFactory.\n * @returns An RDF/JS Dataset containing the data from the given SolidDataset.\n * @since 1.9.0\n */\nfunction toRdfJsDataset(set, options = {}) {\n var _a, _b;\n const datasetFactory = (_b = (_a = options.datasetFactory) === null || _a === void 0 ? void 0 : _a.dataset) !== null && _b !== void 0 ? _b : rdfJsDataset;\n return datasetFactory(toRdfJsQuads(set, options));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * A function to serialise a Solid Dataset as Turtle\n *\n * @param dataset The Dataset to serialize as Turtle\n * @param options.prefixes The Prefixes to use for Turtle serialisation (defaulting to a set of well known prefixes)\n * @param options.thing Restricts serialisation to the part of a dataset related to the thing\n * @returns RDF serialised as Turtle\n * @since 1.20.0\n */\nasync function solidDatasetAsTurtle$1(dataset, options) {\n const { prefixes: prefixes$1 = prefixes, thing } = { ...options };\n const writer = new n3.Writer({ format: \"application/turtle\", prefixes: prefixes$1 });\n const subject = thing ? new n3.NamedNode(thing) : undefined;\n // If the subject is undefined, all the triples match.\n for (const quad of toRdfJsDataset(dataset).match(subject)) {\n writer.addQuad(quad);\n }\n return new Promise((resolve, reject) => {\n writer.end((error, result) => {\n /* istanbul ignore next */\n if (error) {\n reject(error);\n }\n else {\n resolve(result);\n }\n });\n });\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n\nvar formats = /*#__PURE__*/Object.freeze({\n __proto__: null,\n getJsonLdParser: getJsonLdParser$1,\n getTurtleParser: getTurtleParser$1,\n solidDatasetAsTurtle: solidDatasetAsTurtle$1\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst defaultGetFileOptions = {\n fetch,\n};\nconst RESERVED_HEADERS = [\"Slug\", \"If-None-Match\", \"Content-Type\"];\n/**\n * Some of the headers must be set by the library, rather than directly.\n */\nfunction containsReserved(header) {\n return RESERVED_HEADERS.some((reserved) => header[reserved] !== undefined);\n}\n/**\n * Retrieves a file from a URL and returns the file as a blob.\n *\n * For example:\n *\n * ```\n * const fileBlob = await getFile(\"https://pod.example.com/some/file\", { fetch: fetch });\n * ```\n *\n * For additional examples, see\n * [Read/Write Files](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/read-write-files/#retrieve-a-file).\n *\n * @param fileUrl The URL of the file to return\n * @param options Fetching options: a custom fetcher and/or headers.\n * @returns The file as a blob.\n */\nasync function getFile(fileUrl, options = defaultGetFileOptions) {\n const config = {\n ...defaultGetFileOptions,\n ...options,\n };\n const url = internal_toIriString(fileUrl);\n const response = await config.fetch(url, config.init);\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Fetching the File failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n const resourceInfo = internal_parseResourceInfo(response);\n const data = await response.blob();\n const fileWithResourceInfo = Object.assign(data, {\n internal_resourceInfo: resourceInfo,\n });\n return fileWithResourceInfo;\n}\n/**\n * Deletes a file at a given URL.\n *\n * For example:\n *\n * ```\n * await deleteFile( \"https://pod.example.com/some/file\", { fetch: fetch });\n * ```\n *\n * For additional examples, see\n * [Read/Write Files](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/read-write-files/#delete-a-file).\n *\n * @param file The URL of the file to delete or the file itself (if it has ResourceInfo).\n */\nasync function deleteFile(file, options = defaultGetFileOptions) {\n const config = {\n ...defaultGetFileOptions,\n ...options,\n };\n const url = hasResourceInfo(file)\n ? internal_toIriString(getSourceIri(file))\n : internal_toIriString(file);\n const response = await config.fetch(url, {\n ...config.init,\n method: \"DELETE\",\n });\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Deleting the file at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n}\nasync function saveFileInContainer(folderUrl, file, options = defaultGetFileOptions) {\n const folderUrlString = internal_toIriString(folderUrl);\n const response = await writeFile(folderUrlString, file, \"POST\", options);\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Saving the file in [${folderUrl}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n const locationHeader = response.headers.get(\"Location\");\n if (locationHeader === null) {\n throw new Error(\"Could not determine the location of the newly saved file.\");\n }\n const fileIri = new URL(locationHeader, new URL(folderUrlString).origin).href;\n const blobClone = internal_cloneResource(file);\n const resourceInfo = {\n internal_resourceInfo: {\n isRawData: true,\n sourceIri: fileIri,\n contentType: getContentType(file, options.contentType),\n },\n };\n return Object.assign(blobClone, resourceInfo);\n}\nasync function overwriteFile(fileUrl, file, options = defaultGetFileOptions) {\n const fileUrlString = internal_toIriString(fileUrl);\n const response = await writeFile(fileUrlString, file, \"PUT\", options);\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Overwriting the file at [${fileUrlString}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n const blobClone = internal_cloneResource(file);\n const resourceInfo = internal_parseResourceInfo(response);\n resourceInfo.sourceIri = fileUrlString;\n resourceInfo.isRawData = true;\n return Object.assign(blobClone, { internal_resourceInfo: resourceInfo });\n}\nfunction isHeadersArray(headers) {\n return Array.isArray(headers);\n}\n/**\n * The return type of this function is misleading: it should ONLY be used to check\n * whether an object has a forEach method that returns pairs.\n *\n * @param headers A headers object that might have a forEach\n */\nfunction hasHeadersObjectForEach(headers) {\n return typeof headers.forEach === \"function\";\n}\n/**\n * @hidden\n * This function feels unnecessarily complicated, but is required in order to\n * have Headers according to type definitions in both Node and browser environments.\n * This might require a fix upstream to be cleaned up.\n *\n * @param headersToFlatten A structure containing headers potentially in several formats\n */\nfunction flattenHeaders(headersToFlatten) {\n if (typeof headersToFlatten === \"undefined\") {\n return {};\n }\n let flatHeaders = {};\n if (isHeadersArray(headersToFlatten)) {\n headersToFlatten.forEach(([key, value]) => {\n flatHeaders[key] = value;\n });\n // Note that the following line must be a elsif, because string[][] has a forEach,\n // but it returns string[] instead of \n }\n else if (hasHeadersObjectForEach(headersToFlatten)) {\n headersToFlatten.forEach((value, key) => {\n flatHeaders[key] = value;\n });\n }\n else {\n // If the headers are already a Record,\n // they can directly be returned.\n flatHeaders = headersToFlatten;\n }\n return flatHeaders;\n}\nasync function writeFile(targetUrl, file, method, options) {\n var _a, _b;\n const config = {\n ...defaultGetFileOptions,\n ...options,\n };\n const headers = flattenHeaders((_b = (_a = config.init) === null || _a === void 0 ? void 0 : _a.headers) !== null && _b !== void 0 ? _b : {});\n if (containsReserved(headers)) {\n throw new Error(`No reserved header (${RESERVED_HEADERS.join(\", \")}) should be set in the optional RequestInit.`);\n }\n // If a slug is in the parameters, set the request headers accordingly\n if (config.slug !== undefined) {\n headers.Slug = config.slug;\n }\n headers[\"Content-Type\"] = getContentType(file, options.contentType);\n const targetUrlString = internal_toIriString(targetUrl);\n return config.fetch(targetUrlString, {\n ...config.init,\n headers,\n method,\n body: file,\n });\n}\nfunction getContentType(file, contentTypeOverride) {\n if (typeof contentTypeOverride === \"string\") {\n return contentTypeOverride;\n }\n const fileType = typeof file === \"object\" &&\n file !== null &&\n \"type\" in file &&\n typeof file.type === \"string\" &&\n file.type.length > 0\n ? file.type\n : undefined;\n return fileType !== null && fileType !== void 0 ? fileType : \"application/octet-stream\";\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden For internal use only. */\nfunction internal_getReadableValue(value) {\n var _a, _b, _c, _d, _e, _f, _g, _h;\n if (isNamedNode(value)) {\n return `<${value.value}> (URL)`;\n }\n if (isLiteral(value)) {\n /* istanbul ignore if: thingAsMarkdown always instantiates a NamedNode, so we can't hit this code path in tests. */\n if (!isNamedNode(value.datatype)) {\n return `[${value.value}] (RDF/JS Literal of unknown type)`;\n }\n let val;\n switch (value.datatype.value) {\n case xmlSchemaTypes.boolean:\n val =\n (_b = (_a = deserializeBoolean(value.value)) === null || _a === void 0 ? void 0 : _a.valueOf()) !== null && _b !== void 0 ? _b : `Invalid data: \\`${value.value}\\``;\n return `${val} (boolean)`;\n case xmlSchemaTypes.dateTime:\n val =\n (_d = (_c = deserializeDatetime(value.value)) === null || _c === void 0 ? void 0 : _c.toUTCString()) !== null && _d !== void 0 ? _d : `Invalid data: \\`${value.value}\\``;\n return `${val} (datetime)`;\n case xmlSchemaTypes.decimal:\n val =\n (_f = (_e = deserializeDecimal(value.value)) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : `Invalid data: \\`${value.value}\\``;\n return `${val} (decimal)`;\n case xmlSchemaTypes.integer:\n val =\n (_h = (_g = deserializeInteger(value.value)) === null || _g === void 0 ? void 0 : _g.toString()) !== null && _h !== void 0 ? _h : `Invalid data: \\`${value.value}\\``;\n return `${val} (integer)`;\n case xmlSchemaTypes.langString:\n return `\"${value.value}\" (${value.language} string)`;\n case xmlSchemaTypes.string:\n return `\"${value.value}\" (string)`;\n default:\n return `[${value.value}] (RDF/JS Literal of type: \\`${value.datatype.value}\\`)`;\n }\n }\n /* istanbul ignore else: thingAsMarkdown doesn't generate other Nodes, so we can't hit this path in tests. */\n if (value.termType === \"BlankNode\") {\n return `[${value.value}] (RDF/JS BlankNode)`;\n }\n /* istanbul ignore next: thingAsMarkdown doesn't generate Quad Nodes, so we can't hit this path in tests. */\n if (value.termType === \"Quad\") {\n return `??? (nested RDF* Quad)`;\n }\n /* istanbul ignore else: The if statements are exhaustive; if not, TypeScript will complain. */\n /* istanbul ignore next: thingAsMarkdown doesn't generate Variable Nodes, so we can't hit this path in tests. */\n if (value.termType === \"Variable\") {\n return `?${value.value} (RDF/JS Variable)`;\n }\n /* istanbul ignore next: The if statements are exhaustive; if not, TypeScript will complain. */\n return value;\n}\n/**\n * @hidden\n */\nfunction internal_throwIfNotThing(thing) {\n if (!isThing(thing)) {\n throw new ThingExpectedError(thing);\n }\n}\n/**\n * @hidden\n * @param solidDataset\n */\nfunction internal_addAdditionsToChangeLog(solidDataset, additions) {\n const changeLog = hasChangelog(solidDataset)\n ? solidDataset.internal_changeLog\n : /* istanbul ignore next: This function always gets called after addDeletionsToChangeLog, so the ChangeLog always already exists in tests: */\n { additions: [], deletions: [] };\n const [newAdditions, newDeletions] = additions\n .filter((addition) => !containsBlankNode(addition))\n .reduce(([additionsAcc, deletionsAcc], addition) => {\n const existingDeletion = deletionsAcc.find((deletion) => deletion.equals(addition));\n if (typeof existingDeletion !== \"undefined\") {\n return [\n additionsAcc,\n deletionsAcc.filter((deletion) => !deletion.equals(addition)),\n ];\n }\n return [additionsAcc.concat(addition), deletionsAcc];\n }, [changeLog.additions, changeLog.deletions]);\n return freeze({\n ...solidDataset,\n internal_changeLog: {\n additions: newAdditions,\n deletions: newDeletions,\n },\n });\n}\n/**\n * @hidden\n * @param solidDataset\n */\nfunction internal_addDeletionsToChangeLog(solidDataset, deletions) {\n const changeLog = hasChangelog(solidDataset)\n ? solidDataset.internal_changeLog\n : { additions: [], deletions: [] };\n const [newAdditions, newDeletions] = deletions\n .filter((deletion) => !containsBlankNode(deletion))\n .reduce(([additionsAcc, deletionsAcc], deletion) => {\n const existingAddition = additionsAcc.find((addition) => addition.equals(deletion));\n if (typeof existingAddition !== \"undefined\") {\n return [\n additionsAcc.filter((addition) => !addition.equals(deletion)),\n deletionsAcc,\n ];\n }\n return [additionsAcc, deletionsAcc.concat(deletion)];\n }, [changeLog.additions, changeLog.deletions]);\n return freeze({\n ...solidDataset,\n internal_changeLog: {\n additions: newAdditions,\n deletions: newDeletions,\n },\n });\n}\n/**\n * Enforces the presence of a Changelog for a given dataset. If a changelog is\n * already present, it is unchanged. Otherwise, an empty changelog is created.\n * @hidden\n * @param solidDataset\n */\nfunction internal_withChangeLog(solidDataset) {\n const newSolidDataset = hasChangelog(solidDataset)\n ? solidDataset\n : freeze({\n ...solidDataset,\n internal_changeLog: { additions: [], deletions: [] },\n });\n return newSolidDataset;\n}\n/**\n * We don't currently support reading and writing Blank Nodes, so this function can be used to skip those Quads.\n *\n * This is needed because we cannot reconcile Blank Nodes in additions and\n * deletions. Down the road, we should do a diff before saving a SolidDataset\n * against a saved copy of the originally-fetched one, based on our own data\n * structures, which should make it easier to reconcile.\n */\nfunction containsBlankNode(quad) {\n return (quad.subject.termType === \"BlankNode\" ||\n quad.object.termType === \"BlankNode\");\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Returns the URLs of all Properties that the given [[Thing ]]has values for.b\n *\n * @param thing The [[Thing]] of which to get that Property URLs that have a value.\n * @returns The URLs of the Properties for which values are defined for the given Thing.\n * @hidden This is an advanced API that should not be needed for most Solid use cases. If you do find yourself needing this, please file a feature request sharing your use case.\n */\nfunction getPropertyAll(thing) {\n return Object.keys(thing.predicates).filter((predicate) => getTerm(thing, predicate) !== null);\n}\n/**\n * Returns the URL value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type URL, returns null.\n * If the Property has multiple URL values, returns one of its URL values.\n *\n * @param thing The [[Thing]] to read a URL value from.\n * @param property The Property whose URL value to return.\n * @returns A URL value for the given Property if present, or null if the Property is not present or the value is not of type URL.\n */\nfunction getUrl(thing, property) {\n var _a, _b, _c;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateUrl = internal_toIriString(property);\n const firstUrl = (_c = (_b = (_a = thing.predicates[predicateUrl]) === null || _a === void 0 ? void 0 : _a.namedNodes) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : null;\n if (firstUrl === null) {\n return null;\n }\n return isLocalNodeIri(firstUrl) ? `#${getLocalNodeName(firstUrl)}` : firstUrl;\n}\n/** @hidden Alias of [[getUrl]] for those who prefer IRI terminology. */\nconst getIri = getUrl;\n/**\n * Returns the URL values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type URL, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the URL values from.\n * @param property The Property whose URL values to return.\n * @returns An array of URL values for the given Property.\n */\nfunction getUrlAll(thing, property) {\n var _a, _b, _c;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateUrl = internal_toIriString(property);\n return ((_c = (_b = (_a = thing.predicates[predicateUrl]) === null || _a === void 0 ? void 0 : _a.namedNodes) === null || _b === void 0 ? void 0 : _b.map((iri) => isLocalNodeIri(iri) ? `#${getLocalNodeName(iri)}` : iri)) !== null && _c !== void 0 ? _c : []);\n}\n/** @hidden Alias of [[getUrlAll]] for those who prefer IRI terminology. */\nconst getIriAll = getUrlAll;\n/**\n * Returns the boolean value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type boolean, returns null.\n * If the Property has multiple boolean values, returns one of its values.\n *\n * @param thing The [[Thing]] to read a boolean value from.\n * @param property The Property whose boolean value to return.\n * @returns A boolean value for the given Property if present, or null if the Property is not present or the value is not of type boolean.\n */\nfunction getBoolean(thing, property) {\n internal_throwIfNotThing(thing);\n const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.boolean);\n if (literalString === null) {\n return null;\n }\n return deserializeBoolean(literalString);\n}\n/**\n * Returns the boolean values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type boolean, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the boolean values from.\n * @param property The Property whose boolean values to return.\n * @returns An array of boolean values for the given Property.\n */\nfunction getBooleanAll(thing, property) {\n internal_throwIfNotThing(thing);\n const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.boolean);\n return literalStrings\n .map(deserializeBoolean)\n .filter((possibleBoolean) => possibleBoolean !== null);\n}\n/**\n * Returns the datetime value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type datetime, returns null.\n * If the Property has multiple datetime values, returns one of its values.\n *\n * @param thing The [[Thing]] to read a datetime value from.\n * @param property The Property whose datetime value to return.\n * @returns A datetime value for the given Property if present, or null if the Property is not present or the value is not of type datetime.\n */\nfunction getDatetime(thing, property) {\n internal_throwIfNotThing(thing);\n const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.dateTime);\n if (literalString === null) {\n return null;\n }\n return deserializeDatetime(literalString);\n}\n/**\n * Returns the datetime values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type datetime, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the datetime values from.\n * @param property The Property whose datetime values to return.\n * @returns An array of datetime values for the given Property.\n */\nfunction getDatetimeAll(thing, property) {\n internal_throwIfNotThing(thing);\n const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.dateTime);\n return literalStrings\n .map(deserializeDatetime)\n .filter((potentialDatetime) => potentialDatetime !== null);\n}\n/**\n * Returns the date value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type date, returns null.\n * If the Property has multiple date values, returns one of its values.\n *\n * @param thing The [[Thing]] to read a date value from.\n * @param property The Property whose date value to return.\n * @returns A date value for the given Property if present, or null if the Property is not present or the value is not of type date.\n * @since 1.10.0\n */\nfunction getDate(thing, property) {\n internal_throwIfNotThing(thing);\n const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.date);\n if (literalString === null) {\n return null;\n }\n return deserializeDate(literalString);\n}\n/**\n * Returns the date values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type date, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the date values from.\n * @param property The Property whose date values to return.\n * @returns An array of date values for the given Property.\n * @since 1.10.0\n */\nfunction getDateAll(thing, property) {\n internal_throwIfNotThing(thing);\n const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.date);\n return literalStrings\n .map(deserializeDate)\n .filter((potentialDate) => potentialDate !== null);\n}\n/**\n * Returns the time value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type time, returns null.\n * If the Property has multiple time values, returns one of its values.\n *\n * @param thing The [[Thing]] to read a time value from.\n * @param property The Property whose time value to return.\n * @returns A time value for the given Property if present, or null if the Property is not present or the value is not of type time.\n * @since 1.10.0\n */\nfunction getTime(thing, property) {\n internal_throwIfNotThing(thing);\n const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.time);\n if (literalString === null) {\n return null;\n }\n return deserializeTime(literalString);\n}\n/**\n * Returns the time values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type time, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the time values from.\n * @param property The Property whose time values to return.\n * @returns An array of time values for the given Property.\n * @since 1.10.0\n */\nfunction getTimeAll(thing, property) {\n internal_throwIfNotThing(thing);\n const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.time);\n return literalStrings\n .map(deserializeTime)\n .filter((potentialTime) => potentialTime !== null);\n}\n/**\n * Returns the decimal value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type decimal, returns null.\n * If the Property has multiple decimal values, returns one of its values.\n *\n * @param thing The [[Thing]] to read a decimal value from.\n * @param property The Property whose decimal value to return.\n * @returns A decimal value for the given Property if present, or null if the Property is not present or the value is not of type decimal.\n */\nfunction getDecimal(thing, property) {\n internal_throwIfNotThing(thing);\n const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.decimal);\n if (literalString === null) {\n return null;\n }\n return deserializeDecimal(literalString);\n}\n/**\n * Returns the decimal values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type decimal, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the decimal values from.\n * @param property The Property whose decimal values to return.\n * @returns An array of decimal values for the given Property.\n */\nfunction getDecimalAll(thing, property) {\n internal_throwIfNotThing(thing);\n const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.decimal);\n return literalStrings\n .map((literalString) => deserializeDecimal(literalString))\n .filter((potentialDecimal) => potentialDecimal !== null);\n}\n/**\n * Returns the integer value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type integer, returns null.\n * If the Property has multiple integer values, returns one of its values.\n *\n * @param thing The [[Thing]] to read an integer value from.\n * @param property The Property whose integer value to return.\n * @returns A integer value for the given Property if present, or null if the Property is not present or the value is not of type datetime.\n */\nfunction getInteger(thing, property) {\n internal_throwIfNotThing(thing);\n const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.integer);\n if (literalString === null) {\n return null;\n }\n return deserializeInteger(literalString);\n}\n/**\n * Returns the integer values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type integer, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the integer values from.\n * @param property The Property whose integer values to return.\n * @returns An array of integer values for the given Property.\n */\nfunction getIntegerAll(thing, property) {\n internal_throwIfNotThing(thing);\n const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.integer);\n return literalStrings\n .map((literalString) => deserializeInteger(literalString))\n .filter((potentialInteger) => potentialInteger !== null);\n}\n/**\n * Returns the English (language tag \"en\") string value of the specified Property from a [[Thing]].\n * If the Property is not present as a string in English, returns null.\n * If the Property has multiple English string values, returns one of its values.\n *\n * @param thing The [[Thing]] to read a localised string value from.\n * @param property The Property whose localised string value to return.\n * @returns An English string value for the given Property if present, or null otherwise.\n * @since 1.13.0\n */\nfunction getStringEnglish(thing, property) {\n return getStringWithLocale(thing, property, \"en\");\n}\n/**\n * Returns the localized string value of the specified Property from a [[Thing]].\n * If the Property is not present as a string in the specified locale, returns null.\n * If the Property has multiple string values for the specified locale, returns one of its values.\n *\n * @param thing The [[Thing]] to read a localised string value from.\n * @param property The Property whose localised string value to return.\n * @param locale The desired locale for the string value.\n * @returns A localised string value for the given Property if present in the specified `locale`, or null otherwise.\n */\nfunction getStringWithLocale(thing, property, locale) {\n var _a, _b;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {};\n const existingLocales = Object.keys(langStrings);\n const matchingLocale = existingLocales.find((existingLocale) => existingLocale.toLowerCase() === locale.toLowerCase() &&\n Array.isArray(langStrings[existingLocale]) &&\n langStrings[existingLocale].length > 0);\n return typeof matchingLocale === \"string\"\n ? langStrings[matchingLocale][0]\n : null;\n}\n/**\n * Returns the English (language tag \"en\") string values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not an English string, omits that value in the array.\n *\n * @param thing The [[Thing]] to read a localised string value from.\n * @param property The Property whose localised string value to return.\n * @returns An array of English string values for the given Property.\n */\nfunction getStringEnglishAll(thing, property) {\n return getStringWithLocaleAll(thing, property, \"en\");\n}\n/**\n * Returns the localized string values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not a string of the specified locale, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the localised string values from.\n * @param property The Property whose localised string values to return.\n * @param locale The desired locale for the string values.\n * @returns An array of localised string values for the given Property.\n */\nfunction getStringWithLocaleAll(thing, property, locale) {\n var _a, _b;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {};\n const existingLocales = Object.keys(langStrings);\n const matchingLocale = existingLocales.find((existingLocale) => existingLocale.toLowerCase() === locale.toLowerCase() &&\n Array.isArray(langStrings[existingLocale]) &&\n langStrings[existingLocale].length > 0);\n return typeof matchingLocale === \"string\"\n ? [...langStrings[matchingLocale]]\n : [];\n}\n/**\n * Returns all localized string values mapped by the locales for the specified property from the\n * specified [[Thing]] (explicitly filters out non-language string literals).\n *\n * @param thing The [[Thing]] to read the localised string values from.\n * @param property The Property whose localised string values to return.\n * @returns A Map of objects, keyed on locale with the value an array of string values (for that locale).\n */\nfunction getStringByLocaleAll(thing, property) {\n var _a, _b;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const stringsByLocale = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {};\n return new Map(Object.entries(stringsByLocale).map(([locale, values]) => [\n locale,\n [...values],\n ]));\n}\n/**\n * Returns the string value of the specified Property from a [[Thing]].\n * If the Property is not present or its value is not of type string, returns null.\n * If the Property has multiple string values, returns one of its values.\n *\n * @param thing The [[Thing]] to read a string value from.\n * @param property The Property whose string value to return.\n * @returns A string value for the given Property if present, or null if the Property is not present or the value is not of type string.\n */\nfunction getStringNoLocale(thing, property) {\n internal_throwIfNotThing(thing);\n const literalString = getLiteralOfType(thing, property, xmlSchemaTypes.string);\n return literalString;\n}\n/**\n * Returns the string values of the specified Property from a [[Thing]].\n * If the Property is not present, returns an empty array.\n * If the Property's value is not of type string, omits that value in the array.\n *\n * @param thing The [[Thing]] to read the string values from.\n * @param property The Property whose string values to return.\n * @returns An array of string values for the given Property.\n */\nfunction getStringNoLocaleAll(thing, property) {\n internal_throwIfNotThing(thing);\n const literalStrings = getLiteralAllOfType(thing, property, xmlSchemaTypes.string);\n return literalStrings;\n}\n/**\n * @param thing The [[Thing]] to read a NamedNode value from.\n * @param property The given Property for which you want the NamedNode value.\n * @returns A NamedNode value for the given Property, if present, or null otherwise.\n * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @see https://rdf.js.org/data-model-spec/#namednode-interface\n */\nfunction getNamedNode(thing, property) {\n const iriString = getIri(thing, property);\n if (iriString === null) {\n return null;\n }\n return DataFactory.namedNode(iriString);\n}\n/**\n * @param thing The [[Thing]] to read the NamedNode values from.\n * @param property The given Property for which you want the NamedNode values.\n * @returns The NamedNode values for the given Property.\n * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @see https://rdf.js.org/data-model-spec/#namednode-interface\n */\nfunction getNamedNodeAll(thing, property) {\n const iriStrings = getIriAll(thing, property);\n return iriStrings.map((iriString) => DataFactory.namedNode(iriString));\n}\n/**\n * @param thing The [[Thing]] to read a Literal value from.\n * @param property The given Property for which you want the Literal value.\n * @returns A Literal value for the given Property, if present, or null otherwise.\n * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @see https://rdf.js.org/data-model-spec/#literal-interface\n */\nfunction getLiteral(thing, property) {\n var _a, _b, _c, _d;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {};\n const locales = Object.keys(langStrings);\n if (locales.length > 0) {\n const nonEmptyLocale = locales.find((locale) => Array.isArray(langStrings[locale]) && langStrings[locale].length > 0);\n if (typeof nonEmptyLocale === \"string\") {\n return DataFactory.literal(langStrings[nonEmptyLocale][0], nonEmptyLocale);\n }\n }\n const otherLiterals = (_d = (_c = thing.predicates[predicateIri]) === null || _c === void 0 ? void 0 : _c.literals) !== null && _d !== void 0 ? _d : {};\n const dataTypes = Object.keys(otherLiterals);\n if (dataTypes.length > 0) {\n const nonEmptyDataType = dataTypes.find((dataType) => Array.isArray(otherLiterals[dataType]) &&\n otherLiterals[dataType].length > 0);\n if (typeof nonEmptyDataType === \"string\") {\n return DataFactory.literal(otherLiterals[nonEmptyDataType][0], DataFactory.namedNode(nonEmptyDataType));\n }\n }\n return null;\n}\n/**\n * @param thing The [[Thing]] to read the Literal values from.\n * @param property The given Property for which you want the Literal values.\n * @returns The Literal values for the given Property.\n * @ignore This should not be needed due to the other get*All() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @see https://rdf.js.org/data-model-spec/#literal-interface\n */\nfunction getLiteralAll(thing, property) {\n var _a, _b, _c, _d;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n let literals = [];\n const langStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {};\n const locales = Object.keys(langStrings);\n for (const locale of locales) {\n const stringsInLocale = langStrings[locale];\n const localeLiterals = stringsInLocale.map((langString) => DataFactory.literal(langString, locale));\n literals = literals.concat(localeLiterals);\n }\n const otherLiterals = (_d = (_c = thing.predicates[predicateIri]) === null || _c === void 0 ? void 0 : _c.literals) !== null && _d !== void 0 ? _d : {};\n const dataTypes = Object.keys(otherLiterals);\n for (const dataType of dataTypes) {\n const values = otherLiterals[dataType];\n const typeNode = DataFactory.namedNode(dataType);\n const dataTypeLiterals = values.map((value) => DataFactory.literal(value, typeNode));\n literals = literals.concat(dataTypeLiterals);\n }\n return literals;\n}\n/**\n * @param thing The [[Thing]] to read a raw RDF/JS value from.\n * @param property The given Property for which you want the raw value.\n * @returns A Term for the given Property, if present, or null otherwise.\n * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @see https://rdf.js.org/data-model-spec/\n * @since 0.3.0\n */\nfunction getTerm(thing, property) {\n var _a, _b;\n internal_throwIfNotThing(thing);\n const namedNode = getNamedNode(thing, property);\n if (namedNode !== null) {\n return namedNode;\n }\n const literal = getLiteral(thing, property);\n if (literal !== null) {\n return literal;\n }\n const predicateIri = internal_toIriString(property);\n const blankNodes = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.blankNodes) !== null && _b !== void 0 ? _b : [];\n if (blankNodes.length > 0) {\n const blankNodeValue = isBlankNodeId(blankNodes[0])\n ? getBlankNodeValue(blankNodes[0])\n : undefined;\n return DataFactory.blankNode(blankNodeValue);\n }\n return null;\n}\n/**\n * @param thing The [[Thing]] to read the raw RDF/JS values from.\n * @param property The given Property for which you want the raw values.\n * @returns The Terms for the given Property.\n * @ignore This should not be needed due to the other get*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @see https://rdf.js.org/data-model-spec/\n * @since 0.3.0\n */\nfunction getTermAll(thing, property) {\n var _a, _b;\n internal_throwIfNotThing(thing);\n const namedNodes = getNamedNodeAll(thing, property);\n const literals = getLiteralAll(thing, property);\n const predicateIri = internal_toIriString(property);\n const blankNodeValues = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.blankNodes) !== null && _b !== void 0 ? _b : [];\n const blankNodes = blankNodeValues.map((rawBlankNode) => {\n const blankNodeName = isBlankNodeId(rawBlankNode)\n ? getBlankNodeValue(rawBlankNode)\n : undefined;\n return DataFactory.blankNode(blankNodeName);\n });\n const terms = namedNodes\n .concat(literals)\n .concat(blankNodes);\n return terms;\n}\n/**\n * @param thing The [Thing]] to read a Literal of the given type from.\n * @param property The given Property for which you want the Literal value.\n * @param literalType Set type of the Literal data.\n * @returns The stringified value for the given Property and type, if present, or null otherwise.\n */\nfunction getLiteralOfType(thing, property, literalType) {\n var _a, _b, _c, _d;\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n return (_d = (_c = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.literals) === null || _b === void 0 ? void 0 : _b[literalType]) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : null;\n}\n/**\n * @param thing The [Thing]] to read the Literals of the given type from.\n * @param property The given Property for which you want the Literal values.\n * @param literalType Set type of the Literal data.\n * @returns The stringified values for the given Property and type.\n */\nfunction getLiteralAllOfType(thing, property, literalType) {\n var _a, _b, _c;\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const literalsOfType = (_c = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.literals) === null || _b === void 0 ? void 0 : _b[literalType]) !== null && _c !== void 0 ? _c : [];\n return [...literalsOfType];\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Extract Quads with a given Subject from a [[SolidDataset]] into a [[Thing]].\n *\n * @param solidDataset The [[SolidDataset]] to extract the [[Thing]] from.\n * @param thingUrl The URL of the desired [[Thing]].\n * @param options Not yet implemented.\n */\nfunction getThing(solidDataset, thingUrl, options = {}) {\n var _a;\n if (!internal_isValidUrl(thingUrl)) {\n throw new ValidThingUrlExpectedError(thingUrl);\n }\n const graph = typeof options.scope !== \"undefined\"\n ? internal_toIriString(options.scope)\n : \"default\";\n const thingsByIri = (_a = solidDataset.graphs[graph]) !== null && _a !== void 0 ? _a : {};\n const thingIri = internal_toIriString(thingUrl);\n const resolvedThingIri = isLocalNodeIri(thingIri) && hasServerResourceInfo(solidDataset)\n ? resolveLocalIri(getLocalNodeName(thingIri), getSourceUrl(solidDataset))\n : thingIri;\n const thing = thingsByIri[resolvedThingIri];\n if (typeof thing === \"undefined\") {\n return null;\n }\n return thing;\n}\n/**\n * Get all [[Thing]]s in a [[SolidDataset]].\n *\n * @param solidDataset The [[SolidDataset]] to extract the [[Thing]]s from.\n * @param options Not yet implemented.\n */\nfunction getThingAll(solidDataset, options = { acceptBlankNodes: false }) {\n var _a;\n const graph = typeof options.scope !== \"undefined\"\n ? internal_toIriString(options.scope)\n : \"default\";\n const thingsByIri = (_a = solidDataset.graphs[graph]) !== null && _a !== void 0 ? _a : {};\n return Object.values(thingsByIri).filter((thing) => !isBlankNodeId(thing.url) || options.acceptBlankNodes);\n}\n/**\n * Insert a [[Thing]] into a [[SolidDataset]], replacing previous instances of that Thing.\n *\n * @param solidDataset The SolidDataset to insert a Thing into.\n * @param thing The Thing to insert into the given SolidDataset.\n * @returns A new SolidDataset equal to the given SolidDataset, but with the given Thing.\n */\nfunction setThing(solidDataset, thing) {\n var _a;\n const thingIri = isThingLocal(thing) && hasServerResourceInfo(solidDataset)\n ? resolveLocalIri(getLocalNodeName(thing.url), getSourceUrl(solidDataset))\n : thing.url;\n const defaultGraph = solidDataset.graphs.default;\n const updatedDefaultGraph = freeze({\n ...defaultGraph,\n [thingIri]: freeze({ ...thing, url: thingIri }),\n });\n const updatedGraphs = freeze({\n ...solidDataset.graphs,\n default: updatedDefaultGraph,\n });\n const subjectNode = DataFactory.namedNode(thingIri);\n const deletedThingPredicates = (_a = solidDataset.graphs.default[thingIri]) === null || _a === void 0 ? void 0 : _a.predicates;\n const deletions = typeof deletedThingPredicates !== \"undefined\"\n ? subjectToRdfJsQuads(deletedThingPredicates, subjectNode, DataFactory.defaultGraph())\n : [];\n const additions = subjectToRdfJsQuads(thing.predicates, subjectNode, DataFactory.defaultGraph());\n return internal_addAdditionsToChangeLog(internal_addDeletionsToChangeLog(freeze({\n ...solidDataset,\n graphs: updatedGraphs,\n }), deletions), additions);\n}\n/**\n * Remove a Thing from a SolidDataset.\n *\n * @param solidDataset The SolidDataset to remove a Thing from.\n * @param thing The Thing to remove from `solidDataset`.\n * @returns A new [[SolidDataset]] equal to the input SolidDataset, excluding the given Thing.\n */\nfunction removeThing(solidDataset, thing) {\n var _a;\n let thingIri;\n if (isNamedNode(thing)) {\n thingIri = thing.value;\n }\n else if (typeof thing === \"string\") {\n thingIri =\n isLocalNodeIri(thing) && hasServerResourceInfo(solidDataset)\n ? resolveLocalIri(getLocalNodeName(thing), getSourceUrl(solidDataset))\n : thing;\n }\n else if (isThingLocal(thing)) {\n thingIri = thing.url;\n }\n else {\n thingIri = asIri(thing);\n }\n const defaultGraph = solidDataset.graphs.default;\n const updatedDefaultGraph = { ...defaultGraph };\n delete updatedDefaultGraph[thingIri];\n const updatedGraphs = freeze({\n ...solidDataset.graphs,\n default: freeze(updatedDefaultGraph),\n });\n const subjectNode = DataFactory.namedNode(thingIri);\n const deletedThingPredicates = (_a = solidDataset.graphs.default[thingIri]) === null || _a === void 0 ? void 0 : _a.predicates;\n const deletions = typeof deletedThingPredicates !== \"undefined\"\n ? subjectToRdfJsQuads(deletedThingPredicates, subjectNode, DataFactory.defaultGraph())\n : [];\n return internal_addDeletionsToChangeLog(freeze({\n ...solidDataset,\n graphs: updatedGraphs,\n }), deletions);\n}\nfunction createThing(options = {}) {\n var _a;\n if (typeof options.url !== \"undefined\") {\n const { url } = options;\n if (!internal_isValidUrl(url)) {\n throw new ValidThingUrlExpectedError(url);\n }\n const thing = freeze({\n type: \"Subject\",\n predicates: freeze({}),\n url,\n });\n return thing;\n }\n const name = (_a = options.name) !== null && _a !== void 0 ? _a : generateName();\n const localNodeIri = getLocalNodeIri(name);\n const thing = freeze({\n type: \"Subject\",\n predicates: freeze({}),\n url: localNodeIri,\n });\n return thing;\n}\n/**\n * @param input An value that might be a [[Thing]].\n * @returns Whether `input` is a Thing.\n * @since 0.2.0\n */\nfunction isThing(input) {\n return (typeof input === \"object\" &&\n input !== null &&\n typeof input.type === \"string\" &&\n input.type === \"Subject\");\n}\nfunction asUrl(thing, baseUrl) {\n if (isThingLocal(thing)) {\n if (typeof baseUrl === \"undefined\") {\n throw new Error(\"The URL of a Thing that has not been persisted cannot be determined without a base URL.\");\n }\n return resolveLocalIri(getLocalNodeName(thing.url), baseUrl);\n }\n return thing.url;\n}\n/** @hidden Alias of [[asUrl]] for those who prefer IRI terminology. */\nconst asIri = asUrl;\n/**\n * Gets a human-readable representation of the given Thing to aid debugging.\n *\n * Note that changes to the exact format of the return value are not considered a breaking change;\n * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.\n *\n * @param thing The Thing to get a human-readable representation of.\n * @since 0.3.0\n */\nfunction thingAsMarkdown(thing) {\n let thingAsMarkdown = \"\";\n if (isThingLocal(thing)) {\n thingAsMarkdown += `## Thing (no URL yet — identifier: \\`#${getLocalNodeName(thing.url)}\\`)\\n`;\n }\n else {\n thingAsMarkdown += `## Thing: ${thing.url}\\n`;\n }\n const predicateIris = Object.keys(thing.predicates);\n if (predicateIris.length === 0) {\n thingAsMarkdown += \"\\n\\n\";\n }\n else {\n for (const predicate of predicateIris) {\n thingAsMarkdown += `\\nProperty: ${predicate}\\n`;\n const values = getTermAll(thing, predicate);\n thingAsMarkdown += values.reduce((acc, value) => {\n return `${acc}- ${internal_getReadableValue(value)}\\n`;\n }, \"\");\n }\n }\n return thingAsMarkdown;\n}\n/**\n * @param thing The [[Thing]] of which a URL might or might not be known.\n * @return `true` if `thing` has no known URL yet.\n * @since 1.7.0\n */\nfunction isThingLocal(thing) {\n return isLocalNodeIri(thing.url);\n}\n/**\n * This error is thrown when a function expected to receive a [[Thing]] but received something else.\n * @since 1.2.0\n */\nclass ThingExpectedError extends SolidClientError {\n constructor(receivedValue) {\n const message = `Expected a Thing, but received: [${receivedValue}].`;\n super(message);\n this.receivedValue = receivedValue;\n }\n}\n/**\n * This error is thrown when a function expected to receive a valid URL to identify a property but received something else.\n */\nclass ValidPropertyUrlExpectedError extends SolidClientError {\n constructor(receivedValue) {\n const value = isNamedNode(receivedValue)\n ? receivedValue.value\n : receivedValue;\n const message = `Expected a valid URL to identify a property, but received: [${value}].`;\n super(message);\n this.receivedProperty = value;\n }\n}\n/**\n * This error is thrown when a function expected to receive a valid URL value but received something else.\n */\nclass ValidValueUrlExpectedError extends SolidClientError {\n constructor(receivedValue) {\n const value = isNamedNode(receivedValue)\n ? receivedValue.value\n : receivedValue;\n const message = `Expected a valid URL value, but received: [${value}].`;\n super(message);\n this.receivedValue = value;\n }\n}\n/**\n * This error is thrown when a function expected to receive a valid URL to identify a [[Thing]] but received something else.\n */\nclass ValidThingUrlExpectedError extends SolidClientError {\n constructor(receivedValue) {\n const value = isNamedNode(receivedValue)\n ? receivedValue.value\n : receivedValue;\n const message = `Expected a valid URL to identify a Thing, but received: [${value}].`;\n super(message);\n this.receivedValue = value;\n }\n}\n/**\n * Generate a string that can be used as the unique identifier for a Thing\n *\n * This function works by starting with a date string (so that Things can be\n * sorted chronologically), followed by a random number generated by taking a\n * random number between 0 and 1, and cutting off the `0.`.\n *\n * @internal\n * @returns An string that's likely to be unique\n */\nconst generateName = () => {\n return uuid.v4();\n};\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * This function normalizes IRIs as managed by the server to ease accurate comparison.\n * @param iri\n * @hidden\n */\nfunction normalizeServerSideIri(iri) {\n const iriObj = new URL(iri);\n iriObj.hash = \"\";\n return iriObj.href;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Initialise a new [[SolidDataset]] in memory.\n *\n * @returns An empty [[SolidDataset]].\n */\nfunction createSolidDataset() {\n return freeze({\n type: \"Dataset\",\n graphs: {\n default: {},\n },\n });\n}\n/**\n * @hidden This interface is not exposed yet until we've tried it out in practice.\n */\nasync function responseToSolidDataset(response, parseOptions = {}) {\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Fetching the SolidDataset at [${response.url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n const resourceInfo = responseToResourceInfo(response);\n const parsers = {\n \"text/turtle\": getTurtleParser$1(),\n ...parseOptions.parsers,\n };\n const contentType = getContentType$1(resourceInfo);\n if (contentType === null) {\n throw new Error(`Could not determine the content type of the Resource at [${getSourceUrl(resourceInfo)}].`);\n }\n const mimeType = contentType.split(\";\")[0];\n const parser = parsers[mimeType];\n if (typeof parser === \"undefined\") {\n throw new Error(`The Resource at [${getSourceUrl(resourceInfo)}] has a MIME type of [${mimeType}], but the only parsers available are for the following MIME types: [${Object.keys(parsers).join(\", \")}].`);\n }\n const data = await response.text();\n const parsingPromise = new Promise((resolve, reject) => {\n let solidDataset = freeze({\n graphs: freeze({ default: freeze({}) }),\n type: \"Dataset\",\n });\n // While Quads without Blank Nodes can be added to the SolidDataset as we\n // encounter them, to parse Quads with Blank Nodes, we'll have to wait until\n // we've seen all the Quads, so that we can reconcile equal Blank Nodes.\n const quadsWithBlankNodes = [];\n const allQuads = [];\n parser.onError((error) => {\n reject(new Error(`Encountered an error parsing the Resource at [${getSourceUrl(resourceInfo)}] with content type [${contentType}]: ${error}`));\n });\n parser.onQuad((quad) => {\n allQuads.push(quad);\n if (quad.subject.termType === \"BlankNode\" ||\n quad.object.termType === \"BlankNode\") {\n // Quads with Blank Nodes will be parsed when all Quads are known,\n // so that equal Blank Nodes can be reconciled:\n quadsWithBlankNodes.push(quad);\n }\n else {\n solidDataset = addRdfJsQuadToDataset(solidDataset, quad);\n }\n });\n parser.onComplete(async () => {\n // If a Resource contains more than this number of Blank Nodes,\n // we consider the detection of chains (O(n^2), I think) to be too\n // expensive, and just incorporate them as regular Blank Nodes with\n // non-deterministic, ad-hoc identifiers into the SolidDataset:\n const maxBlankNodesToDetectChainsFor = 20;\n // Some Blank Nodes only serve to use a set of Quads as the Object for a\n // single Subject. Those Quads will be added to the SolidDataset when\n // their Subject's Blank Node is encountered in the Object position.\n const chainBlankNodes = quadsWithBlankNodes.length <= maxBlankNodesToDetectChainsFor\n ? getChainBlankNodes(quadsWithBlankNodes)\n : [];\n const quadsWithoutChainBlankNodeSubjects = quadsWithBlankNodes.filter((quad) => chainBlankNodes.every((chainBlankNode) => !chainBlankNode.equals(quad.subject)));\n solidDataset = quadsWithoutChainBlankNodeSubjects.reduce((datasetAcc, quad) => addRdfJsQuadToDataset(datasetAcc, quad, {\n otherQuads: allQuads,\n chainBlankNodes,\n }), solidDataset);\n const solidDatasetWithResourceInfo = freeze({\n ...solidDataset,\n ...resourceInfo,\n });\n resolve(solidDatasetWithResourceInfo);\n });\n parser.parse(data, resourceInfo);\n });\n return parsingPromise;\n}\n/**\n * Fetch a SolidDataset from the given URL. Currently requires the SolidDataset to be available as [Turtle](https://www.w3.org/TR/turtle/).\n *\n * Note that the URL of a container ends with a [trailing slash \"/\"](https://solidproject.org/TR/protocol#uri).\n * If it is missing, some libraries will add it automatically, which may result in additional round-trips, possibly including\n * authentication errors ([more information](https://github.com/inrupt/solid-client-js/issues/1216#issuecomment-904703695)).\n *\n * @param url URL to fetch a [[SolidDataset]] from.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns Promise resolving to a [[SolidDataset]] containing the data at the given Resource, or rejecting if fetching it failed.\n */\nasync function getSolidDataset(url, options = internal_defaultFetchOptions) {\n var _a;\n url = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const parserContentTypes = Object.keys((_a = options.parsers) !== null && _a !== void 0 ? _a : {});\n const acceptedContentTypes = parserContentTypes.length > 0\n ? parserContentTypes.join(\", \")\n : \"text/turtle\";\n const response = await config.fetch(url, {\n headers: {\n Accept: acceptedContentTypes,\n },\n });\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Fetching the Resource at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n const solidDataset = await responseToSolidDataset(response, options);\n return solidDataset;\n}\n/**\n * Create a SPARQL UPDATE Patch request from a [[SolidDataset]] with a changelog.\n * @param solidDataset the [[SolidDataset]] that has been locally updated, and that should be persisted.\n * @returns an HTTP PATCH request configuration object, aligned with the [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters), containing a SPARQL UPDATE.\n * @hidden\n */\nasync function prepareSolidDatasetUpdate(solidDataset) {\n const deleteStatement = solidDataset.internal_changeLog.deletions.length > 0\n ? `DELETE DATA {${(await triplesToTurtle(solidDataset.internal_changeLog.deletions.map(getNamedNodesForLocalNodes))).trim()}};`\n : \"\";\n const insertStatement = solidDataset.internal_changeLog.additions.length > 0\n ? `INSERT DATA {${(await triplesToTurtle(solidDataset.internal_changeLog.additions.map(getNamedNodesForLocalNodes))).trim()}};`\n : \"\";\n return {\n method: \"PATCH\",\n body: `${deleteStatement} ${insertStatement}`,\n headers: {\n \"Content-Type\": \"application/sparql-update\",\n },\n };\n}\n/**\n * Create a Put request to write a locally created [[SolidDataset]] to a Pod.\n * @param solidDataset the [[SolidDataset]] that has been locally updated, and that should be persisted.\n * @returns an HTTP PUT request configuration object, aligned with the [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters), containing a serialization of the [[SolidDataset]].\n * @hidden\n */\nasync function prepareSolidDatasetCreation(solidDataset, options) {\n return {\n method: \"PUT\",\n body: await triplesToTurtle(toRdfJsQuads(solidDataset).map(getNamedNodesForLocalNodes), options),\n headers: {\n \"Content-Type\": \"text/turtle\",\n \"If-None-Match\": \"*\",\n Link: `<${ldp.Resource}>; rel=\"type\"`,\n },\n };\n}\n/**\n * Given a SolidDataset, store it in a Solid Pod (overwriting the existing data at the given URL).\n *\n * A SolidDataset keeps track of the data changes compared to the data in the Pod; i.e.,\n * the changelog tracks both the old value and new values of the property being modified. This\n * function applies the changes to the current SolidDataset. If the old value specified in the\n * changelog does not correspond to the value currently in the Pod, this function will throw an\n * error (common issues are listed in [the documentation](https://docs.inrupt.com/developer-tools/javascript/client-libraries/reference/error-codes/)).\n *\n * The SolidDataset returned by this function will contain the data sent to the Pod, and a ChangeLog\n * up-to-date with the saved data. Note that if the data on the server was modified in between the\n * first fetch and saving it, the updated data will not be reflected in the returned SolidDataset.\n * To make sure you have the latest data, call [[getSolidDataset]] again after saving the data.\n *\n * The Solid server will create any intermediary Containers that do not exist yet, so they do not\n * need to be created in advance. For example, if the target URL is\n * https://example.pod/container/resource and https://example.pod/container/ does not exist yet,\n * it will exist after this function resolves successfully.\n *\n * @param url URL to save `solidDataset` to.\n * @param solidDataset The [[SolidDataset]] to save.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * `options.prefixes`: A prefix map to customize the serialization. Only applied on resource creation if the serialization allows it.\n * @returns A Promise resolving to a [[SolidDataset]] containing the stored data, or rejecting if saving it failed.\n */\nasync function saveSolidDatasetAt(url, solidDataset, options = internal_defaultFetchOptions) {\n url = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const datasetWithChangelog = internal_withChangeLog(solidDataset);\n const requestInit = isUpdate(datasetWithChangelog, url)\n ? await prepareSolidDatasetUpdate(datasetWithChangelog)\n : await prepareSolidDatasetCreation(datasetWithChangelog, options);\n const response = await config.fetch(url, requestInit);\n if (internal_isUnsuccessfulResponse(response)) {\n const diagnostics = isUpdate(datasetWithChangelog, url)\n ? `The changes that were sent to the Pod are listed below.\\n\\n${changeLogAsMarkdown(datasetWithChangelog)}`\n : `The SolidDataset that was sent to the Pod is listed below.\\n\\n${solidDatasetAsMarkdown(datasetWithChangelog)}`;\n throw new FetchError(`Storing the Resource at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.\\n\\n${diagnostics}`, response);\n }\n const resourceInfo = {\n ...internal_parseResourceInfo(response),\n isRawData: false,\n };\n const storedDataset = freeze({\n ...solidDataset,\n internal_changeLog: { additions: [], deletions: [] },\n internal_resourceInfo: resourceInfo,\n });\n const storedDatasetWithResolvedIris = resolveLocalIrisInSolidDataset(storedDataset);\n return storedDatasetWithResolvedIris;\n}\n/**\n * Deletes the SolidDataset at a given URL.\n *\n * If operating on a container, the container must be empty otherwise a 409 CONFLICT will be raised.\n *\n * @param solidDataset The URL of the SolidDataset to delete or the SolidDataset itself (if it has ResourceInfo).\n * @since 0.6.0\n */\nasync function deleteSolidDataset(solidDataset, options = internal_defaultFetchOptions) {\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const url = hasResourceInfo(solidDataset)\n ? internal_toIriString(getSourceUrl(solidDataset))\n : internal_toIriString(solidDataset);\n const response = await config.fetch(url, { method: \"DELETE\" });\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Deleting the SolidDataset at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n}\n/**\n * Create a Container at the given URL. Some content may optionally be specified,\n * e.g. to add metadata describing the container.\n *\n * Throws an error if creating the Container failed, e.g. because the current user does not have\n * permissions to, or because the Container already exists.\n *\n * Note that a Solid server will automatically create the necessary Containers when storing a\n * Resource; i.e. there is no need to call this function if it is immediately followed by\n * [[saveSolidDatasetAt]] or [[overwriteFile]].\n *\n * @param url URL of the empty Container that is to be created.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @param solidDataset Optional parameter - if provided we use this dataset as the body of the HTT request, meaning it's data is included in the Container resource.\n * @since 0.2.0\n */\nasync function createContainerAt(url, options = internal_defaultFetchOptions) {\n var _a;\n url = internal_toIriString(url);\n url = url.endsWith(\"/\") ? url : `${url}/`;\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const response = await config.fetch(url, {\n method: \"PUT\",\n body: config.initialContent\n ? await triplesToTurtle(toRdfJsQuads(config.initialContent).map(getNamedNodesForLocalNodes))\n : undefined,\n headers: {\n Accept: \"text/turtle\",\n \"Content-Type\": \"text/turtle\",\n \"If-None-Match\": \"*\",\n // This header should not be required to create a Container,\n // but ESS currently expects it:\n Link: `<${ldp.BasicContainer}>; rel=\"type\"`,\n },\n });\n if (internal_isUnsuccessfulResponse(response)) {\n const containerType = config.initialContent === undefined ? \"empty\" : \"non-empty\";\n throw new FetchError(`Creating the ${containerType} Container at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n const resourceInfo = internal_parseResourceInfo(response);\n const containerDataset = freeze({\n ...((_a = options.initialContent) !== null && _a !== void 0 ? _a : createSolidDataset()),\n internal_changeLog: { additions: [], deletions: [] },\n internal_resourceInfo: resourceInfo,\n });\n return containerDataset;\n}\nfunction isSourceIriEqualTo(dataset, iri) {\n return (normalizeServerSideIri(dataset.internal_resourceInfo.sourceIri) ===\n normalizeServerSideIri(iri));\n}\nfunction isUpdate(solidDataset, url) {\n return (hasChangelog(solidDataset) &&\n hasResourceInfo(solidDataset) &&\n typeof solidDataset.internal_resourceInfo.sourceIri === \"string\" &&\n isSourceIriEqualTo(solidDataset, url));\n}\n/**\n * Given a SolidDataset, store it in a Solid Pod in a new Resource inside a Container.\n *\n * The Container at the given URL should already exist; if it does not, you can initialise it first\n * using [[createContainerAt]], or directly save the SolidDataset at the desired location using\n * [[saveSolidDatasetAt]].\n *\n * This function is primarily useful if the current user does not have access to change existing files in\n * a Container, but is allowed to add new files; in other words, they have Append, but not Write\n * access to a Container. This is useful in situations where someone wants to allow others to,\n * for example, send notifications to their Pod, but not to view or delete existing notifications.\n * You can pass a suggestion for the new Resource's name, but the server may decide to give it\n * another name — for example, if a Resource with that name already exists inside the given\n * Container.\n * If the user does have access to write directly to a given location, [[saveSolidDatasetAt]]\n * will do the job just fine, and does not require the parent Container to exist in advance.\n *\n * @param containerUrl URL of the Container in which to create a new Resource.\n * @param solidDataset The [[SolidDataset]] to save to a new Resource in the given Container.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A Promise resolving to a [[SolidDataset]] containing the saved data. The Promise rejects if the save failed.\n */\nasync function saveSolidDatasetInContainer(containerUrl, solidDataset, options = internal_defaultFetchOptions) {\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n containerUrl = internal_toIriString(containerUrl);\n const rawTurtle = await triplesToTurtle(toRdfJsQuads(solidDataset).map(getNamedNodesForLocalNodes));\n const headers = {\n \"Content-Type\": \"text/turtle\",\n Link: `<${ldp.Resource}>; rel=\"type\"`,\n };\n if (options.slugSuggestion) {\n headers.slug = options.slugSuggestion;\n }\n const response = await config.fetch(containerUrl, {\n method: \"POST\",\n body: rawTurtle,\n headers,\n });\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Storing the Resource in the Container at [${containerUrl}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.\\n\\n` +\n `The SolidDataset that was sent to the Pod is listed below.\\n\\n${solidDatasetAsMarkdown(solidDataset)}`, response);\n }\n const internalResourceInfo = internal_parseResourceInfo(response);\n if (!internalResourceInfo.location) {\n throw new Error(\"Could not determine the location of the newly saved SolidDataset.\");\n }\n let resourceIri;\n try {\n // Try to parse the location header as a URL (safe if it's an absolute URL)``\n // This should help determine the container URL if normalisation happened on the server side.\n resourceIri = new URL(internalResourceInfo.location).href;\n }\n catch (e) {\n // If it's a relative URL then, rely on the response.url to construct the sourceIri\n resourceIri = new URL(internalResourceInfo.location, response.url).href;\n }\n const resourceInfo = {\n internal_resourceInfo: {\n isRawData: false,\n sourceIri: resourceIri,\n },\n };\n const resourceWithResourceInfo = freeze({\n ...solidDataset,\n ...resourceInfo,\n });\n const resourceWithResolvedIris = resolveLocalIrisInSolidDataset(resourceWithResourceInfo);\n return resourceWithResolvedIris;\n}\n/**\n * Create an empty Container inside the Container at the given URL.\n *\n * Throws an error if creating the Container failed, e.g. because the current user does not have\n * permissions to.\n *\n * The Container in which to create the new Container should itself already exist.\n *\n * This function is primarily useful if the current user does not have access to change existing files in\n * a Container, but is allowed to add new files; in other words, they have Append, but not Write\n * access to a Container. This is useful in situations where someone wants to allow others to,\n * for example, send notifications to their Pod, but not to view or delete existing notifications.\n * You can pass a suggestion for the new Resource's name, but the server may decide to give it\n * another name — for example, if a Resource with that name already exists inside the given\n * Container.\n * If the user does have access to write directly to a given location, [[createContainerAt]]\n * will do the job just fine, and does not require the parent Container to exist in advance.\n *\n * @param containerUrl URL of the Container in which the empty Container is to\n * be created.\n * @param options Optional parameter `options.fetch`: An alternative `fetch`\n * function to make the HTTP request, compatible with the browser-native [fetch\n * API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).`options.slugSuggestion`\n * accepts a string for your new Container's name.\n * @returns A promise that resolves to a SolidDataset with ResourceInfo if\n * successful, and that rejects otherwise.\n * @since 0.2.0\n */\nasync function createContainerInContainer(containerUrl, options = internal_defaultFetchOptions) {\n containerUrl = internal_toIriString(containerUrl);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const headers = {\n \"Content-Type\": \"text/turtle\",\n Link: `<${ldp.BasicContainer}>; rel=\"type\"`,\n };\n if (options.slugSuggestion) {\n headers.slug = options.slugSuggestion;\n }\n const response = await config.fetch(containerUrl, {\n method: \"POST\",\n headers,\n });\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Creating an empty Container in the Container at [${containerUrl}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n const internalResourceInfo = internal_parseResourceInfo(response);\n if (!internalResourceInfo.location) {\n throw new Error(\"Could not determine the location of the newly created Container.\");\n }\n try {\n // Try to parse the location header as a URL (safe if it's an absolute URL)``\n // This should help determine the container URL if normalisation happened on the server side.\n const sourceIri = new URL(internalResourceInfo.location).toString();\n return freeze({\n ...createSolidDataset(),\n internal_resourceInfo: {\n ...internalResourceInfo,\n sourceIri,\n },\n });\n }\n catch (e) {\n // If it's a relative URL then, rely on the response.url to construct the sourceIri\n }\n return freeze({\n ...createSolidDataset(),\n internal_resourceInfo: {\n ...internalResourceInfo,\n sourceIri: new URL(internalResourceInfo.location, response.url).href,\n },\n });\n}\n/**\n * Deletes the Container at a given URL.\n *\n * @param container The URL of the Container to delete or the Container Dataset itself (if it has ResourceInfo).\n * @since 0.6.0\n */\nasync function deleteContainer(container, options = internal_defaultFetchOptions) {\n const url = hasResourceInfo(container)\n ? internal_toIriString(getSourceUrl(container))\n : internal_toIriString(container);\n if (!isContainer(container)) {\n throw new Error(`You're trying to delete the Container at [${url}], but Container URLs should end in a \\`/\\`. Are you sure this is a Container?`);\n }\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const response = await config.fetch(url, { method: \"DELETE\" });\n if (internal_isUnsuccessfulResponse(response)) {\n throw new FetchError(`Deleting the Container at [${url}] failed: [${response.status}] [${response.statusText}] ${await response.text()}.`, response);\n }\n}\nfunction isChildResource(a, b) {\n const parent = new URL(b);\n const child = new URL(a);\n // Explicitly test on the whole URL to enforce similar origins.\n const isAncestor = child.href.startsWith(parent.href);\n const relativePath = child.pathname\n .substring(parent.pathname.length, child.pathname.length)\n .replace(/(^\\/)|(\\/$)/g, \"\");\n // The child path component that isn't present in the parent should only\n // potentially include slashes at the end (if it is a container).\n return isAncestor && relativePath.length >= 1 && !relativePath.includes(\"/\");\n}\n/**\n * Given a [[SolidDataset]] representing a Container (see [[isContainer]]), fetch the URLs of all\n * contained resources that respect [slash semantics](https://solidproject.org/TR/protocol#uri-slash-semantics)\n * (see {@link validateContainedResourceAll}).\n * If the solidDataset given is not a container, or is missing resourceInfo, throw an error.\n *\n * @param solidDataset The container from which to fetch all contained Resource URLs.\n * @returns A list of URLs, each of which points to a contained Resource of the given SolidDataset.\n * @since 1.3.0\n */\nfunction getContainedResourceUrlAll(solidDataset) {\n const containerUrl = getSourceUrl(solidDataset);\n const container = getThing(solidDataset, containerUrl);\n if (container === null) {\n return [];\n }\n // See https://www.w3.org/TR/2015/REC-ldp-20150226/#h-ldpc-http_post:\n // > a containment triple MUST be added to the state of the LDPC whose subject is the LDPC URI,\n // > whose predicate is ldp:contains and whose object is the URI for the newly created document\n return (getIriAll(container, ldp.contains)\n // See https://solidproject.org/TR/protocol#resource-containment\n .filter((childUrl) => isChildResource(childUrl, containerUrl)));\n}\n/**\n * Given a {@link SolidDataset} representing a [Container](https://solidproject.org/TR/protocol#resource-containment)\n * (see {@link isContainer}), verify that all its containment claims are valid. Containment of a resource is valid if\n * it respects [slash semantics](https://solidproject.org/TR/protocol#uri-slash-semantics).\n *\n * For the example, given a container at https://example.org/container/:\n * - The following resources are valid:\n * - https://example.org/container/resource\n * - https://example.org/container/subcontainer/\n * - The following resources are invalid:\n * - https://example.org/container/resource/invalid (not a direct child resource)\n * - https://example.org/container2 (not a child resource)\n * - https://domain2.example.org/container/resource (not a direct child resource)\n *\n * If a component claim is invalid, {@link validateContainedResourceAll} returns the invalid component's URL\n * as part of its return object.\n *\n * Note: It is recommended that this function always be used before calling\n * {@link getContainedResourceUrlAll} since {@link getContainedResourceUrlAll} does not\n * return Resources for which containment is invalid. Using the function in conjunction\n * with {@link getContainedResourceUrlAll} allows for the detection of unexpected behaviour from servers,\n * including malicious containment triples that could appear. Because ESS conforms to the Solid Protocol,\n * i.e., respects slash semantics for its containment triples, validateContainedResourceAll returns true for\n * containers fetched from ESS.\n *\n * @param solidDataset The container from which containment claims are validated.\n * @returns A validation report, including the offending contained resources URL if any.\n * @since unreleased\n */\nfunction validateContainedResourceAll(solidDataset) {\n const containerUrl = getSourceUrl(solidDataset);\n const container = getThing(solidDataset, containerUrl);\n if (container === null) {\n return { isValid: true, invalidContainedResources: [] };\n }\n // See https://www.w3.org/TR/2015/REC-ldp-20150226/#h-ldpc-http_post:\n // > a containment triple MUST be added to the state of the LDPC whose subject is the LDPC URI,\n // > whose predicate is ldp:contains and whose object is the URI for the newly created document\n const invalidChildren = getIriAll(container, ldp.contains)\n // See https://solidproject.org/TR/protocol#resource-containment\n .filter((childUrl) => !isChildResource(childUrl, containerUrl));\n if (invalidChildren.length > 0) {\n return { isValid: false, invalidContainedResources: invalidChildren };\n }\n return { isValid: true, invalidContainedResources: [] };\n}\n/**\n * Gets a human-readable representation of the given SolidDataset to aid debugging.\n *\n * Note that changes to the exact format of the return value are not considered a breaking change;\n * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.\n *\n * @param solidDataset The [[SolidDataset]] to get a human-readable representation of.\n * @since 0.3.0\n */\nfunction solidDatasetAsMarkdown(solidDataset) {\n let readableSolidDataset = \"\";\n if (hasResourceInfo(solidDataset)) {\n readableSolidDataset += `# SolidDataset: ${getSourceUrl(solidDataset)}\\n`;\n }\n else {\n readableSolidDataset += `# SolidDataset (no URL yet)\\n`;\n }\n const things = getThingAll(solidDataset);\n if (things.length === 0) {\n readableSolidDataset += \"\\n\\n\";\n }\n else {\n things.forEach((thing) => {\n readableSolidDataset += `\\n${thingAsMarkdown(thing)}`;\n if (hasChangelog(solidDataset)) {\n readableSolidDataset += `\\n${getReadableChangeLogSummary(solidDataset, thing)}\\n`;\n }\n });\n }\n return readableSolidDataset;\n}\n/**\n * Gets a human-readable representation of the local changes to a Resource to aid debugging.\n *\n * Note that changes to the exact format of the return value are not considered a breaking change;\n * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.\n *\n * @param solidDataset The Resource of which to get a human-readable representation of the changes applied to it locally.\n * @since 0.3.0\n */\nfunction changeLogAsMarkdown(solidDataset) {\n if (!hasResourceInfo(solidDataset)) {\n return \"This is a newly initialized SolidDataset, so there is no source to compare it to.\";\n }\n if (!hasChangelog(solidDataset) ||\n (solidDataset.internal_changeLog.additions.length === 0 &&\n solidDataset.internal_changeLog.deletions.length === 0)) {\n return (`## Changes compared to ${getSourceUrl(solidDataset)}\\n\\n` +\n `This SolidDataset has not been modified since it was fetched from ${getSourceUrl(solidDataset)}.\\n`);\n }\n let readableChangeLog = `## Changes compared to ${getSourceUrl(solidDataset)}\\n`;\n const changeLogsByThingAndProperty = sortChangeLogByThingAndProperty(solidDataset);\n Object.keys(changeLogsByThingAndProperty).forEach((thingUrl) => {\n readableChangeLog += `\\n### Thing: ${thingUrl}\\n`;\n const changeLogByProperty = changeLogsByThingAndProperty[thingUrl];\n Object.keys(changeLogByProperty).forEach((propertyUrl) => {\n readableChangeLog += `\\nProperty: ${propertyUrl}\\n`;\n const { deleted } = changeLogByProperty[propertyUrl];\n const { added } = changeLogByProperty[propertyUrl];\n if (deleted.length > 0) {\n readableChangeLog += \"- Removed:\\n\";\n readableChangeLog += deleted.reduce((acc, deletedValue) => {\n return `${acc} - ${internal_getReadableValue(deletedValue)}\\n`;\n }, \"\");\n }\n if (added.length > 0) {\n readableChangeLog += \"- Added:\\n\";\n readableChangeLog += added.reduce((acc, addedValue) => {\n return `${acc} - ${internal_getReadableValue(addedValue)}\\n`;\n }, \"\");\n }\n });\n });\n return readableChangeLog;\n}\nfunction sortChangeLogByThingAndProperty(solidDataset) {\n const changeLogsByThingAndProperty = Object.create(null);\n solidDataset.internal_changeLog.deletions.forEach((deletion) => {\n var _a, _b;\n var _c;\n const subjectNode = isLocalNode(deletion.subject)\n ? /* istanbul ignore next: Unsaved deletions should be removed from the additions list instead, so this code path shouldn't be hit: */\n resolveIriForLocalNode(deletion.subject, getSourceUrl(solidDataset))\n : deletion.subject;\n if (!isNamedNode(subjectNode) || !isNamedNode(deletion.predicate)) {\n return;\n }\n const thingUrl = internal_toIriString(subjectNode);\n const propertyUrl = internal_toIriString(deletion.predicate);\n (_a = changeLogsByThingAndProperty[thingUrl]) !== null && _a !== void 0 ? _a : (changeLogsByThingAndProperty[thingUrl] = Object.create(null));\n (_b = (_c = changeLogsByThingAndProperty[thingUrl])[propertyUrl]) !== null && _b !== void 0 ? _b : (_c[propertyUrl] = {\n added: [],\n deleted: [],\n });\n changeLogsByThingAndProperty[thingUrl][propertyUrl].deleted.push(deletion.object);\n });\n solidDataset.internal_changeLog.additions.forEach((addition) => {\n var _a, _b;\n var _c;\n const subjectNode = isLocalNode(addition.subject)\n ? /* istanbul ignore next: setThing already resolves local Subjects when adding them, so this code path should never be hit. */\n resolveIriForLocalNode(addition.subject, getSourceUrl(solidDataset))\n : addition.subject;\n if (!isNamedNode(subjectNode) || !isNamedNode(addition.predicate)) {\n return;\n }\n const thingUrl = internal_toIriString(subjectNode);\n const propertyUrl = internal_toIriString(addition.predicate);\n (_a = changeLogsByThingAndProperty[thingUrl]) !== null && _a !== void 0 ? _a : (changeLogsByThingAndProperty[thingUrl] = Object.create(null));\n (_b = (_c = changeLogsByThingAndProperty[thingUrl])[propertyUrl]) !== null && _b !== void 0 ? _b : (_c[propertyUrl] = {\n added: [],\n deleted: [],\n });\n changeLogsByThingAndProperty[thingUrl][propertyUrl].added.push(addition.object);\n });\n return changeLogsByThingAndProperty;\n}\nfunction getReadableChangeLogSummary(solidDataset, thing) {\n const subject = DataFactory.namedNode(thing.url);\n const nrOfAdditions = solidDataset.internal_changeLog.additions.reduce((count, addition) => (addition.subject.equals(subject) ? count + 1 : count), 0);\n const nrOfDeletions = solidDataset.internal_changeLog.deletions.reduce((count, deletion) => (deletion.subject.equals(subject) ? count + 1 : count), 0);\n const additionString = nrOfAdditions === 1\n ? \"1 new value added\"\n : `${nrOfAdditions} new values added`;\n const deletionString = nrOfDeletions === 1 ? \"1 value removed\" : `${nrOfDeletions} values removed`;\n return `(${additionString} / ${deletionString})`;\n}\nfunction getNamedNodesForLocalNodes(quad) {\n const subject = isNamedNode(quad.subject)\n ? getNamedNodeFromLocalNode(quad.subject)\n : /* istanbul ignore next: We don't allow non-NamedNodes as the Subject, so this code path should never be hit: */\n quad.subject;\n const object = isNamedNode(quad.object)\n ? getNamedNodeFromLocalNode(quad.object)\n : quad.object;\n return DataFactory.quad(subject, quad.predicate, object, quad.graph);\n}\nfunction getNamedNodeFromLocalNode(node) {\n if (isLocalNodeIri(node.value)) {\n return DataFactory.namedNode(`#${getLocalNodeName(node.value)}`);\n }\n return node;\n}\nfunction resolveLocalIrisInSolidDataset(solidDataset) {\n const resourceIri = getSourceUrl(solidDataset);\n const defaultGraph = solidDataset.graphs.default;\n const thingIris = Object.keys(defaultGraph);\n const updatedDefaultGraph = thingIris.reduce((graphAcc, thingIri) => {\n const resolvedThing = resolveLocalIrisInThing(graphAcc[thingIri], resourceIri);\n const resolvedThingIri = isLocalNodeIri(thingIri)\n ? `${resourceIri}#${getLocalNodeName(thingIri)}`\n : thingIri;\n const updatedGraph = { ...graphAcc };\n delete updatedGraph[thingIri];\n updatedGraph[resolvedThingIri] = resolvedThing;\n return freeze(updatedGraph);\n }, defaultGraph);\n const updatedGraphs = freeze({\n ...solidDataset.graphs,\n default: updatedDefaultGraph,\n });\n return freeze({\n ...solidDataset,\n graphs: updatedGraphs,\n });\n}\nfunction resolveLocalIrisInThing(thing, baseIri) {\n const predicateIris = Object.keys(thing.predicates);\n const updatedPredicates = predicateIris.reduce((predicatesAcc, predicateIri) => {\n var _a;\n const namedNodes = (_a = predicatesAcc[predicateIri].namedNodes) !== null && _a !== void 0 ? _a : [];\n if (namedNodes.every((namedNode) => !isLocalNodeIri(namedNode))) {\n // This Predicate has no local node Objects, so return it unmodified:\n return predicatesAcc;\n }\n const updatedNamedNodes = freeze(namedNodes.map((namedNode) => isLocalNodeIri(namedNode)\n ? `${baseIri}#${getLocalNodeName(namedNode)}`\n : namedNode));\n const updatedPredicate = freeze({\n ...predicatesAcc[predicateIri],\n namedNodes: updatedNamedNodes,\n });\n return freeze({\n ...predicatesAcc,\n [predicateIri]: updatedPredicate,\n });\n }, thing.predicates);\n return freeze({\n ...thing,\n predicates: updatedPredicates,\n url: isLocalNodeIri(thing.url)\n ? `${baseIri}#${getLocalNodeName(thing.url)}`\n : thing.url,\n });\n}\n/**\n * @hidden\n *\n * Fetch a SolidDataset containing information about the capabilities of the\n * storage server that hosts the given resource URL. For more information,\n * please see the [ESS\n * Documentation](https://docs.inrupt.com/ess/latest/services/discovery-endpoint/#well-known-solid).\n *\n * **Note:** The data contained in this dataset has changed between ESS 1.1 and\n * ESS 2.0, as such you will need to check for multiple predicates to support\n * both versions.\n *\n * ```typescript\n * const wellKnown = await getWellKnownSolid(resource);\n *\n * // The wellKnown dataset uses a blank node for the subject all of it’s predicates,\n * // such that we need to call getThingAll with acceptBlankNodes set to true to\n * // retrieve back predicates contained within the dataset\n * const wellKnownSubjects = getThingAll(wellKnown, {\n * acceptBlankNodes: true,\n * });\n * const wellKnownSubject = wellKnownSubjects[0];\n *\n * // Retrieve a value from the wellKnown dataset:\n * let notificationGateway = getIri(\n * wellKnownSubject,\n * \"http://www.w3.org/ns/solid/terms#notificationGateway\"\n * );\n * ```\n *\n *\n * @param url URL of a Resource.\n * @param options Optional parameter `options.fetch`: An alternative `fetch`\n * function to make the HTTP request, compatible with the browser-native [fetch\n * API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns Promise resolving to a [[SolidDataset]] containing the data at\n * '.well-known/solid' for the given Resource, or rejecting if fetching it\n * failed.\n * @since 1.12.0\n */\nasync function getWellKnownSolid(url, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(url);\n // Try to fetch the well-known solid dataset from the server's root\n try {\n const wellKnownSolidUrl = new URL(\"/.well-known/solid\", new URL(urlString).origin).href;\n return await getSolidDataset(wellKnownSolidUrl, {\n fetch: fetch,\n });\n }\n catch (e) {\n // In case of error, do nothing and try to discover the .well-known\n // at the pod's root.\n }\n // 1.1s implementation:\n const resourceMetadata = await getResourceInfo(urlString, {\n fetch: options.fetch,\n // Discovering the .well-known/solid document is useful even for resources\n // we don't have access to.\n ignoreAuthenticationErrors: true,\n });\n const linkedResources = getLinkedResourceUrlAll(resourceMetadata);\n const rootResources = linkedResources[pim.storage];\n const rootResource = (rootResources === null || rootResources === void 0 ? void 0 : rootResources.length) === 1 ? rootResources[0] : null;\n // If pod root (storage) was advertised, retrieve well known solid from pod's root\n if (rootResource !== null) {\n const wellKnownSolidUrl = new URL(\".well-known/solid\", rootResource.endsWith(\"/\") ? rootResource : `${rootResource}/`).href;\n return getSolidDataset(wellKnownSolidUrl, {\n ...options,\n parsers: {\n \"application/ld+json\": getJsonLdParser$1(),\n },\n });\n }\n throw new Error(\"Could not determine storage root or well-known solid resource.\");\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests**.\n * ```\n *\n * This function initialises a new [[SolidDataset]] with metadata as though the\n * SolidDataset has been retrieved from the given URL. The mock SolidDataset can be used in\n * unit tests that require persisted SolidDatasets; e.g., unit tests that call [[getSourceUrl]].\n *\n * @param url The URL from which the returned SolidDataset appears to be retrieved.\n * @returns A mock SolidDataset that appears to be retrieved from the `url`.\n * @since 0.2.0\n */\nfunction mockSolidDatasetFrom(url) {\n const solidDataset = createSolidDataset();\n const solidDatasetWithResourceInfo = {\n ...solidDataset,\n internal_resourceInfo: {\n sourceIri: internal_toIriString(url),\n isRawData: false,\n contentType: \"text/turtle\",\n linkedResources: {},\n },\n };\n return solidDatasetWithResourceInfo;\n}\n/**\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests**.\n * ```\n *\n * This function initialises a new Container [[SolidDataset]] with metadata as though the\n * Container has been retrieved from the given URL. The mock SolidDataset can be used in\n * unit tests that require persisted Containers; e.g., unit tests that call [[isContainer]].\n *\n * @param url The URL from which the returned Container appears to be retrieved. The `url` must end in a slash.\n * @returns A mock SolidDataset that appears to be retrieved from the `url`.\n * @since 0.2.0\n */\nfunction mockContainerFrom(url) {\n const sourceIri = internal_toIriString(url);\n if (!sourceIri.endsWith(\"/\")) {\n throw new Error(\"A Container's URL should end in a slash. Please update your tests.\");\n }\n return mockSolidDatasetFrom(sourceIri);\n}\n/**\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests**.\n * ```\n *\n * This function initialises a new File with metadata as though the\n * File has been retrieved from the given URL. The mock File can be used in\n * unit tests that require persisted Files; e.g. unit tests that call [[getSourceUrl]].\n *\n * @param url The URL from which the returned File appears to be retrieved.\n * @returns A mock File that appears to be retrieved from the `url`.\n * @since 0.2.0\n */\nfunction mockFileFrom(url, options) {\n const file = new Blob();\n const fileWithResourceInfo = Object.assign(file, {\n internal_resourceInfo: {\n sourceIri: internal_toIriString(url),\n isRawData: true,\n contentType: options === null || options === void 0 ? void 0 : options.contentType,\n linkedResources: {},\n },\n });\n return fileWithResourceInfo;\n}\n/**\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests**.\n * ```\n *\n * This function initialises a new Error object with metadata as though the\n * it was the result of getting a 404 when trying to fetch the Resource at the\n * given URL. The mock Error can be used in unit tests that require functions\n * that fetch Resources (like [[getSolidDataset]]) to fail.\n *\n * @param url The URL of the Resource that could not be fetched according to the error.\n * @param statusCode Optional status code (defaults to 404) that caused the error.\n * @returns A mock Error that represents not having been able to fetch the Resource at `url` due to a 404 Response.\n * @since 1.1.0\n */\nfunction mockFetchError(fetchedUrl, statusCode = 404, statusText = \"Not Found\") {\n // The Response constructor in Node 14 makes an empty status text undefined.\n const failedResponse = new universalFetch.Response(undefined, {\n status: statusCode,\n statusText,\n });\n return new FetchError(`Fetching the Resource at [${fetchedUrl}] failed: [${failedResponse.status}] [${failedResponse.statusText}].`, failedResponse);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Create a new Thing with a URL added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setUrl]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a URL value to.\n * @param property Property for which to add the given URL value.\n * @param url URL to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nconst addUrl = (thing, property, url) => {\n var _a, _b;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n if (!isThing(url) && !internal_isValidUrl(url)) {\n throw new ValidValueUrlExpectedError(url);\n }\n const predicateIri = internal_toIriString(property);\n const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {};\n const existingNamedNodes = (_b = existingPredicate.namedNodes) !== null && _b !== void 0 ? _b : [];\n let iriToAdd;\n if (isNamedNode(url)) {\n iriToAdd = url.value;\n }\n else if (typeof url === \"string\") {\n iriToAdd = url;\n }\n else if (isThingLocal(url)) {\n iriToAdd = url.url;\n }\n else {\n iriToAdd = asIri(url);\n }\n const updatedNamedNodes = freeze(existingNamedNodes.concat(internal_toIriString(iriToAdd)));\n const updatedPredicate = freeze({\n ...existingPredicate,\n namedNodes: updatedNamedNodes,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n const updatedThing = freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n return updatedThing;\n};\n/** @hidden Alias for [[addUrl]] for those who prefer IRI terminology. */\nconst addIri = addUrl;\n/**\n * Create a new Thing with a boolean added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setBoolean]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a boolean value to.\n * @param property Property for which to add the given boolean value.\n * @param value Boolean to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nconst addBoolean = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addLiteralOfType(thing, property, serializeBoolean(value), xmlSchemaTypes.boolean);\n};\n/**\n * Create a new Thing with a datetime added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setDatetime]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a datetime value to.\n * @param property Property for which to add the given datetime value.\n * @param value Datetime to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nconst addDatetime = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addLiteralOfType(thing, property, serializeDatetime(value), xmlSchemaTypes.dateTime);\n};\n/**\n * Create a new Thing with a date added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setDate]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a date value to.\n * @param property Property for which to add the given date value.\n * @param value Date to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n * @since 1.10.0\n */\nconst addDate = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addLiteralOfType(thing, property, serializeDate(value), xmlSchemaTypes.date);\n};\n/**\n * Create a new Thing with a time added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setDatetime]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a datetime value to.\n * @param property Property for which to add the given datetime value.\n * @param value time to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n * @since 1.10.0\n */\nconst addTime = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addLiteralOfType(thing, property, serializeTime(value), xmlSchemaTypes.time);\n};\n/**\n * Create a new Thing with a decimal added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setDecimal]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a decimal value to.\n * @param property Property for which to add the given decimal value.\n * @param value Decimal to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nconst addDecimal = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addLiteralOfType(thing, property, serializeDecimal(value), xmlSchemaTypes.decimal);\n};\n/**\n * Create a new Thing with an integer added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setInteger]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add an integer value to.\n * @param property Property for which to add the given integer value.\n * @param value Integer to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nconst addInteger = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addLiteralOfType(thing, property, serializeInteger(value), xmlSchemaTypes.integer);\n};\n/**\n * Create a new Thing with an English string added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setStringEnglish]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a localised string value to.\n * @param property Property for which to add the given string value.\n * @param value String to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n * @since 1.13.0\n */\nfunction addStringEnglish(thing, property, value) {\n return addStringWithLocale(thing, property, value, \"en\");\n}\n/**\n * Create a new Thing with a localised string added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setStringWithLocale]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add a localised string value to.\n * @param property Property for which to add the given string value.\n * @param value String to add to `thing` for the given `property`.\n * @param locale Locale of the added string.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nfunction addStringWithLocale(thing, property, value, locale) {\n var _a, _b, _c;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const normalizedLocale = normalizeLocale(locale);\n const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {};\n const existingLangStrings = (_b = existingPredicate.langStrings) !== null && _b !== void 0 ? _b : {};\n const existingStringsInLocale = (_c = existingLangStrings[normalizedLocale]) !== null && _c !== void 0 ? _c : [];\n const updatedStringsInLocale = freeze(existingStringsInLocale.concat(value));\n const updatedLangStrings = freeze({\n ...existingLangStrings,\n [normalizedLocale]: updatedStringsInLocale,\n });\n const updatedPredicate = freeze({\n ...existingPredicate,\n langStrings: updatedLangStrings,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n const updatedThing = freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n return updatedThing;\n}\n/**\n * Create a new Thing with an unlocalised string added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setStringNoLocale]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to add an unlocalised string value to.\n * @param property Property for which to add the given string value.\n * @param value String to add to `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nconst addStringNoLocale = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addLiteralOfType(thing, property, value, xmlSchemaTypes.string);\n};\n/**\n * Create a new Thing with a Named Node added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setNamedNode]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing The [[Thing]] to add a Named Node to.\n * @param property Property for which to add a value.\n * @param value The Named Node to add.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nfunction addNamedNode(thing, property, value) {\n return addUrl(thing, property, value.value);\n}\n/**\n * Create a new Thing with a Literal added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setLiteral]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing The [[Thing]] to add a Literal to.\n * @param property Property for which to add a value.\n * @param value The Literal to add.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n */\nfunction addLiteral(thing, property, value) {\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const typeIri = value.datatype.value;\n if (typeIri === xmlSchemaTypes.langString) {\n return addStringWithLocale(thing, property, value.value, value.language);\n }\n return addLiteralOfType(thing, property, value.value, value.datatype.value);\n}\n/**\n * Creates a new Thing with a Term added for a Property.\n *\n * This preserves existing values for the given Property. To replace them, see [[setTerm]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @ignore This should not be needed due to the other add*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing The [[Thing]] to add a Term to.\n * @param property Property for which to add a value.\n * @param value The Term to add.\n * @returns A new Thing equal to the input Thing with the given value added for the given Property.\n * @since 0.3.0\n */\nfunction addTerm(thing, property, value) {\n var _a, _b;\n if (value.termType === \"NamedNode\") {\n return addNamedNode(thing, property, value);\n }\n if (value.termType === \"Literal\") {\n return addLiteral(thing, property, value);\n }\n if (value.termType === \"BlankNode\") {\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {};\n const existingBlankNodes = (_b = existingPredicate.blankNodes) !== null && _b !== void 0 ? _b : [];\n const updatedBlankNodes = freeze(existingBlankNodes.concat(getBlankNodeId(value)));\n const updatedPredicate = freeze({\n ...existingPredicate,\n blankNodes: updatedBlankNodes,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n const updatedThing = freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n return updatedThing;\n }\n throw new Error(`Term type [${value.termType}] is not supported by @inrupt/solid-client.`);\n}\nfunction addLiteralOfType(thing, property, value, type) {\n var _a, _b, _c;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const existingPredicate = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {};\n const existingLiterals = (_b = existingPredicate.literals) !== null && _b !== void 0 ? _b : {};\n const existingValuesOfType = (_c = existingLiterals[type]) !== null && _c !== void 0 ? _c : [];\n const updatedValuesOfType = freeze(existingValuesOfType.concat(value));\n const updatedLiterals = freeze({\n ...existingLiterals,\n [type]: updatedValuesOfType,\n });\n const updatedPredicate = freeze({\n ...existingPredicate,\n literals: updatedLiterals,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n const updatedThing = freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n return updatedThing;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction removeAll(thing, property) {\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const newPredicates = { ...thing.predicates };\n delete newPredicates[predicateIri];\n return freeze({\n ...thing,\n predicates: freeze(newPredicates),\n });\n}\n/**\n * Create a new Thing with the given URL removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a URL value from.\n * @param property Property for which to remove the given URL value.\n * @param value URL to remove from `thing` for the given `Property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nconst removeUrl = (thing, property, value) => {\n var _a, _b, _c;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n if (!isThing(value) && !internal_isValidUrl(value)) {\n throw new ValidValueUrlExpectedError(value);\n }\n const iriToRemove = isThing(value)\n ? asIri(value)\n : internal_toIriString(value);\n const updatedNamedNodes = freeze((_c = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.namedNodes) === null || _b === void 0 ? void 0 : _b.filter((namedNode) => namedNode.toLowerCase() !== iriToRemove.toLowerCase())) !== null && _c !== void 0 ? _c : []);\n const updatedPredicate = freeze({\n ...thing.predicates[predicateIri],\n namedNodes: updatedNamedNodes,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n return freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n};\n/** @hidden Alias of [[removeUrl]] for those who prefer IRI terminology. */\nconst removeIri = removeUrl;\n/**\n * Create a new Thing with the given boolean removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a boolean value from.\n * @param property Property for which to remove the given boolean value.\n * @param value Boolean to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nconst removeBoolean = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return removeLiteralMatching(thing, property, xmlSchemaTypes.boolean, (foundBoolean) => deserializeBoolean(foundBoolean) === value);\n};\n/**\n * Create a new Thing with the given datetime removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a datetime value from.\n * @param property Property for which to remove the given datetime value.\n * @param value Datetime to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nconst removeDatetime = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return removeLiteralMatching(thing, property, xmlSchemaTypes.dateTime, (foundDatetime) => { var _a; return ((_a = deserializeDatetime(foundDatetime)) === null || _a === void 0 ? void 0 : _a.getTime()) === value.getTime(); });\n};\n/**\n * Create a new Thing with the given date removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a date value from.\n * @param property Property for which to remove the given date value.\n * @param value Date to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n * @since 1.10.0\n */\nconst removeDate = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return removeLiteralMatching(thing, property, xmlSchemaTypes.date, function (foundDate) {\n const deserializedDate = deserializeDate(foundDate);\n if (deserializedDate) {\n return (deserializedDate.getFullYear() === value.getFullYear() &&\n deserializedDate.getMonth() === value.getMonth() &&\n deserializedDate.getUTCDate() === value.getUTCDate());\n }\n return false;\n });\n};\n/**\n * Create a new Thing with the given datetime removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a datetime value from.\n * @param property Property for which to remove the given datetime value.\n * @param value Time to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n * @since 1.10.0\n */\nconst removeTime = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return removeLiteralMatching(thing, property, xmlSchemaTypes.time, function (foundTime) {\n const deserializedTime = deserializeTime(foundTime);\n if (deserializedTime) {\n return (deserializedTime.hour === value.hour &&\n deserializedTime.minute === value.minute &&\n deserializedTime.second === value.second &&\n deserializedTime.millisecond === value.millisecond &&\n deserializedTime.timezoneHourOffset === value.timezoneHourOffset &&\n deserializedTime.timezoneMinuteOffset === value.timezoneMinuteOffset);\n }\n return false;\n });\n};\n/**\n * Create a new Thing with the given decimal removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a decimal value from.\n * @param property Property for which to remove the given decimal value.\n * @param value Decimal to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nconst removeDecimal = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return removeLiteralMatching(thing, property, xmlSchemaTypes.decimal, (foundDecimal) => deserializeDecimal(foundDecimal) === value);\n};\n/**\n * Create a new Thing with the given integer removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove an integer value from.\n * @param property Property for which to remove the given integer value.\n * @param value Integer to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nconst removeInteger = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return removeLiteralMatching(thing, property, xmlSchemaTypes.integer, (foundInteger) => deserializeInteger(foundInteger) === value);\n};\n/**\n * Create a new Thing with the given English string removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a localised string value from.\n * @param property Property for which to remove the given localised string value.\n * @param value String to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n * @since 1.13.0\n */\nfunction removeStringEnglish(thing, property, value) {\n return removeStringWithLocale(thing, property, value, \"en\");\n}\n/**\n * Create a new Thing with the given localised string removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove a localised string value from.\n * @param property Property for which to remove the given localised string value.\n * @param value String to remove from `thing` for the given `property`.\n * @param locale Locale of the string to remove.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nfunction removeStringWithLocale(thing, property, value, locale) {\n var _a, _b;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const existingLangStrings = (_b = (_a = thing.predicates[predicateIri]) === null || _a === void 0 ? void 0 : _a.langStrings) !== null && _b !== void 0 ? _b : {};\n const matchingLocale = Object.keys(existingLangStrings).find((existingLocale) => normalizeLocale(existingLocale) === normalizeLocale(locale) &&\n Array.isArray(existingLangStrings[existingLocale]) &&\n existingLangStrings[existingLocale].length > 0);\n if (typeof matchingLocale !== \"string\") {\n // Nothing to remove.\n return thing;\n }\n const existingStringsInLocale = existingLangStrings[matchingLocale];\n const updatedStringsInLocale = freeze(existingStringsInLocale.filter((existingString) => existingString !== value));\n const updatedLangStrings = freeze({\n ...existingLangStrings,\n [matchingLocale]: updatedStringsInLocale,\n });\n const updatedPredicate = freeze({\n ...thing.predicates[predicateIri],\n langStrings: updatedLangStrings,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n return freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n}\n/**\n * Create a new Thing with the given unlocalised string removed for the given Property.\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to remove an unlocalised string value from.\n * @param property Property for which to remove the given string value.\n * @param value String to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nconst removeStringNoLocale = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return removeLiteralMatching(thing, property, xmlSchemaTypes.string, (foundString) => foundString === value);\n};\n/**\n * @ignore This should not be needed due to the other remove*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing Thing to remove a NamedNode value from.\n * @param property Property for which to remove the given NamedNode value.\n * @param value NamedNode to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nfunction removeNamedNode(thing, property, value) {\n return removeUrl(thing, property, value.value);\n}\n/**\n * @ignore This should not be needed due to the other remove*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing Thing to remove a Literal value from.\n * @param property Property for which to remove the given Literal value.\n * @param value Literal to remove from `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with the given value removed for the given Property.\n */\nfunction removeLiteral(thing, property, value) {\n var _a, _b, _c;\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const typeIri = value.datatype.value;\n if (typeIri === xmlSchemaTypes.langString) {\n return removeStringWithLocale(thing, property, value.value, value.language);\n }\n const predicateIri = internal_toIriString(property);\n const existingPredicateValues = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {};\n const existingLiterals = (_b = existingPredicateValues.literals) !== null && _b !== void 0 ? _b : {};\n const existingValuesOfType = (_c = existingLiterals[typeIri]) !== null && _c !== void 0 ? _c : [];\n const updatedValues = freeze(existingValuesOfType.filter((existingValue) => existingValue !== value.value));\n const updatedLiterals = freeze({\n ...existingLiterals,\n [typeIri]: updatedValues,\n });\n const updatedPredicate = freeze({\n ...existingPredicateValues,\n literals: updatedLiterals,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n const updatedThing = freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n return updatedThing;\n}\n/**\n * @param thing Thing to remove a Literal value from.\n * @param property Property for which to remove the given Literal value.\n * @param type Data type that the Literal should be stored as.\n * @param matcher Function that returns true if the given value is an equivalent serialisation of the value to remove. For example, when removing a `false` boolean, the matcher should return true for both \"0\" and \"false\".\n */\nfunction removeLiteralMatching(thing, property, type, matcher) {\n var _a, _b, _c;\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n const predicateIri = internal_toIriString(property);\n const existingPredicateValues = (_a = thing.predicates[predicateIri]) !== null && _a !== void 0 ? _a : {};\n const existingLiterals = (_b = existingPredicateValues.literals) !== null && _b !== void 0 ? _b : {};\n const existingValuesOfType = (_c = existingLiterals[type]) !== null && _c !== void 0 ? _c : [];\n const updatedValues = freeze(existingValuesOfType.filter((existingValue) => !matcher(existingValue)));\n const updatedLiterals = freeze({\n ...existingLiterals,\n [type]: updatedValues,\n });\n const updatedPredicate = freeze({\n ...existingPredicateValues,\n literals: updatedLiterals,\n });\n const updatedPredicates = freeze({\n ...thing.predicates,\n [predicateIri]: updatedPredicate,\n });\n const updatedThing = freeze({\n ...thing,\n predicates: updatedPredicates,\n });\n return updatedThing;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Create a new Thing with existing values replaced by the given URL for the given Property.\n *\n * To preserve existing values, see [[addUrl]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set a URL value on.\n * @param property Property for which to set the given URL value.\n * @param url URL to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nconst setUrl = (thing, property, url) => {\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n if (!isThing(url) && !internal_isValidUrl(url)) {\n throw new ValidValueUrlExpectedError(url);\n }\n return addUrl(removeAll(thing, property), property, url);\n};\n/** @hidden Alias of [[setUrl]] for those who prefer IRI terminology. */\nconst setIri = setUrl;\n/**\n * Create a new Thing with existing values replaced by the given boolean for the given Property.\n *\n * To preserve existing values, see [[addBoolean]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set a boolean value on.\n * @param property Property for which to set the given boolean value.\n * @param value Boolean to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nconst setBoolean = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addBoolean(removeAll(thing, property), property, value);\n};\n/**\n * Create a new Thing with existing values replaced by the given datetime for the given Property.\n *\n * To preserve existing values, see [[addDatetime]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set an datetime value on.\n * @param property Property for which to set the given datetime value.\n * @param value Datetime to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nconst setDatetime = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addDatetime(removeAll(thing, property), property, value);\n};\n/**\n * Create a new Thing with existing values replaced by the given date for the given Property.\n *\n * To preserve existing values, see [[addDate]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set an date value on.\n * @param property Property for which to set the given date value.\n * @param value Date to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n * @since 1.10.0\n */\nconst setDate = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addDate(removeAll(thing, property), property, value);\n};\n/**\n * Create a new Thing with existing values replaced by the given time for the given Property.\n *\n * To preserve existing values, see [[addTime]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set an time value on.\n * @param property Property for which to set the given time value.\n * @param value time to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n * @since 1.10.0\n */\nconst setTime = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addTime(removeAll(thing, property), property, value);\n};\n/**\n * Create a new Thing with existing values replaced by the given decimal for the given Property.\n *\n * To preserve existing values, see [[addDecimal]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set a decimal value on.\n * @param property Property for which to set the given decimal value.\n * @param value Decimal to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nconst setDecimal = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addDecimal(removeAll(thing, property), property, value);\n};\n/**\n * Create a new Thing with existing values replaced by the given integer for the given Property.\n *\n * To preserve existing values, see [[addInteger]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set an integer value on.\n * @param property Property for which to set the given integer value.\n * @param value Integer to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nconst setInteger = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addInteger(removeAll(thing, property), property, value);\n};\n/**\n * Create a new Thing with existing values replaced by the given localised string for the given Property.\n *\n * To preserve existing values, see [[addStringWithLocale]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set a localised string value on.\n * @param property Property for which to set the given localised string value.\n * @param value Localised string to set on `thing` for the given `property`.\n * @param locale Locale of the added string.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nfunction setStringWithLocale(thing, property, value, locale) {\n internal_throwIfNotThing(thing);\n return addStringWithLocale(removeAll(thing, property), property, value, locale);\n}\n/**\n * Create a new Thing with existing values replaced by the given unlocalised string for the given Property.\n *\n * To preserve existing values, see [[addStringNoLocale]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @param thing Thing to set an unlocalised string value on.\n * @param property Property for which to set the given unlocalised string value.\n * @param value Unlocalised string to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nconst setStringNoLocale = (thing, property, value) => {\n internal_throwIfNotThing(thing);\n return addStringNoLocale(removeAll(thing, property), property, value);\n};\n/**\n * Create a new Thing with existing values replaced by the given Named Node for the given Property.\n *\n * This replaces existing values for the given Property. To preserve them, see [[addNamedNode]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @ignore This should not be needed due to the other set*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing The [[Thing]] to set a NamedNode on.\n * @param property Property for which to set the value.\n * @param value The NamedNode to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nfunction setNamedNode(thing, property, value) {\n internal_throwIfNotThing(thing);\n return addNamedNode(removeAll(thing, property), property, value);\n}\n/**\n * Create a new Thing with existing values replaced by the given Literal for the given Property.\n *\n * This replaces existing values for the given Property. To preserve them, see [[addLiteral]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @ignore This should not be needed due to the other set*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing The [[Thing]] to set a Literal on.\n * @param property Property for which to set the value.\n * @param value The Literal to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n */\nfunction setLiteral(thing, property, value) {\n internal_throwIfNotThing(thing);\n return addLiteral(removeAll(thing, property), property, value);\n}\n/**\n * Creates a new Thing with existing values replaced by the given Term for the given Property.\n *\n * This replaces existing values for the given Property. To preserve them, see [[addTerm]].\n *\n * The original `thing` is not modified; this function returns a cloned Thing with updated values.\n *\n * @ignore This should not be needed due to the other set*() functions. If you do find yourself needing it, please file a feature request for your use case.\n * @param thing The [[Thing]] to set a Term on.\n * @param property Property for which to set the value.\n * @param value The raw RDF/JS value to set on `thing` for the given `property`.\n * @returns A new Thing equal to the input Thing with existing values replaced by the given value for the given Property.\n * @since 0.3.0\n */\nfunction setTerm(thing, property, value) {\n internal_throwIfNotThing(thing);\n if (!internal_isValidUrl(property)) {\n throw new ValidPropertyUrlExpectedError(property);\n }\n return addTerm(removeAll(thing, property), property, value);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Create or modify a [[Thing]], setting multiple properties in a single expresssion.\n *\n * For example, you can create a new Thing and initialise several properties as follows:\n *\n * const me = buildThing()\n * .addUrl(rdf.type, schema.Person)\n * .addStringNoLocale(schema.givenName, \"Vincent\")\n * .build();\n *\n * Take note of the final call to `.build()` to obtain the actual Thing.\n *\n * @param init Optionally pass an existing [[Thing]] to modify the properties of. If left empty, `buildThing` will initialise a new Thing.\n * @returns a [[ThingBuilder]], a Fluent API that allows you to set multiple properties in a single expression.\n * @since 1.9.0\n */\nfunction buildThing(init = createThing()) {\n let thing = isThing(init) ? init : createThing(init);\n function getAdder(adder) {\n return (property, value) => {\n thing = adder(thing, property, value);\n return builder;\n };\n }\n function getSetter(setter) {\n return (property, value) => {\n thing = setter(thing, property, value);\n return builder;\n };\n }\n function getRemover(remover) {\n return (property, value) => {\n thing = remover(thing, property, value);\n return builder;\n };\n }\n const builder = {\n build: () => thing,\n addUrl: getAdder(addUrl),\n addIri: getAdder(addIri),\n addBoolean: getAdder(addBoolean),\n addDatetime: getAdder(addDatetime),\n addDate: getAdder(addDate),\n addTime: getAdder(addTime),\n addDecimal: getAdder(addDecimal),\n addInteger: getAdder(addInteger),\n addStringNoLocale: getAdder(addStringNoLocale),\n addStringEnglish: (property, value) => {\n thing = addStringWithLocale(thing, property, value, \"en\");\n return builder;\n },\n addStringWithLocale: (property, value, locale) => {\n thing = addStringWithLocale(thing, property, value, locale);\n return builder;\n },\n addNamedNode: getAdder(addNamedNode),\n addLiteral: getAdder(addLiteral),\n addTerm: getAdder(addTerm),\n setUrl: getSetter(setUrl),\n setIri: getSetter(setIri),\n setBoolean: getSetter(setBoolean),\n setDatetime: getSetter(setDatetime),\n setDate: getSetter(setDate),\n setTime: getSetter(setTime),\n setDecimal: getSetter(setDecimal),\n setInteger: getSetter(setInteger),\n setStringNoLocale: getSetter(setStringNoLocale),\n setStringEnglish: (property, value) => {\n thing = setStringWithLocale(thing, property, value, \"en\");\n return builder;\n },\n setStringWithLocale: (property, value, locale) => {\n thing = setStringWithLocale(thing, property, value, locale);\n return builder;\n },\n setNamedNode: getSetter(setNamedNode),\n setLiteral: getSetter(setLiteral),\n setTerm: getSetter(setTerm),\n removeAll: (property) => {\n thing = removeAll(thing, property);\n return builder;\n },\n removeUrl: getRemover(removeUrl),\n removeIri: getRemover(removeIri),\n removeBoolean: getRemover(removeBoolean),\n removeDatetime: getRemover(removeDatetime),\n removeDate: getRemover(removeDate),\n removeTime: getRemover(removeTime),\n removeDecimal: getRemover(removeDecimal),\n removeInteger: getRemover(removeInteger),\n removeStringNoLocale: getRemover(removeStringNoLocale),\n removeStringEnglish: (property, value) => buildThing(removeStringWithLocale(thing, property, value, \"en\")),\n removeStringWithLocale: (property, value, locale) => buildThing(removeStringWithLocale(thing, property, value, locale)),\n removeNamedNode: getRemover(removeNamedNode),\n removeLiteral: getRemover(removeLiteral),\n };\n return builder;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Function for use in unit tests to mock a [[Thing]] with a given URL.\n *\n * Warning: do not use this function in actual production code.\n * This function initialises a new empty Thing and sets its URL to a given URL.\n * This is useful to mock a Thing in tests of code that call e.g.\n * [[asUrl]].\n *\n * @param url The URL that the mocked Thing pretends identifies it.\n * @returns A new Thing, pretending to be identified by the given URL.\n * @since 0.2.0\n */\nfunction mockThingFrom(url) {\n const iri = internal_toIriString(url);\n const thing = {\n type: \"Subject\",\n predicates: {},\n url: iri,\n };\n return thing;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @param linkedAccessResource A Resource exposed via the Link header of another Resource with rel=\"acl\".\n * @returns Whether that Resource is an ACP ACR or not (in which case it's likely a WAC ACL).\n */\nfunction isAcr(linkedAccessResource) {\n const relTypeLinks = getLinkedResourceUrlAll(linkedAccessResource).type;\n return (Array.isArray(relTypeLinks) &&\n relTypeLinks.includes(acp.AccessControlResource));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * This (currently internal) function fetches the ACL indicated in the [[WithServerResourceInfo]]\n * attached to a resource.\n *\n * @internal\n * @param resourceInfo The Resource info with the ACL URL\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters).\n */\nasync function internal_fetchAcl(resourceInfo, options = internal_defaultFetchOptions) {\n if (!hasAccessibleAcl(resourceInfo)) {\n return {\n resourceAcl: null,\n fallbackAcl: null,\n };\n }\n try {\n const resourceAcl = await internal_fetchResourceAcl(resourceInfo, options);\n const acl = resourceAcl === null\n ? {\n resourceAcl: null,\n fallbackAcl: await internal_fetchFallbackAcl(resourceInfo, options),\n }\n : { resourceAcl, fallbackAcl: null };\n return acl;\n }\n catch (e) {\n /* istanbul ignore else: fetchResourceAcl swallows all non-AclIsAcrErrors */\n if (e instanceof AclIsAcrError) {\n return {\n resourceAcl: null,\n fallbackAcl: null,\n };\n }\n /* istanbul ignore next: fetchResourceAcl swallows all non-AclIsAcrErrors */\n throw e;\n }\n}\n/** @internal */\nasync function internal_fetchResourceAcl(dataset, options = internal_defaultFetchOptions) {\n if (!hasAccessibleAcl(dataset)) {\n return null;\n }\n try {\n const aclSolidDataset = await getSolidDataset(dataset.internal_resourceInfo.aclUrl, options);\n if (isAcr(aclSolidDataset)) {\n throw new AclIsAcrError(dataset, aclSolidDataset);\n }\n return freeze({\n ...aclSolidDataset,\n internal_accessTo: getSourceUrl(dataset),\n });\n }\n catch (e) {\n if (e instanceof AclIsAcrError) {\n throw e;\n }\n // Since a Solid server adds a `Link` header to an ACL even if that ACL does not exist,\n // failure to fetch the ACL is expected to happen - we just return `null` and let callers deal\n // with it.\n return null;\n }\n}\n/** @internal */\nasync function internal_fetchFallbackAcl(resource, options = internal_defaultFetchOptions) {\n const resourceUrl = new URL(getSourceUrl(resource));\n const resourcePath = resourceUrl.pathname;\n // Note: we're currently assuming that the Origin is the root of the Pod. However, it is not yet\n // set in stone that that will always be the case. We might need to check the Container's\n // metadata at some point in time to check whether it is actually the root of the Pod.\n // See: https://github.com/solid/specification/issues/153#issuecomment-624630022\n if (resourcePath === \"/\") {\n // We're already at the root, so there's no Container we can retrieve:\n return null;\n }\n const containerPath = internal_getContainerPath(resourcePath);\n const containerIri = new URL(containerPath, resourceUrl.origin).href;\n const containerInfo = await getResourceInfo(containerIri, options);\n if (!hasAccessibleAcl(containerInfo)) {\n // If the current user does not have access to this Container's ACL,\n // we cannot determine whether its ACL is the one that applies. Thus, return null:\n return null;\n }\n const containerAcl = await internal_fetchResourceAcl(containerInfo, options);\n if (containerAcl === null) {\n return internal_fetchFallbackAcl(containerInfo, options);\n }\n return containerAcl;\n}\n/**\n * Given the path to a Resource, get the URL of the Container one level up in the hierarchy.\n * @param resourcePath The path of the Resource of which we need to determine the Container's path.\n * @hidden For internal use only.\n */\nfunction internal_getContainerPath(resourcePath) {\n const resourcePathWithoutTrailingSlash = resourcePath.substring(resourcePath.length - 1) === \"/\"\n ? resourcePath.substring(0, resourcePath.length - 1)\n : resourcePath;\n const containerPath = `${resourcePath.substring(0, resourcePathWithoutTrailingSlash.lastIndexOf(\"/\"))}/`;\n return containerPath;\n}\n/** @internal */\nfunction internal_getAclRules(aclDataset) {\n const things = getThingAll(aclDataset);\n return things.filter(isAclRule);\n}\nfunction isAclRule(thing) {\n return getIriAll(thing, rdf.type).includes(acl.Authorization);\n}\n/** @internal */\nfunction internal_getResourceAclRulesForResource(aclRules, resource) {\n return aclRules.filter((rule) => appliesToResource(rule, resource));\n}\nfunction appliesToResource(aclRule, resource) {\n return getIriAll(aclRule, acl.accessTo).includes(resource);\n}\n/** @internal */\nfunction internal_getDefaultAclRulesForResource(aclRules, resource) {\n return aclRules.filter((rule) => isDefaultForResource(rule, resource));\n}\nfunction isDefaultForResource(aclRule, resource) {\n return (getIriAll(aclRule, acl.default).includes(resource) ||\n getIriAll(aclRule, acl.defaultForNew).includes(resource));\n}\n/** @internal */\nfunction internal_getAccess(rule) {\n const ruleAccessModes = getIriAll(rule, acl.mode);\n const writeAccess = ruleAccessModes.includes(internal_accessModeIriStrings.write);\n return writeAccess\n ? {\n read: ruleAccessModes.includes(internal_accessModeIriStrings.read),\n append: true,\n write: true,\n control: ruleAccessModes.includes(internal_accessModeIriStrings.control),\n }\n : {\n read: ruleAccessModes.includes(internal_accessModeIriStrings.read),\n append: ruleAccessModes.includes(internal_accessModeIriStrings.append),\n write: false,\n control: ruleAccessModes.includes(internal_accessModeIriStrings.control),\n };\n}\n/** @internal */\nfunction internal_combineAccessModes(modes) {\n return modes.reduce((accumulator, current) => {\n const writeAccess = accumulator.write || current.write;\n return writeAccess\n ? {\n read: accumulator.read || current.read,\n append: true,\n write: true,\n control: accumulator.control || current.control,\n }\n : {\n read: accumulator.read || current.read,\n append: accumulator.append || current.append,\n write: false,\n control: accumulator.control || current.control,\n };\n }, { read: false, append: false, write: false, control: false });\n}\n/** @internal */\nfunction internal_removeEmptyAclRules(aclDataset) {\n const aclRules = internal_getAclRules(aclDataset);\n const aclRulesToRemove = aclRules.filter(isEmptyAclRule);\n // Is this too clever? It iterates over aclRulesToRemove, one by one removing them from aclDataset.\n const updatedAclDataset = aclRulesToRemove.reduce(removeThing, aclDataset);\n return updatedAclDataset;\n}\nfunction isEmptyAclRule(aclRule) {\n // If there are Quads in there unrelated to Access Control,\n // this is not an empty ACL rule that can be deleted:\n if (subjectToRdfJsQuads(aclRule.predicates, DataFactory.namedNode(aclRule.url), DataFactory.defaultGraph()).some((quad) => !isAclQuad(quad))) {\n return false;\n }\n // If the rule does not apply to any Resource, it is no longer working:\n if (getIri(aclRule, acl.accessTo) === null &&\n getIri(aclRule, acl.default) === null &&\n getIri(aclRule, acl.defaultForNew) === null) {\n return true;\n }\n // If the rule does not specify Access Modes, it is no longer working:\n if (getIri(aclRule, acl.mode) === null) {\n return true;\n }\n // If the rule does not specify whom it applies to, it is no longer working:\n if (getIri(aclRule, acl.agent) === null &&\n getIri(aclRule, acl.agentGroup) === null &&\n getIri(aclRule, acl.agentClass) === null) {\n return true;\n }\n return false;\n}\nfunction isAclQuad(quad) {\n const { predicate } = quad;\n const { object } = quad;\n if (predicate.equals(DataFactory.namedNode(rdf.type)) &&\n object.equals(DataFactory.namedNode(acl.Authorization))) {\n return true;\n }\n if (predicate.equals(DataFactory.namedNode(acl.accessTo)) ||\n predicate.equals(DataFactory.namedNode(acl.default)) ||\n predicate.equals(DataFactory.namedNode(acl.defaultForNew))) {\n return true;\n }\n if (predicate.equals(DataFactory.namedNode(acl.mode)) &&\n Object.values(internal_accessModeIriStrings).some((mode) => object.equals(DataFactory.namedNode(mode)))) {\n return true;\n }\n if (predicate.equals(DataFactory.namedNode(acl.agent)) ||\n predicate.equals(DataFactory.namedNode(acl.agentGroup)) ||\n predicate.equals(DataFactory.namedNode(acl.agentClass))) {\n return true;\n }\n if (predicate.equals(DataFactory.namedNode(acl.origin))) {\n return true;\n }\n return false;\n}\n/**\n * IRIs of potential Access Modes\n * @internal\n */\nconst internal_accessModeIriStrings = {\n read: \"http://www.w3.org/ns/auth/acl#Read\",\n append: \"http://www.w3.org/ns/auth/acl#Append\",\n write: \"http://www.w3.org/ns/auth/acl#Write\",\n control: \"http://www.w3.org/ns/auth/acl#Control\",\n};\n/** @internal\n * This function finds, among a set of ACL rules, the ones granting access to a given entity (the target)\n * and identifying it with a specific property (`acl:agent` or `acl:agentGroup`).\n * @param aclRules The set of rules to filter\n * @param targetIri The IRI of the target\n * @param targetType The property linking the rule to the target\n */\nfunction internal_getAclRulesForIri(aclRules, targetIri, targetType) {\n return aclRules.filter((rule) => getIriAll(rule, targetType).includes(targetIri));\n}\n/** @internal\n * This function transforms a given set of rules into a map associating the IRIs\n * of the entities to which permissions are granted by these rules, and the permissions\n * granted to them. Additionally, it filters these entities based on the predicate\n * that refers to them in the rule.\n */\nfunction internal_getAccessByIri(aclRules, targetType) {\n const targetIriAccess = {};\n aclRules.forEach((rule) => {\n const ruleTargetIri = getIriAll(rule, targetType);\n const access = internal_getAccess(rule);\n // A rule might apply to multiple agents. If multiple rules apply to the same agent, the Access\n // Modes granted by those rules should be combined:\n ruleTargetIri.forEach((targetIri) => {\n targetIriAccess[targetIri] =\n typeof targetIriAccess[targetIri] === \"undefined\"\n ? access\n : internal_combineAccessModes([targetIriAccess[targetIri], access]);\n });\n });\n return targetIriAccess;\n}\n/**\n * Initialises a new ACL Rule that grants some access - but does not yet specify to whom.\n *\n * @hidden This is an internal utility function that should not be used directly by downstreams.\n * @param access Access mode that this Rule will grant\n */\nfunction internal_initialiseAclRule(access) {\n let newRule = createThing();\n newRule = setIri(newRule, rdf.type, acl.Authorization);\n if (access.read) {\n newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.read);\n }\n if (access.append && !access.write) {\n newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.append);\n }\n if (access.write) {\n newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.write);\n }\n if (access.control) {\n newRule = addIri(newRule, acl.mode, internal_accessModeIriStrings.control);\n }\n return newRule;\n}\n/**\n * Creates a new ACL Rule with the same ACL values as the input ACL Rule, but having a different IRI.\n *\n * Note that non-ACL values will not be copied over.\n *\n * @hidden This is an internal utility function that should not be used directly by downstreams.\n * @param sourceRule ACL rule to duplicate.\n */\nfunction internal_duplicateAclRule(sourceRule) {\n let targetRule = createThing();\n targetRule = setIri(targetRule, rdf.type, acl.Authorization);\n function copyIris(inputRule, outputRule, predicate) {\n return getIriAll(inputRule, predicate).reduce((outputRule, iriTarget) => addIri(outputRule, predicate, iriTarget), outputRule);\n }\n targetRule = copyIris(sourceRule, targetRule, acl.accessTo);\n targetRule = copyIris(sourceRule, targetRule, acl.default);\n targetRule = copyIris(sourceRule, targetRule, acl.defaultForNew);\n targetRule = copyIris(sourceRule, targetRule, acl.agent);\n targetRule = copyIris(sourceRule, targetRule, acl.agentGroup);\n targetRule = copyIris(sourceRule, targetRule, acl.agentClass);\n targetRule = copyIris(sourceRule, targetRule, acl.origin);\n targetRule = copyIris(sourceRule, targetRule, acl.mode);\n return targetRule;\n}\nfunction internal_setAcl(resource, acl) {\n return Object.assign(internal_cloneResource(resource), { internal_acl: acl });\n}\nconst supportedActorPredicates = [\n acl.agent,\n acl.agentClass,\n acl.agentGroup,\n acl.origin,\n];\n/**\n * Given an ACL Rule, returns two new ACL Rules that cover all the input Rule's use cases,\n * except for giving the given Actor access to the given Resource.\n *\n * @param rule The ACL Rule that should no longer apply for a given Actor to a given Resource.\n * @param actor The Actor that should be removed from the Rule for the given Resource.\n * @param resourceIri The Resource to which the Rule should no longer apply for the given Actor.\n * @returns A tuple with the original ACL Rule without the given Actor, and a new ACL Rule for the given Actor for the remaining Resources, respectively.\n */\nfunction internal_removeActorFromRule(rule, actor, actorPredicate, resourceIri, ruleType) {\n // If the existing Rule does not apply to the given Actor, we don't need to split up.\n // Without this check, we'd be creating a new rule for the given Actor (ruleForOtherTargets)\n // that would give it access it does not currently have:\n if (!getIriAll(rule, actorPredicate).includes(actor)) {\n const emptyRule = internal_initialiseAclRule({\n read: false,\n append: false,\n write: false,\n control: false,\n });\n return [rule, emptyRule];\n }\n // The existing rule will keep applying to Actors other than the given one:\n const ruleWithoutActor = removeIri(rule, actorPredicate, actor);\n // The actor might have been given other access in the existing rule, so duplicate it...\n let ruleForOtherTargets = internal_duplicateAclRule(rule);\n // ...but remove access to the original Resource...\n ruleForOtherTargets = removeIri(ruleForOtherTargets, ruleType === \"resource\" ? acl.accessTo : acl.default, resourceIri);\n // Prevents the legacy predicate 'acl:defaultForNew' to lead to privilege escalation\n if (ruleType === \"default\") {\n ruleForOtherTargets = removeIri(ruleForOtherTargets, acl.defaultForNew, resourceIri);\n }\n // ...and only apply the new Rule to the given Actor (because the existing Rule covers the others):\n ruleForOtherTargets = setIri(ruleForOtherTargets, actorPredicate, actor);\n supportedActorPredicates\n .filter((predicate) => predicate !== actorPredicate)\n .forEach((predicate) => {\n ruleForOtherTargets = removeAll(ruleForOtherTargets, predicate);\n });\n return [ruleWithoutActor, ruleForOtherTargets];\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n * Modifies the resource ACL (Access Control List) to set the Access Modes for the given Agent.\n * Specifically, the function returns a new resource ACL initialised with the given ACL and\n * new rules for the Actor's access.\n *\n * If rules for Actor's access already exist in the given ACL, in the returned ACL,\n * they are replaced by the new rules.\n *\n * This function does not modify:\n *\n * - Access Modes granted indirectly to Actors through other ACL rules, e.g., public or group-specific permissions.\n * - Access Modes granted to Actors for the child Resources if the associated Resource is a Container.\n * - The original ACL.\n *\n * @param aclDataset The SolidDataset that contains Access-Control List rules.\n * @param actor The Actor to grant specific Access Modes.\n * @param access The Access Modes to grant to the Actor for the Resource.\n * @returns A new resource ACL initialised with the given `aclDataset` and `access` for the `agent`.\n */\nfunction internal_setActorAccess$2(aclDataset, access, actorPredicate, accessType, actor) {\n // First make sure that none of the pre-existing rules in the given ACL SolidDataset\n // give the Agent access to the Resource:\n let filteredAcl = aclDataset;\n getThingAll(aclDataset).forEach((aclRule) => {\n // Obtain both the Rule that no longer includes the given Actor,\n // and a new Rule that includes all ACL Quads\n // that do not pertain to the given Actor-Resource combination.\n // Note that usually, the latter will no longer include any meaningful statements;\n // we'll clean them up afterwards.\n const [filteredRule, remainingRule] = internal_removeActorFromRule(aclRule, actor, actorPredicate, aclDataset.internal_accessTo, accessType);\n filteredAcl = setThing(filteredAcl, filteredRule);\n filteredAcl = setThing(filteredAcl, remainingRule);\n });\n // Create a new Rule that only grants the given Actor the given Access Modes:\n let newRule = internal_initialiseAclRule(access);\n newRule = setIri(newRule, accessType === \"resource\" ? acl.accessTo : acl.default, aclDataset.internal_accessTo);\n newRule = setIri(newRule, actorPredicate, actor);\n const updatedAcl = setThing(filteredAcl, newRule);\n // Remove any remaining Rules that do not contain any meaningful statements:\n return internal_removeEmptyAclRules(updatedAcl);\n}\nfunction internal_setResourceAcl(resource, acl) {\n const newAcl = {\n resourceAcl: acl,\n fallbackAcl: null,\n };\n return internal_setAcl(resource, newAcl);\n}\nfunction internal_getResourceAcl(resource) {\n return resource.internal_acl.resourceAcl;\n}\n/**\n * This error indicates that, if we're following a Link with rel=\"acl\",\n * it does not result in a WAC ACL, but in an ACP ACR.\n */\nclass AclIsAcrError extends Error {\n constructor(sourceResource, aclResource) {\n super(`[${getSourceIri(sourceResource)}] is governed by Access Control Policies in [${getSourceIri(aclResource)}] rather than by Web Access Control.`);\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Verify whether a given SolidDataset was fetched together with its Access Control List.\n *\n * @param dataset A [[SolidDataset]] that may have its ACLs attached.\n * @returns True if `dataset` was fetched together with its ACLs.\n */\nfunction hasAcl(dataset) {\n const potentialAcl = dataset;\n return typeof potentialAcl.internal_acl === \"object\";\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Verifies whether the given Resource has a resource ACL (Access Control List) attached.\n *\n * The [[hasResourceAcl]] function checks that:\n * - a given Resource has a resource ACL attached, and\n * - the user calling [[hasResourceAcl]] has Control access to the Resource.\n *\n * To retrieve a Resource with its ACLs, see [[getSolidDatasetWithAcl]].\n *\n * @param resource A Resource that might have an ACL attached.\n * @returns `true` if the Resource has a resource ACL attached that is accessible by the user.\n */\nfunction hasResourceAcl(resource) {\n return (resource.internal_acl.resourceAcl !== null &&\n getSourceUrl(resource) ===\n resource.internal_acl.resourceAcl.internal_accessTo &&\n resource.internal_resourceInfo.aclUrl ===\n getSourceUrl(resource.internal_acl.resourceAcl));\n}\n/**\n * Experimental: fetch a SolidDataset and its associated Access Control List.\n *\n * This is an experimental function that fetches both a Resource, the linked ACL Resource (if\n * available), and the ACL that applies to it if the linked ACL Resource is not available. This can\n * result in many HTTP requests being executed, in lieu of the Solid spec mandating servers to\n * provide this info in a single request. Therefore, and because this function is still\n * experimental, prefer [[getSolidDataset]] instead.\n *\n * If the Resource does not advertise the ACL Resource (because the authenticated user does not have\n * access to it), the `acl` property in the returned value will be null. `acl.resourceAcl` will be\n * undefined if the Resource's linked ACL Resource could not be fetched (because it does not exist),\n * and `acl.fallbackAcl` will be null if the applicable Container's ACL is not accessible to the\n * authenticated user.\n *\n * @param url URL of the SolidDataset to fetch.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A SolidDataset and the ACLs that apply to it, if available to the authenticated user.\n */\nasync function getSolidDatasetWithAcl(url, options = internal_defaultFetchOptions) {\n const solidDataset = await getSolidDataset(url, options);\n const acl = await internal_fetchAcl(solidDataset, options);\n return internal_setAcl(solidDataset, acl);\n}\n/**\n * ```{note} This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Retrieves a file, its resource ACL (Access Control List) if available,\n * and its fallback ACL from a URL and returns them as a blob.\n *\n * If the user calling the function does not have access to the file's resource ACL,\n * [[hasAccessibleAcl]] on the returned blob returns false.\n * If the user has access to the file's resource ACL but the resource ACL does not exist,\n * [[getResourceAcl]] on the returned blob returns null.\n * If the fallback ACL is inaccessible by the user,\n * [[getFallbackAcl]] on the returned blob returns null.\n *\n * ```{tip}\n * To retrieve the ACLs, the function results in multiple HTTP requests rather than a single\n * request as mandated by the Solid spec. As such, prefer [[getFile]] instead if you do not need the ACL.\n * ```\n *\n * @param url The URL of the fetched file\n * @param options Fetching options: a custom fetcher and/or headers.\n * @returns A file and its ACLs, if available to the authenticated user, as a blob.\n * @since 0.2.0\n */\nasync function getFileWithAcl(input, options = internal_defaultFetchOptions) {\n const file = await getFile(input, options);\n const acl = await internal_fetchAcl(file, options);\n return internal_setAcl(file, acl);\n}\n/**\n * Experimental: fetch a Resource's metadata and its associated Access Control List.\n *\n * This is an experimental function that fetches both a Resource's metadata, the linked ACL Resource (if\n * available), and the ACL that applies to it if the linked ACL Resource is not available (if accessible). This can\n * result in many HTTP requests being executed, in lieu of the Solid spec mandating servers to\n * provide this info in a single request.\n *\n * If the Resource's linked ACL Resource could not be fetched (because it does not exist, or because\n * the authenticated user does not have access to it), `acl.resourceAcl` will be `null`. If the\n * applicable Container's ACL is not accessible to the authenticated user, `acl.fallbackAcl` will be\n * `null`.\n *\n * @param url URL of the SolidDataset to fetch.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A Resource's metadata and the ACLs that apply to the Resource, if available to the authenticated user.\n */\nasync function getResourceInfoWithAcl(url, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfo(url, options);\n const acl = await internal_fetchAcl(resourceInfo, options);\n return internal_setAcl(resourceInfo, acl);\n}\nfunction getResourceAcl(resource) {\n if (!hasResourceAcl(resource)) {\n return null;\n }\n return resource.internal_acl.resourceAcl;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Verifies whether the given Resource has a fallback ACL (Access Control List) attached.\n *\n * A fallback ACL for a Resource is inherited from the Resource's parent Container\n * (or another of its ancestor Containers) and applies if the Resource does\n * not have its own resource ACL.\n *\n * The [[hasFallbackAcl]] function checks that:\n * - a given Resource has a fallback ACL attached, and\n * - the user calling [[hasFallbackAcl]] has Control access to the Container\n * from which the Resource inherits its ACL.\n *\n * To retrieve a Resource with its ACLs, see [[getSolidDatasetWithAcl]].\n *\n * @param resource A [[SolidDataset]] that might have a fallback ACL attached.\n *\n * @returns `true` if the Resource has a fallback ACL attached that is accessible to the user.\n */\nfunction hasFallbackAcl(resource) {\n return resource.internal_acl.fallbackAcl !== null;\n}\nfunction getFallbackAcl(dataset) {\n if (!hasFallbackAcl(dataset)) {\n return null;\n }\n return dataset.internal_acl.fallbackAcl;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Creates an empty resource ACL (Access Control List) for a given Resource.\n *\n * @param targetResource A Resource that does not have its own ACL yet (see [[hasResourceAcl]]).\n * @returns An empty resource ACL for the given Resource.\n */\nfunction createAcl(targetResource) {\n const emptyResourceAcl = freeze({\n ...createSolidDataset(),\n internal_accessTo: getSourceUrl(targetResource),\n internal_resourceInfo: {\n sourceIri: targetResource.internal_resourceInfo.aclUrl,\n isRawData: false,\n linkedResources: {},\n },\n });\n return emptyResourceAcl;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Creates a resource ACL (Access Control List), initialised from the fallback ACL\n * inherited from the given Resource's Container (or another of its ancestor Containers).\n * That is, the new ACL has the same rules/entries as the fallback ACL that currently\n * applies to the Resource.\n *\n * @param resource A Resource without its own resource ACL (see [[hasResourceAcl]]) but with an accessible fallback ACL (see [[hasFallbackAcl]]).\n * @returns A resource ACL initialised with the rules/entries from the Resource's fallback ACL.\n */\nfunction createAclFromFallbackAcl(resource) {\n const emptyResourceAcl = createAcl(resource);\n const fallbackAclRules = internal_getAclRules(resource.internal_acl.fallbackAcl);\n const defaultAclRules = internal_getDefaultAclRulesForResource(fallbackAclRules, resource.internal_acl.fallbackAcl.internal_accessTo);\n const newAclRules = defaultAclRules.map((rule) => {\n rule = removeAll(rule, acl.default);\n rule = removeAll(rule, acl.defaultForNew);\n rule = setIri(rule, acl.accessTo, getSourceUrl(resource));\n rule = setIri(rule, acl.default, getSourceUrl(resource));\n return rule;\n });\n // Iterate over every ACL Rule we want to import, inserting them into `emptyResourceAcl` one by one:\n const initialisedResourceAcl = newAclRules.reduce(setThing, emptyResourceAcl);\n return initialisedResourceAcl;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Saves the resource ACL for a Resource.\n *\n * @param resource The Resource to which the given resource ACL applies.\n * @param resourceAcl An [[AclDataset]] whose ACL Rules will apply to `resource`.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n */\nasync function saveAclFor(resource, resourceAcl, options = internal_defaultFetchOptions) {\n if (!hasAccessibleAcl(resource)) {\n throw new Error(`Could not determine the location of the ACL for the Resource at [${getSourceUrl(resource)}]; possibly the current user does not have Control access to that Resource. Try calling \\`hasAccessibleAcl()\\` before calling \\`saveAclFor()\\`.`);\n }\n const savedDataset = await saveSolidDatasetAt(resource.internal_resourceInfo.aclUrl, resourceAcl, options);\n const savedAclDataset = {\n ...savedDataset,\n internal_accessTo: getSourceUrl(resource),\n };\n return savedAclDataset;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes the resource ACL (Access Control List) from a Resource.\n *\n * Once the resource ACL is removed from the Resource, the Resource relies on the\n * fallback ACL inherited from the Resource's parent Container (or another of its ancestor Containers).\n *\n * @param resource The Resource for which you want to delete the ACL.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n */\nasync function deleteAclFor(resource, options = internal_defaultFetchOptions) {\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const response = await config.fetch(resource.internal_resourceInfo.aclUrl, {\n method: \"DELETE\",\n });\n if (!response.ok) {\n throw new Error(`Deleting the ACL of the Resource at [${getSourceUrl(resource)}] failed: [${response.status}] [${response.statusText}].`);\n }\n const storedResource = Object.assign(internal_cloneResource(resource), {\n acl: {\n resourceAcl: null,\n },\n });\n return storedResource;\n}\n/**\n * Given a [[SolidDataset]], verify whether its Access Control List is accessible to the current user.\n *\n * This should generally only be true for SolidDatasets fetched by\n * [[getSolidDatasetWithAcl]].\n *\n * Please note that the Web Access Control specification is not yet finalised, and hence, this\n * function is still experimental and can change in a non-major release.\n *\n * @param dataset A [[SolidDataset]].\n * @returns Whether the given `dataset` has a an ACL that is accessible to the current user.\n */\nfunction hasAccessibleAcl(dataset) {\n return typeof dataset.internal_resourceInfo.aclUrl === \"string\";\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns an Agent's explicitly-granted Access Modes for the given Resource.\n *\n * The function does not return Access Modes granted indirectly to the Agent through other\n * ACL rules, e.g., public or group-specific permissions.\n *\n * @param resourceInfo Information about the Resource to which the given Agent may have been granted access.\n * @param agent WebID of the Agent for which to retrieve what access it has to the Resource.\n * @returns Access Modes that have been explicitly granted to the Agent for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control access to a given Resource or its Container).\n */\nfunction getAgentAccess$5(resourceInfo, agent) {\n if (hasResourceAcl(resourceInfo)) {\n return getAgentResourceAccess(resourceInfo.internal_acl.resourceAcl, agent);\n }\n if (hasFallbackAcl(resourceInfo)) {\n return getAgentDefaultAccess(resourceInfo.internal_acl.fallbackAcl, agent);\n }\n return null;\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n * Returns all explicitly-granted Access Modes per Agent for the given Resource.\n *\n * The function does not return Access Modes granted indirectly to Agents through other\n * ACL rules, e.g., public or group-specific permissions.\n *\n * @param resourceInfo Information about the Resource to which Agents may have been granted access.\n * @returns Access Modes per Agent that have been explicitly granted for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control access to a given Resource or its Container).\n */\nfunction getAgentAccessAll$5(resourceInfo) {\n if (hasResourceAcl(resourceInfo)) {\n const resourceAcl = getResourceAcl(resourceInfo);\n return getAgentResourceAccessAll(resourceAcl);\n }\n if (hasFallbackAcl(resourceInfo)) {\n const fallbackAcl = getFallbackAcl(resourceInfo);\n return getAgentDefaultAccessAll(fallbackAcl);\n }\n return null;\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the Access Modes explicitly granted to an Agent for the Resource\n * associated with an ACL (Access ControlList).\n *\n * The function does not return:\n *\n * - Access Modes granted indirectly to the Agent through other ACL rules, e.g., public or group-specific permissions.\n * - Access Modes granted to the Agent for the child Resources if the associated Resource is a Container (see [[getAgentDefaultAccess]] instead).\n *\n * @param aclDataset The SolidDataset that contains ACL rules.\n * @param agent WebID of the Agent for which to retrieve what access it has to the Resource.\n * @returns Access Modes that have been explicitly granted to an Agent for the Resource associated with an ACL SolidDataset.\n */\nfunction getAgentResourceAccess(aclDataset, agent) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const agentResourceRules = getAgentAclRulesForAgent(resourceRules, agent);\n const agentAccessModes = agentResourceRules.map(internal_getAccess);\n return internal_combineAccessModes(agentAccessModes);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the explicitly granted Access Modes per Agent for the Resource associated\n * with an ACL (Access Control List).\n *\n * The function does not return:\n *\n * - Access Modes granted indirectly to Agents through other ACL rules, e.g., public or group-specific permissions.\n * - Access Modes granted to Agents for the child Resources if the associated Resource is a Container.\n *\n * @param aclDataset The SolidDataset that contains ACL rules.\n * @returns Access Modes per Agent that have been explicitly granted for the Resource associated with an ACL SolidDataset.\n */\nfunction getAgentResourceAccessAll(aclDataset) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const agentResourceRules = getAgentAclRules(resourceRules);\n return getAccessByAgent(agentResourceRules);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n * Modifies the resource ACL (Access Control List) to set the Access Modes for the given Agent.\n * Specifically, the function returns a new resource ACL initialised with the given ACL and\n * new rules for the Agent's access.\n *\n * If rules for Agent's access already exist in the given ACL, in the returned ACL,\n * they are replaced by the new rules.\n *\n * This function does not modify:\n *\n * - Access Modes granted indirectly to Agents through other ACL rules, e.g., public or group-specific permissions.\n * - Access Modes granted to Agents for the child Resources if the associated Resource is a Container.\n * - The original ACL.\n *\n * @param aclDataset The SolidDataset that contains Access-Control List rules.\n * @param agent The Agent to grant specific Access Modes.\n * @param access The Access Modes to grant to the Agent for the Resource.\n * @returns A new resource ACL initialised with the given `aclDataset` and `access` for the `agent`.\n */\nfunction setAgentResourceAccess$1(aclDataset, agent, access) {\n return internal_setActorAccess$2(aclDataset, access, acl.agent, \"resource\", agent);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns an Agent's Access Modes explicitly granted for the children of the\n * Container associated with the given ACL (Access Control List).\n *\n * The function does not return:\n * - Access Modes granted indirectly to the Agent through other ACL rules, e.g. public or group-specific permissions.\n * - Access Modes granted to the Agent for the Container Resource itself (see [[getAgentResourceAccess]] instead).\n *\n * @param aclDataset The SolidDataset that contains Access-Control List rules for a certain Container.\n * @param agent WebID of the Agent for which to retrieve what access it has to the Container's children.\n * @returns Access Modes that have been explicitly granted to an Agent for the children of the Container associated with the given ACL.\n */\nfunction getAgentDefaultAccess(aclDataset, agent) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const agentResourceRules = getAgentAclRulesForAgent(resourceRules, agent);\n const agentAccessModes = agentResourceRules.map(internal_getAccess);\n return internal_combineAccessModes(agentAccessModes);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the Access Modes, per Agent, that have been explicitly granted for the children\n * of the Container associated with the given ACL (Access Control List).\n *\n * The function does not return:\n *\n * - Access Modes granted indirectly to the Agents through other ACL rules, e.g. public or group-specific permissions.\n * - Access Modes granted to the Agents for the Container Resource itself (see [[getAgentResourceAccessAll]] instead).\n *\n * @param aclDataset The SolidDataset that contains Access-Control List rules.\n * @returns Access Modes, per Agent, that have been explicitly granted for the children of the Container associated with the given ACL.\n */\nfunction getAgentDefaultAccessAll(aclDataset) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const agentResourceRules = getAgentAclRules(resourceRules);\n return getAccessByAgent(agentResourceRules);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Modifies the default ACL (Access Control List) to set an Agent's Access Modes for the Container's children.\n * Specifically, the function returns a new default ACL initialised with the given ACL and\n * new rules for the Agent's access.\n *\n * If rules already exist for the Agent in the given ACL, in the returned ACL, they are replaced by the new rules.\n *\n * This function does not modify:\n * - Access Modes granted indirectly to the Agent through other ACL rules, e.g., public or group-specific permissions.\n * - Access Modes granted to the Agent for the Container Resource itself.\n * - The original ACL.\n *\n * @param aclDataset The SolidDataset that contains Access-Control List rules.\n * @param agent The Agent to grant specific Access Modes.\n * @param access The Access Modes to grant to the Agent.\n * @returns A new default ACL initialised with the given `aclDataset` and `access` for the `agent`.\n */\nfunction setAgentDefaultAccess(aclDataset, agent, access) {\n return internal_setActorAccess$2(aclDataset, access, acl.agent, \"default\", agent);\n}\nfunction getAgentAclRulesForAgent(aclRules, agent) {\n return internal_getAclRulesForIri(aclRules, agent, acl.agent);\n}\nfunction getAgentAclRules(aclRules) {\n return aclRules.filter(isAgentAclRule);\n}\nfunction isAgentAclRule(aclRule) {\n return getIri(aclRule, acl.agent) !== null;\n}\nfunction getAccessByAgent(aclRules) {\n return internal_getAccessByIri(aclRules, acl.agent);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note} This function is still experimental and subject to change, even in a non-major release.\n * ```\n * Returns a Group's explicity-granted Access Modes for a given Resource.\n *\n * The function does not return Access Modes granted indirectly to the Group through other\n * ACL rules, e.g., public permissions.\n *\n * @param resourceInfo Information about the Resource to which the given Group may have been granted access.\n * @param group URL of the Group for which to retrieve what access it has to the Resource.\n * @returns Access Modes that have been explicitly granted to the `group` for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control Access to a given Resource or its Container).\n */\nfunction getGroupAccess$2(resourceInfo, group) {\n if (hasResourceAcl(resourceInfo)) {\n return getGroupResourceAccess(resourceInfo.internal_acl.resourceAcl, group);\n }\n if (hasFallbackAcl(resourceInfo)) {\n return getGroupDefaultAccess(resourceInfo.internal_acl.fallbackAcl, group);\n }\n return null;\n}\n/**\n * ```{note} This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns all explicitly-granted Access Modes per Group for the given Resource.\n *\n * The function does not return Access Modes granted indirectly to the Group through other\n * ACL rules, e.g., public permissions.\n *\n * @param resourceInfo Information about the Resource to which the given Group may have been granted access.\n * @returns Access Modes per Group that have been explicitly granted for the given Resource, or `null` if it could not be determined (e.g. because the current user does not have Control Access to a given Resource or its Container).\n */\nfunction getGroupAccessAll$2(resourceInfo) {\n if (hasResourceAcl(resourceInfo)) {\n const resourceAcl = getResourceAcl(resourceInfo);\n return getGroupResourceAccessAll(resourceAcl);\n }\n if (hasFallbackAcl(resourceInfo)) {\n const fallbackAcl = getFallbackAcl(resourceInfo);\n return getGroupDefaultAccessAll(fallbackAcl);\n }\n return null;\n}\n/**\n * ```{note} This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the Access Modes explicitly granted to a Group for the Resource\n * associated with an ACL (Access Control List).\n *\n * The function does not return:\n * - Access Modes granted indirectly to the Group through other ACL rules, e.g., public permissions.\n * - Access Modes granted to the Group for the child Resources if the associated Resource is a Container\n * (see [[getGroupDefaultAccess]] instead).\n *\n * @param aclDataset The SolidDataset that contains Access Control List rules.\n * @param group URL of the Group for which to retrieve what access it has to the Resource.\n * @returns Access Modes explicitly granted to a Group for the Resource associated with an ACL.\n */\nfunction getGroupResourceAccess(aclDataset, group) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const groupResourceRules = getGroupAclRuleForGroup(resourceRules, group);\n const groupAccessModes = groupResourceRules.map(internal_getAccess);\n return internal_combineAccessModes(groupAccessModes);\n}\n/**\n * ```{note} This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the explicitly granted Access Modes per Group for the Resource associated\n * with an ACL (Access Control List).\n *\n * The function does not return:\n * - Access Modes granted indirectly to the Group through other ACL rules, e.g., public permissions.\n * - Access Modes granted to Groups for the child Resources if the associated Resource is a Container.\n *\n * @param aclDataset The SolidDataset that contains Access Control List rules.\n * @returns Access Modes per Group that have been explicitly granted for the Resource associated with an ACL.\n */\nfunction getGroupResourceAccessAll(aclDataset) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo);\n return getAccessByGroup(resourceRules);\n}\n/**\n * ```{note} This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns a Group's Access Modes explicitly granted for the children of the\n * Container associated with an ACL (Access ControlList).\n *\n * The function does not return:\n * - Access Modes granted indirectly to the Group through other ACL rules, e.g. public permissions.\n * - Access Modes granted to the Group for the Container Resource itself (see [[getGroupResourceAccess]] instead).\n *\n * @param aclDataset The SolidDataset that contains ACL rules for a certain Container.\n * @param group URL of the Group for which to retrieve what access it has to the child Resources of the given Container.\n * @returns Access Modes that have been explicitly granted to the Group for the children of the Container associated with the given ACL.\n */\nfunction getGroupDefaultAccess(aclDataset, group) {\n const allRules = internal_getAclRules(aclDataset);\n const defaultRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const groupDefaultRules = getGroupAclRuleForGroup(defaultRules, group);\n const groupAccessModes = groupDefaultRules.map(internal_getAccess);\n return internal_combineAccessModes(groupAccessModes);\n}\n/**\n * ```{note} This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the Access Modes, per Group, that have been explicitly granted for the children\n * of the Container associated with the given ACL (Access Control List).\n *\n * The function does not return:\n * - Access Modes granted indirectly to the Groups through other ACL rules, e.g. public permissions.\n * - Access Modes granted to the Groups for the Container Resource itself (see [[getGroupResourceAccessAll]] instead).\n *\n * @param aclDataset The SolidDataset that contains Access Control List rules for a certain Container.\n * @returns Access Modes per Group that have been explicitly granted for the children of the Container associated with the given ACL SolidDataset.\n */\nfunction getGroupDefaultAccessAll(aclDataset) {\n const allRules = internal_getAclRules(aclDataset);\n const defaultRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo);\n return getAccessByGroup(defaultRules);\n}\nfunction getGroupAclRuleForGroup(rules, group) {\n return internal_getAclRulesForIri(rules, group, acl.agentGroup);\n}\nfunction getAccessByGroup(aclRules) {\n return internal_getAccessByIri(aclRules, acl.agentGroup);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n * Modifies the resource ACL (Access Control List) to set the Access Modes for the given Group.\n * Specifically, the function returns a new resource ACL initialised with the given ACL and\n * new rules for the Group's access.\n *\n * If rules for Groups's access already exist in the given ACL, in the returned ACL,\n * they are replaced by the new rules.\n *\n * This function does not modify:\n *\n * - Access Modes granted indirectly to Groups through other ACL rules, e.g., public or Agent-specific permissions.\n * - Access Modes granted to Groups for the child Resources if the associated Resource is a Container.\n * - The original ACL.\n *\n * @param aclDataset The SolidDataset that contains Access-Control List rules.\n * @param group The Group to grant specific Access Modes.\n * @param access The Access Modes to grant to the Group for the Resource.\n * @returns A new resource ACL initialised with the given `aclDataset` and `access` for the `group`.\n * @since 1.4.0\n */\nfunction setGroupResourceAccess$1(aclDataset, group, access) {\n return internal_setActorAccess$2(aclDataset, access, acl.agentGroup, \"resource\", group);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Modifies the default ACL (Access Control List) to set a Group's Access Modes for the Container's children.\n * Specifically, the function returns a new default ACL initialised with the given ACL and\n * new rules for the Group's access.\n *\n * If rules already exist for the Group in the given ACL, in the returned ACL, they are replaced by the new rules.\n *\n * This function does not modify:\n * - Access Modes granted indirectly to the Group through other ACL rules, e.g., public or Agent-specific permissions.\n * - Access Modes granted to the Group for the Container Resource itself.\n * - The original ACL.\n *\n * @param aclDataset The SolidDataset that contains Access-Control List rules.\n * @param group The Group to grant specific Access Modes.\n * @param access The Access Modes to grant to the Group.\n * @returns A new default ACL initialised with the given `aclDataset` and `access` for the `group`.\n * @since 1.4.0\n */\nfunction setGroupDefaultAccess(aclDataset, group, access) {\n return internal_setActorAccess$2(aclDataset, access, acl.agentGroup, \"default\", group);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the Access Modes granted to the public in general for a Resource.\n *\n * This function does not return Access Modes granted to specific Agents\n * through other ACL (Access Control List) rules, e.g., agent- or group-specific permissions.\n *\n * @param resourceInfo Information about the Resource to which the given Agent may have been granted access.\n * @returns Access Modes granted to the public in general for the Resource, or `null` if it could not be determined (e.g. because the current user does not have Control Access to a given Resource or its Container).\n */\nfunction getPublicAccess$5(resourceInfo) {\n if (hasResourceAcl(resourceInfo)) {\n return getPublicResourceAccess(resourceInfo.internal_acl.resourceAcl);\n }\n if (hasFallbackAcl(resourceInfo)) {\n return getPublicDefaultAccess(resourceInfo.internal_acl.fallbackAcl);\n }\n return null;\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the Access Modes granted to the public in general for the Resource\n * associated with an ACL (Access Control List).\n *\n * This function does not return:\n * - Access Modes granted to specific Agents through other ACL rules, e.g., agent- or group-specific permissions.\n * - Access Modes to child Resources if the associated Resource is a Container (see [[getPublicDefaultAccess]] instead).\n *\n * @param aclDataset The SolidDataset that contains Access Control List rules.\n * @returns Access Modes granted to the public in general for the Resource associated with the `aclDataset`.\n */\nfunction getPublicResourceAccess(aclDataset) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getResourceAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const publicResourceRules = getClassAclRulesForClass(resourceRules, foaf.Agent);\n const publicAccessModes = publicResourceRules.map(internal_getAccess);\n return internal_combineAccessModes(publicAccessModes);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Returns the Access Modes granted to the public in general for the child Resources\n * of the Container associated with an ACL (Access Control List).\n *\n * This function does not return:\n * - Access Modes granted to Agents through other ACL rules, e.g., agent- or group-specific permissions.\n * - Access Modes to the Container Resource itself (see [[getPublicResourceAccess]] instead).\n *\n * @param aclDataset The SolidDataset that contains Access Control List rules for a certain Container.\n * @returns Access Modes granted to the public in general for the children of the Container associated with the given `aclDataset`.\n */\nfunction getPublicDefaultAccess(aclDataset) {\n const allRules = internal_getAclRules(aclDataset);\n const resourceRules = internal_getDefaultAclRulesForResource(allRules, aclDataset.internal_accessTo);\n const publicResourceRules = getClassAclRulesForClass(resourceRules, foaf.Agent);\n const publicAccessModes = publicResourceRules.map(internal_getAccess);\n return internal_combineAccessModes(publicAccessModes);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Modifies the resource ACL (Access Control List) to set the Access Modes for the public.\n * Specifically, the function returns a new resource ACL (Access Control List) initialised\n * with the given resource ACL and new rules for the given public access.\n *\n * If rules for public access already exist in the given ACL, in the *returned* ACL,\n * they are replaced by the new rules.\n *\n * This function does not modify:\n * - Access Modes granted to Agents through other ACL rules, e.g., agent- or group-specific permissions.\n * - Access Modes to child Resources if the associated Resource is a Container.\n * - The original ACL.\n *\n * @param aclDataset The SolidDataset that contains Access Control List rules.\n * @param access The Access Modes to grant to the public.\n * @returns A new resource ACL initialised with the given `aclDataset` and public `access`.\n */\nfunction setPublicResourceAccess$1(aclDataset, access) {\n return internal_setActorAccess$2(aclDataset, access, acl.agentClass, \"resource\", foaf.Agent);\n}\n/**\n * ```{note}\n * This function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Modifies the default ACL (Access Control List) to set the public's default Access Modes\n * to child resources. Specifically, the function returns a new default ACL initialised\n * with the given default ACL and new rules for the given public access.\n *\n * If rules for public access already exist in the given ACL, in the *returned* ACL,\n * they are replaced by the new rules.\n *\n * This function does not modify:\n * - Access Modes granted to Agents through other ACL rules, e.g., agent- or group-specific permissions.\n * - Access Modes to Container Resource itself.\n * - The original ACL.\n *\n * @param aclDataset The SolidDataset that contains Access Control List rules.\n * @param access The Access Modes to grant to the public.\n * @returns A new default ACL initialised with the given `aclDataset` and public `access`.\n */\nfunction setPublicDefaultAccess(aclDataset, access) {\n return internal_setActorAccess$2(aclDataset, access, acl.agentClass, \"default\", foaf.Agent);\n}\nfunction getClassAclRulesForClass(aclRules, agentClass) {\n return aclRules.filter((rule) => appliesToClass(rule, agentClass));\n}\nfunction appliesToClass(aclRule, agentClass) {\n return getIriAll(aclRule, acl.agentClass).includes(agentClass);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction setMockAclUrl(resource, aclUrl) {\n const resourceWithAclUrl = Object.assign(internal_cloneResource(resource), {\n internal_resourceInfo: {\n ...resource.internal_resourceInfo,\n aclUrl,\n },\n });\n return resourceWithAclUrl;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests** that\n * require a [[SolidDataset]] with a resource ACL (Access Control List).\n * ```\n *\n * Initialises a new empty ACL and attaches it to a given [[SolidDataset]] for use\n * in **unit tests**; e.g., unit tests that call [[getResourceAcl]].\n *\n * @param resource The Resource to mock up with a new resource ACL.\n * @returns The input Resource with an empty resource ACL attached.\n * @since 0.2.0\n */\nfunction addMockResourceAclTo(resource) {\n var _a;\n const aclUrl = (_a = resource.internal_resourceInfo.aclUrl) !== null && _a !== void 0 ? _a : \"https://your.pod/mock-acl.ttl\";\n const resourceWithAclUrl = Object.assign(internal_cloneResource(resource), {\n internal_resourceInfo: {\n ...resource.internal_resourceInfo,\n aclUrl,\n },\n });\n const aclDataset = createAcl(resourceWithAclUrl);\n const resourceWithResourceAcl = internal_setAcl(resourceWithAclUrl, {\n resourceAcl: aclDataset,\n fallbackAcl: null,\n });\n return resourceWithResourceAcl;\n}\n/**\n *\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests** that require a\n * [[SolidDataset]] with a fallback ACL (Access Control List).\n * ```\n *\n * Initialises a new empty fallback ACL and attaches it to a given [[SolidDataset]] for use\n * in **unit tests**; e.g., unit tests that call [[getFallbackAcl]].\n *\n * @param resource The Resource to mock up with new fallback ACL.\n * @returns The input Resource with an empty fallback ACL attached.\n * @since 0.2.0\n */\nfunction addMockFallbackAclTo(resource) {\n const containerUrl = internal_getContainerPath(getSourceIri(resource));\n const aclUrl = `${containerUrl}.acl`;\n const mockContainer = setMockAclUrl(mockContainerFrom(containerUrl), aclUrl);\n const aclDataset = createAcl(mockContainer);\n const resourceWithFallbackAcl = internal_setAcl(internal_cloneResource(resource), {\n resourceAcl: null,\n fallbackAcl: aclDataset,\n });\n return resourceWithFallbackAcl;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction getProfileFromProfileDoc(profileDataset, webId) {\n const profile = getThing(profileDataset, webId);\n if (profile === null) {\n throw new Error(`Profile document [${getSourceUrl(profileDataset)}] does not include WebID [${webId}]`);\n }\n return profile;\n}\n/**\n * Set a JWKS IRI associated with a WebID in a profile document.\n *\n * @param profileDocument The profile document dataset.\n * @param webId The WebID associated with the profile document.\n * @param jwksIri The JWKS IRI to be set.\n * @returns A modified copy of the profile document, with the JWKS IRI set.\n * @since 1.12.0\n */\nfunction setProfileJwks(profileDocument, webId, jwksIri) {\n return setThing(profileDocument, setIri(getProfileFromProfileDoc(profileDocument, webId), security.publicKey, jwksIri));\n}\n/**\n * Look for a JWKS IRI optionally advertized from a profile document.\n *\n * @param profileDocument The profile document.\n * @param webId The WebID featured in the profile document.\n * @returns The JWKS IRI associated with the WebID, if any.\n * @since 1.12.0\n */\nfunction getProfileJwksIri(profileDocument, webId) {\n return getUrl(getProfileFromProfileDoc(profileDocument, webId), security.publicKey);\n}\nconst isJwks = (jwksDocument) => {\n return typeof jwksDocument.keys !== \"undefined\";\n};\n/**\n * Fetch a JWKS at a given IRI, and add the given JWK to the obtained key set.\n *\n * @param jwk The JWK to add to the set.\n * @param jwksIri The IRI where the key set should be looked up.\n * @param options @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns Promise resolving to a JWKS where the given key has been added.\n * @since 1.12.0\n */\nasync function addJwkToJwks(jwk, jwksIri, options = internal_defaultFetchOptions) {\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const jwksResponse = await config.fetch(jwksIri);\n if (!jwksResponse.ok) {\n throw new Error(`Fetching [${jwksIri}] returned an error: ${jwksResponse.status} ${jwksResponse.statusText}`);\n }\n try {\n const jwksDocument = await jwksResponse.json();\n if (!isJwks(jwksDocument)) {\n throw new Error(`[${jwksIri}] does not dereference to a valid JWKS: ${JSON.stringify(jwksDocument)}`);\n }\n return {\n keys: [...jwksDocument.keys, jwk],\n };\n }\n catch (e) {\n throw new Error(`Parsing the document at [${jwksIri}] failed: ${e}`);\n }\n}\n/**\n * Adds a public key to the JWKS listed in the profile associated to the given WebID.\n * Retrieves the profile document for the specified WebID and looks up the associated\n * JWKS. Having added the given key to the JWKS, this function overwrites the\n * previous JWKS so that the new version is saved. This assumes the JWKS is hosted\n * at a read-write IRI, such as in a Solid Pod.\n *\n * @param publicKey The public key value to set.\n * @param webId The WebID whose profile document references the key set to which we wish to add the specified public key.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @since 1.12.0\n */\nasync function addPublicKeyToProfileJwks(publicKey, webId, options = internal_defaultFetchOptions) {\n const profileDataset = await getSolidDataset(webId, {\n fetch: options.fetch,\n });\n if (profileDataset === null) {\n throw new Error(`The profile document associated with WebID [${webId}] could not be retrieved.`);\n }\n const jwksIri = getProfileJwksIri(profileDataset, webId);\n if (jwksIri === null) {\n throw new Error(`No key set is declared for the property [${security.publicKey}] in the profile of [${webId}]`);\n }\n const updatedJwks = await addJwkToJwks(publicKey, jwksIri, options);\n return overwriteFile(jwksIri, new Blob([JSON.stringify(updatedJwks)]), {\n contentType: \"application/json\",\n fetch: options.fetch,\n });\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * List all the alternative profiles IRI found in a given WebID profile.\n *\n * Note that some of these profiles may be private, and you may not have access to\n * the resulting resource.\n *\n * @param webId The WebID of the user's whose alternative profiles you are discovering.\n * @param webIdProfile The WebID profile obtained dereferencing the provided WebID.\n * @returns A list of URLs of the user's alternative profiles.\n * @since 1.20.0\n */\nfunction getAltProfileUrlAllFrom(webId, webIdProfile) {\n const webIdThing = getThing(webIdProfile, webId);\n const altProfileUrlAll = getThingAll(webIdProfile)\n .filter((thing) => getIriAll(thing, foaf.primaryTopic).length > 0)\n .map(asIri)\n .concat(webIdThing ? getIriAll(webIdThing, rdfs.seeAlso) : [])\n .concat(webIdThing ? getIriAll(webIdThing, foaf.isPrimaryTopicOf) : [])\n .filter((profileIri) => profileIri !== getSourceIri(webIdProfile));\n // Deduplicate the results.\n return Array.from(new Set(altProfileUrlAll));\n}\nasync function getProfileAll(webId, options = internal_defaultFetchOptions) {\n var _a, _b;\n const authFetch = (_a = options.fetch) !== null && _a !== void 0 ? _a : fetch;\n const webIdProfile = (_b = options.webIdProfile) !== null && _b !== void 0 ? _b : (await getSolidDataset(webId, {\n // This should always use an unauthenticated fetch.\n fetch: fetch,\n }));\n const altProfileAll = (await Promise.allSettled(getAltProfileUrlAllFrom(webId, webIdProfile).map((uniqueProfileIri) => getSolidDataset(uniqueProfileIri, { fetch: authFetch }))))\n // Ignore the alternative profiles lookup which failed.\n .filter((result) => result.status === \"fulfilled\")\n .map((successfulResult) => successfulResult.value);\n return {\n webIdProfile,\n altProfileAll,\n };\n}\n/**\n * Discover the Pods an agent advertises for in their profile resources. Both the\n * agent's WebID and alternative profiles are fetched. Note that this function will\n * only return URLs of Pods linked to using the `pim:storage`, i.e. a triple\n * looking like should appear in the profile\n * resources.\n *\n * @param webId The WebID of the agent whose Pods should be discovered\n * @param options Optional parameter\n * - `options.fetch`: An alternative `fetch` function to make the HTTP request,\n * compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns a Promise resolving to an array containing the URLs of all the Pods\n * linked from the agent's profile resource using the `pim:storage` predicate.\n * @since 1.18.0\n */\nasync function getPodUrlAll(webId, options = internal_defaultFetchOptions) {\n const profiles = await getProfileAll(webId, options);\n return getPodUrlAllFrom(profiles, webId);\n}\n/**\n * Discover the Pods advertised for in the provided profile resources. Note that\n * this function will only return URLs of Pods linked to using the `pim:storage`\n * predicate, i.e. a triple looking like \n * should appear in the profile resources.\n *\n * @param profiles The profile resources in which the Pods should be discovered\n * @param webId The WebID of the agent whose Pods should be discovered\n * @returns An array containing the URLs of all the Pods linked from the agent's\n * profile resource using the `pim:storage` predicate.\n * @since 1.18.0\n */\nfunction getPodUrlAllFrom(profiles, webId) {\n const result = new Set();\n [profiles.webIdProfile, ...profiles.altProfileAll].forEach((profileResource) => {\n const webIdThing = getThing(profileResource, webId);\n if (webIdThing !== null) {\n getIriAll(webIdThing, pim.storage).forEach((podIri) => result.add(podIri));\n }\n });\n return Array.from(result);\n}\n/**\n * Get the WebID Profile document dataset.\n *\n * @example\n * ```\n * const webId = \"https://example.org/people/me\";\n * const profile = await getWebIdDataset(webId);\n * const podRoot = getPodUrlAllFrom({ webIdProfile: profile, altProfileAll: [] }, webId);\n * const profileThing = getThing(profile, webId);\n * const name = getStringNoLocale(profileThing, FOAF.name);\n * ```\n *\n * @param webId The WebID of the agent whose WebID Profile dataset is to be fetched.\n * @returns a SolidDataset for the WebID Profile document.\n * @since 1.24.0\n */\nasync function getWebIdDataset(webId) {\n return getSolidDataset(webId, { fetch: fetch });\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction internal_getAcr(resource) {\n if (!hasAccessibleAcr(resource)) {\n throw new Error(`An Access Control Resource for [${getSourceUrl(resource)}] is not available. This could be because the current user is not allowed to see it, or because their Pod Server does not support Access Control Resources.`);\n }\n return resource.internal_acp.acr;\n}\n/** @hidden */\nfunction internal_setAcr(resource, acr) {\n return Object.assign(internal_cloneResource(resource), {\n internal_acp: {\n ...resource.internal_acp,\n acr,\n },\n });\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Initialise a new [[Control]].\n * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly.\n * @deprecated\n */\nfunction internal_createControl(options) {\n let control = createThing(options);\n control = setIri(control, rdf.type, acp.AccessControl);\n return control;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Find an [[Control]] with a given URL in a given Resource with an Access Control Resource.\n *\n * @returns The requested Access Control, or `null` if it could not be found.\n * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly.\n * @deprecated\n */\nfunction internal_getControl(withAccessControlResource, url, options) {\n const acr = internal_getAcr(withAccessControlResource);\n const foundThing = getThing(acr, url, options);\n if (foundThing === null ||\n !getIriAll(foundThing, rdf.type).includes(acp.AccessControl)) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get all [[Control]]s in the Access Control Resource of a given Resource.\n * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly.\n * @deprecated\n */\nfunction internal_getControlAll(withAccessControlResource, options) {\n const acr = internal_getAcr(withAccessControlResource);\n const foundThings = getThingAll(acr, options);\n const explicitAccessControl = foundThings.filter((foundThing) => getIriAll(foundThing, rdf.type).includes(acp.AccessControl));\n const implicitAccessControl = foundThings\n .filter((foundThing) => getIriAll(foundThing, acp.accessControl).length > 0)\n .map((thingWithAccessControl) => {\n // The initial filter ensures that at least one AccessControl will be found.\n const controlIri = getIriAll(thingWithAccessControl, acp.accessControl)[0];\n // The found control is only an object in the current dataset, so we create the\n // associated thing in order to possibly make it a subject.\n return createThing({ url: controlIri });\n });\n return explicitAccessControl.concat(implicitAccessControl);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert an [[Control]] into the [[AccessControlResource]] of a Resource, replacing previous\n * instances of that Access Control.\n *\n * @param withAccessControlResource A Resource with the Access Control Resource into which to insert an Access Control.\n * @param control The Control to insert into the Access Control Resource.\n * @returns The given Resource with a new Access Control Resource equal to the original Access Control Resource, but with the given Access Control.\n * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly.\n * @deprecated\n */\nfunction internal_setControl(withAccessControlResource, control) {\n const acr = internal_getAcr(withAccessControlResource);\n const updatedAcr = setThing(acr, control);\n const updatedResource = internal_setAcr(withAccessControlResource, updatedAcr);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a [[Policy]] to an [[Control]] such that that Policy applies to the Resource to which\n * the [[Control]] is linked.\n *\n * @param accessControl The [[Control]] to which the Policy should be added.\n * @param policyUrl URL of the Policy that should apply to the Resource to which the [[Control]] is linked.\n * @returns A new [[Control]] equal to the given [[Control]], but with the given policy added to it.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_addPolicyUrl(accessControl, policyUrl) {\n return addIri(accessControl, acp.apply, policyUrl);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get all Policies that apply to the Resource to which the given [[Control]] is linked, and\n * which can be removed by anyone with Write access to the Access Control Resource that contains the\n * [[Control]].\n *\n * @param accessControl The [[Control]] of which to get the Policies.\n * @returns The Policies that are listed in this [[Control]] as applying to the Resource it is linked to, and as removable by anyone with Write access to the Access Control Resource.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_getPolicyUrlAll(accessControl) {\n return getIriAll(accessControl, acp.apply);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove a given Policy that applies to the Resource to which the given [[Control]] is linked,\n * and which can be removed by anyone with Write access to the Access Control Resource that contains\n * the Access Control.\n *\n * @param accessControl The [[Control]] of which to remove the Policies.\n * @param policyUrl URL of the Policy that should no longer apply to the Resource to which the [[Control]] is linked.\n * @returns A new [[Control]] equal to the given [[Control]], but with the given Policy removed from it.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_removePolicyUrl(accessControl, policyUrl) {\n return removeIri(accessControl, acp.apply, policyUrl);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove all Policies that apply to the Resource to which the given [[Control]] is linked, and\n * which can be removed by anyone with Write access to the Access Control Resource that contains the\n * [[Control]].\n *\n * @param accessControl The [[Control]] of which to remove the Policies.\n * @returns A new [[Control]] equal to the given [[Control]], but with all Policies removed from it.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_removePolicyUrlAll(accessControl) {\n return removeAll(accessControl, acp.apply);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a [[Policy]] to an [[Control]] such that that Policy applies to the children of the\n * Resource to which the [[Control]] is linked.\n *\n * @param accessControl The [[Control]] to which the Policy should be added.\n * @param policyUrl URL of the Policy that should apply to the children of the Resource to which the [[Control]] is linked.\n * @returns A new [[Control]] equal to the given [[Control]], but with the given policy added to it as a Member Policy.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_addMemberPolicyUrl(accessControl, policyUrl) {\n return addIri(accessControl, acp.applyMembers, policyUrl);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get all Policies that apply to the children of the Resource to which the given [[Control]] is\n * linked, and which can be removed by anyone with Write access to the Access Control Resource that\n * contains the [[Control]].\n *\n * @param accessControl The [[Control]] of which to get the Policies.\n * @returns The Policies that are listed in this [[Control]] as applying to the children of the Resource it is linked to, and as removable by anyone with Write access to the Access Control Resource.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_getMemberPolicyUrlAll(accessControl) {\n return getIriAll(accessControl, acp.applyMembers);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove a given Policy that applies to the children of the Resource to which the given Access\n * Control is linked, and which can be removed by anyone with Write access to the Access Control\n * Resource that contains the Access Control.\n *\n * @param accessControl The [[Control]] of which to remove the Member Policy.\n * @param policyUrl URL of the Member Policy that should no longer apply to the Resource to which the [[Control]] is linked.\n * @returns A new [[Control]] equal to the given [[Control]], but with the given Member Policy removed from it.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_removeMemberPolicyUrl(accessControl, policyUrl) {\n return removeIri(accessControl, acp.applyMembers, policyUrl);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove all Policies that apply to the children of the Resource to which the given Access Control\n * is linked, and which can be removed by anyone with Write access to the Access Control Resource\n * that contains the Access Control.\n *\n * @param accessControl The [[Control]] of which to remove the Member Policies.\n * @returns A new [[Control]] equal to the given [[Control]], but with all Member Policies removed from it.\n * @hidden Developers don't need to care about working with Controls - they can just add Policies to the Resource directly.\n * @deprecated\n */\nfunction internal_removeMemberPolicyUrlAll(accessControl) {\n return removeAll(accessControl, acp.applyMembers);\n}\nfunction internal_getInitialisedControl(resourceWithAcr) {\n const allControls = internal_getControlAll(resourceWithAcr);\n return allControls.length === 0 ? internal_createControl() : allControls[0];\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a Resource, check whether it is governed by Access Policies.\n * (Specifically, a Resource that is governed by Access Policies will refer to exactly one Access\n * Control Resource, and expose that to users who are allowed to see or modify access to the given\n * Resource.)\n *\n * @param resource Resource which may or may not be governed by Access Policies.\n * @returns True if the Resource refers to an Access Control Resource and is hence governed by Access Policies, or false if it does not.\n * @since 1.6.0\n */\nfunction hasLinkedAcr(resource) {\n return (hasServerResourceInfo(resource) &&\n Array.isArray(resource.internal_resourceInfo.linkedResources[acp.accessControl]) &&\n resource.internal_resourceInfo.linkedResources[acp.accessControl].length ===\n 1);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a [[Policy]] to an Access Control Resource such that that [[Policy]] applies to the Access\n * Control Resource itself, rather than the Resource it governs.\n *\n * @param resourceWithAcr The Resource with an Access Control Resource to which the ACR Policy should be added.\n * @param policyUrl URL of the Policy that should apply to the given Access Control Resource.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given ACR Policy added to it.\n * @since 1.6.0\n */\nfunction addAcrPolicyUrl$1(resourceWithAcr, policyUrl) {\n var _a;\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n let acrThing = (_a = getThing(acr, acrUrl)) !== null && _a !== void 0 ? _a : createThing({ url: acrUrl });\n acrThing = addIri(acrThing, acp.access, policyUrl);\n const updatedAcr = setThing(acr, acrThing);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a [[Policy]] to a Resource's Access Control Resource such that that\n * Policy applies to the Access Control Resources of child Resources.\n *\n * @param resourceWithAcr The Resource with an Access Control Resource to which the ACR Policy should be added.\n * @param policyUrl URL of the Policy that should apply to the given Access Control Resources of children of the Resource.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given ACR Policy added to it.\n * @since 1.6.0\n */\nfunction addMemberAcrPolicyUrl$1(resourceWithAcr, policyUrl) {\n var _a;\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n let acrThing = (_a = getThing(acr, acrUrl)) !== null && _a !== void 0 ? _a : createThing({ url: acrUrl });\n acrThing = addIri(acrThing, acp.accessMembers, policyUrl);\n const updatedAcr = setThing(acr, acrThing);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the URLs of the Access Policies that apply to an Access Control Resource itself, rather than\n * to the Resource it governs.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to it.\n * @returns URLs of the Policies that govern access to the given Access Control Resource.\n * @since 1.6.0\n */\nfunction getAcrPolicyUrlAll$1(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const acrThing = getThing(acr, acrUrl);\n if (acrThing === null) {\n return [];\n }\n return getIriAll(acrThing, acp.access);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the URLs of the Access Policies that apply to the Access Control Resources of the Resource's\n * children.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to its children.\n * @returns URLs of the Policies that govern access to the Access Control Resources of the given Resource's children.\n * @since 1.6.0\n */\nfunction getMemberAcrPolicyUrlAll$1(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const acrThing = getThing(acr, acrUrl);\n if (acrThing === null) {\n return [];\n }\n return getIriAll(acrThing, acp.accessMembers);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop the URL of a given [[Policy]] from applying to an Access Control Resource itself.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource to which the given URL of a Policy should no longer apply.\n * @param policyUrl The URL of the Policy that should no longer apply.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given ACR Policy removed from it.\n * @since 1.6.0\n */\nfunction removeAcrPolicyUrl$1(resourceWithAcr, policyUrl) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const acrThing = getThing(acr, acrUrl);\n if (acrThing === null) {\n return resourceWithAcr;\n }\n const updatedAcrThing = removeIri(acrThing, acp.access, policyUrl);\n const updatedAcr = setThing(acr, updatedAcrThing);\n return internal_setAcr(resourceWithAcr, updatedAcr);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop the URL of a given [[Policy]] from applying to the Access Control Resources of the\n * Resource's children.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource to whose children's ACRs the given URL of a Policy should no longer apply.\n * @param policyUrl The URL of the Policy that should no longer apply.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given member ACR Policy removed from it.\n * @since 1.6.0\n */\nfunction removeMemberAcrPolicyUrl$1(resourceWithAcr, policyUrl) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const acrThing = getThing(acr, acrUrl);\n if (acrThing === null) {\n return resourceWithAcr;\n }\n const updatedAcrThing = removeIri(acrThing, acp.accessMembers, policyUrl);\n const updatedAcr = setThing(acr, updatedAcrThing);\n return internal_setAcr(resourceWithAcr, updatedAcr);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop all URL of Access Policies from applying to an Access Control Resource itself.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource to which no more Policies should apply.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to it.\n * @since 1.6.0\n */\nfunction removeAcrPolicyUrlAll(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const acrThing = getThing(acr, acrUrl);\n if (acrThing === null) {\n return resourceWithAcr;\n }\n const updatedAcrThing = removeAll(acrThing, acp.access);\n const updatedAcr = setThing(acr, updatedAcrThing);\n return internal_setAcr(resourceWithAcr, updatedAcr);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop all URL of Access Policies from applying to the Access Control Resources of the Resource's\n * children.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource that should no longer apply Policies to its children's ACRs.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to its children's ACRs.\n * @since 1.6.0\n */\nfunction removeMemberAcrPolicyUrlAll(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const acrThing = getThing(acr, acrUrl);\n if (acrThing === null) {\n return resourceWithAcr;\n }\n const updatedAcrThing = removeAll(acrThing, acp.accessMembers);\n const updatedAcr = setThing(acr, updatedAcrThing);\n return internal_setAcr(resourceWithAcr, updatedAcr);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a [[Policy]] to an Access Control Resource such that that [[Policy]] applies to that Resource.\n *\n * @param resourceWithAcr The Resource to which the ACR Policy should be added.\n * @param policyUrl URL of the Policy that should apply to the given Resource.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given Policy added to it.\n * @since 1.6.0\n */\nfunction addPolicyUrl$1(resourceWithAcr, policyUrl) {\n const control = internal_getInitialisedControl(resourceWithAcr);\n const updatedControl = internal_addPolicyUrl(control, policyUrl);\n const updatedResource = internal_setControl(resourceWithAcr, updatedControl);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a [[Policy]] to a Resource's Access Control Resource such that that\n * Policy applies to that Resource's children.\n *\n * @param resourceWithAcr The Resource to whose Access Control Resource the Policy should be added.\n * @param policyUrl URL of the Policy that should apply to the given Resource's children.\n * @returns A new Resource equal to the given Resource, but with the given Member Policy added to its Access Control Resource.\n * @since 1.6.0\n */\nfunction addMemberPolicyUrl$1(resourceWithAcr, policyUrl) {\n const control = internal_getInitialisedControl(resourceWithAcr);\n const updatedControl = internal_addMemberPolicyUrl(control, policyUrl);\n const updatedResource = internal_setControl(resourceWithAcr, updatedControl);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the URLs of the Access Policies that apply to a Resource.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to it.\n * @returns URLs of the Policies that govern access to the given Resource.\n * @since 1.6.0\n */\nfunction getPolicyUrlAll$1(resourceWithAcr) {\n const controls = internal_getControlAll(resourceWithAcr);\n const policyUrlsByControl = controls.map((control) => internal_getPolicyUrlAll(control));\n const uniquePolicyUrls = new Set();\n policyUrlsByControl.forEach((policyUrls) => {\n policyUrls.forEach((url) => uniquePolicyUrls.add(url));\n });\n return Array.from(uniquePolicyUrls);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the URLs of the Access Policies that apply to a Resource's children.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource of which to get the URLs of the Policies that govern access to its children.\n * @returns URLs of the Policies that govern access to the given Resource's children.\n * @since 1.6.0\n */\nfunction getMemberPolicyUrlAll$1(resourceWithAcr) {\n const controls = internal_getControlAll(resourceWithAcr);\n const memberPolicyUrlsByControl = controls.map((control) => internal_getMemberPolicyUrlAll(control));\n const uniquePolicyUrls = new Set();\n memberPolicyUrlsByControl.forEach((policyUrls) => {\n policyUrls.forEach((url) => uniquePolicyUrls.add(url));\n });\n return Array.from(uniquePolicyUrls);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop the URL of a given [[Policy]] from applying to a Resource.\n *\n * @param resourceWithAcr The Resource, with its Access Control Resource, to which the given URL of a Policy should no longer apply.\n * @param policyUrl The URL of the Policy that should no longer apply.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given Policy removed from it.\n * @since 1.6.0\n */\nfunction removePolicyUrl$1(resourceWithAcr, policyUrl) {\n const controls = internal_getControlAll(resourceWithAcr);\n const updatedControls = controls.map((control) => internal_removePolicyUrl(control, policyUrl));\n const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop the URL of a given [[Policy]] from applying to the Resource's children.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource to whose children the given URL of a Policy should no longer apply.\n * @param policyUrl The URL of the Policy that should no longer apply.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but with the given Member Policy removed from it.\n * @since 1.6.0\n */\nfunction removeMemberPolicyUrl$1(resourceWithAcr, policyUrl) {\n const controls = internal_getControlAll(resourceWithAcr);\n const updatedControls = controls.map((control) => internal_removeMemberPolicyUrl(control, policyUrl));\n const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop all URL of Access Policies from applying to a Resource.\n *\n * @param resourceWithAcr The Resource, with its Access Control Resource, to which no more Policies should apply.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to the Resource.\n * @since 1.6.0\n */\nfunction removePolicyUrlAll(resourceWithAcr) {\n const controls = internal_getControlAll(resourceWithAcr);\n const updatedControls = controls.map((control) => internal_removePolicyUrlAll(control));\n const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr);\n return updatedResource;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Stop all URL of Access Policies from applying to the Resource's children.\n *\n * @param resourceWithAcr The Resource with the Access Control Resource that should no longer apply Policies to its children.\n * @returns A Resource with a new Access Control Resource equal to the original ACR, but without any Policy applying to the Resource's children.\n * @since 1.6.0\n */\nfunction removeMemberPolicyUrlAll(resourceWithAcr) {\n const controls = internal_getControlAll(resourceWithAcr);\n const updatedControls = controls.map((control) => internal_removeMemberPolicyUrlAll(control));\n const updatedResource = updatedControls.reduce(internal_setControl, resourceWithAcr);\n return updatedResource;\n}\n/**\n * Gets a human-readable representation of the given [[Control]] to aid debugging.\n *\n * Note that changes to the exact format of the return value are not considered a breaking change;\n * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.\n *\n * @param resourceWithAcr The Resource with an attached Access Control Resource of which you want to get a human-readable representation.\n * @since 1.6.0\n * @deprecated\n */\nfunction acrAsMarkdown(resourceWithAcr) {\n let markdown = `# Access controls for ${getSourceUrl(resourceWithAcr)}\\n`;\n const policyUrls = getPolicyUrlAll$1(resourceWithAcr);\n const memberPolicyUrls = getMemberPolicyUrlAll$1(resourceWithAcr);\n const acrPolicyUrls = getAcrPolicyUrlAll$1(resourceWithAcr);\n const memberAcrPolicyUrls = getMemberAcrPolicyUrlAll$1(resourceWithAcr);\n if (policyUrls.length === 0 &&\n memberPolicyUrls.length === 0 &&\n acrPolicyUrls.length === 0 &&\n memberAcrPolicyUrls.length === 0) {\n markdown += \"\\n\\n\";\n }\n if (policyUrls.length > 0) {\n markdown += \"\\nThe following policies apply to this resource:\\n- \";\n markdown += `${policyUrls.join(\"\\n- \")}\\n`;\n }\n if (acrPolicyUrls.length > 0) {\n markdown +=\n \"\\nThe following policies apply to the access control resource for this resource:\\n- \";\n markdown += `${acrPolicyUrls.join(\"\\n- \")}\\n`;\n }\n if (memberPolicyUrls.length > 0) {\n markdown +=\n \"\\nThe following policies apply to the children of this resource:\\n- \";\n markdown += `${memberPolicyUrls.join(\"\\n- \")}\\n`;\n }\n if (memberAcrPolicyUrls.length > 0) {\n markdown +=\n \"\\nThe following policies apply to the access control resources for children of this resource:\\n- \";\n markdown += `${memberAcrPolicyUrls.join(\"\\n- \")}\\n`;\n }\n return markdown;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nconst ACP_NAMESPACE = \"http://www.w3.org/ns/solid/acp#\";\n/** @hidden */\nconst ACP = {\n AccessControl: ACP_NAMESPACE.concat(\"AccessControl\"),\n AccessControlResource: ACP_NAMESPACE.concat(\"AccessControlResource\"),\n AuthenticatedAgent: ACP_NAMESPACE.concat(\"AuthenticatedAgent\"),\n CreatorAgent: ACP_NAMESPACE.concat(\"CreatorAgent\"),\n Matcher: ACP_NAMESPACE.concat(\"Matcher\"),\n Policy: ACP_NAMESPACE.concat(\"Policy\"),\n PublicAgent: ACP_NAMESPACE.concat(\"PublicAgent\"),\n access: ACP_NAMESPACE.concat(\"access\"),\n accessControl: ACP_NAMESPACE.concat(\"accessControl\"),\n agent: ACP_NAMESPACE.concat(\"agent\"),\n allOf: ACP_NAMESPACE.concat(\"allOf\"),\n allow: ACP_NAMESPACE.concat(\"allow\"),\n anyOf: ACP_NAMESPACE.concat(\"anyOf\"),\n apply: ACP_NAMESPACE.concat(\"apply\"),\n client: ACP_NAMESPACE.concat(\"client\"),\n deny: ACP_NAMESPACE.concat(\"deny\"),\n memberAccessControl: ACP_NAMESPACE.concat(\"memberAccessControl\"),\n noneOf: ACP_NAMESPACE.concat(\"noneOf\"),\n vc: ACP_NAMESPACE.concat(\"vc\"),\n};\n/** @hidden */\nconst ACL_NAMESPACE = \"http://www.w3.org/ns/auth/acl#\";\n/** @hidden */\nconst ACL = {\n Append: ACL_NAMESPACE.concat(\"Append\"),\n Control: ACL_NAMESPACE.concat(\"Control\"),\n Read: ACL_NAMESPACE.concat(\"Read\"),\n Write: ACL_NAMESPACE.concat(\"Write\"),\n};\n/** @hidden */\nconst VC_ACCESS_GRANT = \"http://www.w3.org/ns/solid/vc#SolidAccessGrant\";\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction getAccessControlResourceThing(resource) {\n const acr = internal_getAcr(resource);\n const acrUrl = getSourceUrl(acr);\n return getThing(acr, acrUrl);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nconst DEFAULT_ACCESS_CONTROL = \"defaultAccessControl\";\n/** @hidden */\nconst DEFAULT_ACR_ACCESS_CONTROL = \"defaultAcrAccessControl\";\n/** @hidden */\nconst DEFAULT_MEMBER_ACCESS_CONTROL = \"defaultMemberAccessControl\";\n/** @hidden */\nconst DEFAULT_MEMBER_ACR_ACCESS_CONTROL = \"defaultMemberAcrAccessControl\";\n/** @hidden */\nfunction getDefaultAccessControlUrl(resource, name) {\n const acr = internal_getAcr(resource);\n const acrUrl = getSourceUrl(acr);\n return acrUrl.concat(\"#\").concat(name);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction getDefaultAccessControlThing(resource, name) {\n const acr = internal_getAcr(resource);\n const defaultAccessControlUrl = getDefaultAccessControlUrl(resource, name);\n const accessControlThing = getThing(acr, defaultAccessControlUrl);\n if (accessControlThing === null ||\n typeof accessControlThing === \"undefined\") {\n return createThing({ url: defaultAccessControlUrl });\n }\n return accessControlThing;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction getModes(policy, type) {\n const modes = getIriAll(policy, type);\n return {\n read: modes.includes(ACL.Read),\n append: modes.includes(ACL.Append),\n write: modes.includes(ACL.Write),\n controlRead: false,\n controlWrite: false,\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @hidden\n *\n * Internal function that attaches an ACR to a Resource. Prefer using this than\n * setting the internal values manually (easier to refactor when changing the internals).\n */\nfunction setAcr(resource, acr) {\n return Object.assign(internal_cloneResource(resource), {\n internal_acp: {\n acr,\n },\n });\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction setModes(policy, modes, type) {\n let newPolicy = removeAll(policy, type);\n if (modes.read || modes.controlRead) {\n newPolicy = addIri(newPolicy, type, ACL.Read);\n }\n if (modes.append) {\n newPolicy = addIri(newPolicy, type, ACL.Append);\n }\n if (modes.write || modes.controlWrite) {\n newPolicy = addIri(newPolicy, type, ACL.Write);\n }\n return newPolicy;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst DEFAULT_VC_POLICY_NAME = \"defaultVcPolicy\";\nconst DEFAULT_VC_MATCHER_NAME = \"defaultVcMatcher\";\nfunction createVcPolicy(acr, policyIri, matcherIri, access) {\n var _a;\n let vcPolicy = getThing(acr, policyIri);\n if (vcPolicy === null) {\n // If the policy does not exist, create it and link the default Access Control to it.\n vcPolicy = buildThing({ url: policyIri })\n .addIri(rdf.type, ACP.Policy)\n .addIri(ACP.anyOf, matcherIri)\n .build();\n }\n const vcMatcher = (_a = getThing(acr, matcherIri)) !== null && _a !== void 0 ? _a : buildThing({ url: matcherIri })\n .addIri(rdf.type, ACP.Matcher)\n .addIri(ACP.vc, VC_ACCESS_GRANT)\n .build();\n const currentModes = getModes(vcPolicy, ACP.allow);\n // Only change the modes which are set in `access`, and preserve the others.\n vcPolicy = setModes(vcPolicy, { ...currentModes, ...access }, ACP.allow);\n return {\n matcher: vcMatcher,\n policy: vcPolicy,\n };\n}\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Set the maximum access modes that are allowed for a VC holder for a given resource.\n * If the resource owner issued an Access Grant for the resource, the agent that\n * has been granted access will have at most the permissions set by this function.\n * The Access Grant may be more restrictive.\n *\n * Note that additional access may have been set if the ACR has been manipulated\n * not using this library, which is currently out of scope. In this case, the access\n * set by this function may not apply.\n *\n * @param resourceWithAcr The resource for which the access modes are being set for VC holders.\n * @param access The access modes to set. Setting a mode to `true` will enable it, to `false`\n * will disable it, and to `undefined` will leave it unchanged compared to what was previously\n * set.\n * @param options An option object to customize the function behavior:\n * - inherit: if set to `true`, the access set to the target resource cascades\n * to its contained resources.\n * @returns A copy of the resource and its attached ACR, updated to the new access modes.\n * @since 1.17.0\n */\nfunction setVcAccess(resourceWithAcr, access, options = { inherit: false }) {\n var _a;\n let acr = internal_getAcr(resourceWithAcr);\n const defaultVcPolicyIri = `${getSourceIri(acr)}#${DEFAULT_VC_POLICY_NAME}`;\n const defaultVcMatcherIri = `${getSourceIri(acr)}#${DEFAULT_VC_MATCHER_NAME}`;\n const { policy, matcher } = createVcPolicy(acr, defaultVcPolicyIri, defaultVcMatcherIri, access);\n let accessControl = getDefaultAccessControlThing(resourceWithAcr, \"defaultAccessControl\");\n if (!getIriAll(accessControl, ACP.apply).includes(asIri(policy))) {\n // Case when the ACR Thing existed, but did not include a link to the default Access Control.\n accessControl = addIri(accessControl, ACP.apply, policy);\n }\n let memberAccessControl = getDefaultAccessControlThing(resourceWithAcr, \"defaultMemberAccessControl\");\n let acrThing = (_a = getAccessControlResourceThing(resourceWithAcr)) !== null && _a !== void 0 ? _a : createThing({ url: getSourceIri(acr) });\n if (!getIriAll(acrThing, ACP.accessControl).includes(asIri(accessControl))) {\n // Case when the ACR Thing existed, but did not include a link to the default Access Control.\n acrThing = addIri(acrThing, ACP.accessControl, accessControl);\n }\n // Write the changed access control, policy and matchers in the ACR\n acr = [acrThing, accessControl, policy, matcher].reduce(setThing, acr);\n if (options.inherit) {\n // Add triples to the member access control and link it to the ACR only\n // if the VC access is recursive if they don't exist already.\n if (!getIriAll(memberAccessControl, ACP.apply).includes(asIri(policy))) {\n memberAccessControl = addIri(memberAccessControl, ACP.apply, policy);\n }\n if (!getIriAll(acrThing, ACP.memberAccessControl).includes(asIri(memberAccessControl))) {\n acrThing = addIri(acrThing, ACP.memberAccessControl, memberAccessControl);\n }\n acr = [acrThing, memberAccessControl].reduce(setThing, acr);\n }\n return setAcr(resourceWithAcr, acr);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst DEFAULT_NO_ACCESS = {\n read: false,\n append: false,\n write: false,\n controlRead: false,\n controlWrite: false,\n};\nconst linkExists = (subject, predicate, object) => getIriAll(subject, predicate).includes(asIri(object));\n// TODO: It should be possible to write a `chainExists` function, taking in a chain\n// of Thing, predicate, Thing, predicate... and checks whether such chain exists\n// in a given dataset. It would make the following function much easier to read,\n// instead of checking at each link that it isn't null and it is connected to the\n// next link.\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Get the maximum access modes that are allowed for a VC holder for a given resource.\n * If the resource owner issued an Access Grant for the resource, the agent that\n * has been granted access will have at most the permissions returned by this function.\n * The Access Grant may be more restrictive.\n *\n * Note that only the modes set using [[setVcAccess]] will be returned by this function.\n * Additional access may have been set if the ACR has been manipulated not using this\n * library, which is currently out of scope.\n *\n * @param resourceWithAcr The resource for which the VC access modes are looked up.\n * @returns The access modes available to a VC holder.\n * @since 1.17.0\n */\nfunction getVcAccess(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const accessControl = getDefaultAccessControlThing(resourceWithAcr, \"defaultAccessControl\");\n const acrThing = getAccessControlResourceThing(resourceWithAcr);\n if (acrThing === null ||\n !linkExists(acrThing, ACP.accessControl, accessControl)) {\n return DEFAULT_NO_ACCESS;\n }\n const defaultVcPolicyIri = `${getSourceIri(acr)}#${DEFAULT_VC_POLICY_NAME}`;\n const vcPolicy = getThing(acr, defaultVcPolicyIri);\n if (vcPolicy === null || !linkExists(accessControl, ACP.apply, vcPolicy)) {\n return DEFAULT_NO_ACCESS;\n }\n const defaultVcMatcherIri = `${getSourceIri(acr)}#${DEFAULT_VC_MATCHER_NAME}`;\n const vcMatcher = getThing(acr, defaultVcMatcherIri);\n if (vcMatcher === null || !linkExists(vcPolicy, ACP.anyOf, vcMatcher)) {\n return DEFAULT_NO_ACCESS;\n }\n return getModes(vcPolicy, ACP.allow);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Fetch a SolidDataset and its associated Access Control Resource (if available to the current user).\n *\n * @param url URL of the SolidDataset to fetch.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A SolidDataset and the ACR that applies to it, if available to the authenticated user.\n * @since 1.6.0\n */\nasync function getSolidDatasetWithAcr(url, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const solidDataset = await getSolidDataset(urlString, config);\n const acp = await fetchAcr(solidDataset, config);\n return { ...solidDataset, ...acp };\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Fetch a file and its associated Access Control Resource (if available to the current user).\n *\n * @param url URL of the file to fetch.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A file and the ACR that applies to it, if available to the authenticated user.\n * @since 1.6.0\n */\nasync function getFileWithAcr(url, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const file = await getFile(urlString, config);\n const acp = await fetchAcr(file, config);\n return Object.assign(file, acp);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Retrieve information about a Resource and its associated Access Control Resource (if available to\n * the current user), without fetching the Resource itself.\n *\n * @param url URL of the Resource about which to fetch its information.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns Metadata describing a Resource, and the ACR that applies to it, if available to the authenticated user.\n * @since 1.6.0\n */\nasync function getResourceInfoWithAcr(url, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const resourceInfo = await getResourceInfo(urlString, config);\n const acp = await fetchAcr(resourceInfo, config);\n return { ...resourceInfo, ...acp };\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Fetch a SolidDataset, and:\n * - if the Resource is governed by an ACR: its associated Access Control Resource (if available to\n * the current user), and all the Access Control Policies\n * referred to therein, if available to the current user.\n * - if the Resource is governed by an ACL: its associated Resource ACL (if available to the current\n * user), or its Fallback ACL if it does not exist.\n *\n * @param url URL of the SolidDataset to fetch.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A SolidDataset and either the ACL access data or the ACR access data, if available to the current user.\n * @since 1.6.0\n */\nasync function getSolidDatasetWithAccessDatasets(url, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const solidDataset = await getSolidDataset(urlString, config);\n if (hasAccessibleAcl(solidDataset)) {\n const acl = await internal_fetchAcl(solidDataset, config);\n return internal_setAcl(solidDataset, acl);\n }\n const acr = await fetchAcr(solidDataset, config);\n return { ...solidDataset, ...acr };\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Fetch a File, and:\n * - if the Resource is governed by an ACR: its associated Access Control Resource (if available to\n * the current user), and all the Access Control Policies\n * referred to therein, if available to the current user.\n * - if the Resource is governed by an ACL: its associated Resource ACL (if available to the current\n * user), or its Fallback ACL if it does not exist.\n *\n * @param url URL of the File to fetch.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A File and either the ACL access data or the ACR access data, if available to the current user.\n * @since 1.6.0\n */\nasync function getFileWithAccessDatasets(url, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const file = await getFile(urlString, config);\n if (hasAccessibleAcl(file)) {\n const acl = await internal_fetchAcl(file, config);\n return internal_setAcl(file, acl);\n }\n const acr = await fetchAcr(file, config);\n return Object.assign(file, acr);\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Fetch information about a Resource, and:\n * - if the Resource is governed by an ACR: its associated Access Control Resource (if available to\n * the current user), and all the Access Control Policies\n * referred to therein, if available to the current user.\n * - if the Resource is governed by an ACL: its associated Resource ACL (if available to the current\n * user), or its Fallback ACL if it does not exist.\n *\n * @param url URL of the Resource information about which to fetch.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns Information about a Resource and either the ACL access data or the ACR access data, if available to the current user.\n * @since 1.6.0\n */\nasync function getResourceInfoWithAccessDatasets(url, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(url);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const resourceInfo = await getResourceInfo(urlString, config);\n if (hasAccessibleAcl(resourceInfo)) {\n const acl = await internal_fetchAcl(resourceInfo, config);\n return internal_setAcl(resourceInfo, acl);\n }\n const acr = await fetchAcr(resourceInfo, config);\n return { ...resourceInfo, ...acr };\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Save a Resource's Access Control Resource.\n *\n * @param resource Resource with an Access Control Resource that should be saved.\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @since 1.6.0\n */\nasync function saveAcrFor(resource, options = internal_defaultFetchOptions) {\n const acr = internal_getAcr(resource);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const savedAcr = await saveSolidDatasetAt(getSourceUrl(acr), acr, config);\n return internal_setAcr(resource, savedAcr);\n}\n/**\n * @param resource Resource of which to check whether it has an Access Control Resource attached.\n * @returns Boolean representing whether the given Resource has an Access Control Resource attached for use in e.g. [[getPolicyUrlAll]].\n * @since 1.6.0\n */\nfunction hasAccessibleAcr(resource) {\n return (typeof resource.internal_acp === \"object\" &&\n resource.internal_acp !== null &&\n typeof resource.internal_acp.acr === \"object\" &&\n resource.internal_acp.acr !== null);\n}\nasync function fetchAcr(resource, options) {\n let acrUrl;\n if (hasLinkedAcr(resource)) {\n // Whereas a Resource can generally have multiple linked Resources for the same relation,\n // it can only have one Access Control Resource for that ACR to be valid.\n // Hence the accessing of [0] directly:\n const { linkedResources } = resource.internal_resourceInfo;\n [acrUrl] = linkedResources[acp.accessControl];\n }\n else if (hasAccessibleAcl(resource)) {\n // The ACP proposal will be updated to expose the Access Control Resource\n // via a Link header with rel=\"acl\", just like WAC. That means that if\n // an ACL is advertised, we can still fetch its metadata — if that indicates\n // that it's actually an ACP Access Control Resource, then we can fetch that\n // instead.\n let aclResourceInfo;\n try {\n aclResourceInfo = await getResourceInfo(resource.internal_resourceInfo.aclUrl, options);\n }\n catch (e) {\n // Since both ACL and ACR will be discovered through the same header, we\n // need to ignore errors here so that in the case of ACL not found, the\n // code can resume and a new ACL can be initialized. The case for ACR is\n // covered in the code below, since in this case the ACR is always present\n }\n if (aclResourceInfo && isAcr(aclResourceInfo)) {\n acrUrl = getSourceUrl(aclResourceInfo);\n }\n }\n // If the Resource doesn't advertise an ACR via the old Link header,\n // nor via a rel=\"acl\" header, then return, indicating that no ACR could be\n // fetched:\n if (typeof acrUrl !== \"string\") {\n return {\n internal_acp: {\n acr: null,\n },\n };\n }\n let acr;\n try {\n acr = await getSolidDataset(acrUrl, options);\n }\n catch (e) {\n return {\n internal_acp: {\n acr: null,\n },\n };\n }\n const acrDataset = {\n ...acr,\n accessTo: getSourceUrl(resource),\n };\n const acpInfo = {\n internal_acp: {\n acr: acrDataset,\n },\n };\n return acpInfo;\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * To make it easy to fetch all the relevant Access Policy Resources,\n * this function returns all referenced Access Policy Resources referenced in an\n * Access Control Resource.\n * In other words, if Access Controls refer to different Policies in the same\n * Access Policy Resource, this function will only return that Access Policy\n * Resource's URL once.\n *\n * @param withAcr A Resource with an Access Control Resource attached.\n * @returns List of all unique Access Policy Resources that are referenced in the given Access Control Resource.\n * @since 1.6.0\n */\nfunction getReferencedPolicyUrlAll(withAcr) {\n const policyUrls = getPolicyUrlAll$1(withAcr)\n .map(normalizeServerSideIri)\n .concat(getMemberPolicyUrlAll$1(withAcr).map(normalizeServerSideIri))\n .concat(getAcrPolicyUrlAll$1(withAcr).map(normalizeServerSideIri))\n .concat(getMemberAcrPolicyUrlAll$1(withAcr).map(normalizeServerSideIri));\n const uniqueUrls = Array.from(new Set(policyUrls));\n return uniqueUrls;\n}\n/**\n * Verify whether the access to the given resource is controlled using the ACP\n * system.\n * @param resource The target resource\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns True if the access to the resource is controlled using ACP, false otherwise.\n * @since 1.14.0.\n */\nasync function isAcpControlled(resource, options = internal_defaultFetchOptions) {\n const urlString = internal_toIriString(resource);\n const config = {\n ...internal_defaultFetchOptions,\n ...options,\n };\n const resourceInfo = await getResourceInfo(urlString, config);\n return hasAccessibleAcr(await fetchAcr(resourceInfo, config));\n}\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a Resource, find out the URL of its governing Access Control Resource.\n *\n * @param resource Resource which should be governed by Access Policies.\n * @returns The URL of the Access Control Resource, or undefined if not ACR is found.\n * @since 1.15.0\n */\nfunction getLinkedAcrUrl(resource) {\n if (!hasServerResourceInfo(resource)) {\n return undefined;\n }\n // Two rels types are acceptable to indicate a link to an ACR.\n const acrLinks = [acp.accessControl, \"acl\"].map((rel) => {\n if (Array.isArray(resource.internal_resourceInfo.linkedResources[rel]) &&\n resource.internal_resourceInfo.linkedResources[rel].length === 1) {\n return resource.internal_resourceInfo.linkedResources[rel][0];\n }\n return undefined;\n });\n return acrLinks.find((x) => x !== undefined);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * NOTE: Don't export for now (i.e. if exported, should this be `isAcpRule()` so\n * as not to clash with `isAclRule()`.\n *\n * @param thing the [[Thing]] to check to see if it's an ACP rule or not\n */\nfunction isRule(thing) {\n return getIriAll(thing, rdf.type).includes(acp.Rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a rule that refines the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is **not** present in **any** of the \"All Of\" rules,\n * they will not be granted access.\n *\n * Also see [[addAnyOfRuleUrl]] and [[addNoneOfRuleUrl]].\n *\n * @param policy The [[Policy]] to which the rule should be added.\n * @param rule The rule to add to the policy.\n * @returns A new [[Policy]] clone of the original one, with the new rule added.\n * @since 1.6.0\n */\nfunction addAllOfRuleUrl(policy, rule) {\n return addIri(policy, acp.allOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes a rule that refines the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is **not** present in **any** of the \"All Of\" rules,\n * they will not be granted access.\n * @param policy The [[Policy]] from which the rule should be removed.\n * @param rule The rule to remove from the policy.\n * @returns A new [[Policy]] clone of the original one, with the rule removed.\n * @since 1.6.0\n */\nfunction removeAllOfRuleUrl(policy, rule) {\n return removeIri(policy, acp.allOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrites the rule refining the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is **not** present in **any** of the \"All Of\" rules,\n * they will not be granted access.\n * @param policy The [[Policy]] to which the rule should be added.\n * @param rules The rules the policy requires.\n * @returns A new [[Policy]] clone of the original one, with the \"All Of\" rules replaced.\n * @since 1.6.0\n */\nfunction setAllOfRuleUrl(policy, rule) {\n return setIri(policy, acp.allOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the \"All Of\" [[Rule]]s for the given [[Policy]]\n * @param policy The [[policy]] from which the rules should be read.\n * @returns A list of the \"All Of\" [[Rule]]s\n * @since 1.6.0\n */\nfunction getAllOfRuleUrlAll(policy) {\n return getIriAll(policy, acp.allOf);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a rule that extends the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the \"Any Of\" rules,\n * they will be granted access.\n *\n * Also see [[addAllOfRuleUrl]] and [[addNoneOfRuleUrl]].\n *\n * @param policy The [[Policy]] to which the rule should be added.\n * @param rule The rule to add to the policy.\n * @returns A new [[Policy]] clone of the original one, with the new rule added.\n * @since 1.6.0\n */\nfunction addAnyOfRuleUrl(policy, rule) {\n return addIri(policy, acp.anyOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes a rule that extends the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the \"Any Of\" rules,\n * they will be granted access.\n * @param policy The [[Policy]] from which the rule should be removed.\n * @param rule The rule to remove from the policy.\n * @returns A new [[Policy]] clone of the original one, with the rule removed.\n * @since 1.6.0\n */\nfunction removeAnyOfRuleUrl(policy, rule) {\n return removeIri(policy, acp.anyOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrite the rule extending the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the \"Any Of\" rules,\n * they will be granted access.\n * @param policy The [[Policy]] to which the rule should be added.\n * @param rules The rules the policy accepts.\n * @returns A new [[Policy]] clone of the original one, with the \"Any Of\" rules replaced.\n * @since 1.6.0\n */\nfunction setAnyOfRuleUrl(policy, rule) {\n return setIri(policy, acp.anyOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the \"Any Of\" [[Rule]]s for the given [[Policy]]\n * @param policy The [[policy]] from which the rules should be read.\n * @returns A list of the \"Any Of\" [[Rule]]s\n * @since 1.6.0\n */\nfunction getAnyOfRuleUrlAll(policy) {\n return getIriAll(policy, acp.anyOf);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a rule that restricts the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the forbidden rules,\n * they will **not** be granted access.\n *\n * Also see [[addAllOfRuleUrl]] and [[addAnyOfRuleUrl]].\n *\n * @param policy The [[Policy]] to which the rule should be added.\n * @param rule The rule to add to the policy.\n * @returns A new [[Policy]] clone of the original one, with the new rule added.\n * @since 1.6.0\n */\nfunction addNoneOfRuleUrl(policy, rule) {\n return addIri(policy, acp.noneOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes a rule that restricts the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the forbidden rules,\n * they will **not** be granted access.\n * @param policy The [[Policy]] from which the rule should be removed.\n * @param rule The rule to remove from the policy.\n * @returns A new [[Policy]] clone of the original one, with the rule removed.\n * @since 1.6.0\n */\nfunction removeNoneOfRuleUrl(policy, rule) {\n return removeIri(policy, acp.noneOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set the rules restrincting the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the \"None Of\" rules,\n * they will not be granted access.\n * @param policy The [[Policy]] to which the rule should be added.\n * @param rules The rules the policy accepts.\n * @returns A new [[Policy]] clone of the original one, with the \"Any Of\" rules replaced.\n * @since 1.6.0\n */\nfunction setNoneOfRuleUrl(policy, rule) {\n return setIri(policy, acp.noneOf, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the \"None Of\" [[Rule]]s for the given [[Policy]]\n * @param policy The [[policy]] from which the rules should be read.\n * @returns A list of the forbidden [[Rule]]s\n * @since 1.6.0\n */\nfunction getNoneOfRuleUrlAll(policy) {\n return getIriAll(policy, acp.noneOf);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Initialise a new, empty [[Rule]].\n *\n * @param url URL that identifies this [[Rule]].\n * @since 1.6.0\n */\nfunction createRule(url) {\n const stringUrl = internal_toIriString(url);\n let ruleThing = createThing({ url: stringUrl });\n ruleThing = setUrl(ruleThing, rdf.type, acp.Rule);\n return ruleThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Initialise a new, empty [[ResourceRule]] for the given Resource.\n *\n * @param resourceWithAcr The Resource to which the new Rule is to apply.\n * @param name Name that identifies this [[Rule]].\n * @since 1.6.0\n */\nfunction createResourceRuleFor(resourceWithAcr, name) {\n const acr = internal_getAcr(resourceWithAcr);\n const url = new URL(getSourceUrl(acr));\n url.hash = `#${name}`;\n let ruleThing = createThing({ url: url.href });\n ruleThing = setUrl(ruleThing, rdf.type, acp.Rule);\n return ruleThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the [[Rule]] with the given URL from an [[SolidDataset]].\n *\n * @param ruleResource The Resource that contains the given [[Rule]].\n * @param url URL that identifies this [[Rule]].\n * @returns The requested [[Rule]], if it exists, or `null` if it does not.\n * @since 1.6.0\n */\nfunction getRule(ruleResource, url) {\n const foundThing = getThing(ruleResource, url);\n if (foundThing === null || getUrl(foundThing, rdf.type) !== acp.Rule) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the [[ResourceRule]] with the given name from an Resource's Access Control\n * Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains the given [[ResourceRule]].\n * @param name Name that identifies this [[ResourceRule]].\n * @returns The requested [[ResourceRule]], if it exists, or `null` if it does not.\n * @since 1.6.0\n */\nfunction getResourceRule(resourceWithAcr, name) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const url = new URL(acrUrl);\n url.hash = `#${name}`;\n const foundThing = getThing(acr, url.href);\n if (foundThing === null || !isRule(foundThing)) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Gets the [[Rule]]s from a [[SolidDataset]].\n *\n * @param ruleResource The Resource that contains (zero or more) [[Rule]]s.\n * @returns The [[Rule]]s contained in this resource.\n * @since 1.6.0\n */\nfunction getRuleAll(ruleResource) {\n const things = getThingAll(ruleResource);\n return things.filter(isRule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Gets the [[ResourceRule]]s from a Resource's Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceRule]]s.\n * @returns The [[ResourceRule]]s contained in this Resource's Access Control Resource.\n * @since 1.6.0\n */\nfunction getResourceRuleAll(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const things = getThingAll(acr);\n return things.filter(isRule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes the given [[Rule]] from the given [[SolidDataset]].\n *\n * @param ruleResource The Resource that contains (zero or more) [[Rule]]s.\n * @returns A new SolidDataset equal to the given Rule Resource, but without the given Rule.\n * @since 1.6.0\n */\nfunction removeRule(ruleResource, rule) {\n return removeThing(ruleResource, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes the given [[ResourceRule]] from the given Resource's Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceRule]]s.\n * @returns A new Resource equal to the given Resource, but without the given Rule in its ACR.\n * @since 1.6.0\n */\nfunction removeResourceRule(resourceWithAcr, rule) {\n const acr = internal_getAcr(resourceWithAcr);\n let ruleToRemove;\n if (typeof rule === \"string\") {\n if (internal_isValidUrl(rule)) {\n ruleToRemove = rule;\n }\n else {\n // If the given Rule to remove is the name of the Rule,\n // resolve it to its full URL — developers usually refer to either the\n // Rule itself, or by its name, as they do not have access to the ACR\n // directly.\n const ruleUrl = new URL(getSourceUrl(acr));\n ruleUrl.hash = `#${rule}`;\n ruleToRemove = ruleUrl.href;\n }\n }\n else if (isNamedNode(rule)) {\n ruleToRemove = internal_toIriString(rule);\n }\n else {\n ruleToRemove = asUrl(rule);\n }\n // Check whether the actual Rule (i.e. with the Rule type) exists:\n const matchingRule = getResourceRule(resourceWithAcr, new URL(ruleToRemove).hash.substring(1));\n if (matchingRule === null) {\n // No such Rule exists yet, so return the Resource+ACR unchanged:\n return resourceWithAcr;\n }\n const updatedAcr = removeThing(acr, matchingRule);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return updatedResource;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert the given [[Rule]] into the given [[SolidDataset]], replacing previous\n * instances of that Rule.\n *\n * @param ruleResource The Resource that contains (zero or more) [[Rule]]s.\n * @returns A new SolidDataset equal to the given Rule Resource, but with the given Rule.\n * @since 1.6.0\n */\nfunction setRule(ruleResource, rule) {\n return setThing(ruleResource, rule);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert the given [[ResourceRule]] into the given Resource's Access Control Resource,\n * replacing previous instances of that Rule.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceRule]]s.\n * @returns A new Resource equal to the given Resource, but with the given Rule in its ACR.\n * @since 1.6.0\n */\nfunction setResourceRule(resourceWithAcr, rule) {\n const acr = internal_getAcr(resourceWithAcr);\n const updatedAcr = setThing(acr, rule);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return updatedResource;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * List all the agents a [[Rule]] applies **directly** to. This will not include agents\n * that are part of a group the [[Rule]] applies to, nor will it include specific agent\n * classes, such as authenticated or public agents.\n *\n * @param rule The rule from which agents are read.\n * @returns A list of the WebIDs of agents included in the rule.\n * @since 1.6.0\n */\nfunction getAgentAll$1(rule) {\n return getIriAll(rule, acp.agent).filter((agent) => agent !== acp.PublicAgent &&\n agent !== acp.AuthenticatedAgent &&\n agent !== acp.CreatorAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrite the agents the [[Rule]] applies to with the provided agents.\n *\n * @param rule The rule for which agents are set.\n * @param agent The agent the rule should apply to.\n * @returns A copy of the input rule, applying to a different set of agents.\n * @since 1.6.0\n */\nfunction setAgent$1(rule, agent) {\n // Preserve the special agent classes authenticated and public, which we\n // don't want to overwrite with this function.\n const isPublic = hasPublic$1(rule);\n const isAuthenticated = hasAuthenticated$1(rule);\n const isCreator = hasCreator$1(rule);\n let result = setIri(rule, acp.agent, agent);\n // Restore public and authenticated\n if (isPublic) {\n result = setPublic$1(result);\n }\n if (isAuthenticated) {\n result = setAuthenticated$1(result);\n }\n if (isCreator) {\n result = setCreator$1(result);\n }\n return result;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Apply the [[Rule]] to an additional agent.\n *\n * @param rule The [[Rule]] to be applied to an additional agent.\n * @param agent The agent the [[Rule]] should apply to.\n * @returns A copy of the [[Rule]], applying to an additional agent.\n * @since 1.6.0\n */\nfunction addAgent$1(rule, agent) {\n return addIri(rule, acp.agent, agent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Prevent the [[Rule]] from applying to a given agent directly. This will not\n * remove the agent from any groups the rule applies to.\n *\n * @param rule The [[Rule]] that should no longer apply to a given agent.\n * @param agent The agent the rule should no longer apply to.\n * @returns A copy of the rule, not applying to the given agent.\n * @since 1.6.0\n */\nfunction removeAgent$1(rule, agent) {\n return removeIri(rule, acp.agent, agent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Lists all the groups a [[Rule]] applies to.\n *\n * @param rule The rule from which groups are read.\n * @returns A list of the [[URL]]'s of groups included in the rule.\n * @since 1.6.0\n * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality.\n */\nfunction getGroupAll(rule) {\n return getIriAll(rule, acp.group);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrite the groups the [[Rule]] applies to with the provided groups.\n *\n * @param rule The rule for which groups are set.\n * @param group The group the rule should apply to.\n * @returns A copy of the input rule, applying to a different set of groups.\n * @since 1.6.0\n * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality.\n */\nfunction setGroup(rule, group) {\n return setIri(rule, acp.group, group);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Apply the [[Rule]] to an additional group.\n *\n * @param rule The [[Rule]] to be applied to an additional group.\n * @param agent The group the [[Rule]] should apply to.\n * @returns A copy of the [[Rule]], applying to an additional group.\n * @since 1.6.0\n * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality.\n */\nfunction addGroup(rule, group) {\n return addIri(rule, acp.group, group);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Prevent the [[Rule]] from applying to a given group.\n *\n * @param rule The [[Rule]] that should no longer apply to a given group.\n * @param agent The group the rule should no longer apply to.\n * @returns A copy of the rule, not applying to the given group.\n * @since 1.6.0\n * @deprecated Access Control Policies will no longer support vcard:Group. You can re-use a Rule listing multiple Agents to get the same functionality.\n */\nfunction removeGroup(rule, group) {\n return removeIri(rule, acp.group, group);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the rule applies to any agent.\n *\n * @param rule The rule checked for public access.\n * @returns Whether the rule applies to any agent or not.\n * @since 1.6.0\n */\nfunction hasPublic$1(rule) {\n return (getIriAll(rule, acp.agent).filter((agent) => agent === acp.PublicAgent)\n .length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Rule to apply to any Agent.\n *\n * @param rule The rule being modified.\n * @returns A copy of the rule, updated to apply to any agent.\n * @since 1.6.0\n */\nfunction setPublic$1(rule) {\n // The second argument should not be part of the function signature,\n // so it's not in the parameter list:\n // eslint-disable-next-line prefer-rest-params\n if (typeof arguments === \"object\" && typeof arguments[1] === \"boolean\") {\n throw new Error(\"The function `setPublic` no longer takes a second parameter. It is now used together with `removePublic` instead.\");\n }\n return addIri(rule, acp.agent, acp.PublicAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Rule to no longer apply to any Agent.\n *\n * @param rule The rule being modified.\n * @returns A copy of the rule, updated to no longer apply to any agent.\n * @since 1.6.0\n */\nfunction removePublic$1(rule) {\n return removeIri(rule, acp.agent, acp.PublicAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the rule applies to any authenticated agent.\n *\n * @param rule The rule checked for authenticated access.\n * @returns Whether the rule applies to any authenticated agent or not.\n * @since 1.6.0\n */\nfunction hasAuthenticated$1(rule) {\n return (getIriAll(rule, acp.agent).filter((agent) => agent === acp.AuthenticatedAgent).length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Rule to apply to any authenticated Agent.\n *\n * @param rule The rule being modified.\n * @returns A copy of the rule, updated to apply to any authenticated Agent.\n * @since 1.6.0\n */\nfunction setAuthenticated$1(rule) {\n // The second argument should not be part of the function signature,\n // so it's not in the parameter list:\n // eslint-disable-next-line prefer-rest-params\n if (typeof arguments === \"object\" && typeof arguments[1] === \"boolean\") {\n throw new Error(\"The function `setAuthenticated` no longer takes a second parameter. It is now used together with `removeAuthenticated` instead.\");\n }\n return addIri(rule, acp.agent, acp.AuthenticatedAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Rule to no longer apply to any authenticated Agent.\n *\n * @param rule The rule being modified.\n * @returns A copy of the rule, updated to apply/not apply to any authenticated agent.\n * @since 1.6.0\n */\nfunction removeAuthenticated$1(rule) {\n return removeIri(rule, acp.agent, acp.AuthenticatedAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the rule applies to the creator of the Resource.\n *\n * @param rule The rule checked for authenticated access.\n * @returns Whether the rule applies to the creator of the Resource or not.\n * @since 1.6.0\n */\nfunction hasCreator$1(rule) {\n return (getIriAll(rule, acp.agent).filter((agent) => agent === acp.CreatorAgent)\n .length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Rule to apply to the creator of a Resource.\n *\n * @param rule The rule being modified.\n * @returns A copy of the rule, updated to apply to the creator of a Resource.\n * @since 1.6.0\n */\nfunction setCreator$1(rule) {\n // The second argument should not be part of the function signature,\n // so it's not in the parameter list:\n // eslint-disable-next-line prefer-rest-params\n if (typeof arguments === \"object\" && typeof arguments[1] === \"boolean\") {\n throw new Error(\"The function `setCreator` no longer takes a second parameter. It is now used together with `removeCreator` instead.\");\n }\n return addIri(rule, acp.agent, acp.CreatorAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Rule to no longer apply to the creator of a Resource.\n *\n * @param rule The rule being modified.\n * @returns A copy of the rule, updated to apply/not apply to the creator of a Resource.\n * @since 1.6.0\n */\nfunction removeCreator$1(rule) {\n return removeIri(rule, acp.agent, acp.CreatorAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * List all the clients a [[Rule]] applies **directly** to. This will not include\n * specific client classes, such as public clients.\n *\n * @param rule The rule from which clients are read.\n * @returns A list of the WebIDs of clients included in the rule.\n * @since 1.6.0\n */\nfunction getClientAll$1(rule) {\n return getIriAll(rule, acp.client).filter((client) => client !== solid.PublicOidcClient);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrite the clients the [[Rule]] applies to with the provided Client.\n *\n * @param rule The rule for which clients are set.\n * @param client The Client the rule should apply to.\n * @returns A copy of the input rule, applying to a different set of Clients.\n * @since 1.6.0\n */\nfunction setClient$1(rule, client) {\n // Preserve the special \"any client\" class, which we\n // don't want to overwrite with this function.\n const anyClientEnabled = hasAnyClient$1(rule);\n let result = setIri(rule, acp.client, client);\n // Restore the \"any client\" class\n if (anyClientEnabled) {\n result = setAnyClient$1(result);\n }\n return result;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Apply the [[Rule]] to an additional Client.\n *\n * @param rule The [[Rule]] to be applied to an additional Client.\n * @param client The Client the [[Rule]] should apply to.\n * @returns A copy of the [[Rule]], applying to an additional Client.\n * @since 1.6.0\n */\nfunction addClient$1(rule, client) {\n return addIri(rule, acp.client, client);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Prevent the [[Rule]] from applying to a given Client directly.\n *\n * @param rule The [[Rule]] that should no longer apply to a given Client.\n * @param client The Client the rule should no longer apply to.\n * @returns A copy of the rule, not applying to the given Client.\n * @since 1.6.0\n */\nfunction removeClient$1(rule, client) {\n return removeIri(rule, acp.client, client);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the rule applies to any client, i.e. all the applications\n * regardless of their identifier.\n *\n * @param rule The rule checked for authenticated access.\n * @returns Whether the rule applies to public clients.\n * @since 1.6.0\n */\nfunction hasAnyClient$1(rule) {\n return (getIriAll(rule, acp.client).filter((client) => client === solid.PublicOidcClient).length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Make the [[Rule]] apply to any client application.\n *\n * @param rule The rule for which clients are set.\n * @returns A copy of the rule, updated to apply to any client\n * @since 1.6.0\n */\nfunction setAnyClient$1(rule) {\n return addIri(rule, acp.client, solid.PublicOidcClient);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Make the [[Rule]] no longer apply to any client application.\n *\n * @param rule The rule for which clients are set.\n * @returns A copy of the rule, updated to no longer apply to any client\n * @since 1.6.0\n */\nfunction removeAnyClient$1(rule) {\n return removeIri(rule, acp.client, solid.PublicOidcClient);\n}\n/**\n * Gets a human-readable representation of the given [[Rule]] to aid debugging.\n *\n * Note that changes to the exact format of the return value are not considered a breaking change;\n * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.\n *\n * @param rule The Rule to get a human-readable representation of.\n * @since 1.6.0\n */\nfunction ruleAsMarkdown(rule) {\n let markdown = `## Rule: ${asUrl(rule)}\\n\\n`;\n let targetEnumeration = \"\";\n if (hasPublic$1(rule)) {\n targetEnumeration += \"- Everyone\\n\";\n }\n if (hasAuthenticated$1(rule)) {\n targetEnumeration += \"- All authenticated agents\\n\";\n }\n if (hasCreator$1(rule)) {\n targetEnumeration += \"- The creator of this resource\\n\";\n }\n if (hasAnyClient$1(rule)) {\n targetEnumeration += \"- Users of any client application\\n\";\n }\n const targetAgents = getAgentAll$1(rule);\n if (targetAgents.length > 0) {\n targetEnumeration += \"- The following agents:\\n - \";\n targetEnumeration += `${targetAgents.join(\"\\n - \")}\\n`;\n }\n const targetGroups = getGroupAll(rule);\n if (targetGroups.length > 0) {\n targetEnumeration += \"- Members of the following groups:\\n - \";\n targetEnumeration += `${targetGroups.join(\"\\n - \")}\\n`;\n }\n const targetClients = getClientAll$1(rule);\n if (targetClients.length > 0) {\n targetEnumeration += \"- Users of the following client applications:\\n - \";\n targetEnumeration += `${targetClients.join(\"\\n - \")}\\n`;\n }\n markdown +=\n targetEnumeration.length > 0\n ? `This rule applies to:\\n${targetEnumeration}`\n : \"\\n\";\n return markdown;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @param thing the [[Thing]] to check to see if it's an ACP Policy or not\n */\nfunction isPolicy(thing) {\n return getIriAll(thing, rdf.type).includes(acp.Policy);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Initialise a new, empty [[Policy]].\n *\n * @param url URL that identifies this Policy.\n * @since 1.6.0\n */\nfunction createPolicy(url) {\n const stringUrl = internal_toIriString(url);\n let policyThing = createThing({ url: stringUrl });\n policyThing = setUrl(policyThing, rdf.type, acp.Policy);\n return policyThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the [[Policy]] with the given URL from an [[SolidDataset]].\n *\n * @param policyResource The Resource that contains the given Policy.\n * @param url URL that identifies this Policy.\n * @returns The requested Policy, if it exists, or `null` if it does not.\n * @since 1.6.0\n */\nfunction getPolicy(policyResource, url) {\n const foundThing = getThing(policyResource, url);\n if (foundThing === null || !isPolicy(foundThing)) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get all [[Policy]]'s in a given [[SolidDataset]].\n *\n * @param policyResource The Resource that contains Access Policies.\n * @since 1.6.0\n */\nfunction getPolicyAll(policyResource) {\n const foundThings = getThingAll(policyResource);\n const foundPolicies = foundThings.filter((thing) => !isThingLocal(thing) && isPolicy(thing));\n return foundPolicies;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove the given [[Policy]] from the given [[SolidDataset]].\n *\n * @param policyResource The Resource that contains Access Policies.\n * @param policy The Policy to remove from the resource.\n * @since 1.6.0\n */\nfunction removePolicy(policyResource, policy) {\n return removeThing(policyResource, policy);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert the given [[Policy]] into the given [[SolidDataset]], replacing previous instances of that Policy.\n *\n * @param policyResource The Resource that contains Access Policies.\n * @param policy The Policy to insert into the Resource.\n * @returns A new dataset equal to the given resource, but with the given Policy.\n * @since 1.6.0\n */\nfunction setPolicy(policyResource, policy) {\n return setThing(policyResource, policy);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given\n * Policy, but with the given Access Modes allowed on it.\n *\n * @param policy The Policy on which to set the modes to allow.\n * @param modes Modes to allow for this Policy.\n * @since Not released yet.\n */\nfunction setAllowModesV2(policy, modes) {\n let newPolicy = removeAll(policy, acp.allow);\n if (modes.read === true) {\n newPolicy = addIri(newPolicy, acp.allow, internal_accessModeIriStrings.read);\n }\n if (modes.append === true) {\n newPolicy = addIri(newPolicy, acp.allow, internal_accessModeIriStrings.append);\n }\n if (modes.write === true) {\n newPolicy = addIri(newPolicy, acp.allow, internal_accessModeIriStrings.write);\n }\n return newPolicy;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given\n * Policy, but with the given Access Modes allowed on it.\n *\n * @param policy The Policy on which to set the modes to allow.\n * @param modes Modes to allow for this Policy.\n * @since 1.6.0\n * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[setAllowModesV2]].\n */\nfunction setAllowModesV1(policy, modes) {\n let newPolicy = removeAll(policy, acp.allow);\n if (modes.read === true) {\n newPolicy = addIri(newPolicy, acp.allow, acp.Read);\n }\n if (modes.append === true) {\n newPolicy = addIri(newPolicy, acp.allow, acp.Append);\n }\n if (modes.write === true) {\n newPolicy = addIri(newPolicy, acp.allow, acp.Write);\n }\n return newPolicy;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]], return which [[AccessModes]] it allows.\n *\n * @param policy The Policy for which you want to know the Access Modes it allows.\n * @since Not released yet.\n */\nfunction getAllowModesV2(policy) {\n const allowedModes = getIriAll(policy, acp.allow);\n return {\n read: allowedModes.includes(internal_accessModeIriStrings.read),\n append: allowedModes.includes(internal_accessModeIriStrings.append),\n write: allowedModes.includes(internal_accessModeIriStrings.write),\n };\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]], return which [[AccessModes]] it allows.\n *\n * @param policy The Policy for which you want to know the Access Modes it allows.\n * @since 1.6.0\n * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[getAllowModesV2]].\n */\nfunction getAllowModesV1(policy) {\n const allowedModes = getIriAll(policy, acp.allow);\n return {\n read: allowedModes.includes(acp.Read),\n append: allowedModes.includes(acp.Append),\n write: allowedModes.includes(acp.Write),\n };\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given\n * Policy, but with the given Access Modes disallowed on it.\n *\n * @param policy The Policy on which to set the modes to disallow.\n * @param modes Modes to disallow for this Policy.\n * @since Not released yet.\n */\nfunction setDenyModesV2(policy, modes) {\n let newPolicy = removeAll(policy, acp.deny);\n if (modes.read === true) {\n newPolicy = addIri(newPolicy, acp.deny, internal_accessModeIriStrings.read);\n }\n if (modes.append === true) {\n newPolicy = addIri(newPolicy, acp.deny, internal_accessModeIriStrings.append);\n }\n if (modes.write === true) {\n newPolicy = addIri(newPolicy, acp.deny, internal_accessModeIriStrings.write);\n }\n return newPolicy;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]] and a set of [[AccessModes]], return a new Policy based on the given\n * Policy, but with the given Access Modes disallowed on it.\n *\n * @param policy The Policy on which to set the modes to disallow.\n * @param modes Modes to disallow for this Policy.\n * @since 1.6.0\n * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[setDenyModesV2]].\n */\nfunction setDenyModesV1(policy, modes) {\n let newPolicy = removeAll(policy, acp.deny);\n if (modes.read === true) {\n newPolicy = addIri(newPolicy, acp.deny, acp.Read);\n }\n if (modes.append === true) {\n newPolicy = addIri(newPolicy, acp.deny, acp.Append);\n }\n if (modes.write === true) {\n newPolicy = addIri(newPolicy, acp.deny, acp.Write);\n }\n return newPolicy;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]], return which [[AccessModes]] it disallows.\n *\n * @param policy The Policy on which you want to know the Access Modes it disallows.\n * @since Not released yet.\n */\nfunction getDenyModesV2(policy) {\n const deniedModes = getIriAll(policy, acp.deny);\n return {\n read: deniedModes.includes(internal_accessModeIriStrings.read),\n append: deniedModes.includes(internal_accessModeIriStrings.append),\n write: deniedModes.includes(internal_accessModeIriStrings.write),\n };\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Given a [[Policy]], return which [[AccessModes]] it disallows.\n *\n * @param policy The Policy on which you want to know the Access Modes it disallows.\n * @since 1.6.0\n * @deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use [[getDenyModesV2]].\n */\nfunction getDenyModesV1(policy) {\n const deniedModes = getIriAll(policy, acp.deny);\n return {\n read: deniedModes.includes(acp.Read),\n append: deniedModes.includes(acp.Append),\n write: deniedModes.includes(acp.Write),\n };\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Initialise a new, empty [[ResourcePolicy]] for the given Resource.\n *\n * @param resourceWithAcr The Resource to which the Policy is to apply.\n * @param name The name that identifies this Policy.\n * @since 1.6.0\n */\nfunction createResourcePolicyFor(resourceWithAcr, name) {\n const acr = internal_getAcr(resourceWithAcr);\n const url = new URL(getSourceUrl(acr));\n url.hash = `#${name}`;\n let policyThing = createThing({ url: url.href });\n policyThing = setUrl(policyThing, rdf.type, acp.Policy);\n return policyThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the [[ResourcePolicy]] with the given name that applies to a Resource\n * from its Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose ACR contains the given Policy.\n * @param name The name that identifies this Policy.\n * @returns The requested Policy, if it exists and applies to the given Resource, or `null` if it does not.\n * @since 1.6.0\n */\nfunction getResourcePolicy(resourceWithAcr, name) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const url = new URL(acrUrl);\n url.hash = `#${name}`;\n const foundThing = getThing(acr, url.href);\n if (!getPolicyUrlAll$1(resourceWithAcr).includes(url.href) ||\n foundThing === null ||\n !isPolicy(foundThing)) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the [[ResourcePolicy]] with the given name that applies to a Resource's\n * Access Control Resource from that Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose ACR contains the given Policy.\n * @param name The name that identifies this Policy.\n * @returns The requested Policy, if it exists and applies to the Resource's ACR, or `null` if it does not.\n * @since 1.6.0\n */\nfunction getResourceAcrPolicy(resourceWithAcr, name) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const url = new URL(acrUrl);\n url.hash = `#${name}`;\n const foundThing = getThing(acr, url.href);\n if (!getAcrPolicyUrlAll$1(resourceWithAcr).includes(url.href) ||\n foundThing === null ||\n !isPolicy(foundThing)) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get all [[ResourcePolicy]]'s that apply to a Resource in its Access Control\n * Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies applying to it.\n * @since 1.6.0\n */\nfunction getResourcePolicyAll(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const policyUrls = getPolicyUrlAll$1(resourceWithAcr);\n const foundThings = policyUrls.map((policyUrl) => getThing(acr, policyUrl));\n const foundPolicies = foundThings.filter((thing) => thing !== null && isPolicy(thing));\n return foundPolicies;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get all [[ResourcePolicy]]'s that apply to a given Resource's Access Control\n * Resource from that Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies.\n * @since 1.6.0\n */\nfunction getResourceAcrPolicyAll(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const policyUrls = getAcrPolicyUrlAll$1(resourceWithAcr);\n const foundThings = policyUrls.map((policyUrl) => getThing(acr, policyUrl));\n const foundPolicies = foundThings.filter((thing) => thing !== null && isPolicy(thing));\n return foundPolicies;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove the given [[ResourcePolicy]] from the given Resource's Access Control\n * Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies.\n * @param policy The Policy to remove from the Resource's Access Control Resource.\n * @since 1.6.0\n */\nfunction removeResourcePolicy(resourceWithAcr, policy) {\n const acr = internal_getAcr(resourceWithAcr);\n let policyToRemove = policy;\n if (typeof policyToRemove === \"string\") {\n if (internal_isValidUrl(policyToRemove) === false) {\n // If the given Policy to remove is the name of the Policy,\n // resolve it to its full URL — developers usually refer to either the\n // Policy itself, or by its name, as they do not have access to the ACR\n // directly.\n const policyUrl = new URL(getSourceUrl(acr));\n policyUrl.hash = `#${policy}`;\n policyToRemove = policyUrl.href;\n }\n }\n let policyUrlString;\n if (typeof policyToRemove === \"string\") {\n policyUrlString = policyToRemove;\n }\n else if (isNamedNode(policyToRemove)) {\n policyUrlString = internal_toIriString(policyToRemove);\n }\n else {\n policyUrlString = asUrl(policyToRemove, getSourceUrl(acr));\n }\n // Check whether the actual Policy (i.e. with the Policy type) exists:\n const matchingRule = getResourcePolicy(resourceWithAcr, new URL(policyUrlString).hash.substring(1));\n if (matchingRule === null) {\n // No such Policy exists yet, so return the Resource+ACR unchanged:\n return resourceWithAcr;\n }\n const updatedAcr = removeThing(acr, policyToRemove);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return removePolicyUrl$1(updatedResource, policyUrlString);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove the given [[ResourcePolicy]] that applies to a given Resource's Access\n * Control Resource from that Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies.\n * @param policy The ACR Policy to remove from the Resource's Access Control Resource.\n * @since 1.6.0\n */\nfunction removeResourceAcrPolicy(resourceWithAcr, policy) {\n const acr = internal_getAcr(resourceWithAcr);\n let policyToRemove = policy;\n if (typeof policyToRemove === \"string\") {\n if (internal_isValidUrl(policyToRemove) === false) {\n // If the given Policy to remove is the name of the Policy,\n // resolve it to its full URL — developers usually refer to either the\n // Policy itself, or by its name, as they do not have access to the ACR\n // directly.\n const policyUrl = new URL(getSourceUrl(acr));\n policyUrl.hash = `#${policy}`;\n policyToRemove = policyUrl.href;\n }\n }\n let policyUrlString;\n if (typeof policyToRemove === \"string\") {\n policyUrlString = policyToRemove;\n }\n else if (isNamedNode(policyToRemove)) {\n policyUrlString = internal_toIriString(policyToRemove);\n }\n else {\n policyUrlString = asUrl(policyToRemove, getSourceUrl(acr));\n }\n // Check whether the actual Policy (i.e. with the Policy type) exists:\n const matchingRule = getResourceAcrPolicy(resourceWithAcr, new URL(policyUrlString).hash.substring(1));\n if (matchingRule === null) {\n // No such Policy exists yet, so return the Resource+ACR unchanged:\n return resourceWithAcr;\n }\n const updatedAcr = removeThing(acr, policyToRemove);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return removeAcrPolicyUrl$1(updatedResource, policyUrlString);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert the given [[ResourcePolicy]] into the given Resource's Acccess Control\n * Resource, replacing previous instances of that Policy.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies.\n * @param policy The Policy to insert into the Resource's Access Control Resource.\n * @returns A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource.\n * @since 1.6.0\n */\nfunction setResourcePolicy$1(resourceWithAcr, policy) {\n const acr = internal_getAcr(resourceWithAcr);\n const updatedAcr = setThing(acr, policy);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n const policyUrl = asUrl(policy, getSourceUrl(acr));\n return addPolicyUrl$1(updatedResource, policyUrl);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert the given [[ResourcePolicy]] into the given Resource's Acccess Control\n * Resource, replacing previous instances of that Policy, to apply to the Access\n * Control Resource itself.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies.\n * @param policy The Policy to insert into the Resource's Access Control Resource.\n * @returns A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource, applying to that Access Control Resource.\n * @since 1.6.0\n */\nfunction setResourceAcrPolicy(resourceWithAcr, policy) {\n const acr = internal_getAcr(resourceWithAcr);\n const updatedAcr = setThing(acr, policy);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n const policyUrl = asUrl(policy, getSourceUrl(acr));\n return addAcrPolicyUrl$1(updatedResource, policyUrl);\n}\n/**\n * Gets a human-readable representation of the given [[Policy]] to aid debugging.\n *\n * Note that changes to the exact format of the return value are not considered a breaking change;\n * it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.\n *\n * @param policy The Policy to get a human-readable representation of.\n * @since 1.6.0\n * @deprecated\n */\nfunction policyAsMarkdown(policy) {\n function getStatus(allow, deny) {\n if (deny) {\n return \"denied\";\n }\n if (allow) {\n return \"allowed\";\n }\n return \"unspecified\";\n }\n const allowModes = getAllowModesV1(policy);\n const denyModes = getDenyModesV1(policy);\n let markdown = `## Policy: ${asUrl(policy)}\\n\\n`;\n markdown += `- Read: ${getStatus(allowModes.read, denyModes.read)}\\n`;\n markdown += `- Append: ${getStatus(allowModes.append, denyModes.append)}\\n`;\n markdown += `- Write: ${getStatus(allowModes.write, denyModes.write)}\\n`;\n const allOfRules = getAllOfRuleUrlAll(policy);\n const anyOfRules = getAnyOfRuleUrlAll(policy);\n const noneOfRules = getNoneOfRuleUrlAll(policy);\n if (allOfRules.length === 0 &&\n anyOfRules.length === 0 &&\n noneOfRules.length === 0) {\n markdown += \"\\n\\n\";\n }\n if (allOfRules.length > 0) {\n markdown += \"\\nAll of these rules should match:\\n\";\n markdown += `- ${allOfRules.join(\"\\n- \")}\\n`;\n }\n if (anyOfRules.length > 0) {\n markdown += \"\\nAt least one of these rules should match:\\n\";\n markdown += `- ${anyOfRules.join(\"\\n- \")}\\n`;\n }\n if (noneOfRules.length > 0) {\n markdown += \"\\nNone of these rules should match:\\n\";\n markdown += `- ${noneOfRules.join(\"\\n- \")}\\n`;\n }\n return markdown;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n *\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests** that require a\n * [[AccessControlResource]].\n * ```\n *\n * Initialises a new empty Access Control Resource for a given Resource for use\n * in **unit tests**.\n *\n * @param resourceUrl The URL of the Resource to which the mocked ACR should apply.\n * @returns The mocked empty Access Control Resource for the given Resource.\n * @since 1.6.0\n */\nfunction mockAcrFor(resourceUrl) {\n const acrUrl = new URL(\"access-control-resource\", resourceUrl).href;\n const acr = {\n ...mockSolidDatasetFrom(acrUrl),\n accessTo: resourceUrl,\n };\n return acr;\n}\n/**\n * ```{warning}\n * Do not use this function in production code. For use in **unit tests** that require a\n * Resource with an [[AccessControlResource]].\n * ```\n *\n * Attaches an Access Control Resource to a given [[SolidDataset]] for use\n * in **unit tests**; e.g., unit tests that call [[getPolicyUrlAll]].\n *\n * @param resource The Resource to mock up with a new resource ACL.\n * @param accessControlResource The Access Control Resource to attach to the given Resource.\n * @returns The input Resource with an empty resource ACL attached.\n * @since 1.6.0\n */\nfunction addMockAcrTo(resource, accessControlResource = mockAcrFor(getSourceUrl(resource))) {\n const resourceWithAcr = Object.assign(internal_cloneResource(resource), {\n internal_acp: {\n acr: accessControlResource,\n aprs: {},\n },\n });\n return resourceWithAcr;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst v2AcpFunctions = {\n getFileWithAccessDatasets,\n getFileWithAcr,\n getReferencedPolicyUrlAll,\n getResourceInfoWithAccessDatasets,\n getResourceInfoWithAcr,\n getSolidDatasetWithAccessDatasets,\n getSolidDatasetWithAcr,\n hasAccessibleAcr,\n saveAcrFor,\n};\nconst v2ControlFunctions = {\n acrAsMarkdown,\n addAcrPolicyUrl: addAcrPolicyUrl$1,\n addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1,\n addMemberPolicyUrl: addMemberPolicyUrl$1,\n addPolicyUrl: addPolicyUrl$1,\n getAcrPolicyUrlAll: getAcrPolicyUrlAll$1,\n getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1,\n getMemberPolicyUrlAll: getMemberPolicyUrlAll$1,\n getPolicyUrlAll: getPolicyUrlAll$1,\n hasLinkedAcr,\n removeAcrPolicyUrl: removeAcrPolicyUrl$1,\n removeAcrPolicyUrlAll,\n removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1,\n removeMemberAcrPolicyUrlAll,\n removeMemberPolicyUrl: removeMemberPolicyUrl$1,\n removeMemberPolicyUrlAll,\n removePolicyUrl: removePolicyUrl$1,\n removePolicyUrlAll,\n};\nconst v2PolicyFunctions = {\n createPolicy,\n getAllowModes: getAllowModesV1,\n getDenyModes: getDenyModesV1,\n getPolicy,\n getPolicyAll,\n policyAsMarkdown,\n removePolicy,\n setAllowModes: setAllowModesV1,\n setDenyModes: setDenyModesV1,\n setPolicy,\n};\nconst v2RuleFunctions = {\n addAgent: addAgent$1,\n addForbiddenRuleUrl: addNoneOfRuleUrl,\n addGroup,\n addOptionalRuleUrl: addAnyOfRuleUrl,\n addRequiredRuleUrl: addAllOfRuleUrl,\n createRule,\n getAgentAll: getAgentAll$1,\n getForbiddenRuleUrlAll: getNoneOfRuleUrlAll,\n getGroupAll,\n getOptionalRuleUrlAll: getAnyOfRuleUrlAll,\n getRequiredRuleUrlAll: getAllOfRuleUrlAll,\n getRule,\n getRuleAll,\n hasAuthenticated: hasAuthenticated$1,\n hasCreator: hasCreator$1,\n hasPublic: hasPublic$1,\n removeAgent: removeAgent$1,\n removeForbiddenRuleUrl: removeNoneOfRuleUrl,\n removeGroup,\n removeOptionalRuleUrl: removeAnyOfRuleUrl,\n removeRequiredRuleUrl: removeAllOfRuleUrl,\n removeRule,\n ruleAsMarkdown,\n setAgent: setAgent$1,\n setForbiddenRuleUrl: setNoneOfRuleUrl,\n setGroup,\n setOptionalRuleUrl: setAnyOfRuleUrl,\n setRequiredRuleUrl: setAllOfRuleUrl,\n setRule,\n};\nconst v2MockFunctions = {\n addMockAcrTo,\n mockAcrFor,\n};\n/* istanbul ignore next Not a supported public API: */\n/** @deprecated Replaced by [[setPublic]] */\nfunction previousSetPublicSignature(rule, enable) {\n return enable ? setPublic$1(rule) : removePublic$1(rule);\n}\n/* istanbul ignore next Not a supported public API: */\n/** @deprecated Replaced by [[setAuthenticated]] */\nfunction previousSetAuthenticatedSignature(rule, enable) {\n return enable ? setAuthenticated$1(rule) : removeAuthenticated$1(rule);\n}\n/* istanbul ignore next Not a supported public API: */\n/** @deprecated Replaced by [[setCreator]] */\nfunction previousSetCreatorSignature(rule, enable) {\n return enable ? setCreator$1(rule) : removeCreator$1(rule);\n}\nconst deprecatedFunctions$1 = {\n /** @deprecated This misspelling was included accidentally. The correct function is [[getForbiddenRuleUrlAll]]. */\n getForbiddenRuleurlAll: getNoneOfRuleUrlAll,\n setPublic: previousSetPublicSignature,\n setAuthenticated: previousSetAuthenticatedSignature,\n setCreator: previousSetCreatorSignature,\n};\n/**\n * @hidden\n * @deprecated Replaced by [[acp_v3]].\n */\nconst acp_v2 = {\n ...v2AcpFunctions,\n ...v2ControlFunctions,\n ...v2PolicyFunctions,\n ...v2RuleFunctions,\n ...v2MockFunctions,\n ...deprecatedFunctions$1,\n};\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst v1AcpFunctions = {\n getFileWithAccessDatasets,\n getFileWithAcr,\n getReferencedPolicyUrlAll,\n getResourceInfoWithAccessDatasets,\n getResourceInfoWithAcr,\n getSolidDatasetWithAccessDatasets,\n getSolidDatasetWithAcr,\n hasAccessibleAcr,\n saveAcrFor,\n};\nconst v1PolicyFunctions = {\n createPolicy,\n getAllowModes: getAllowModesV1,\n getDenyModes: getDenyModesV1,\n getPolicy,\n getPolicyAll,\n policyAsMarkdown,\n removePolicy,\n setAllowModes: setAllowModesV1,\n setDenyModes: setDenyModesV1,\n setPolicy,\n};\nconst v1RuleFunctions = {\n addAgent: addAgent$1,\n addForbiddenRuleUrl: addNoneOfRuleUrl,\n addGroup,\n addOptionalRuleUrl: addAnyOfRuleUrl,\n addRequiredRuleUrl: addAllOfRuleUrl,\n createRule,\n getAgentAll: getAgentAll$1,\n getForbiddenRuleUrlAll: getNoneOfRuleUrlAll,\n getGroupAll,\n getOptionalRuleUrlAll: getAnyOfRuleUrlAll,\n getRequiredRuleUrlAll: getAllOfRuleUrlAll,\n getRule,\n getRuleAll,\n hasAuthenticated: hasAuthenticated$1,\n hasCreator: hasCreator$1,\n hasPublic: hasPublic$1,\n removeAgent: removeAgent$1,\n removeForbiddenRuleUrl: removeNoneOfRuleUrl,\n removeGroup,\n removeOptionalRuleUrl: removeAnyOfRuleUrl,\n removeRequiredRuleUrl: removeAllOfRuleUrl,\n removeRule,\n ruleAsMarkdown,\n setAgent: setAgent$1,\n setForbiddenRuleUrl: setNoneOfRuleUrl,\n setGroup,\n setOptionalRuleUrl: setAnyOfRuleUrl,\n setRequiredRuleUrl: setAllOfRuleUrl,\n setRule,\n};\nconst v1MockFunctions = {\n addMockAcrTo,\n mockAcrFor,\n};\nconst v1ControlFunctions = {\n hasLinkedAcr,\n addAcrPolicyUrl: addAcrPolicyUrl$1,\n addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1,\n getAcrPolicyUrlAll: getAcrPolicyUrlAll$1,\n getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1,\n removeAcrPolicyUrl: removeAcrPolicyUrl$1,\n removeAcrPolicyUrlAll,\n removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1,\n removeMemberAcrPolicyUrlAll,\n};\nconst deprecatedFunctions = {\n createControl: internal_createControl,\n getControl: internal_getControl,\n getAllControl: internal_getControlAll,\n getControlAll: internal_getControlAll,\n setControl: internal_setControl,\n removeControl,\n addPolicyUrl: internal_addPolicyUrl,\n getPolicyUrlAll: internal_getPolicyUrlAll,\n removePolicyUrl: internal_removePolicyUrl,\n removePolicyUrlAll: internal_removePolicyUrlAll,\n addMemberPolicyUrl: internal_addMemberPolicyUrl,\n getMemberPolicyUrlAll: internal_getMemberPolicyUrlAll,\n removeMemberPolicyUrl: internal_getMemberPolicyUrlAll,\n removeMemberPolicyUrlAll: internal_removeMemberPolicyUrlAll,\n /** @deprecated This misspelling was included accidentally. The correct function is [[getForbiddenRuleUrlAll]]. */\n getForbiddenRuleurlAll: getNoneOfRuleUrlAll,\n setPublic: previousSetPublicSignature,\n setAuthenticated: previousSetAuthenticatedSignature,\n setCreator: previousSetCreatorSignature,\n};\n/**\n * @hidden\n * @deprecated Replaced by [[acp_v2]].\n */\nconst acp_v1 = {\n ...v1AcpFunctions,\n ...v1PolicyFunctions,\n ...v1RuleFunctions,\n ...v1MockFunctions,\n ...v1ControlFunctions,\n ...deprecatedFunctions,\n};\n/**\n * ```{note} The Web Access Control specification is not yet finalised. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Remove an [[Control]] from the [[AccessControlResource]] of a Resource.\n *\n * @param withAccessControlResource A Resource with the Access Control Resource from which to remove an Access Control.\n * @param control The [[Control]] to remove from the given Access Control Resource.\n * @returns The given Resource with a new Access Control Resource equal to the original Access Control Resource, excluding the given Access Control.\n * @hidden Developers don't need to care about initialising Controls - they can just add Policies directly.\n * @deprecated\n */\nfunction removeControl(withAccessControlResource, control) {\n const acr = internal_getAcr(withAccessControlResource);\n const updatedAcr = removeThing(acr, control);\n const updatedResource = internal_setAcr(withAccessControlResource, updatedAcr);\n return updatedResource;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst v3AcpFunctions = {\n getFileWithAccessDatasets,\n getFileWithAcr,\n getLinkedAcrUrl,\n getReferencedPolicyUrlAll,\n getResourceInfoWithAccessDatasets,\n getResourceInfoWithAcr,\n getSolidDatasetWithAccessDatasets,\n getSolidDatasetWithAcr,\n hasAccessibleAcr,\n saveAcrFor,\n isAcpControlled,\n};\nconst v3ControlFunctions = {\n acrAsMarkdown,\n addAcrPolicyUrl: addAcrPolicyUrl$1,\n addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1,\n addMemberPolicyUrl: addMemberPolicyUrl$1,\n addPolicyUrl: addPolicyUrl$1,\n getAcrPolicyUrlAll: getAcrPolicyUrlAll$1,\n getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1,\n getMemberPolicyUrlAll: getMemberPolicyUrlAll$1,\n getPolicyUrlAll: getPolicyUrlAll$1,\n hasLinkedAcr,\n removeAcrPolicyUrl: removeAcrPolicyUrl$1,\n removeAcrPolicyUrlAll,\n removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1,\n removeMemberAcrPolicyUrlAll,\n removeMemberPolicyUrl: removeMemberPolicyUrl$1,\n removeMemberPolicyUrlAll,\n removePolicyUrl: removePolicyUrl$1,\n removePolicyUrlAll,\n};\nconst v3PolicyFunctions = {\n createPolicy,\n getAllowModes: getAllowModesV1,\n getDenyModes: getDenyModesV1,\n getPolicy,\n getPolicyAll,\n policyAsMarkdown,\n removePolicy,\n setAllowModes: setAllowModesV1,\n setDenyModes: setDenyModesV1,\n setPolicy,\n createResourcePolicyFor,\n getResourceAcrPolicy,\n getResourceAcrPolicyAll,\n getResourcePolicy,\n getResourcePolicyAll,\n removeResourceAcrPolicy,\n removeResourcePolicy,\n setResourceAcrPolicy,\n setResourcePolicy: setResourcePolicy$1,\n};\nconst v3RuleFunctions = {\n addAgent: addAgent$1,\n addGroup,\n createRule,\n getAgentAll: getAgentAll$1,\n getGroupAll,\n getRule,\n getRuleAll,\n removeAgent: removeAgent$1,\n removeGroup,\n removeRule,\n ruleAsMarkdown,\n setAgent: setAgent$1,\n setGroup,\n setRule,\n addClient: addClient$1,\n getClientAll: getClientAll$1,\n hasAnyClient: hasAnyClient$1,\n removeClient: removeClient$1,\n setAnyClient: setAnyClient$1,\n setClient: setClient$1,\n removeAnyClient: removeAnyClient$1,\n hasAuthenticated: hasAuthenticated$1,\n hasCreator: hasCreator$1,\n hasPublic: hasPublic$1,\n setAuthenticated: setAuthenticated$1,\n setCreator: setCreator$1,\n setPublic: setPublic$1,\n removeAuthenticated: removeAuthenticated$1,\n removeCreator: removeCreator$1,\n removePublic: removePublic$1,\n getAnyOfRuleUrlAll,\n addAnyOfRuleUrl,\n removeAnyOfRuleUrl,\n setAnyOfRuleUrl,\n getAllOfRuleUrlAll,\n addAllOfRuleUrl,\n removeAllOfRuleUrl,\n setAllOfRuleUrl,\n getNoneOfRuleUrlAll,\n addNoneOfRuleUrl,\n removeNoneOfRuleUrl,\n setNoneOfRuleUrl,\n createResourceRuleFor,\n getResourceRule,\n getResourceRuleAll,\n removeResourceRule,\n setResourceRule,\n};\nconst v3MockFunctions = {\n addMockAcrTo,\n mockAcrFor,\n};\n/**\n * @hidden\n * @deprecated Please import \"acp_ess_1\" directly.\n */\nconst acp_v3 = {\n ...v3AcpFunctions,\n ...v3ControlFunctions,\n ...v3PolicyFunctions,\n ...v3RuleFunctions,\n ...v3MockFunctions,\n};\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction setAccessControlResourceThing(resource, thing) {\n return Object.assign(internal_cloneResource(resource), {\n internal_acp: {\n ...resource.internal_acp,\n acr: setThing(resource.internal_acp.acr, thing),\n },\n });\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction getAccessControlTypeFromDefaultAccessControlName(name) {\n if (name.includes(\"Member\")) {\n return ACP.memberAccessControl;\n }\n return ACP.accessControl;\n}\n/** @hidden */\nfunction setDefaultAccessControlThingIfNotExist(resource, name) {\n const defaultAccessControlThingUrl = getDefaultAccessControlUrl(resource, name);\n const acr = internal_getAcr(resource);\n // Get the Access Control Resource Thing or create it\n let accessControlResourceThing = getAccessControlResourceThing(resource);\n if (accessControlResourceThing === null ||\n typeof accessControlResourceThing === \"undefined\") {\n accessControlResourceThing = createThing({ url: getSourceUrl(acr) });\n }\n // Get the Default Access Control Thing or create it and return\n const accessControlUrlAll = getIriAll(accessControlResourceThing, getAccessControlTypeFromDefaultAccessControlName(name));\n if (!accessControlUrlAll.includes(defaultAccessControlThingUrl)) {\n accessControlResourceThing = buildThing(accessControlResourceThing)\n .addUrl(getAccessControlTypeFromDefaultAccessControlName(name), defaultAccessControlThingUrl)\n .build();\n return setAccessControlResourceThing(resource, accessControlResourceThing);\n }\n // Return the original resource if the ACR and Default AC exist\n return resource;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Add a policy applying to the ACR of the given resource.\n *\n * @param resourceWithAcr The resource for which to add the URL of a policy\n * applying to its access control resource.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction addAcrPolicyUrl(resourceWithAcr, policyUrl) {\n const resourceWithAcrContainingDefaultAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_ACR_ACCESS_CONTROL);\n const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultAccessControl, DEFAULT_ACR_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcrContainingDefaultAccessControl, buildThing(defaultAccessControlThing).addUrl(ACP.access, policyUrl).build());\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Add a policy applying to the ACRs of the given resource's children.\n *\n * @param resourceWithAcr The resource for which to add the URL of a policy\n * applying to its children's access control resources.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction addMemberAcrPolicyUrl(resourceWithAcr, policyUrl) {\n const resourceWithAcrContainingDefaultAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_MEMBER_ACR_ACCESS_CONTROL);\n const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultAccessControl, DEFAULT_MEMBER_ACR_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcrContainingDefaultAccessControl, buildThing(defaultAccessControlThing).addUrl(ACP.access, policyUrl).build());\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Add a policy applying to the given resource's children.\n *\n * @param resourceWithAcr The resource for which to add the URL of a policy\n * applying to its children.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction addMemberPolicyUrl(resourceWithAcr, policyUrl) {\n const resourceWithAcrContainingDefaultMemberAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_MEMBER_ACCESS_CONTROL);\n const defaultMemberAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultMemberAccessControl, DEFAULT_MEMBER_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcrContainingDefaultMemberAccessControl, buildThing(defaultMemberAccessControlThing)\n .addUrl(ACP.apply, policyUrl)\n .build());\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Add a policy applying to the given resource.\n *\n * @param resourceWithAcr The resource for which to add the URL of a policy\n * applying to it.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction addPolicyUrl(resourceWithAcr, policyUrl) {\n const resourceWithAcrContainingDefaultAccessControl = setDefaultAccessControlThingIfNotExist(resourceWithAcr, DEFAULT_ACCESS_CONTROL);\n const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcrContainingDefaultAccessControl, DEFAULT_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcrContainingDefaultAccessControl, buildThing(defaultAccessControlThing).addUrl(ACP.apply, policyUrl).build());\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Get the URL of all access controls linked to the given resource's ACR.\n *\n * @param resourceWithAcr The resource for which to retrieve URLs of access\n * controls applying to it.\n * @returns Access Control URL array\n * @since 1.6.0\n */\nfunction getAccessControlUrlAll(resourceWithAcr) {\n const acrThing = getAccessControlResourceThing(resourceWithAcr);\n if (acrThing === null) {\n return [];\n }\n return getIriAll(acrThing, ACP.accessControl);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction getPolicyUrls(resource, accessControlUrls, type) {\n const acr = internal_getAcr(resource);\n return Array.from(new Set(accessControlUrls\n .map((accessControlUrl) => {\n const accessControlThing = getThing(acr, accessControlUrl);\n // istanbul ignore next\n if (accessControlThing !== null) {\n return getIriAll(accessControlThing, type);\n }\n // istanbul ignore next\n return [];\n })\n .reduce((previousValue, currentValue) => previousValue.concat(currentValue), [])));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Get the URLs of policies applying to the ACR of the given resource.\n *\n * @param resourceWithAcr The resource for which to retrieve URLs of policies\n * applying to its access control resource.\n * @returns Policy URL array.\n * @since 1.16.1\n */\nfunction getAcrPolicyUrlAll(resourceWithAcr) {\n return getPolicyUrls(resourceWithAcr, getAccessControlUrlAll(resourceWithAcr), ACP.access);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Get the URL of all member access controls linked to the given resource's ACR.\n *\n * @param resourceWithAcr The resource for which to retrieve URLs of access\n * controls inherited by its children.\n * @returns Access Control URL array\n * @since 1.6.0\n */\nfunction getMemberAccessControlUrlAll(resourceWithAcr) {\n const acrThing = getAccessControlResourceThing(resourceWithAcr);\n if (acrThing === null) {\n return [];\n }\n return getIriAll(acrThing, ACP.memberAccessControl);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Get the URLs of policies applying to the ACRs of the given resource's\n * children.\n *\n * @param resourceWithAcr The resource for which to retrieve URLs of policies\n * applying to its children's access control resources.\n * @returns Policy URL array.\n * @since 1.16.1\n */\nfunction getMemberAcrPolicyUrlAll(resourceWithAcr) {\n return getPolicyUrls(resourceWithAcr, getMemberAccessControlUrlAll(resourceWithAcr), ACP.access);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Get the URLs of policies applying to the given resource's children.\n *\n * @param resourceWithAcr The resource for which to retrieve URLs policies\n * applying to its children.\n * @returns Policy URL array.\n * @since 1.16.1\n */\nfunction getMemberPolicyUrlAll(resourceWithAcr) {\n return getPolicyUrls(resourceWithAcr, getMemberAccessControlUrlAll(resourceWithAcr), ACP.apply);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Get the URLs of policies applying to the given resource.\n *\n * @param resourceWithAcr The resource for which to retrieve URLs of policies\n * applying to it.\n * @returns Policy URL array.\n * @since 1.16.1\n */\nfunction getPolicyUrlAll(resourceWithAcr) {\n return getPolicyUrls(resourceWithAcr, getAccessControlUrlAll(resourceWithAcr), ACP.apply);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Remove a policy applying to the ACR of the given resource.\n *\n * @param resourceWithAcr The resource for which to remove the URL of a policy\n * applying to its access control resource.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction removeAcrPolicyUrl(resourceWithAcr, policyUrl) {\n const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_ACR_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.access, policyUrl));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Remove a policy applying to the ACRs of the given resource's children.\n *\n * @param resourceWithAcr The resource for which to remove the URL of a policy\n * applying to its children's access control resources.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction removeMemberAcrPolicyUrl(resourceWithAcr, policyUrl) {\n const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_MEMBER_ACR_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.access, policyUrl));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Remove a policy applying to the given resource's children.\n *\n * @param resourceWithAcr The resource for which to remove the URL of a policy\n * applying to its children.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction removeMemberPolicyUrl(resourceWithAcr, policyUrl) {\n const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_MEMBER_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.apply, policyUrl));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Remove a policy applying to the given resource.\n *\n * @param resourceWithAcr The resource for which to remove the URL of a policy\n * applying to it.\n * @param policyUrl A Policy URL.\n * @returns The resource with its ammended access control resource.\n * @since 1.16.1\n */\nfunction removePolicyUrl(resourceWithAcr, policyUrl) {\n const defaultAccessControlThing = getDefaultAccessControlThing(resourceWithAcr, DEFAULT_ACCESS_CONTROL);\n return setAccessControlResourceThing(resourceWithAcr, removeIri(defaultAccessControlThing, ACP.apply, policyUrl));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Insert the given [[ResourcePolicy]] into the given Resource's Acccess Control\n * Resource, replacing previous instances of that Policy.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains Access Policies.\n * @param policy The Policy to insert into the Resource's Access Control Resource.\n * @returns A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource.\n * @since 1.18.0\n */\nfunction setResourcePolicy(resourceWithAcr, policy) {\n return setAccessControlResourceThing(resourceWithAcr, policy);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * @param thing the [[Thing]] to check to see if it's an ACP Matcher or not\n */\nfunction isMatcher(thing) {\n return getIriAll(thing, rdf.type).includes(acp.Matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a Matcher that refines the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is **not** present in **any** of the \"All Of\" Matchers,\n * they will not be granted access.\n *\n * Also see [[addAnyOfMatcherUrl]] and [[addNoneOfMatcherUrl]].\n *\n * @param policy The [[Policy]] to which the Matcher should be added.\n * @param matcher The Matcher to add to the policy.\n * @returns A new [[Policy]] clone of the original one, with the new Matcher added.\n * @since Not released yet.\n */\nfunction addAllOfMatcherUrl(policy, matcher) {\n return addIri(policy, acp.allOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes a Matcher that refines the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is **not** present in **any** of the \"All Of\" Matchers,\n * they will not be granted access.\n * @param policy The [[Policy]] from which the Matcher should be removed.\n * @param matcher The Matcher to remove from the policy.\n * @returns A new [[Policy]] clone of the original one, with the Matcher removed.\n * @since Not released yet.\n */\nfunction removeAllOfMatcherUrl(policy, matcher) {\n return removeIri(policy, acp.allOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrites the Matcher refining the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is **not** present in **any** of the \"All Of\" Matchers,\n * they will not be granted access.\n * @param policy The [[Policy]] to which the Matcher should be added.\n * @param matcher The Matcher to set for the Policy.\n * @returns A new [[Policy]] clone of the original one, with the \"All Of\" Matchers replaced.\n * @since Not released yet.\n */\nfunction setAllOfMatcherUrl(policy, matcher) {\n return setIri(policy, acp.allOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the \"All Of\" [[Matcher]]s for the given [[Policy]]\n * @param policy The [[policy]] from which the Matchers should be read.\n * @returns A list of the \"All Of\" [[Matcher]]s\n * @since Not released yet.\n */\nfunction getAllOfMatcherUrlAll(policy) {\n return getIriAll(policy, acp.allOf);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a Matcher that extends the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the \"Any Of\" Matchers,\n * they will be granted access.\n *\n * Also see [[addAllOfMatcherUrl]] and [[addNoneOfMatcherUrl]].\n *\n * @param policy The [[Policy]] to which the Matcher should be added.\n * @param matcher The Matcher to add to the policy.\n * @returns A new [[Policy]] clone of the original one, with the new Matcher added.\n * @since Not released yet.\n */\nfunction addAnyOfMatcherUrl(policy, matcher) {\n return addIri(policy, acp.anyOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes a Matcher that extends the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the \"Any Of\" Matchers,\n * they will be granted access.\n * @param policy The [[Policy]] from which the Matcher should be removed.\n * @param matcher The Matcher to remove from the policy.\n * @returns A new [[Policy]] clone of the original one, with the Matcher removed.\n * @since Not released yet.\n */\nfunction removeAnyOfMatcherUrl(policy, matcher) {\n return removeIri(policy, acp.anyOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrite the Matcher extending the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is present in **any** of the \"Any Of\" Matchers,\n * they will be granted access.\n * @param policy The [[Policy]] to which the Matcher should be added.\n * @param matcher The Matcher to set for the Policy.\n * @returns A new [[Policy]] clone of the original one, with the \"Any Of\" Matchers replaced.\n * @since Not released yet.\n */\nfunction setAnyOfMatcherUrl(policy, matcher) {\n return setIri(policy, acp.anyOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the \"Any Of\" [[Matcher]]s for the given [[Policy]]\n * @param policy The [[policy]] from which the Matchers should be read.\n * @returns A list of the \"Any Of\" [[Matcher]]s\n * @since Not released yet.\n */\nfunction getAnyOfMatcherUrlAll(policy) {\n return getIriAll(policy, acp.anyOf);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Add a Matcher that restricts the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is matched by another Matcher, but **also**\n * by the given Matcher, they will **not** be granted access.\n *\n * Also see [[addAllOfMatcherUrl]] and [[addAnyOfMatcherUrl]].\n *\n * @param policy The [[Policy]] to which the Matcher should be added.\n * @param matcher The Matcher to add to the policy.\n * @returns A new [[Policy]] clone of the original one, with the new Matcher added.\n * @since Not released yet.\n */\nfunction addNoneOfMatcherUrl(policy, matcher) {\n return addIri(policy, acp.noneOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes a Matcher that restricts the scope of a given the [[Policy]]. If an agent\n * requesting access to a resource is matched by another Matcher, but **also**\n * in any of the \"None Of\" Matchers, they will **not** be granted access.\n *\n * @param policy The [[Policy]] from which the Matcher should be removed.\n * @param matcher The Matcher to remove from the policy.\n * @returns A new [[Policy]] clone of the original one, with the Matcher removed.\n * @since Not released yet.\n */\nfunction removeNoneOfMatcherUrl(policy, matcher) {\n return removeIri(policy, acp.noneOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set the Matchers restricting the scope of a given [[Policy]]. If an agent\n * requesting access to a resource is matched by another Matcher, but **also**\n * by any of the \"None Of\" Matchers, they will not be granted access.\n *\n * @param policy The [[Policy]] to which the Matcher should be added.\n * @param matcher The Matcher to set for the Policy.\n * @returns A new [[Policy]] clone of the original one, with the \"None Of\" Matchers replaced.\n * @since Not released yet.\n */\nfunction setNoneOfMatcherUrl(policy, matcher) {\n return setIri(policy, acp.noneOf, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the \"None Of\" [[Matcher]]s for the given [[Policy]]\n * @param policy The [[policy]] from which the Matchers should be read.\n * @returns A list of the forbidden [[Matcher]]s\n * @since Not released yet.\n */\nfunction getNoneOfMatcherUrlAll(policy) {\n return getIriAll(policy, acp.noneOf);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Initialise a new, empty [[Matcher]].\n *\n * @param url URL that identifies this [[Matcher]].\n * @since Not released yet.\n */\nfunction createMatcher(url) {\n const stringUrl = internal_toIriString(url);\n let matcherThing = createThing({ url: stringUrl });\n matcherThing = setUrl(matcherThing, rdf.type, acp.Matcher);\n return matcherThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Initialise a new, empty [[ResourceMatcher]] for the given Resource.\n *\n * @param resourceWithAcr The Resource to which the new Matcher is to apply.\n * @param name Name that identifies this [[Matcher]].\n * @since Not released yet.\n */\nfunction createResourceMatcherFor(resourceWithAcr, name) {\n const acr = internal_getAcr(resourceWithAcr);\n const url = new URL(getSourceUrl(acr));\n url.hash = `#${name}`;\n let matcherThing = createThing({ url: url.href });\n matcherThing = setUrl(matcherThing, rdf.type, acp.Matcher);\n return matcherThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the [[Matcher]] with the given URL from an [[SolidDataset]].\n *\n * @param matcherResource The Resource that contains the given [[Matcher]].\n * @param url URL that identifies this [[Matcher]].\n * @returns The requested [[Matcher]], if it exists, or `null` if it does not.\n * @since Not released yet.\n */\nfunction getMatcher(matcherResource, url) {\n const foundThing = getThing(matcherResource, url);\n if (foundThing === null || !isMatcher(foundThing)) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Get the [[ResourceMatcher]] with the given name from an Resource's Access Control\n * Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains the given [[ResourceMatcher]].\n * @param name Name that identifies this [[ResourceMatcher]].\n * @returns The requested [[ResourceMatcher]], if it exists, or `null` if it does not.\n * @since Not released yet.\n */\nfunction getResourceMatcher(resourceWithAcr, name) {\n const acr = internal_getAcr(resourceWithAcr);\n const acrUrl = getSourceUrl(acr);\n const url = new URL(acrUrl);\n url.hash = `#${name}`;\n const foundThing = getThing(acr, url.href);\n if (foundThing === null || !isMatcher(foundThing)) {\n return null;\n }\n return foundThing;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Gets the [[Matcher]]s from a [[SolidDataset]].\n *\n * @param matcherResource The Resource that contains (zero or more) [[Matcher]]s.\n * @returns The [[Matcher]]s contained in this resource.\n * @since Not released yet.\n */\nfunction getMatcherAll(matcherResource) {\n const things = getThingAll(matcherResource);\n return things.filter(isMatcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Gets the [[ResourceMatcher]]s from a Resource's Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceMatcher]]s.\n * @returns The [[ResourceMatcher]]s contained in this Resource's Access Control Resource.\n * @since Not released yet.\n */\nfunction getResourceMatcherAll(resourceWithAcr) {\n const acr = internal_getAcr(resourceWithAcr);\n const things = getThingAll(acr);\n return things.filter(isMatcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes the given [[Matcher]] from the given [[SolidDataset]].\n *\n * @param matcherResource The Resource that contains (zero or more) [[Matcher]]s.\n * @returns A new SolidDataset equal to the given Matcher Resource, but without the given Matcher.\n * @since Not released yet.\n */\nfunction removeMatcher(matcherResource, matcher) {\n return removeThing(matcherResource, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Removes the given [[ResourceMatcher]] from the given Resource's Access Control Resource.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceMatcher]]s.\n * @returns A new Resource equal to the given Resource, but without the given Matcher in its ACR.\n * @since Not released yet.\n */\nfunction removeResourceMatcher(resourceWithAcr, matcher) {\n const acr = internal_getAcr(resourceWithAcr);\n let matcherToRemove;\n if (typeof matcher === \"string\") {\n if (internal_isValidUrl(matcher)) {\n matcherToRemove = matcher;\n }\n else {\n // If the given Matcher to remove is the name of the Matcher,\n // resolve it to its full URL — developers usually refer to either the\n // Matcher itself, or by its name, as they do not have access to the ACR\n // directly.\n const matcherUrl = new URL(getSourceUrl(acr));\n matcherUrl.hash = `#${matcher}`;\n matcherToRemove = matcherUrl.href;\n }\n }\n else if (isNamedNode(matcher)) {\n matcherToRemove = internal_toIriString(matcher);\n }\n else {\n matcherToRemove = asUrl(matcher);\n }\n // Check whether the actual Matcher (i.e. with the Matcher type) exists:\n const matchingMatcher = getResourceMatcher(resourceWithAcr, new URL(matcherToRemove).hash.substring(1));\n if (matchingMatcher === null) {\n // No such Matcher exists yet, so return the Resource+ACR unchanged:\n return resourceWithAcr;\n }\n const updatedAcr = removeThing(acr, matchingMatcher);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return updatedResource;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert the given [[Matcher]] into the given [[SolidDataset]], replacing previous\n * instances of that Matcher.\n *\n * @param matcherResource The Resource that contains (zero or more) [[Matcher]]s.\n * @returns A new SolidDataset equal to the given Matcher Resource, but with the given Matcher.\n * @since Not released yet.\n */\nfunction setMatcher(matcherResource, matcher) {\n return setThing(matcherResource, matcher);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Insert the given [[ResourceMatcher]] into the given Resource's Access Control Resource,\n * replacing previous instances of that Matcher.\n *\n * @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceMatcher]]s.\n * @returns A new Resource equal to the given Resource, but with the given Matcher in its ACR.\n * @since Not released yet.\n */\nfunction setResourceMatcher(resourceWithAcr, matcher) {\n const acr = internal_getAcr(resourceWithAcr);\n const updatedAcr = setThing(acr, matcher);\n const updatedResource = internal_setAcr(resourceWithAcr, updatedAcr);\n return updatedResource;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * List all the agents a [[Matcher]] applies **directly** to. This will not include agents\n * that are matched on a property other than their WebID.\n *\n * @param matcher The matcher from which agents are read.\n * @returns A list of the WebIDs of agents included in the matcher.\n * @since Not released yet.\n */\nfunction getAgentAll(matcher) {\n return getIriAll(matcher, acp.agent).filter((agent) => agent !== acp.PublicAgent &&\n agent !== acp.AuthenticatedAgent &&\n agent !== acp.CreatorAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrite the agents the [[Matcher]] applies to with the provided agents.\n *\n * @param matcher The matcher for which agents are set.\n * @param agent The agent the matcher should apply to.\n * @returns A copy of the input matcher, applying to a different set of agents.\n * @since Not released yet.\n */\nfunction setAgent(matcher, agent) {\n // Preserve the special agent classes authenticated and public, which we\n // don't want to overwrite with this function.\n const isPublic = hasPublic(matcher);\n const isAuthenticated = hasAuthenticated(matcher);\n const isCreator = hasCreator(matcher);\n let result = setIri(matcher, acp.agent, agent);\n // Restore public and authenticated\n if (isPublic) {\n result = setPublic(result);\n }\n if (isAuthenticated) {\n result = setAuthenticated(result);\n }\n if (isCreator) {\n result = setCreator(result);\n }\n return result;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Apply the [[Matcher]] to an additional agent.\n *\n * @param matcher The [[Matcher]] to be applied to an additional agent.\n * @param agent The agent the [[Matcher]] should apply to.\n * @returns A copy of the [[Matcher]], applying to an additional agent.\n * @since Not released yet.\n */\nfunction addAgent(matcher, agent) {\n return addIri(matcher, acp.agent, agent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Prevent the [[Matcher]] from applying to a given agent directly. This will not\n * prevent the agent from matching on other properties than its WebID.\n *\n * @param matcher The [[Matcher]] that should no longer apply to a given agent.\n * @param agent The agent the Matcher should no longer apply to.\n * @returns A copy of the Matcher, not applying to the given agent.\n * @since Not released yet.\n */\nfunction removeAgent(matcher, agent) {\n return removeIri(matcher, acp.agent, agent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the Matcher applies to any agent.\n *\n * @param matcher The Matcher checked for public access.\n * @returns Whether the Matcher applies to any agent or not.\n * @since Not released yet.\n */\nfunction hasPublic(matcher) {\n return (getIriAll(matcher, acp.agent).filter((agent) => agent === acp.PublicAgent)\n .length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Matcher to apply to any Agent.\n *\n * @param matcher The Matcher being modified.\n * @returns A copy of the Matcher, updated to apply to any agent.\n * @since Not released yet.\n */\nfunction setPublic(matcher) {\n // The second argument should not be part of the function signature,\n // so it's not in the parameter list:\n // eslint-disable-next-line prefer-rest-params\n if (typeof arguments === \"object\" && typeof arguments[1] === \"boolean\") {\n throw new Error(\"The function `setPublic` no longer takes a second parameter. It is now used together with `removePublic` instead.\");\n }\n return addIri(matcher, acp.agent, acp.PublicAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Matcher to no longer apply to any Agent.\n *\n * @param matcher The Matcher being modified.\n * @returns A copy of the Matcher, updated to no longer apply to any agent.\n * @since Not released yet.\n */\nfunction removePublic(matcher) {\n return removeIri(matcher, acp.agent, acp.PublicAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the Matcher applies to any authenticated agent.\n *\n * @param matcher The Matcher checked for authenticated access.\n * @returns Whether the Matcher applies to any authenticated agent or not.\n * @since Not released yet.\n */\nfunction hasAuthenticated(matcher) {\n return (getIriAll(matcher, acp.agent).filter((agent) => agent === acp.AuthenticatedAgent).length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Matcher to apply to any authenticated Agent.\n *\n * @param matcher The Matcher being modified.\n * @returns A copy of the Matcher, updated to apply to any authenticated Agent.\n * @since Not released yet.\n */\nfunction setAuthenticated(matcher) {\n // The second argument should not be part of the function signature,\n // so it's not in the parameter list:\n // eslint-disable-next-line prefer-rest-params\n if (typeof arguments === \"object\" && typeof arguments[1] === \"boolean\") {\n throw new Error(\"The function `setAuthenticated` no longer takes a second parameter. It is now used together with `removeAuthenticated` instead.\");\n }\n return addIri(matcher, acp.agent, acp.AuthenticatedAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Matcher to no longer apply to any authenticated Agent.\n *\n * @param matcher The Matcher being modified.\n * @returns A copy of the Matcher, updated to apply/not apply to any authenticated agent.\n * @since Not released yet.\n */\nfunction removeAuthenticated(matcher) {\n return removeIri(matcher, acp.agent, acp.AuthenticatedAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the Matcher applies to the creator of the Resource.\n *\n * @param matcher The Matcher checked for authenticated access.\n * @returns Whether the Matcher applies to the creator of the Resource or not.\n * @since Not released yet.\n */\nfunction hasCreator(matcher) {\n return (getIriAll(matcher, acp.agent).filter((agent) => agent === acp.CreatorAgent)\n .length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Matcher to apply to the creator of a Resource.\n *\n * @param matcher The Matcher being modified.\n * @returns A copy of the Matcher, updated to apply to the creator of a Resource.\n * @since Not released yet.\n */\nfunction setCreator(matcher) {\n // The second argument should not be part of the function signature,\n // so it's not in the parameter list:\n // eslint-disable-next-line prefer-rest-params\n if (typeof arguments === \"object\" && typeof arguments[1] === \"boolean\") {\n throw new Error(\"The function `setCreator` no longer takes a second parameter. It is now used together with `removeCreator` instead.\");\n }\n return addIri(matcher, acp.agent, acp.CreatorAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Set a Matcher to no longer apply to the creator of a Resource.\n *\n * @param matcher The Matcher being modified.\n * @returns A copy of the Matcher, updated to apply/not apply to the creator of a Resource.\n * @since Not released yet.\n */\nfunction removeCreator(matcher) {\n return removeIri(matcher, acp.agent, acp.CreatorAgent);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * List all the clients a [[Matcher]] applies **directly** to. This will not include\n * specific client classes, such as public clients.\n *\n * @param matcher The Matcher from which clients are read.\n * @returns A list of the WebIDs of clients included in the Matcher.\n * @since Not released yet.\n */\nfunction getClientAll(matcher) {\n return getIriAll(matcher, acp.client)\n .filter((client) => client !== solid.PublicOidcClient)\n .concat(getStringNoLocaleAll(matcher, acp.client));\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Overwrite the clients the [[Matcher]] applies to with the provided Client.\n *\n * @param matcher The Matcher for which clients are set.\n * @param client The Client the Matcher should apply to.\n * @returns A copy of the input Matcher, applying to a different set of Clients.\n */\nfunction setClient(matcher, client) {\n // Preserve the special \"any client\" class, which we\n // don't want to overwrite with this function.\n const anyClientEnabled = hasAnyClient(matcher);\n let result = setIri(matcher, acp.client, client);\n // Restore the \"any client\" class\n if (anyClientEnabled) {\n result = setAnyClient(result);\n }\n return result;\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Apply the [[Matcher]] to an additional Client.\n *\n * @param matcher The [[Matcher]] to be applied to an additional Client.\n * @param client The Client the [[Matcher]] should apply to.\n * @returns A copy of the [[Matcher]], applying to an additional Client.\n * @since Not released yet.\n */\nfunction addClient(matcher, client) {\n if (!internal_isValidUrl(client)) {\n return addStringNoLocale(matcher, acp.client, client);\n }\n return addIri(matcher, acp.client, client);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Prevent the [[Matcher]] from applying to a given Client directly.\n *\n * @param matcher The [[Matcher]] that should no longer apply to a given Client.\n * @param client The Client the Matcher should no longer apply to.\n * @returns A copy of the Matcher, not applying to the given Client.\n * @since Not released yet.\n */\nfunction removeClient(matcher, client) {\n if (!internal_isValidUrl(client)) {\n return removeStringNoLocale(matcher, acp.client, client);\n }\n return removeIri(matcher, acp.client, client);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Check if the Matcher applies to any client, i.e. all the applications\n * regardless of their identifier.\n *\n * @param matcher The Matcher checked for authenticated access.\n * @returns Whether the Matcher applies to public clients.\n * @since Not released yet.\n * @deprecated\n */\nfunction hasAnyClient(matcher) {\n return (getIriAll(matcher, acp.client).filter((client) => client === solid.PublicOidcClient).length > 0);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Make the [[Matcher]] apply to any client application.\n *\n * @param matcher The Matcher for which clients are set.\n * @returns A copy of the Matcher, updated to apply to any client\n * @since Not released yet.\n * @deprecated\n */\nfunction setAnyClient(matcher) {\n return addIri(matcher, acp.client, solid.PublicOidcClient);\n}\n/**\n * ```{note} There is no Access Control Policies specification yet. As such, this\n * function is still experimental and subject to change, even in a non-major release.\n * ```\n *\n * Make the [[Matcher]] no longer apply to any client application.\n *\n * @param matcher The Matcher for which clients are set.\n * @returns A copy of the Matcher, updated to no longer apply to any client\n * @since Not released yet.\n * @deprecated\n */\nfunction removeAnyClient(matcher) {\n return removeIri(matcher, acp.client, solid.PublicOidcClient);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst v4AcpFunctions = {\n getFileWithAccessDatasets,\n getFileWithAcr,\n getReferencedPolicyUrlAll,\n getResourceInfoWithAccessDatasets,\n getResourceInfoWithAcr,\n getSolidDatasetWithAccessDatasets,\n getSolidDatasetWithAcr,\n hasAccessibleAcr,\n saveAcrFor,\n isAcpControlled,\n getVcAccess,\n setVcAccess,\n};\nconst v4ControlFunctions = {\n addAcrPolicyUrl,\n addMemberAcrPolicyUrl,\n addMemberPolicyUrl,\n addPolicyUrl,\n getAcrPolicyUrlAll,\n getMemberAcrPolicyUrlAll,\n getMemberPolicyUrlAll,\n getPolicyUrlAll,\n hasLinkedAcr,\n removeAcrPolicyUrl,\n removeAcrPolicyUrlAll,\n removeMemberAcrPolicyUrl,\n removeMemberAcrPolicyUrlAll,\n removeMemberPolicyUrl,\n removeMemberPolicyUrlAll,\n removePolicyUrl,\n removePolicyUrlAll,\n};\nconst v4PolicyFunctions = {\n createPolicy,\n getAllowModes: getAllowModesV2,\n getDenyModes: getDenyModesV2,\n getPolicy,\n getPolicyAll,\n removePolicy,\n setAllowModes: setAllowModesV2,\n setDenyModes: setDenyModesV2,\n setPolicy,\n createResourcePolicyFor,\n getResourceAcrPolicy,\n getResourceAcrPolicyAll,\n getResourcePolicy,\n getResourcePolicyAll,\n removeResourceAcrPolicy,\n removeResourcePolicy,\n setResourcePolicy,\n};\nconst v4MatcherFunctions = {\n addAgent,\n createMatcher,\n getAgentAll,\n getMatcher,\n getMatcherAll,\n removeAgent,\n removeMatcher,\n setAgent,\n setMatcher,\n addClient,\n getClientAll,\n hasAnyClient,\n removeClient,\n setAnyClient,\n setClient,\n removeAnyClient,\n hasAuthenticated,\n hasCreator,\n hasPublic,\n setAuthenticated,\n setCreator,\n setPublic,\n removeAuthenticated,\n removeCreator,\n removePublic,\n getAnyOfMatcherUrlAll,\n addAnyOfMatcherUrl,\n removeAnyOfMatcherUrl,\n setAnyOfMatcherUrl,\n getAllOfMatcherUrlAll,\n addAllOfMatcherUrl,\n removeAllOfMatcherUrl,\n setAllOfMatcherUrl,\n getNoneOfMatcherUrlAll,\n addNoneOfMatcherUrl,\n removeNoneOfMatcherUrl,\n setNoneOfMatcherUrl,\n createResourceMatcherFor,\n getResourceMatcher,\n getResourceMatcherAll,\n removeResourceMatcher,\n setResourceMatcher,\n};\nconst v4MockFunctions = {\n addMockAcrTo,\n mockAcrFor,\n};\n/**\n * @hidden\n * @deprecated Please import \"acp_ess_2\" directly.\n */\nconst acp_v4 = {\n ...v4AcpFunctions,\n ...v4ControlFunctions,\n ...v4PolicyFunctions,\n ...v4MatcherFunctions,\n ...v4MockFunctions,\n};\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst knownActorRelations$1 = [acp.agent, acp.group];\n/**\n * Get an overview of what access is defined for a given actor in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to this actor.\n *\n * Additionally, this only considers access given _explicitly_ to the given actor, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setActorAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param actorRelation What type of actor (e.g. acp:agent or acp:group) you want to get the access for.\n * @param actor Which instance of the given actor type you want to get the access for.\n * @returns What Access modes are granted to the given actor explicitly, or null if it could not be determined.\n */\nfunction internal_getActorAccess$1(acpData, actorRelation, actor) {\n if (acpData.inaccessibleUrls.length > 0) {\n // If we can't see all access data,\n // we can't reliably determine what access the given actor has:\n return null;\n }\n const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData));\n const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData));\n const initialAccess = {\n read: false,\n append: false,\n write: false,\n controlRead: false,\n controlWrite: false,\n };\n // All allowed reading and writing defined in ACR policies\n // determines whether the `controlRead` and `controlWrite` statuses are `true`.\n const allowedAcrAccess = applicableAcrPolicies.reduce((acc, policy) => {\n const allAllowedAccess = { ...acc };\n const allowModes = getAllowModesV1(policy);\n if (allowModes.read) {\n allAllowedAccess.controlRead = true;\n }\n if (allowModes.write) {\n allAllowedAccess.controlWrite = true;\n }\n return allAllowedAccess;\n }, initialAccess);\n // Then allowed reading, appending and writing in regular policies\n // determines whether the respective status is `true`.\n const withAllowedAccess = applicablePolicies.reduce((acc, policy) => {\n const allAllowedAccess = { ...acc };\n const allowModes = getAllowModesV1(policy);\n if (allowModes.read) {\n allAllowedAccess.read = true;\n }\n if (allowModes.append) {\n allAllowedAccess.append = true;\n }\n if (allowModes.write) {\n allAllowedAccess.write = true;\n }\n return allAllowedAccess;\n }, allowedAcrAccess);\n // At this point, everything that has been explicitly allowed is true.\n // However, it could still be overridden by access that is explicitly denied.\n // Starting with `controlRead` and `controlWrite`,\n // by inspecting denied reading and writing defined in the ACR policies.\n const withAcrDeniedAccess = applicableAcrPolicies.reduce((acc, policy) => {\n const allDeniedAccess = { ...acc };\n const denyModes = getDenyModesV1(policy);\n if (denyModes.read === true) {\n allDeniedAccess.controlRead = false;\n }\n if (denyModes.write === true) {\n allDeniedAccess.controlWrite = false;\n }\n return allDeniedAccess;\n }, withAllowedAccess);\n // And finally, we set to `false` those access modes that are explicitly denied\n // in the regular policies:\n const withDeniedAccess = applicablePolicies.reduce((acc, policy) => {\n const allDeniedAccess = { ...acc };\n const denyModes = getDenyModesV1(policy);\n if (denyModes.read === true) {\n allDeniedAccess.read = false;\n }\n if (denyModes.append === true) {\n allDeniedAccess.append = false;\n }\n if (denyModes.write === true) {\n allDeniedAccess.write = false;\n }\n return allDeniedAccess;\n }, withAcrDeniedAccess);\n return withDeniedAccess;\n}\n/**\n * Get an overview of what access is defined for a given Agent in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to this Agent.\n *\n * Additionally, this only considers access given _explicitly_ to the given Agent, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setAgentAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param webId WebID of the Agent you want to get the access for.\n * @returns What Access modes are granted to the given Agent explicitly, or null if it could not be determined.\n */\nfunction internal_getAgentAccess$1(acpData, webId) {\n return internal_getActorAccess$1(acpData, acp.agent, webId);\n}\n/**\n * Get an overview of what access is defined for a given Group in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to this Group.\n *\n * Additionally, this only considers access given _explicitly_ to the given Group, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setGroupAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param groupUrl URL of the Group you want to get the access for.\n * @returns What Access modes are granted to the given Group explicitly, or null if it could not be determined.\n */\nfunction internal_getGroupAccess(acpData, groupUrl) {\n return internal_getActorAccess$1(acpData, acp.group, groupUrl);\n}\n/**\n * Get an overview of what access is defined for everybody in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to everybody.\n *\n * Additionally, this only considers access given _explicitly_ to everybody, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setPublicAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @returns What Access modes are granted to everyone explicitly, or null if it could not be determined.\n */\nfunction internal_getPublicAccess$1(acpData) {\n return internal_getActorAccess$1(acpData, acp.agent, acp.PublicAgent);\n}\nfunction policyAppliesTo$1(policy, actorRelation, actor, acpData) {\n const allowModes = getIriAll(policy, acp.allow);\n const denyModes = getIriAll(policy, acp.deny);\n if (allowModes.length + denyModes.length === 0) {\n // A Policy that does not specify access modes does not do anything:\n return false;\n }\n // Note: the non-null assertions (`!`) here should be valid because\n // the caller of `policyAppliesTo` should already have validated that\n // the return value of internal_getPoliciesAndRules() did not have any\n // inaccessible URLs, so we should be able to find every Rule.\n const allOfRules = getAllOfRuleUrlAll(policy).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl));\n const anyOfRules = getAnyOfRuleUrlAll(policy).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl));\n const noneOfRules = getNoneOfRuleUrlAll(policy).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl));\n // We assume that this Policy applies if this specific actor is mentioned\n // and no further restrictions are in place.\n // (In other words, the Policy may apply to others *in addition to* this\n // actor, but if it applies to this actor *unless* some other condition holds,\n // we cannot be sure whether it will apply to this actor.)\n // This means that:\n return (\n // Every existing allOf Rule explicitly applies explicitly to this given actor:\n allOfRules.every((rule) => ruleAppliesTo(rule, actorRelation, actor)) &&\n // If there are anyOf Rules, at least one applies explicitly to this actor:\n (anyOfRules.length === 0 ||\n anyOfRules.some((rule) => ruleAppliesTo(rule, actorRelation, actor))) &&\n // No further restrictions are in place that make this sometimes not apply\n // to the given actor:\n noneOfRules.length === 0);\n}\nfunction policyConflictsWith$1(policy, otherAccess) {\n const allowModes = getIriAll(policy, acp.allow);\n const denyModes = getIriAll(policy, acp.deny);\n return ((otherAccess.read === true && denyModes.includes(acp.Read)) ||\n (otherAccess.read === false &&\n allowModes.includes(acp.Read) &&\n !denyModes.includes(acp.Read)) ||\n (otherAccess.append === true && denyModes.includes(acp.Append)) ||\n (otherAccess.append === false &&\n allowModes.includes(acp.Append) &&\n !denyModes.includes(acp.Append)) ||\n (otherAccess.write === true && denyModes.includes(acp.Write)) ||\n (otherAccess.write === false &&\n allowModes.includes(acp.Write) &&\n !denyModes.includes(acp.Write)));\n}\nfunction ruleAppliesTo(rule, actorRelation, actor) {\n // A Rule that does not list *any* actor matches for everyone:\n let isEmpty = true;\n knownActorRelations$1.forEach((knownActorRelation) => {\n isEmpty && (isEmpty = getIri(rule, knownActorRelation) === null);\n });\n return isEmpty || getIriAll(rule, actorRelation).includes(actor);\n}\n/**\n * Get a set of all actors mentioned in an ACR by active Rules (i.e. that are\n * referenced by Policies referenced by the ACR Control, and therefore that\n * effectively apply).\n *\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param actorRelation\n */\nfunction internal_findActorAll$1(acpData, actorRelation) {\n const actors = new Set();\n // This code could be prettier using flat(), which isn't supported by nodeJS 10.\n // If you read this comment after April 2021, feel free to refactor.\n acpData.rules.forEach((rule) => {\n getIriAll(rule, actorRelation)\n .filter((iri) => ![\n acp.PublicAgent,\n acp.CreatorAgent,\n acp.AuthenticatedAgent,\n ].includes(iri) || actorRelation !== acp.agent)\n .forEach((iri) => actors.add(iri));\n });\n return actors;\n}\n/**\n * Iterate through all the actors active for an ACR, and list all of their access.\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param actorRelation The type of actor we want to list access for\n * @returns A map with each actor access indexed by their URL, or null if some\n * external policies are referenced.\n */\nfunction internal_getActorAccessAll$1(acpData, actorRelation) {\n if (acpData.inaccessibleUrls.length > 0) {\n // If we can't see all access data,\n // we can't reliably determine what access actors of the given type have:\n return null;\n }\n const result = {};\n const actors = internal_findActorAll$1(acpData, actorRelation);\n actors.forEach((iri) => {\n // The type assertion holds, because if internal_getActorAccess were null,\n // we would have returned {} already.\n const access = internal_getActorAccess$1(acpData, actorRelation, iri);\n result[iri] = access;\n });\n return result;\n}\n/**\n * Get an overview of what access are defined for all Groups in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to the mentionned\n * Groups.\n *\n * Additionally, this only considers access given _explicitly_ to individual Groups, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setAgentAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @returns A map with each Group's access indexed by their URL, or null if some\n * external policies are referenced.\n */\nfunction internal_getGroupAccessAll(acpData) {\n return internal_getActorAccessAll$1(acpData, acp.group);\n}\n/**\n * Get an overview of what access are defined for all Agents in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Rule applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to the mentionned\n * Agents.\n *\n * Additionally, this only considers access given _explicitly_ to individual Agents, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setAgentAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @returns A map with each Agent's access indexed by their WebID, or null if some\n * external policies are referenced.\n */\nfunction internal_getAgentAccessAll$1(acpData) {\n return internal_getActorAccessAll$1(acpData, acp.agent);\n}\n/**\n * Set access to a Resource for a specific actor.\n *\n * This function adds the relevant Access Control Policies and Rules to a\n * Resource's Access Control Resource to define the given access for the given\n * actor specifically. In other words, it can, for example, add Policies that\n * give a particular Group Read access to the Resource. However, if other\n * Policies specify that everyone in that Group is *denied* Read access *except*\n * for a particular Agent, then that will be left intact.\n * This means that, unless *only* this module's functions are used to manipulate\n * access to this Resource, the set access might not be equal to the effective\n * access for an agent matching the given actor.\n *\n * There are a number of preconditions that have to be fulfilled for this\n * function to work:\n * - Access to the Resource is determined via an Access Control Resource.\n * - The Resource's Access Control Resource does not refer to (Policies or Rules\n * in) other Resources.\n * - The current user has access to the Resource's Access Control Resource.\n *\n * If those conditions do not hold, this function will return `null`.\n *\n * Additionally, take note that the given access will only be applied to the\n * given Resource; if that Resource is a Container, access will have to be set\n * for its contained Resources independently.\n *\n * @param resource Resource that was fetched together with its linked Access Control Resource.\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param actorRelation What type of actor (e.g. acp:agent or acp:group) you want to set the access for.\n * @param actor Which instance of the given actor type you want to set the access for.\n * @param access What access (read, append, write, controlRead, controlWrite) to set for the given actor. `true` to allow, `false` to deny, and `undefined` to leave unchanged.\n * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not.\n */\nfunction internal_setActorAccess$1(resource, acpData, actorRelation, actor, access) {\n var _a, _b, _c, _d, _e;\n if (!hasAccessibleAcr(resource) || acpData.inaccessibleUrls.length > 0) {\n return null;\n }\n // Get the access that currently applies to the given actor\n const existingAccess = internal_getActorAccess$1(acpData, actorRelation, actor);\n /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that above. */\n if (existingAccess === null) {\n return null;\n }\n // Get all Policies that apply specifically to the given actor\n const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData));\n const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo$1(policy, actorRelation, actor, acpData));\n // We only need to override Policies that define access other than what we want:\n const conflictingAcrPolicies = applicableAcrPolicies.filter((policy) => policyConflictsWith$1(policy, {\n read: access.controlRead,\n write: access.controlWrite,\n }));\n const conflictingPolicies = applicablePolicies.filter((policy) => policyConflictsWith$1(policy, {\n read: access.read,\n append: access.append,\n write: access.write,\n }));\n // For every Policy that applies specifically to the given Actor, but _also_\n // to another actor (i.e. that applies using an anyOf Rule, or a Rule that\n // mentions both the given and another actor)...\n const otherActorAcrPolicies = conflictingAcrPolicies.filter((acrPolicy) => policyHasOtherActors$1(acrPolicy, actorRelation, actor, acpData));\n const otherActorPolicies = conflictingPolicies.filter((policy) => policyHasOtherActors$1(policy, actorRelation, actor, acpData));\n // ...check what access the current actor would have if we removed them...\n const acpDataWithPoliciesExcluded = {\n ...acpData,\n acrPolicies: acpData.acrPolicies.filter((acrPolicy) => !otherActorAcrPolicies.includes(acrPolicy)),\n policies: acpData.policies.filter((policy) => !otherActorPolicies.includes(policy)),\n };\n const remainingAccess = internal_getActorAccess$1(acpDataWithPoliciesExcluded, actorRelation, actor);\n /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that at the start. */\n if (remainingAccess === null) {\n return null;\n }\n // ...add copies of those Policies and their Rules, but excluding the given actor...\n let updatedResource = resource;\n otherActorAcrPolicies.forEach((acrPolicy) => {\n const [policyCopy, ruleCopies] = copyPolicyExcludingActor$1(acrPolicy, resource, acpData, actorRelation, actor);\n updatedResource = setResourceAcrPolicy(updatedResource, policyCopy);\n updatedResource = ruleCopies.reduce(setResourceRule, updatedResource);\n });\n otherActorPolicies.forEach((policy) => {\n const [policyCopy, ruleCopies] = copyPolicyExcludingActor$1(policy, resource, acpData, actorRelation, actor);\n updatedResource = setResourcePolicy$1(updatedResource, policyCopy);\n updatedResource = ruleCopies.reduce(setResourceRule, updatedResource);\n });\n // ...add a new Policy that applies the given access,\n // and the previously applying access for access modes that were undefined...\n const newRuleName = `rule_${encodeURIComponent(`${actorRelation}_${actor}`)}`;\n let newRule = createResourceRuleFor(resource, newRuleName);\n newRule = setIri(newRule, actorRelation, actor);\n const newControlReadAccess = (_a = access.controlRead) !== null && _a !== void 0 ? _a : existingAccess.controlRead;\n const newControlWriteAccess = (_b = access.controlWrite) !== null && _b !== void 0 ? _b : existingAccess.controlWrite;\n let acrPoliciesToUnapply = otherActorAcrPolicies;\n // Only replace existing Policies if the defined access actually changes:\n if (newControlReadAccess !== remainingAccess.controlRead ||\n newControlWriteAccess !== remainingAccess.controlWrite) {\n const newAcrPolicyName = uuid.v4();\n let newAcrPolicy = createResourcePolicyFor(resource, newAcrPolicyName);\n newAcrPolicy = setAllowModesV1(newAcrPolicy, {\n read: newControlReadAccess === true,\n append: false,\n write: newControlWriteAccess === true,\n });\n newAcrPolicy = addIri(newAcrPolicy, acp.allOf, newRule);\n updatedResource = setResourceAcrPolicy(updatedResource, newAcrPolicy);\n updatedResource = setResourceRule(updatedResource, newRule);\n // If we don't have to set new access, we only need to unapply the\n // ACR Policies that applied to both the given actor and other actors\n // (because they have been replaced by clones not mentioning the given\n // actor). Hence `policiesToUnApply` is initialised to `otherActorPolicies`.\n // However, if we're in this if branch, that means we also had to replace\n // Policies that defined access for just this actor, so we'll have to remove\n // all Policies mentioning this actor:\n acrPoliciesToUnapply = conflictingAcrPolicies;\n }\n const newReadAccess = (_c = access.read) !== null && _c !== void 0 ? _c : existingAccess.read;\n const newAppendAccess = (_d = access.append) !== null && _d !== void 0 ? _d : existingAccess.append;\n const newWriteAccess = (_e = access.write) !== null && _e !== void 0 ? _e : existingAccess.write;\n let policiesToUnapply = otherActorPolicies;\n // Only replace existing Policies if the defined access actually changes:\n if (newReadAccess !== remainingAccess.read ||\n newAppendAccess !== remainingAccess.append ||\n newWriteAccess !== remainingAccess.write) {\n const newPolicyName = uuid.v4();\n let newPolicy = createResourcePolicyFor(resource, newPolicyName);\n newPolicy = setAllowModesV1(newPolicy, {\n read: newReadAccess === true,\n append: newAppendAccess === true,\n write: newWriteAccess === true,\n });\n newPolicy = addIri(newPolicy, acp.allOf, newRule);\n updatedResource = setResourcePolicy$1(updatedResource, newPolicy);\n updatedResource = setResourceRule(updatedResource, newRule);\n // If we don't have to set new access, we only need to unapply the\n // Policies that applied to both the given actor and other actors (because\n // they have been replaced by clones not mentioning the given actor). Hence\n // `policiesToUnApply` is initialised to `otherActorPolicies`.\n // However, if we're in this if branch, that means we also had to replace\n // Policies that defined access for just this actor, so we'll have to remove\n // all Policies mentioning this actor:\n policiesToUnapply = conflictingPolicies;\n }\n // ...then remove existing Policy URLs that mentioned both the given actor\n // and other actors from the given Resource and apply the new ones (but do not\n // remove the actual old Policies - they might still apply to other Resources!).\n acrPoliciesToUnapply.forEach((previouslyApplicableAcrPolicy) => {\n updatedResource = removeAcrPolicyUrl$1(updatedResource, asIri(previouslyApplicableAcrPolicy));\n });\n policiesToUnapply.forEach((previouslyApplicablePolicy) => {\n updatedResource = removePolicyUrl$1(updatedResource, asIri(previouslyApplicablePolicy));\n });\n return updatedResource;\n}\n/**\n * Set access to a Resource for a specific Agent.\n *\n * This function adds the relevant Access Control Policies and Rules to a\n * Resource's Access Control Resource to define the given access for the given\n * Agent specifically. In other words, it can, for example, add Policies that\n * give a particular Agent Read access to the Resource. However, if other\n * Policies specify that that Agent is *denied* Read access *except* if they're\n * in a particular Group, then that will be left intact.\n * This means that, unless *only* this function is used to manipulate access to\n * this Resource, the set access might not be equal to the effective access for\n * the given Agent.\n *\n * There are a number of preconditions that have to be fulfilled for this\n * function to work:\n * - Access to the Resource is determined via an Access Control Resource.\n * - The Resource's Access Control Resource does not refer to (Policies or Rules\n * in) other Resources.\n * - The current user has access to the Resource's Access Control Resource.\n *\n * If those conditions do not hold, this function will return `null`.\n *\n * Additionally, take note that the given access will only be applied to the\n * given Resource; if that Resource is a Container, access will have to be set\n * for its contained Resources independently.\n *\n * @param resource Resource that was fetched together with its linked Access Control Resource.\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param webId Which Agent you want to set the access for.\n * @param access What access (read, append, write, controlRead, controlWrite) to set for the given Agent. `true` to allow, `false` to deny, and `undefined` to leave unchanged.\n * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not.\n */\nfunction internal_setAgentAccess$1(resource, acpData, webId, access) {\n return internal_setActorAccess$1(resource, acpData, acp.agent, webId, access);\n}\n/**\n * Set access to a Resource for a specific Group.\n *\n * This function adds the relevant Access Control Policies and Rules to a\n * Resource's Access Control Resource to define the given access for the given\n * Group specifically. In other words, it can, for example, add Policies that\n * give a particular Group Read access to the Resource. However, if other\n * Policies specify that it is *denied* Read access *except* if they're a\n * particular Agent, then that will be left intact.\n * This means that, unless *only* this module's functions are used to manipulate\n * access to this Resource, the set access might not be equal to the effective\n * access for Agents in the given Group.\n *\n * There are a number of preconditions that have to be fulfilled for this\n * function to work:\n * - Access to the Resource is determined via an Access Control Resource.\n * - The Resource's Access Control Resource does not refer to (Policies or Rules\n * in) other Resources.\n * - The current user has access to the Resource's Access Control Resource.\n *\n * If those conditions do not hold, this function will return `null`.\n *\n * Additionally, take note that the given access will only be applied to the\n * given Resource; if that Resource is a Container, access will have to be set\n * for its contained Resources independently.\n *\n * @param resource Resource that was fetched together with its linked Access Control Resource.\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param groupUrl Which Group you want to set the access for.\n * @param access What access (read, append, write, controlRead, controlWrite) to set for the given Group. `true` to allow, `false` to deny, and `undefined` to leave unchanged.\n * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not.\n */\nfunction internal_setGroupAccess(resource, acpData, groupUrl, access) {\n return internal_setActorAccess$1(resource, acpData, acp.group, groupUrl, access);\n}\n/**\n * Set access to a Resource for everybody.\n *\n * This function adds the relevant Access Control Policies and Rules to a\n * Resource's Access Control Resource to define the given access for everybody\n * specifically. In other words, it can, for example, add Policies that\n * give everybody Read access to the Resource. However, if other\n * Policies specify that everybody is *denied* Read access *except* if they're\n * in a particular Group, then that will be left intact.\n * This means that, unless *only* this module's functions are used to manipulate\n * access to this Resource, the set access might not be equal to the effective\n * access for a particular Agent.\n *\n * There are a number of preconditions that have to be fulfilled for this\n * function to work:\n * - Access to the Resource is determined via an Access Control Resource.\n * - The Resource's Access Control Resource does not refer to (Policies or Rules\n * in) other Resources.\n * - The current user has access to the Resource's Access Control Resource.\n *\n * If those conditions do not hold, this function will return `null`.\n *\n * Additionally, take note that the given access will only be applied to the\n * given Resource; if that Resource is a Container, access will have to be set\n * for its contained Resources independently.\n *\n * @param resource Resource that was fetched together with its linked Access Control Resource.\n * @param acpData All Access Control Policies and Rules that apply to a particular Resource.\n * @param access What access (read, append, write, controlRead, controlWrite) to set for everybody. `true` to allow, `false` to deny, and `undefined` to leave unchanged.\n * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not.\n */\nfunction internal_setPublicAccess$1(resource, acpData, access) {\n return internal_setActorAccess$1(resource, acpData, acp.agent, acp.PublicAgent, access);\n}\nfunction policyHasOtherActors$1(policy, actorRelation, actor, acpData) {\n // Note: the non-null assertions (`!`) here should be valid because\n // the caller of `policyHasOtherActors` should already have validated\n // that the return value of internal_getPoliciesAndRules() did not have\n // any inaccessible URLs, so we should be able to find every Rule.\n const allOfRules = getIriAll(policy, acp.allOf).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl));\n const allOfRulesHaveOtherActors = allOfRules.some((rule) => {\n return ruleHasOtherActors(rule, actorRelation, actor);\n });\n const anyOfRules = getIriAll(policy, acp.anyOf).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl));\n const anyOfRulesHaveOtherActors = anyOfRules.some((rule) => {\n return ruleHasOtherActors(rule, actorRelation, actor);\n });\n /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Rules */\n const noneOfRules = getIriAll(policy, acp.noneOf).map((ruleUrl) => acpData.rules.find((rule) => asIri(rule) === ruleUrl));\n /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Rules */\n const noneOfRulesHaveOtherActors = noneOfRules.some((rule) => {\n return ruleHasOtherActors(rule, actorRelation, actor);\n });\n return (allOfRulesHaveOtherActors ||\n anyOfRulesHaveOtherActors ||\n noneOfRulesHaveOtherActors);\n}\nfunction ruleHasOtherActors(rule, actorRelation, actor) {\n const otherActors = [];\n knownActorRelations$1.forEach((knownActorRelation) => {\n const otherActorsWithThisRelation = getIriAll(rule, knownActorRelation).filter((applicableActor) => applicableActor !== actor || knownActorRelation !== actorRelation);\n // Unfortunately Node 10 does not support `.flat()` yet, hence the use of `push`:\n otherActors.push(...otherActorsWithThisRelation);\n });\n return otherActors.length > 0;\n}\nfunction copyPolicyExcludingActor$1(inputPolicy, resourceWithAcr, acpData, actorRelationToExclude, actorToExclude) {\n const newIriSuffix = uuid.v4();\n // Create new Rules for the Policy, excluding the given Actor\n const newAllOfRules = copyRulesExcludingActor(getIriAll(inputPolicy, acp.allOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude);\n const newAnyOfRules = copyRulesExcludingActor(getIriAll(inputPolicy, acp.anyOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude);\n const newNoneOfRules = copyRulesExcludingActor(getIriAll(inputPolicy, acp.noneOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude);\n // Create a new Policy with the new Rules\n let newPolicy = createResourcePolicyFor(resourceWithAcr, encodeURI(asIri(inputPolicy)) + newIriSuffix);\n getIriAll(inputPolicy, acp.allow).forEach((allowMode) => {\n newPolicy = addIri(newPolicy, acp.allow, allowMode);\n });\n getIriAll(inputPolicy, acp.deny).forEach((denyMode) => {\n newPolicy = addIri(newPolicy, acp.deny, denyMode);\n });\n newAllOfRules.forEach((newRule) => {\n newPolicy = addIri(newPolicy, acp.allOf, newRule);\n });\n newAnyOfRules.forEach((newRule) => {\n newPolicy = addIri(newPolicy, acp.anyOf, newRule);\n });\n /* istanbul ignore next Policies listing noneOf Rules are left alone (because they do not unambiguously apply to the given actor always), so there will usually not be any noneOf Rules to copy. */\n newNoneOfRules.forEach((newRule) => {\n newPolicy = addIri(newPolicy, acp.noneOf, newRule);\n });\n return [\n newPolicy,\n newAllOfRules.concat(newAnyOfRules).concat(newNoneOfRules),\n ];\n}\n/** Creates clones of all the Rules identified by `ruleIris` in `acpData`, excluding the given Actor */\nfunction copyRulesExcludingActor(ruleIris, resourceWithAcr, acpData, iriSuffix, actorRelationToExclude, actorToExclude) {\n return ruleIris\n .map((ruleIri) => {\n const rule = acpData.rules.find((rule) => asIri(rule) === ruleIri);\n /* istanbul ignore if: getPoliciesAndRules should already have fetched all referenced Rules, so this should never be true: */\n if (typeof rule === \"undefined\") {\n return null;\n }\n let newRule = createResourceRuleFor(resourceWithAcr, encodeURI(asIri(rule)) + iriSuffix);\n let listsOtherActors = false;\n knownActorRelations$1.forEach((knownActorRelation) => {\n getIriAll(rule, knownActorRelation).forEach((targetActor) => {\n if (knownActorRelation === actorRelationToExclude &&\n targetActor === actorToExclude) {\n return;\n }\n listsOtherActors = true;\n newRule = addIri(newRule, knownActorRelation, targetActor);\n });\n });\n return listsOtherActors ? newRule : null;\n })\n .filter(isNotNull$1);\n}\nfunction isNotNull$1(value) {\n return value !== null;\n}\nasync function internal_getPoliciesAndRules(resource, options = internal_defaultFetchOptions) {\n const acrPolicyUrls = getAcrPolicyUrlAll$1(resource);\n const policyUrls = getPolicyUrlAll$1(resource);\n const allPolicyResourceUrls = getResourceUrls$1(acrPolicyUrls).concat(getResourceUrls$1(policyUrls));\n const policyResources = await getResources$1(allPolicyResourceUrls, options);\n const acrPolicies = getThingsFromResources$1(acrPolicyUrls, policyResources).filter(isNotNull$1);\n const policies = getThingsFromResources$1(policyUrls, policyResources).filter(isNotNull$1);\n const ruleUrlSet = new Set();\n acrPolicies.forEach((acrPolicy) => {\n const referencedRuleUrls = getReferencedRuleUrls(acrPolicy);\n referencedRuleUrls.forEach((ruleUrl) => {\n ruleUrlSet.add(ruleUrl);\n });\n });\n policies.forEach((policy) => {\n const referencedRuleUrls = getReferencedRuleUrls(policy);\n referencedRuleUrls.forEach((ruleUrl) => {\n ruleUrlSet.add(ruleUrl);\n });\n });\n const ruleUrls = Array.from(ruleUrlSet);\n const ruleResourceUrls = ruleUrls.map((ruleUrl) => getResourceUrl$1(ruleUrl));\n const unfetchedRuleResourceUrls = ruleResourceUrls.filter((ruleResourceUrl) => !allPolicyResourceUrls.includes(ruleResourceUrl));\n const ruleResources = await getResources$1(unfetchedRuleResourceUrls, options);\n const allResources = {\n ...policyResources,\n ...ruleResources,\n };\n const rules = getThingsFromResources$1(ruleUrls, allResources).filter(isNotNull$1);\n const inaccessibleUrls = Object.keys(allResources).filter((resourceUrl) => allResources[resourceUrl] === null);\n return {\n inaccessibleUrls,\n acrPolicies,\n policies,\n rules,\n };\n}\nfunction getResourceUrl$1(thingUrl) {\n const thingUrlObject = new URL(thingUrl);\n thingUrlObject.hash = \"\";\n return thingUrlObject.href;\n}\nfunction getResourceUrls$1(thingUrls) {\n const resourceUrls = [];\n thingUrls.forEach((thingUrl) => {\n const resourceUrl = getResourceUrl$1(thingUrl);\n if (!resourceUrls.includes(resourceUrl)) {\n resourceUrls.push(resourceUrl);\n }\n });\n return resourceUrls;\n}\nasync function getResources$1(resourceUrls, options) {\n const uniqueResourceUrls = Array.from(new Set(resourceUrls));\n const resources = {};\n await Promise.all(uniqueResourceUrls.map(async (resourceUrl) => {\n try {\n const resource = await getSolidDataset(resourceUrl, options);\n resources[resourceUrl] = resource;\n }\n catch (e) {\n resources[resourceUrl] = null;\n }\n }));\n return resources;\n}\nfunction getThingsFromResources$1(thingUrls, resources) {\n return thingUrls.map((thingUrl) => {\n const resourceUrl = getResourceUrl$1(thingUrl);\n const resource = resources[resourceUrl];\n if (!resource) {\n return null;\n }\n return getThing(resource, thingUrl);\n });\n}\nfunction getReferencedRuleUrls(policy) {\n return getAllOfRuleUrlAll(policy)\n .concat(getAnyOfRuleUrlAll(policy))\n .concat(getNoneOfRuleUrlAll(policy));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nfunction universalAccessToAcl(newAccess, previousAccess) {\n var _a, _b, _c, _d;\n // Universal access is aligned on ACP, which means there is a distinction between\n // controlRead and controlWrite. This split doesn't exist in WAC, which is why\n // the type for the input variable of this function is a restriction on the\n // universal Access type.\n if (newAccess.controlRead !== newAccess.controlWrite) {\n throw new Error(\"For Pods using Web Access Control, controlRead and controlWrite must be equal.\");\n }\n return {\n read: (_a = newAccess.read) !== null && _a !== void 0 ? _a : previousAccess.read,\n append: (_b = newAccess.append) !== null && _b !== void 0 ? _b : previousAccess.append,\n write: (_c = newAccess.write) !== null && _c !== void 0 ? _c : previousAccess.write,\n control: (_d = newAccess.controlRead) !== null && _d !== void 0 ? _d : previousAccess.control,\n };\n}\nfunction aclAccessToUniversal(access) {\n // In ACL, denying access to an actor is a notion that doesn't exist, so an\n // access is either granted or not for a given mode.\n // This creates a misalignment with the ACP notion of an access being granted,\n // denied, or simply not mentioned. Here, we convert the boolean vision of\n // ACL into the boolean or undefined vision of ACP.\n return {\n read: access.read,\n write: access.write,\n append: access.append,\n controlRead: access.control,\n controlWrite: access.control,\n };\n}\nasync function getActorAccess(resource, actor, accessEvaluationCallback, options) {\n const resourceAcl = await internal_fetchAcl(resource, options);\n const wacAccess = accessEvaluationCallback(internal_setAcl(resource, resourceAcl), actor);\n if (wacAccess === null) {\n return null;\n }\n return aclAccessToUniversal(wacAccess);\n}\nasync function getActorClassAccess(resource, accessEvaluationCallback, options) {\n const resourceAcl = await internal_fetchAcl(resource, options);\n const wacAccess = accessEvaluationCallback(internal_setAcl(resource, resourceAcl));\n if (wacAccess === null) {\n return null;\n }\n return aclAccessToUniversal(wacAccess);\n}\nasync function getActorAccessAll(resource, accessEvaluationCallback, options) {\n const resourceAcl = await internal_fetchAcl(resource, options);\n const wacAgentAccess = accessEvaluationCallback(internal_setAcl(resource, resourceAcl));\n if (wacAgentAccess === null) {\n return null;\n }\n const result = {};\n for (const [webId, wacAccess] of Object.entries(wacAgentAccess)) {\n result[webId] = aclAccessToUniversal(wacAccess);\n }\n return result;\n}\n/**\n * For a given Resource, look up its metadata, and read the Access permissions\n * granted to the given Agent.\n *\n * Note that this only lists permissions granted to the given Agent individually,\n * and will not exhaustively list modes the given Agent may have access to because\n * they apply to everyone, or because they apply to the Agent through a group for\n * instance.\n *\n * @param resource The URL of the Resource for which we want to list Access\n * @param agent The Agent for which the Access is granted\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns What Access modes are granted to the given Agent explicitly, or null if it could not be determined.\n */\nfunction getAgentAccess$4(resource, agent, options = internal_defaultFetchOptions) {\n return getActorAccess(resource, agent, getAgentAccess$5, options);\n}\n/**\n * For a given Resource, look up its metadata, and read the Access permissions\n * granted to the given Group.\n *\n * Note that this only lists permissions granted to the given Group individually,\n * and will not exhaustively list modes the given Group may have access to because\n * they apply to everyone, or because they apply to the Group through another\n * Group that may contain it for instance.\n *\n * @param resource The URL of the Resource for which we want to list Access\n * @param group The Group for which the Access is granted\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns What Access modes are granted to the given Group explicitly, or null if it could not be determined.\n */\nfunction getGroupAccess$1(resource, group, options = internal_defaultFetchOptions) {\n return getActorAccess(resource, group, getGroupAccess$2, options);\n}\n/**\n * For a given Resource, look up its metadata, and read the Access permissions\n * granted to everyone.\n *\n * Note that this only lists permissions explicitly granted to everyone as a whole,\n * and will not exhaustively list modes any individual Agent or Group may have\n * access to because they specifically apply to them only.\n *\n * @param resource The URL of the Resource for which we want to list public Access\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns What Access modes are granted to the everyone explicitly, or null if it could not be determined.\n */\nfunction getPublicAccess$4(resource, options = internal_defaultFetchOptions) {\n return getActorClassAccess(resource, getPublicAccess$5, options);\n}\n/**\n * For a given Resource, look up its metadata, and read the Access permissions\n * granted explicitly to each individual Agent.\n *\n * Note that this only lists permissions granted to each Agent individually,\n * and will not exhaustively list modes any Agent may have access to because\n * they apply to everyone, or because they apply to an Agent through a group for\n * instance.\n *\n * @param resource The URL of the Resource for which we want to list Agents Access\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A map of Agent WebIDs and the access granted to them, or null if it could not be determined.\n */\nfunction getAgentAccessAll$4(resource, options = internal_defaultFetchOptions) {\n return getActorAccessAll(resource, getAgentAccessAll$5, options);\n}\n/**\n * For a given Resource, look up its metadata, and read the Access permissions\n * granted explicitly to each individual Group.\n *\n * Note that this only lists permissions granted to each Group individually,\n * and will not exhaustively list modes any Group may have access to because\n * they apply individually to all of the Agents in the Group, or to everyone\n * for instance.\n *\n * @param resource The URL of the Resource for which we want to list Agents Access\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns A map of Group URLs and the access granted to them, or null if it could not be determined.\n */\nfunction getGroupAccessAll$1(resource, options = internal_defaultFetchOptions) {\n return getActorAccessAll(resource, getGroupAccessAll$2, options);\n}\nasync function prepareResourceAcl(resource, options) {\n if (!hasAccessibleAcl(resource)) {\n return null;\n }\n const acl = await internal_fetchAcl(resource, options);\n const resourceWithAcl = internal_setAcl(resource, acl);\n let resourceAcl;\n if (hasResourceAcl(resourceWithAcl)) {\n // This is the simple case, where the Resource ACL we need to update already\n // exists.\n resourceAcl = internal_getResourceAcl(resourceWithAcl);\n }\n else if (hasFallbackAcl(resourceWithAcl)) {\n // In this case, the Resource ACL needs to be created first, and then updated.\n resourceAcl = createAclFromFallbackAcl(resourceWithAcl);\n }\n else {\n return null;\n }\n return internal_setResourceAcl(resourceWithAcl, resourceAcl);\n}\nasync function saveUpdatedAcl(resource, acl, options) {\n let savedAcl = null;\n try {\n savedAcl = await saveAclFor(resource, acl, options);\n return internal_setResourceAcl(resource, savedAcl);\n }\n catch (e) {\n return null;\n }\n}\nasync function setActorClassAccess(resource, access, getAccess, setAccess, options) {\n const resourceWithOldAcl = await prepareResourceAcl(resource, options);\n if (resourceWithOldAcl === null) {\n return null;\n }\n const resourceAcl = getResourceAcl(resourceWithOldAcl);\n const currentAccess = getAccess(resourceWithOldAcl);\n const wacAccess = universalAccessToAcl(access, currentAccess);\n const updatedResourceAcl = setAccess(resourceAcl, wacAccess);\n return saveUpdatedAcl(resourceWithOldAcl, updatedResourceAcl, options);\n}\nasync function setActorAccess(resource, actor, access, getAccess, setAccess, options) {\n const resourceWithOldAcl = await prepareResourceAcl(resource, options);\n if (resourceWithOldAcl === null) {\n return null;\n }\n const currentAccess = getAccess(resourceWithOldAcl, actor);\n const resourceAcl = getResourceAcl(resourceWithOldAcl);\n const wacAccess = universalAccessToAcl(access, currentAccess);\n const updatedResourceAcl = setAccess(resourceAcl, actor, wacAccess);\n return saveUpdatedAcl(resourceWithOldAcl, updatedResourceAcl, options);\n}\n/**\n * Set the Access modes for a given Agent to a given Resource.\n *\n * Important note: if the target resource did not have a Resource ACL, and its\n * Access was regulated by its Fallback ACL, said Fallback ACL is copied to create\n * a new Resource ACL. This has the side effect that the next time the Fallback\n * ACL is updated, the changes _will not impact_ the target resource.\n *\n * If the target Resource's Access mode cannot be determined, e.g. the user does\n * not have Read and Write access to the target Resource's ACL, or to its\n * fallback ACL if it does not have a Resource ACL, then `null` is returned.\n *\n * @param resource The Resource for which Access is being set\n * @param agent The Agent for whom Access is being set\n * @param access The Access being set\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns The Resource, with its ACL updated, or null if the new Access could not\n * be set.\n */\nasync function setAgentResourceAccess(resource, agent, access, options = internal_defaultFetchOptions) {\n return setActorAccess(resource, agent, access, getAgentAccess$5, setAgentResourceAccess$1, options);\n}\n/**\n * Set the Access modes for a given Group to a given Resource.\n *\n * Important note: if the target resource did not have a Resource ACL, and its\n * Access was regulated by its Fallback ACL, said Fallback ACL is copied to create\n * a new Resource ACL. This has the side effect that the next time the Fallback\n * ACL is updated, the changes _will not impact_ the target resource.\n *\n * If the target Resource's Access mode cannot be determined, e.g. the user does\n * not have Read and Write access to the target Resource's ACL, or to its\n * fallback ACL if it does not have a Resource ACL, then `null` is returned.\n *\n * @param resource The Resource for which Access is being set\n * @param agent The Group for which Access is being set\n * @param access The Access being set\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns The Resource, with its ACL updated, or null if the new Access could not\n * be set.\n */\nasync function setGroupResourceAccess(resource, group, access, options = internal_defaultFetchOptions) {\n return setActorAccess(resource, group, access, getGroupAccess$2, setGroupResourceAccess$1, options);\n}\n/**\n * Set the Access modes for everyone to a given Resource.\n *\n * Important note: if the target resource did not have a Resource ACL, and its\n * Access was regulated by its Fallback ACL, said Fallback ACL is copied to create\n * a new Resource ACL. This has the side effect that the next time the Fallback\n * ACL is updated, the changes _will not impact_ the target resource.\n *\n * If the target Resource's Access mode cannot be determined, e.g. the user does\n * not have Read and Write access to the target Resource's ACL, or to its\n * fallback ACL if it does not have a Resource ACL, then `null` is returned.\n *\n * @param resource The Resource for which Access is being set\n * @param access The Access being set\n * @param options Optional parameter `options.fetch`: An alternative `fetch` function to make the HTTP request, compatible with the browser-native [fetch API](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#parameters).\n * @returns The Resource, with its ACL updated, or null if the new Access could not\n * be set.\n */\nasync function setPublicResourceAccess(resource, access, options = internal_defaultFetchOptions) {\n return setActorClassAccess(resource, access, getPublicAccess$5, setPublicResourceAccess$1, options);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// This file exists to maintain backwards compatibility with the old API as long\n// as possible. Once pod.inrupt.com implements the breaking changes to Access\n// Control Policies, this will be updated to point to _v2.\n/**\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\n\nvar universal = /*#__PURE__*/Object.freeze({\n __proto__: null,\n getAccessFor: getAccessFor,\n getAccessForAll: getAccessForAll,\n getAgentAccess: getAgentAccess$3,\n getAgentAccessAll: getAgentAccessAll$3,\n getGroupAccess: getGroupAccess,\n getGroupAccessAll: getGroupAccessAll,\n getPublicAccess: getPublicAccess$3,\n setAccessFor: setAccessFor,\n setAgentAccess: setAgentAccess$3,\n setGroupAccess: setGroupAccess,\n setPublicAccess: setPublicAccess$3\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nasync function getAccessFor(resourceUrl, actorType, actor = internal_defaultFetchOptions, options = internal_defaultFetchOptions) {\n if (actorType === \"agent\") {\n if (typeof actor !== \"string\") {\n throw new Error(\"When reading Agent-specific access, the given agent cannot be left undefined.\");\n }\n return getAgentAccess$3(resourceUrl, actor, options);\n }\n if (actorType === \"group\") {\n if (typeof actor !== \"string\") {\n throw new Error(\"When reading Group-specific access, the given group cannot be left undefined.\");\n }\n return getGroupAccess(resourceUrl, actor, options);\n }\n if (actorType === \"public\") {\n if (typeof actor === \"string\") {\n throw new Error(`When reading public access, no actor type should be specified (here [${actor}]).`);\n }\n return getPublicAccess$3(resourceUrl, actor);\n }\n return null;\n}\n/**\n * Get an overview of what access is defined for a given set of actors: all Agents\n * or all Groups.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for the given actor (Agent\n * or Group). If additional restrictions are set up to apply to the given Agent\n * in a particular situation, those will not be reflected in the return value\n * of this function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param actorType type of actor whose access is being read.\n * @returns What access is set for the given resource, grouped by resp. Agent or Group.\n * @since 1.5.0\n *\n * @hidden\n * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people.\n */\nasync function getAccessForAll(resourceUrl, actorType, options = internal_defaultFetchOptions) {\n if (actorType === \"agent\") {\n return getAgentAccessAll$3(resourceUrl, options);\n }\n if (actorType === \"group\") {\n return getGroupAccessAll(resourceUrl, options);\n }\n return null;\n}\nasync function setAccessFor(resourceUrl, actorType, access, actor = internal_defaultFetchOptions, options = internal_defaultFetchOptions) {\n if (actorType === \"agent\") {\n if (typeof actor !== \"string\") {\n throw new Error(\"When writing Agent-specific access, the given agent cannot be left undefined.\");\n }\n return setAgentAccess$3(resourceUrl, actor, access, options);\n }\n if (actorType === \"group\") {\n if (typeof actor !== \"string\") {\n throw new Error(\"When writing Group-specific access, the given group cannot be left undefined.\");\n }\n return setGroupAccess(resourceUrl, actor, access, options);\n }\n if (actorType === \"public\") {\n if (typeof actor === \"string\") {\n throw new Error(`When writing public access, no actor type should be specified (here [${actor}]).`);\n }\n return setPublicAccess$3(resourceUrl, access, actor);\n }\n return null;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Get an overview of what access is defined for a given Agent.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for the given Agent. If\n * additional restrictions are set up to apply to the given Agent in a\n * particular situation, those will not be reflected in the return value of\n * this function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param webId WebID of the Agent you want to get the access for.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function getAgentAccess$3(resourceUrl, webId, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n return internal_getAgentAccess$1(acpData, webId);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getAgentAccess$4(resourceInfo, webId, options);\n }\n return null;\n}\n/**\n * Set access to a Resource for a specific Agent.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably setting access, in which case it will\n * resolve to `null`.\n * - It will only set access explicitly for the given Agent. In other words,\n * additional restrictions could be present that further restrict or loosen\n * what access the given Agent has in particular circumstances.\n * - The provided access will only apply to the given Resource. In other words,\n * if the Resource is a Container, the configured Access may not apply to\n * contained Resources.\n * - If the current user does not have permission to view or change access for\n * the given Resource, this function will resolve to `null`.\n *\n * Additionally, two caveats apply to users with a Pod server that uses WAC:\n * - If the Resource did not have an ACL yet, a new one will be initialised.\n * This means that changes to the ACL of a parent Container can no longer\n * affect access people have to this Resource, although existing access will\n * be preserved.\n * - Setting different values for `controlRead` and `controlWrite` is not\n * supported, and **will throw an error**. If you expect (some of) your users\n * to have Pods implementing WAC, be sure to pass the same value for both.\n *\n * @param resourceUrl URL of the Resource you want to change the Agent's access to.\n * @param webId WebID of the Agent you want to set access for.\n * @param access What access permissions you want to set for the given Agent to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.\n * @returns What access has been set for the given Agent explicitly.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function setAgentAccess$3(resourceUrl, webId, access, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n const updatedResource = internal_setAgentAccess$1(resourceInfo, acpData, webId, access);\n if (updatedResource) {\n try {\n await saveAcrFor(updatedResource, options);\n return await getAgentAccess$3(resourceUrl, webId, options);\n }\n catch (e) {\n return null;\n }\n }\n return null;\n }\n if (hasAccessibleAcl(resourceInfo)) {\n if (access.controlRead !== access.controlWrite) {\n throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \\`controlRead\\` and \\`controlWrite\\` should have the same value.`);\n }\n const wacAccess = access;\n await setAgentResourceAccess(resourceInfo, webId, wacAccess, options);\n return getAgentAccess$4(resourceInfo, webId, options);\n }\n return null;\n}\n/**\n * Get an overview of what access is defined for all Agents with respect to a given\n * Resource.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for the returned Agents. If\n * additional restrictions are set up to apply to the listed Agents in a\n * particular situation, those will not be reflected in the return value of\n * this function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @returns The access information to the Resource, grouped by Agent.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function getAgentAccessAll$3(resourceUrl, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n return internal_getAgentAccessAll$1(acpData);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getAgentAccessAll$4(resourceInfo, options);\n }\n return null;\n}\n/**\n * Get an overview of what access is defined for a given Group.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for the given Group. If\n * additional restrictions are set up to apply to the given Group in a\n * particular situation, those will not be reflected in the return value of\n * this function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param webId WebID of the Group you want to get the access for.\n * @since 1.5.0\n * @hidden\n * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people.\n */\nasync function getGroupAccess(resourceUrl, webId, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n return internal_getGroupAccess(acpData, webId);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getGroupAccess$1(resourceInfo, webId, options);\n }\n return null;\n}\n/**\n * Get an overview of what access is defined for all Groups with respect to a given\n * Resource.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for the returned Groups. If\n * additional restrictions are set up to apply to the listed Groups in a\n * particular situation, those will not be reflected in the return value of\n * this function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @returns The access information to the Resource, sorted by Group.\n * @since 1.5.0\n * @hidden\n * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people.\n */\nasync function getGroupAccessAll(resourceUrl, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n return internal_getGroupAccessAll(acpData);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getGroupAccessAll$1(resourceInfo, options);\n }\n return null;\n}\n/**\n * Set access to a Resource for a specific Group.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably setting access, in which case it will\n * resolve to `null`.\n * - It will only set access explicitly for the given Group. In other words,\n * additional restrictions could be present that further restrict or loosen\n * what access the given Group has in particular circumstances.\n * - The provided access will only apply to the given Resource. In other words,\n * if the Resource is a Container, the configured Access may not apply to\n * contained Resources.\n * - If the current user does not have permission to view or change access for\n * the given Resource, this function will resolve to `null`.\n *\n * Additionally, two caveats apply to users with a Pod server that uses WAC:\n * - If the Resource did not have an ACL yet, a new one will be initialised.\n * This means that changes to the ACL of a parent Container can no longer\n * affect access people have to this Resource, although existing access will\n * be preserved.\n * - Setting different values for `controlRead` and `controlWrite` is not\n * supported, and **will throw an error**. If you expect (some of) your users\n * to have Pods implementing WAC, be sure to pass the same value for both.\n *\n * @param resourceUrl URL of the Resource you want to change the Group's access to.\n * @param groupUrl URL of the Group you want to set access for.\n * @param access What access permissions you want to set for the given Group to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.\n * @returns What access has been set for the given Group explicitly.\n * @since 1.5.0\n * @hidden\n * @deprecated Access Control Policies will no longer support vcard:Group. Use the mechanism-specific access API's if you want to define access for groups of people.\n */\nasync function setGroupAccess(resourceUrl, groupUrl, access, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n const updatedResource = internal_setGroupAccess(resourceInfo, acpData, groupUrl, access);\n if (updatedResource) {\n try {\n await saveAcrFor(updatedResource, options);\n return await getGroupAccess(resourceUrl, groupUrl, options);\n }\n catch (e) {\n return null;\n }\n }\n return null;\n }\n if (hasAccessibleAcl(resourceInfo)) {\n if (access.controlRead !== access.controlWrite) {\n throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \\`controlRead\\` and \\`controlWrite\\` should have the same value.`);\n }\n const wacAccess = access;\n await setGroupResourceAccess(resourceInfo, groupUrl, wacAccess, options);\n return getGroupAccess$1(resourceInfo, groupUrl, options);\n }\n return null;\n}\n/**\n * Get an overview of what access is defined for everyone.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for everyone. If\n * additional restrictions are set up to apply to users in a particular\n * situation, those will not be reflected in the return value of this\n * function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @since 1.5.0\n *\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function getPublicAccess$3(resourceUrl, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n return internal_getPublicAccess$1(acpData);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getPublicAccess$4(resourceInfo, options);\n }\n return null;\n}\n/**\n * Set access to a Resource for everybody.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably setting access, in which case it will\n * resolve to `null`.\n * - It will only set access explicitly for everybody. In other words,\n * additional restrictions could be present that further restrict or loosen\n * what access a user has in particular circumstances.\n * - The provided access will only apply to the given Resource. In other words,\n * if the Resource is a Container, the configured Access may not apply to\n * contained Resources.\n * - If the current user does not have permission to view or change access for\n * the given Resource, this function will resolve to `null`.\n *\n * Additionally, two caveats apply to users with a Pod server that uses WAC:\n * - If the Resource did not have an ACL yet, a new one will be initialised.\n * This means that changes to the ACL of a parent Container can no longer\n * affect access people have to this Resource, although existing access will\n * be preserved.\n * - Setting different values for `controlRead` and `controlWrite` is not\n * supported, and **will throw an error**. If you expect (some of) your users\n * to have Pods implementing WAC, be sure to pass the same value for both.\n *\n * @param resourceUrl URL of the Resource you want to change public access to.\n * @param access What access permissions you want to set for everybody to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.\n * @returns What access has been set for everybody explicitly.\n * @since 1.5.0\n *\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function setPublicAccess$3(resourceUrl, access, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndRules(resourceInfo, options);\n const updatedResource = internal_setPublicAccess$1(resourceInfo, acpData, access);\n if (updatedResource) {\n try {\n await saveAcrFor(updatedResource, options);\n return await getPublicAccess$3(resourceUrl, options);\n }\n catch (e) {\n return null;\n }\n }\n return null;\n }\n if (hasAccessibleAcl(resourceInfo)) {\n if (access.controlRead !== access.controlWrite) {\n throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \\`controlRead\\` and \\`controlWrite\\` should have the same value.`);\n }\n const wacAccess = access;\n await setPublicResourceAccess(resourceInfo, wacAccess, options);\n return getPublicAccess$4(resourceInfo, options);\n }\n return null;\n}\n\nvar universal_v1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n getAccessFor: getAccessFor,\n getAccessForAll: getAccessForAll,\n getAgentAccess: getAgentAccess$3,\n getAgentAccessAll: getAgentAccessAll$3,\n getGroupAccess: getGroupAccess,\n getGroupAccessAll: getGroupAccessAll,\n getPublicAccess: getPublicAccess$3,\n setAccessFor: setAccessFor,\n setAgentAccess: setAgentAccess$3,\n setGroupAccess: setGroupAccess,\n setPublicAccess: setPublicAccess$3\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\nconst knownActorRelations = [acp.agent];\n/**\n * Get an overview of what access is defined for a given actor in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to this actor.\n *\n * Additionally, this only considers access given _explicitly_ to the given actor, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setActorAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @param actorRelation What type of actor (e.g. acp:agent) you want to get the access for.\n * @param actor Which instance of the given actor type you want to get the access for.\n * @returns What Access modes are granted to the given actor explicitly, or null if it could not be determined.\n */\nfunction internal_getActorAccess(acpData, actorRelation, actor) {\n if (acpData.inaccessibleUrls.length > 0) {\n // If we can't see all access data,\n // we can't reliably determine what access the given actor has:\n return null;\n }\n const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData));\n const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData));\n const initialAccess = {\n read: false,\n append: false,\n write: false,\n controlRead: false,\n controlWrite: false,\n };\n // All allowed reading and writing defined in ACR policies\n // determines whether the `controlRead` and `controlWrite` statuses are `true`.\n const allowedAcrAccess = applicableAcrPolicies.reduce((acc, policy) => {\n const allAllowedAccess = { ...acc };\n const allowModes = getAllowModesV2(policy);\n if (allowModes.read) {\n allAllowedAccess.controlRead = true;\n }\n if (allowModes.write) {\n allAllowedAccess.controlWrite = true;\n }\n return allAllowedAccess;\n }, initialAccess);\n // Then allowed reading, appending and writing in regular policies\n // determines whether the respective status is `true`.\n const withAllowedAccess = applicablePolicies.reduce((acc, policy) => {\n const allAllowedAccess = { ...acc };\n const allowModes = getAllowModesV2(policy);\n if (allowModes.read) {\n allAllowedAccess.read = true;\n }\n if (allowModes.append) {\n allAllowedAccess.append = true;\n }\n if (allowModes.write) {\n allAllowedAccess.write = true;\n }\n return allAllowedAccess;\n }, allowedAcrAccess);\n // At this point, everything that has been explicitly allowed is true.\n // However, it could still be overridden by access that is explicitly denied.\n // Starting with `controlRead` and `controlWrite`,\n // by inspecting denied reading and writing defined in the ACR policies.\n const withAcrDeniedAccess = applicableAcrPolicies.reduce((acc, policy) => {\n const allDeniedAccess = { ...acc };\n const denyModes = getDenyModesV2(policy);\n if (denyModes.read === true) {\n allDeniedAccess.controlRead = false;\n }\n if (denyModes.write === true) {\n allDeniedAccess.controlWrite = false;\n }\n return allDeniedAccess;\n }, withAllowedAccess);\n // And finally, we set to `false` those access modes that are explicitly denied\n // in the regular policies:\n const withDeniedAccess = applicablePolicies.reduce((acc, policy) => {\n const allDeniedAccess = { ...acc };\n const denyModes = getDenyModesV2(policy);\n if (denyModes.read === true) {\n allDeniedAccess.read = false;\n }\n if (denyModes.append === true) {\n allDeniedAccess.append = false;\n }\n if (denyModes.write === true) {\n allDeniedAccess.write = false;\n }\n return allDeniedAccess;\n }, withAcrDeniedAccess);\n return withDeniedAccess;\n}\n/**\n * Get an overview of what access is defined for a given Agent in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to this Agent.\n *\n * Additionally, this only considers access given _explicitly_ to the given Agent, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setAgentAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @param webId WebID of the Agent you want to get the access for.\n * @returns What Access modes are granted to the given Agent explicitly, or null if it could not be determined.\n */\nfunction internal_getAgentAccess(acpData, webId) {\n return internal_getActorAccess(acpData, acp.agent, webId);\n}\n/**\n * Get an overview of what access is defined for everybody in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to everybody.\n *\n * Additionally, this only considers access given _explicitly_ to everybody, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setPublicAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @returns What Access modes are granted to everyone explicitly, or null if it could not be determined.\n */\nfunction internal_getPublicAccess(acpData) {\n return internal_getActorAccess(acpData, acp.agent, acp.PublicAgent);\n}\nfunction policyAppliesTo(policy, actorRelation, actor, acpData) {\n const allowModes = getIriAll(policy, acp.allow);\n const denyModes = getIriAll(policy, acp.deny);\n if (allowModes.length + denyModes.length === 0) {\n // A Policy that does not specify access modes does not do anything:\n return false;\n }\n // Note: the non-null assertions (`!`) here should be valid because\n // the caller of `policyAppliesTo` should already have validated that\n // the return value of internal_getPoliciesAndMatchers() did not have any\n // inaccessible URLs, so we should be able to find every Matcher.\n const allOfMatchers = getAllOfMatcherUrlAll(policy).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl));\n const anyOfMatchers = getAnyOfMatcherUrlAll(policy).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl));\n const noneOfMatchers = getNoneOfMatcherUrlAll(policy).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl));\n // We assume that this Policy applies if this specific actor is mentioned\n // and no further restrictions are in place.\n // (In other words, the Policy may apply to others *in addition to* this\n // actor, but if it applies to this actor *unless* some other condition holds,\n // we cannot be sure whether it will apply to this actor.)\n // This means that:\n return (\n // Every existing allOf Matcher explicitly applies explicitly to this given actor:\n allOfMatchers.every((matcher) => matcherAppliesTo(matcher, actorRelation, actor)) &&\n // If there are anyOf Matchers, at least one applies explicitly to this actor:\n (anyOfMatchers.length === 0 ||\n anyOfMatchers.some((matcher) => matcherAppliesTo(matcher, actorRelation, actor))) &&\n // There is at least one allOf or anyOf Matcher:\n allOfMatchers.length + anyOfMatchers.length > 0 &&\n // No further restrictions are in place that make this sometimes not apply\n // to the given actor:\n noneOfMatchers.length === 0);\n}\nfunction policyConflictsWith(policy, otherAccess) {\n const allowModes = getIriAll(policy, acp.allow);\n const denyModes = getIriAll(policy, acp.deny);\n return ((otherAccess.read === true &&\n denyModes.includes(internal_accessModeIriStrings.read)) ||\n (otherAccess.read === false &&\n allowModes.includes(internal_accessModeIriStrings.read) &&\n !denyModes.includes(internal_accessModeIriStrings.read)) ||\n (otherAccess.append === true &&\n denyModes.includes(internal_accessModeIriStrings.append)) ||\n (otherAccess.append === false &&\n allowModes.includes(internal_accessModeIriStrings.append) &&\n !denyModes.includes(internal_accessModeIriStrings.append)) ||\n (otherAccess.write === true &&\n denyModes.includes(internal_accessModeIriStrings.write)) ||\n (otherAccess.write === false &&\n allowModes.includes(internal_accessModeIriStrings.write) &&\n !denyModes.includes(internal_accessModeIriStrings.write)));\n}\nfunction matcherAppliesTo(matcher, actorRelation, actor) {\n return getIriAll(matcher, actorRelation).includes(actor);\n}\n/**\n * Get a set of all actors mentioned in an ACR by active Matchers (i.e. that are\n * referenced by Policies referenced by the ACR Control, and therefore that\n * effectively apply).\n *\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @param actorRelation\n */\nfunction internal_findActorAll(acpData, actorRelation) {\n const actors = new Set();\n // This code could be prettier using flat(), which isn't supported by nodeJS 10.\n // If you read this comment after April 2021, feel free to refactor.\n acpData.matchers.forEach((matcher) => {\n getIriAll(matcher, actorRelation)\n .filter((iri) => ![\n acp.PublicAgent,\n acp.CreatorAgent,\n acp.AuthenticatedAgent,\n ].includes(iri) || actorRelation !== acp.agent)\n .forEach((iri) => actors.add(iri));\n });\n return actors;\n}\n/**\n * Iterate through all the actors active for an ACR, and list all of their access.\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @param actorRelation The type of actor we want to list access for\n * @returns A map with each actor access indexed by their URL, or null if some\n * external policies are referenced.\n */\nfunction internal_getActorAccessAll(acpData, actorRelation) {\n if (acpData.inaccessibleUrls.length > 0) {\n // If we can't see all access data,\n // we can't reliably determine what access actors of the given type have:\n return null;\n }\n const result = {};\n const actors = internal_findActorAll(acpData, actorRelation);\n actors.forEach((iri) => {\n // The type assertion holds, because if internal_getActorAccess were null,\n // we would have returned {} already.\n const access = internal_getActorAccess(acpData, actorRelation, iri);\n result[iri] = access;\n });\n return result;\n}\n/**\n * Get an overview of what access are defined for all Agents in a Resource's Access Control Resource.\n *\n * This will only return a value if all relevant access is defined in just the Resource's Access\n * Control Resource; in other words, if an Access Policy or Access Matcher applies that is re-used for\n * other Resources, this function will not be able to determine the access relevant to the mentionned\n * Agents.\n *\n * Additionally, this only considers access given _explicitly_ to individual Agents, i.e. without\n * additional conditions.\n *\n * In other words, this function will generally understand and return the access as set by\n * [[internal_setAgentAccess]], but not understand more convoluted Policies.\n *\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @returns A map with each Agent's access indexed by their WebID, or null if some\n * external policies are referenced.\n */\nfunction internal_getAgentAccessAll(acpData) {\n return internal_getActorAccessAll(acpData, acp.agent);\n}\n/**\n * Set access to a Resource for a specific actor.\n *\n * This function adds the relevant Access Control Policies and Matchers to a\n * Resource's Access Control Resource to define the given access for the given\n * actor specifically. In other words, it can, for example, add Policies that\n * give the general Public Read access to the Resource. However, if other\n * Policies specify that everyone is *denied* Read access *except* for a\n * particular Agent, then that will be left intact.\n * This means that, unless *only* this module's functions are used to manipulate\n * access to this Resource, the set access might not be equal to the effective\n * access for an agent matching the given actor.\n *\n * There are a number of preconditions that have to be fulfilled for this\n * function to work:\n * - Access to the Resource is determined via an Access Control Resource.\n * - The Resource's Access Control Resource does not refer to (Policies or Matchers\n * in) other Resources.\n * - The current user has access to the Resource's Access Control Resource.\n *\n * If those conditions do not hold, this function will return `null`.\n *\n * Additionally, take note that the given access will only be applied to the\n * given Resource; if that Resource is a Container, access will have to be set\n * for its contained Resources independently.\n *\n * @param resource Resource that was fetched together with its linked Access Control Resource.\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @param actorRelation What type of actor (e.g. acp:agent) you want to set the access for.\n * @param actor Which instance of the given actor type you want to set the access for.\n * @param access What access (read, append, write, controlRead, controlWrite) to set for the given actor. `true` to allow, `false` to deny, and `undefined` to leave unchanged.\n * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not.\n */\nfunction internal_setActorAccess(resource, acpData, actorRelation, actor, access) {\n var _a, _b, _c, _d, _e;\n if (!hasAccessibleAcr(resource) || acpData.inaccessibleUrls.length > 0) {\n return null;\n }\n // Get the access that currently applies to the given actor\n const existingAccess = internal_getActorAccess(acpData, actorRelation, actor);\n /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that above. */\n if (existingAccess === null) {\n return null;\n }\n // Get all Policies that apply specifically to the given actor\n const applicableAcrPolicies = acpData.acrPolicies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData));\n const applicablePolicies = acpData.policies.filter((policy) => policyAppliesTo(policy, actorRelation, actor, acpData));\n // We only need to override Policies that define access other than what we want:\n const conflictingAcrPolicies = applicableAcrPolicies.filter((policy) => policyConflictsWith(policy, {\n read: access.controlRead,\n write: access.controlWrite,\n }));\n const conflictingPolicies = applicablePolicies.filter((policy) => policyConflictsWith(policy, {\n read: access.read,\n append: access.append,\n write: access.write,\n }));\n // For every Policy that applies specifically to the given Actor, but _also_\n // to another actor (i.e. that applies using an anyOf Matcher, or a Matcher that\n // mentions both the given and another actor)...\n const otherActorAcrPolicies = conflictingAcrPolicies.filter((acrPolicy) => policyHasOtherActors(acrPolicy, actorRelation, actor, acpData));\n const otherActorPolicies = conflictingPolicies.filter((policy) => policyHasOtherActors(policy, actorRelation, actor, acpData));\n // ...check what access the current actor would have if we removed them...\n const acpDataWithPoliciesExcluded = {\n ...acpData,\n acrPolicies: acpData.acrPolicies.filter((acrPolicy) => !otherActorAcrPolicies.includes(acrPolicy)),\n policies: acpData.policies.filter((policy) => !otherActorPolicies.includes(policy)),\n };\n const remainingAccess = internal_getActorAccess(acpDataWithPoliciesExcluded, actorRelation, actor);\n /* istanbul ignore if: It returns null if the ACR has inaccessible Policies, which should happen since we already check for that at the start. */\n if (remainingAccess === null) {\n return null;\n }\n // ...add copies of those Policies and their Matchers, but excluding the given actor...\n let updatedResource = resource;\n otherActorAcrPolicies.forEach((acrPolicy) => {\n const [policyCopy, matcherCopies] = copyPolicyExcludingActor(acrPolicy, resource, acpData, actorRelation, actor);\n updatedResource = setResourceAcrPolicy(updatedResource, policyCopy);\n updatedResource = matcherCopies.reduce(setResourceMatcher, updatedResource);\n });\n otherActorPolicies.forEach((policy) => {\n const [policyCopy, matcherCopies] = copyPolicyExcludingActor(policy, resource, acpData, actorRelation, actor);\n updatedResource = setResourcePolicy$1(updatedResource, policyCopy);\n updatedResource = matcherCopies.reduce(setResourceMatcher, updatedResource);\n });\n // ...add a new Policy that applies the given access,\n // and the previously applying access for access modes that were undefined...\n const newMatcherName = `matcher_${encodeURIComponent(`${actorRelation}_${actor}`)}`;\n let newMatcher = createResourceMatcherFor(resource, newMatcherName);\n newMatcher = setIri(newMatcher, actorRelation, actor);\n const newControlReadAccess = (_a = access.controlRead) !== null && _a !== void 0 ? _a : existingAccess.controlRead;\n const newControlWriteAccess = (_b = access.controlWrite) !== null && _b !== void 0 ? _b : existingAccess.controlWrite;\n let acrPoliciesToUnapply = otherActorAcrPolicies;\n // Only replace existing Policies if the defined access actually changes:\n if (newControlReadAccess !== remainingAccess.controlRead ||\n newControlWriteAccess !== remainingAccess.controlWrite) {\n const newAcrPolicyName = uuid.v4();\n let newAcrPolicy = createResourcePolicyFor(resource, newAcrPolicyName);\n newAcrPolicy = setAllowModesV2(newAcrPolicy, {\n read: newControlReadAccess === true,\n append: false,\n write: newControlWriteAccess === true,\n });\n newAcrPolicy = addIri(newAcrPolicy, acp.allOf, newMatcher);\n updatedResource = setResourceAcrPolicy(updatedResource, newAcrPolicy);\n updatedResource = setResourceMatcher(updatedResource, newMatcher);\n // If we don't have to set new access, we only need to unapply the\n // ACR Policies that applied to both the given actor and other actors\n // (because they have been replaced by clones not mentioning the given\n // actor). Hence `policiesToUnApply` is initialised to `otherActorPolicies`.\n // However, if we're in this if branch, that means we also had to replace\n // Policies that defined access for just this actor, so we'll have to remove\n // all Policies mentioning this actor:\n acrPoliciesToUnapply = conflictingAcrPolicies;\n }\n const newReadAccess = (_c = access.read) !== null && _c !== void 0 ? _c : existingAccess.read;\n const newAppendAccess = (_d = access.append) !== null && _d !== void 0 ? _d : existingAccess.append;\n const newWriteAccess = (_e = access.write) !== null && _e !== void 0 ? _e : existingAccess.write;\n let policiesToUnapply = otherActorPolicies;\n // Only replace existing Policies if the defined access actually changes:\n if (newReadAccess !== remainingAccess.read ||\n newAppendAccess !== remainingAccess.append ||\n newWriteAccess !== remainingAccess.write) {\n const newPolicyName = uuid.v4();\n let newPolicy = createResourcePolicyFor(resource, newPolicyName);\n newPolicy = setAllowModesV2(newPolicy, {\n read: newReadAccess === true,\n append: newAppendAccess === true,\n write: newWriteAccess === true,\n });\n newPolicy = addIri(newPolicy, acp.allOf, newMatcher);\n updatedResource = setResourcePolicy$1(updatedResource, newPolicy);\n updatedResource = setResourceMatcher(updatedResource, newMatcher);\n // If we don't have to set new access, we only need to unapply the\n // Policies that applied to both the given actor and other actors (because\n // they have been replaced by clones not mentioning the given actor). Hence\n // `policiesToUnApply` is initialised to `otherActorPolicies`.\n // However, if we're in this if branch, that means we also had to replace\n // Policies that defined access for just this actor, so we'll have to remove\n // all Policies mentioning this actor:\n policiesToUnapply = conflictingPolicies;\n }\n // ...then remove existing Policy URLs that mentioned both the given actor\n // and other actors from the given Resource and apply the new ones (but do not\n // remove the actual old Policies - they might still apply to other Resources!).\n acrPoliciesToUnapply.forEach((previouslyApplicableAcrPolicy) => {\n updatedResource = removeAcrPolicyUrl$1(updatedResource, asIri(previouslyApplicableAcrPolicy));\n });\n policiesToUnapply.forEach((previouslyApplicablePolicy) => {\n updatedResource = removePolicyUrl$1(updatedResource, asIri(previouslyApplicablePolicy));\n });\n return updatedResource;\n}\n/**\n * Set access to a Resource for a specific Agent.\n *\n * This function adds the relevant Access Control Policies and Matchers to a\n * Resource's Access Control Resource to define the given access for the given\n * Agent specifically. In other words, it can, for example, add Policies that\n * give a particular Agent Read access to the Resource. However, if other\n * Policies specify that that Agent is *denied* Read access *except* if they\n * match on some other characteristic, then that will be left intact.\n * This means that, unless *only* this function is used to manipulate access to\n * this Resource, the set access might not be equal to the effective access for\n * the given Agent.\n *\n * There are a number of preconditions that have to be fulfilled for this\n * function to work:\n * - Access to the Resource is determined via an Access Control Resource.\n * - The Resource's Access Control Resource does not refer to (Policies or Matchers\n * in) other Resources.\n * - The current user has access to the Resource's Access Control Resource.\n *\n * If those conditions do not hold, this function will return `null`.\n *\n * Additionally, take note that the given access will only be applied to the\n * given Resource; if that Resource is a Container, access will have to be set\n * for its contained Resources independently.\n *\n * @param resource Resource that was fetched together with its linked Access Control Resource.\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @param webId Which Agent you want to set the access for.\n * @param access What access (read, append, write, controlRead, controlWrite) to set for the given Agent. `true` to allow, `false` to deny, and `undefined` to leave unchanged.\n * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not.\n */\nfunction internal_setAgentAccess(resource, acpData, webId, access) {\n return internal_setActorAccess(resource, acpData, acp.agent, webId, access);\n}\n/**\n * Set access to a Resource for everybody.\n *\n * This function adds the relevant Access Control Policies and Matchers to a\n * Resource's Access Control Resource to define the given access for everybody\n * specifically. In other words, it can, for example, add Policies that\n * give everybody Read access to the Resource. However, if other\n * Policies specify that everybody is *denied* Read access *except* if they're\n * a particular Agent, then that will be left intact.\n * This means that, unless *only* this module's functions are used to manipulate\n * access to this Resource, the set access might not be equal to the effective\n * access for a particular Agent.\n *\n * There are a number of preconditions that have to be fulfilled for this\n * function to work:\n * - Access to the Resource is determined via an Access Control Resource.\n * - The Resource's Access Control Resource does not refer to (Policies or Matchers\n * in) other Resources.\n * - The current user has access to the Resource's Access Control Resource.\n *\n * If those conditions do not hold, this function will return `null`.\n *\n * Additionally, take note that the given access will only be applied to the\n * given Resource; if that Resource is a Container, access will have to be set\n * for its contained Resources independently.\n *\n * @param resource Resource that was fetched together with its linked Access Control Resource.\n * @param acpData All Access Control Policies and Matchers that apply to a particular Resource.\n * @param access What access (read, append, write, controlRead, controlWrite) to set for everybody. `true` to allow, `false` to deny, and `undefined` to leave unchanged.\n * @returns The Resource with the updated Access Control Resource attached, if updated successfully, or `null` if not.\n */\nfunction internal_setPublicAccess(resource, acpData, access) {\n return internal_setActorAccess(resource, acpData, acp.agent, acp.PublicAgent, access);\n}\nfunction policyHasOtherActors(policy, actorRelation, actor, acpData) {\n // Note: the non-null assertions (`!`) here should be valid because\n // the caller of `policyHasOtherActors` should already have validated\n // that the return value of internal_getPoliciesAndMatchers() did not have\n // any inaccessible URLs, so we should be able to find every Matcher.\n const allOfMatchers = getIriAll(policy, acp.allOf).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl));\n const allOfMatchersHaveOtherActors = allOfMatchers.some((matcher) => {\n return matcherHasOtherActors(matcher, actorRelation, actor);\n });\n const anyOfMatchers = getIriAll(policy, acp.anyOf).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl));\n const anyOfMatchersHaveOtherActors = anyOfMatchers.some((matcher) => {\n return matcherHasOtherActors(matcher, actorRelation, actor);\n });\n /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Matchers */\n const noneOfMatchers = getIriAll(policy, acp.noneOf).map((matcherUrl) => acpData.matchers.find((matcher) => asIri(matcher) === matcherUrl));\n /* istanbul ignore next This function only gets called after policyAppliesTo, which already filters out all noneOf Matchers */\n const noneOfMatchersHaveOtherActors = noneOfMatchers.some((matcher) => {\n return matcherHasOtherActors(matcher, actorRelation, actor);\n });\n return (allOfMatchersHaveOtherActors ||\n anyOfMatchersHaveOtherActors ||\n noneOfMatchersHaveOtherActors);\n}\nfunction matcherHasOtherActors(matcher, actorRelation, actor) {\n const otherActors = [];\n knownActorRelations.forEach((knownActorRelation) => {\n const otherActorsWithThisRelation = getIriAll(matcher, knownActorRelation).filter((applicableActor) => applicableActor !== actor || knownActorRelation !== actorRelation);\n // Unfortunately Node 10 does not support `.flat()` yet, hence the use of `push`:\n otherActors.push(...otherActorsWithThisRelation);\n });\n return otherActors.length > 0;\n}\nfunction copyPolicyExcludingActor(inputPolicy, resourceWithAcr, acpData, actorRelationToExclude, actorToExclude) {\n const newIriSuffix = uuid.v4();\n // Create new Matchers for the Policy, excluding the given Actor\n const newAllOfMatchers = copyMatchersExcludingActor(getIriAll(inputPolicy, acp.allOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude);\n const newAnyOfMatchers = copyMatchersExcludingActor(getIriAll(inputPolicy, acp.anyOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude);\n const newNoneOfMatchers = copyMatchersExcludingActor(getIriAll(inputPolicy, acp.noneOf), resourceWithAcr, acpData, newIriSuffix, actorRelationToExclude, actorToExclude);\n // Create a new Policy with the new Matchers\n let newPolicy = createResourcePolicyFor(resourceWithAcr, encodeURI(asIri(inputPolicy)) + newIriSuffix);\n getIriAll(inputPolicy, acp.allow).forEach((allowMode) => {\n newPolicy = addIri(newPolicy, acp.allow, allowMode);\n });\n getIriAll(inputPolicy, acp.deny).forEach((denyMode) => {\n newPolicy = addIri(newPolicy, acp.deny, denyMode);\n });\n newAllOfMatchers.forEach((newMatcher) => {\n newPolicy = addIri(newPolicy, acp.allOf, newMatcher);\n });\n newAnyOfMatchers.forEach((newMatcher) => {\n newPolicy = addIri(newPolicy, acp.anyOf, newMatcher);\n });\n /* istanbul ignore next Policies listing noneOf Matchers are left alone (because they do not unambiguously apply to the given actor always), so there will usually not be any noneOf Matchers to copy. */\n newNoneOfMatchers.forEach((newMatcher) => {\n newPolicy = addIri(newPolicy, acp.noneOf, newMatcher);\n });\n return [\n newPolicy,\n newAllOfMatchers.concat(newAnyOfMatchers).concat(newNoneOfMatchers),\n ];\n}\n/** Creates clones of all the Matchers identified by `matcherIris` in `acpData`, excluding the given Actor */\nfunction copyMatchersExcludingActor(matcherIris, resourceWithAcr, acpData, iriSuffix, actorRelationToExclude, actorToExclude) {\n return matcherIris\n .map((matcherIri) => {\n const matcher = acpData.matchers.find((matcher) => asIri(matcher) === matcherIri);\n /* istanbul ignore if: getPoliciesAndMatchers should already have fetched all referenced Matchers, so this should never be true: */\n if (typeof matcher === \"undefined\") {\n return null;\n }\n let newMatcher = createResourceMatcherFor(resourceWithAcr, encodeURI(asIri(matcher)) + iriSuffix);\n let listsOtherActors = false;\n knownActorRelations.forEach((knownActorRelation) => {\n getIriAll(matcher, knownActorRelation).forEach((targetActor) => {\n if (knownActorRelation === actorRelationToExclude &&\n targetActor === actorToExclude) {\n return;\n }\n listsOtherActors = true;\n newMatcher = addIri(newMatcher, knownActorRelation, targetActor);\n });\n });\n return listsOtherActors ? newMatcher : null;\n })\n .filter(isNotNull);\n}\nfunction isNotNull(value) {\n return value !== null;\n}\nasync function internal_getPoliciesAndMatchers(resource, options = internal_defaultFetchOptions) {\n const acrPolicyUrls = getAcrPolicyUrlAll$1(resource);\n const policyUrls = getPolicyUrlAll$1(resource);\n const allPolicyResourceUrls = getResourceUrls(acrPolicyUrls).concat(getResourceUrls(policyUrls));\n const policyResources = await getResources(allPolicyResourceUrls, options);\n const acrPolicies = getThingsFromResources(acrPolicyUrls, policyResources).filter(isNotNull);\n const policies = getThingsFromResources(policyUrls, policyResources).filter(isNotNull);\n const matcherUrlSet = new Set();\n acrPolicies.forEach((acrPolicy) => {\n const referencedMatcherUrls = getReferencedMatcherUrls(acrPolicy);\n referencedMatcherUrls.forEach((matcherUrl) => {\n matcherUrlSet.add(matcherUrl);\n });\n });\n policies.forEach((policy) => {\n const referencedMatcherUrls = getReferencedMatcherUrls(policy);\n referencedMatcherUrls.forEach((matcherUrl) => {\n matcherUrlSet.add(matcherUrl);\n });\n });\n const matcherUrls = Array.from(matcherUrlSet);\n const matcherResourceUrls = matcherUrls.map((matcherUrl) => getResourceUrl(matcherUrl));\n const unfetchedMatcherResourceUrls = matcherResourceUrls.filter((matcherResourceUrl) => !allPolicyResourceUrls.includes(matcherResourceUrl));\n const matcherResources = await getResources(unfetchedMatcherResourceUrls, options);\n const allResources = {\n ...policyResources,\n ...matcherResources,\n };\n const matchers = getThingsFromResources(matcherUrls, allResources).filter(isNotNull);\n const inaccessibleUrls = Object.keys(allResources).filter((resourceUrl) => allResources[resourceUrl] === null);\n return {\n inaccessibleUrls,\n acrPolicies,\n policies,\n matchers,\n };\n}\nfunction getResourceUrl(thingUrl) {\n const thingUrlObject = new URL(thingUrl);\n thingUrlObject.hash = \"\";\n return thingUrlObject.href;\n}\nfunction getResourceUrls(thingUrls) {\n const resourceUrls = [];\n thingUrls.forEach((thingUrl) => {\n const resourceUrl = getResourceUrl(thingUrl);\n if (!resourceUrls.includes(resourceUrl)) {\n resourceUrls.push(resourceUrl);\n }\n });\n return resourceUrls;\n}\nasync function getResources(resourceUrls, options) {\n const uniqueResourceUrls = Array.from(new Set(resourceUrls));\n const resources = {};\n await Promise.all(uniqueResourceUrls.map(async (resourceUrl) => {\n try {\n const resource = await getSolidDataset(resourceUrl, options);\n resources[resourceUrl] = resource;\n }\n catch (e) {\n resources[resourceUrl] = null;\n }\n }));\n return resources;\n}\nfunction getThingsFromResources(thingUrls, resources) {\n return thingUrls.map((thingUrl) => {\n const resourceUrl = getResourceUrl(thingUrl);\n const resource = resources[resourceUrl];\n if (!resource) {\n return null;\n }\n return getThing(resource, thingUrl);\n });\n}\nfunction getReferencedMatcherUrls(policy) {\n return getAllOfMatcherUrlAll(policy)\n .concat(getAnyOfMatcherUrlAll(policy))\n .concat(getNoneOfMatcherUrlAll(policy));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Get an overview of what access is defined for a given Agent.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for the given Agent. If\n * additional restrictions are set up to apply to the given Agent in a\n * particular situation, those will not be reflected in the return value of\n * this function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param webId WebID of the Agent you want to get the access for.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function getAgentAccess$2(resourceUrl, webId, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options);\n return internal_getAgentAccess(acpData, webId);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getAgentAccess$4(resourceInfo, webId, options);\n }\n return null;\n}\n/**\n * Set access to a Resource for a specific Agent.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably setting access, in which case it will\n * resolve to `null`.\n * - It will only set access explicitly for the given Agent. In other words,\n * additional restrictions could be present that further restrict or loosen\n * what access the given Agent has in particular circumstances.\n * - The provided access will only apply to the given Resource. In other words,\n * if the Resource is a Container, the configured Access may not apply to\n * contained Resources.\n * - If the current user does not have permission to view or change access for\n * the given Resource, this function will resolve to `null`.\n *\n * Additionally, two caveats apply to users with a Pod server that uses WAC:\n * - If the Resource did not have an ACL yet, a new one will be initialised.\n * This means that changes to the ACL of a parent Container can no longer\n * affect access people have to this Resource, although existing access will\n * be preserved.\n * - Setting different values for `controlRead` and `controlWrite` is not\n * supported, and **will throw an error**. If you expect (some of) your users\n * to have Pods implementing WAC, be sure to pass the same value for both.\n *\n * @param resourceUrl URL of the Resource you want to change the Agent's access to.\n * @param webId WebID of the Agent you want to set access for.\n * @param access What access permissions you want to set for the given Agent to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.\n * @returns What access has been set for the given Agent explicitly.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function setAgentAccess$2(resourceUrl, webId, access, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options);\n const updatedResource = internal_setAgentAccess(resourceInfo, acpData, webId, access);\n if (updatedResource) {\n try {\n await saveAcrFor(updatedResource, options);\n return await getAgentAccess$2(resourceUrl, webId, options);\n }\n catch (e) {\n return null;\n }\n }\n return null;\n }\n if (hasAccessibleAcl(resourceInfo)) {\n if (access.controlRead !== access.controlWrite) {\n throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \\`controlRead\\` and \\`controlWrite\\` should have the same value.`);\n }\n const wacAccess = access;\n await setAgentResourceAccess(resourceInfo, webId, wacAccess, options);\n return getAgentAccess$4(resourceInfo, webId, options);\n }\n return null;\n}\n/**\n * Get an overview of what access is defined for all Agents with respect to a given\n * Resource.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for the returned Agents. If\n * additional restrictions are set up to apply to the listed Agents in a\n * particular situation, those will not be reflected in the return value of\n * this function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @returns The access information to the Resource, grouped by Agent.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function getAgentAccessAll$2(resourceUrl, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options);\n return internal_getAgentAccessAll(acpData);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getAgentAccessAll$4(resourceInfo, options);\n }\n return null;\n}\n/**\n * Get an overview of what access is defined for everyone.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access, in which case it will\n * resolve to `null`.\n * - It will only return access specified explicitly for everyone. If\n * additional restrictions are set up to apply to users in a particular\n * situation, those will not be reflected in the return value of this\n * function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function getPublicAccess$2(resourceUrl, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options);\n return internal_getPublicAccess(acpData);\n }\n if (hasAccessibleAcl(resourceInfo)) {\n return getPublicAccess$4(resourceInfo, options);\n }\n return null;\n}\n/**\n * Set access to a Resource for everybody.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably setting access, in which case it will\n * resolve to `null`.\n * - It will only set access explicitly for everybody. In other words,\n * additional restrictions could be present that further restrict or loosen\n * what access a user has in particular circumstances.\n * - The provided access will only apply to the given Resource. In other words,\n * if the Resource is a Container, the configured Access may not apply to\n * contained Resources.\n * - If the current user does not have permission to view or change access for\n * the given Resource, this function will resolve to `null`.\n *\n * Additionally, two caveats apply to users with a Pod server that uses WAC:\n * - If the Resource did not have an ACL yet, a new one will be initialised.\n * This means that changes to the ACL of a parent Container can no longer\n * affect access people have to this Resource, although existing access will\n * be preserved.\n * - Setting different values for `controlRead` and `controlWrite` is not\n * supported, and **will throw an error**. If you expect (some of) your users\n * to have Pods implementing WAC, be sure to pass the same value for both.\n *\n * @param resourceUrl URL of the Resource you want to change public access to.\n * @param access What access permissions you want to set for everybody to the given Resource. Possible properties are `read`, `append`, `write`, `controlRead` and `controlWrite`: set to `true` to allow, to `false` to stop allowing, or `undefined` to leave unchanged. Take note that `controlRead` and `controlWrite` can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.\n * @returns What access has been set for everybody explicitly.\n * @since 1.5.0\n * @hidden\n * @deprecated Please import from the \"universal\" modules.\n */\nasync function setPublicAccess$2(resourceUrl, access, options = internal_defaultFetchOptions) {\n const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);\n if (hasAccessibleAcr(resourceInfo)) {\n const acpData = await internal_getPoliciesAndMatchers(resourceInfo, options);\n const updatedResource = internal_setPublicAccess(resourceInfo, acpData, access);\n if (updatedResource) {\n try {\n await saveAcrFor(updatedResource, options);\n return await getPublicAccess$2(resourceUrl, options);\n }\n catch (e) {\n return null;\n }\n }\n return null;\n }\n if (hasAccessibleAcl(resourceInfo)) {\n if (access.controlRead !== access.controlWrite) {\n throw new Error(`When setting access for a Resource in a Pod implementing Web Access Control (i.e. [${getSourceIri(resourceInfo)}]), \\`controlRead\\` and \\`controlWrite\\` should have the same value.`);\n }\n const wacAccess = access;\n await setPublicResourceAccess(resourceInfo, wacAccess, options);\n return getPublicAccess$4(resourceInfo, options);\n }\n return null;\n}\n\nvar universal_v2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n getAccessFor: getAccessFor,\n getAccessForAll: getAccessForAll,\n getAgentAccess: getAgentAccess$2,\n getAgentAccessAll: getAgentAccessAll$2,\n getPublicAccess: getPublicAccess$2,\n setAccessFor: setAccessFor,\n setAgentAccess: setAgentAccess$2,\n setPublicAccess: setPublicAccess$2\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Retrieve the Server Resource Info of Resource expressing access control over\n * another resource it is linked to. It applies in both ACP and WAC contexts:\n * the Access Control Resource is discovered consistently using a Link header\n * with `rel=acl`.\n *\n * @param {WithServerResourceInfo} resource The Resource for which ACL we want\n * to retrieve the Server Resource Info.\n * @param {DefaultOptions} options\n * @returns The Server Resource Info if available, null otherwise.\n * @since 1.19.0\n */\nasync function getAclServerResourceInfo(resource, options) {\n if (typeof resource.internal_resourceInfo.aclUrl !== \"string\") {\n return null;\n }\n try {\n return await getResourceInfo(resource.internal_resourceInfo.aclUrl, options);\n }\n catch (_a) {\n // A WAC-governed resource may have a link to a non-existant ACL (by design).\n // The absence of an ACL at the target URL is a useful information that is\n // used by the universal API to pick between ACR and WAC.\n return null;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Policies allow or deny access modes over resources and their associated\n * access control resource.\n *\n * @param policy The Policy Thing which allows retrieved access modes.\n * @returns Policy URL array.\n * @since 1.16.1\n */\nfunction getAllowModes(policy) {\n return getModes(policy, ACP.allow);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * ```{note}\n * The ACP specification is a draft. As such, this function is experimental and\n * subject to change, even in a non-major release.\n * See also: https://solid.github.io/authorization-panel/acp-specification/\n * ```\n *\n * Policies allow or deny access modes over resources and their associated\n * access control resource.\n *\n * @param policy The Policy Thing which denies retrieved access modes.\n * @returns Policy URL array.\n * @since 1.16.1\n */\nfunction getDenyModes(policy) {\n return getModes(policy, ACP.deny);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction isAgentMatched(acr, policy, webId) {\n // TODO: Proper solution\n // Finalise, release and use the TypeScript ACP Solid library\n // internal_getActorAccess in acp_v2:96 doesn't reduce the policies properly\n // policyAppliesTo in acp_v2:256 assumes that every matcher is an agent matcher\n //\n // TODO: Stopgap solution\n // Implement a simplistic reduce function that\n // matches policies where the agent is present in the matchers\n const allOfMatchers = getUrlAll(policy, ACP.allOf)\n .map((url) => getThing(internal_getAcr(acr), url))\n .filter((thing) => thing !== null);\n const allOfMatched = allOfMatchers.every((thing) => {\n return getUrlAll(thing, ACP.agent).includes(webId);\n });\n const anyOfMatchers = getUrlAll(policy, ACP.anyOf)\n .map((url) => getThing(internal_getAcr(acr), url))\n .filter((thing) => thing !== null);\n const anyOfMatched = anyOfMatchers.some((thing) => {\n return getUrlAll(thing, ACP.agent).includes(webId);\n });\n const noneOfMatchers = getUrlAll(policy, ACP.noneOf)\n .map((url) => getThing(internal_getAcr(acr), url))\n .filter((thing) => thing !== null);\n const noneOfMatched = noneOfMatchers.some((thing) => {\n return getUrlAll(thing, ACP.agent).includes(webId);\n });\n return (allOfMatchers.length + anyOfMatchers.length > 0 &&\n (allOfMatchers.length === 0 || allOfMatched) &&\n (anyOfMatchers.length === 0 || anyOfMatched) &&\n (noneOfMatchers.length === 0 || !noneOfMatched));\n}\n/** @hidden */\nfunction reduceModes(policy, modes, type) {\n const allowed = getAllowModes(policy);\n const denied = getDenyModes(policy);\n if (type === \"control\") {\n return {\n read: modes.read,\n append: modes.append,\n write: modes.write,\n controlRead: (modes.controlRead || allowed.read) && !denied.read,\n controlWrite: (modes.controlWrite || allowed.write) && !denied.write,\n };\n }\n return {\n read: (modes.read || allowed.read) && !denied.read,\n append: (modes.append || allowed.append) && !denied.append,\n write: (modes.write || allowed.write) && !denied.write,\n controlRead: modes.controlRead,\n controlWrite: modes.controlWrite,\n };\n}\n/**\n * Get an overview of what access is defined for a given Agent.\n *\n * @param resourceWithAcr URL of the Resource you want to read the access for.\n * @param webId WebID of the Agent you want to get the access for.\n * @since 1.16.0\n */\nasync function getAgentAccess$1(resourceWithAcr, webId) {\n // TODO: add support for external resources\n let resourceAccess = {\n read: false,\n append: false,\n write: false,\n controlRead: false,\n controlWrite: false,\n };\n const policyAll = getPolicyUrlAll(resourceWithAcr)\n .map((url) => getThing(internal_getAcr(resourceWithAcr), url))\n .filter((policy) => policy !== null);\n policyAll.forEach((policy) => {\n if (isAgentMatched(resourceWithAcr, policy, webId)) {\n resourceAccess = reduceModes(policy, resourceAccess, \"resource\");\n }\n });\n const acrPolicyAll = getAcrPolicyUrlAll(resourceWithAcr)\n .map((url) => getThing(internal_getAcr(resourceWithAcr), url))\n .filter((policy) => policy !== null);\n acrPolicyAll.forEach((policy) => {\n if (isAgentMatched(resourceWithAcr, policy, webId)) {\n resourceAccess = reduceModes(policy, resourceAccess, \"control\");\n }\n });\n return resourceAccess;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Retrieve the URL of an Access Control Resource as per pre-draft versions of\n * the ACP specification.\n *\n * @param resource The Resource for which to retrieve the URL of the Access\n * Control Resource if it is accessible.\n * @returns The URL of the ACR or null.\n * @deprecated\n */\nfunction getAcrUrl$1(resource) {\n const linkedAccessControlResource = resource.internal_resourceInfo.linkedResources[ACP.accessControl];\n if (Array.isArray(linkedAccessControlResource) &&\n linkedAccessControlResource.length === 1) {\n return linkedAccessControlResource[0];\n }\n return null;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Retrieve the URL of an Access Control Resource as per the ACP Draft\n * specification.\n *\n * @param resource The Resource for which to retrieve the URL of the Access\n * Control Resource if it is accessible.\n * @returns The URL of the ACR or null.\n */\nasync function getAcrUrl(resource, options) {\n // TODO: Remove as soon as ESS 1.1 is phased out\n const legacyAcrUrl = getAcrUrl$1(resource);\n if (legacyAcrUrl !== null) {\n return legacyAcrUrl;\n }\n // The ACP Draft mandates a link rel=\"type\" header identifies Access Control Resources\n const aclServerResourceInfo = await getAclServerResourceInfo(resource, options);\n if (aclServerResourceInfo === null) {\n return null;\n }\n const relTypeLinks = getLinkedResourceUrlAll(aclServerResourceInfo).type;\n if (Array.isArray(relTypeLinks) &&\n relTypeLinks.includes(ACP.AccessControlResource)) {\n return getSourceUrl(aclServerResourceInfo);\n }\n return null;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Retrieve the Access Control Resource of a Resource as per the ACP Draft\n * specification.\n *\n * @param resource The Resource for which to retrieve the URL of the Access\n * Control Resource if it is accessible.\n * @param options Default Options such as a fetch function.\n * @returns The URL of the ACR or null.\n */\nasync function getResourceAcr(resource, options) {\n const acrUrl = await getAcrUrl(resource, options);\n if (acrUrl === null) {\n return null;\n }\n let acr;\n try {\n acr = await getSolidDataset(acrUrl, options);\n }\n catch (e) {\n return null;\n }\n return {\n ...resource,\n internal_acp: {\n acr: {\n ...acr,\n accessTo: getSourceUrl(resource),\n },\n },\n };\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Get an overview of what access is defined for a given Agent.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access.\n * - It will only return access specified explicitly for the given Agent within\n * the ACL linked to the resource. If additional restrictions or external\n * resources are used, those will not be reflected in the return value of this\n * function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param webId WebID of the Agent you want to get the access for.\n * @param options Default Options such as a fetch function.\n * @since 1.19.0\n */\nasync function getAgentAccess(resourceUrl, webId, options) {\n const resourceInfo = await getResourceInfo(resourceUrl, options);\n const acr = await getResourceAcr(resourceInfo, options);\n if (acr === null) {\n return getAgentAccess$4(resourceInfo, webId, options);\n }\n return getAgentAccess$1(acr, webId);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction getAgentUrlAll(acr) {\n return Array.from(new Set(getThingAll(internal_getAcr(acr))\n .map((thing) => {\n return getUrlAll(thing, ACP.agent);\n })\n .reduce((flatArray, agentArray) => {\n return flatArray.concat(agentArray);\n }, [])));\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Get an overview of what access is defined for agents.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access.\n * - It will only return access specified explicitly for the given Agent within\n * the ACL linked to the resource. If additional restrictions or external\n * resources are used, those will not be reflected in the return value of this\n * function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param options Default Options such as a fetch function.\n * @since 1.21.0\n */\nasync function getAgentAccessAll$1(resourceWithAcr) {\n return (await Promise.all(getAgentUrlAll(resourceWithAcr).map(async (agent) => ({\n [agent]: await getAgentAccess$1(resourceWithAcr, agent),\n })))).reduce((agentAccessAll, currentAgentAccess) => ({\n ...agentAccessAll,\n ...currentAgentAccess,\n }), {});\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Get an overview of what access is defined for agents.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access.\n * - It will only return access specified explicitly for the given Agent within\n * the ACL linked to the resource. If additional restrictions or external\n * resources are used, those will not be reflected in the return value of this\n * function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param options Default Options such as a fetch function.\n * @since 1.21.0\n */\nasync function getAgentAccessAll(resourceUrl, options) {\n const resourceInfo = await getResourceInfo(resourceUrl, options);\n const acr = await getResourceAcr(resourceInfo, options);\n if (acr === null) {\n return getAgentAccessAll$4(resourceInfo, options);\n }\n return getAgentAccessAll$1(acr);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Get an overview of what access is given to the public.\n *\n * @param resourceWithAcr URL of the Resource you want to read the access for.\n * @since 1.16.0\n */\nasync function getPublicAccess$1(resourceWithAcr) {\n return getAgentAccess$1(resourceWithAcr, ACP.PublicAgent);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Get an overview of what access is defined for the Public.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably reading access.\n * - It will only return access specified explicitly for the given Agent within\n * the ACL linked to the resource. If additional restrictions or external\n * resources are used, those will not be reflected in the return value of this\n * function.\n * - It will only return access specified explicitly for the given Resource.\n * In other words, if the Resource is a Container, the returned Access may not\n * apply to contained Resources.\n * - If the current user does not have permission to view access for the given\n * Resource, this function will resolve to `null`.\n *\n * @param resourceUrl URL of the Resource you want to read the access for.\n * @param options Default Options such as a fetch function.\n * @since 1.19.0\n */\nasync function getPublicAccess(resourceUrl, options) {\n const resourceInfo = await getResourceInfo(resourceUrl, options);\n const acr = await getResourceAcr(resourceInfo, options);\n if (acr === null) {\n return getPublicAccess$4(resourceInfo, options);\n }\n return getPublicAccess$1(acr);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction getDefaultAgentMatcherPolicyUrl(resource, name, mode) {\n return getDefaultAccessControlUrl(resource, name)\n .concat(\"AgentMatcher\")\n .concat(mode.charAt(0).toUpperCase() + mode.slice(1))\n .concat(\"Policy\");\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction setDefaultAgentMatcherPolicyThingIfNotExist(resource, name, mode) {\n const policyUrl = getDefaultAgentMatcherPolicyUrl(resource, name, mode);\n // TODO: Re-enable when we support setting agent access on member resources\n // if (policyUrl.includes(\"Member\") && policyUrl.includes(\"Acr\")) {\n // return addMemberAcrPolicyUrl(resource, policyUrl);\n // }\n // if (policyUrl.includes(\"Member\")) {\n // return addMemberPolicyUrl(resource, policyUrl);\n // }\n if (policyUrl.includes(\"Acr\")) {\n return addAcrPolicyUrl(resource, policyUrl);\n }\n return addPolicyUrl(resource, policyUrl);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction getDefaultAgentMatcherPolicyMatcherUrl(resource, name, mode) {\n return getDefaultAgentMatcherPolicyUrl(resource, name, mode).concat(\"Matcher\");\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nconst DEFAULT_POLICY_MATCHER_PREDICATE = ACP.anyOf;\n/**\n * This functions scaffolds the default elements required for giving access to\n * an agent:\n * 1. If the Access Control Resource is empty, create the AccessControlResource\n * element;\n * 2. If the current default Access Control doesn't exist (the one applying to\n * one of: the Resource, the ACR, the Member Resources or the ACR of members)\n * create it;\n * 3. If the default Policy for allowing the Access Modes for the current\n * default Access Control doesn't exist, create it;\n * 4. If the default \"anyOf\" Agent Matcher for the current Policy creates it;\n * 5. Returns an ACR with a Matcher ready to add to.\n * @hidden\n * */\nfunction setDefaultAgentMatcherPolicyMatcherThingIfNotExist(resource, name, mode) {\n const policyUrl = getDefaultAgentMatcherPolicyUrl(resource, name, mode);\n const matcherUrl = getDefaultAgentMatcherPolicyMatcherUrl(resource, name, mode);\n let defaultAgentMatcherPolicyThing = getThing(internal_getAcr(resource), policyUrl);\n if (!defaultAgentMatcherPolicyThing) {\n resource = setDefaultAgentMatcherPolicyThingIfNotExist(resource, name, mode);\n defaultAgentMatcherPolicyThing = createThing({ url: policyUrl });\n defaultAgentMatcherPolicyThing = setModes(defaultAgentMatcherPolicyThing, { [mode]: true }, ACP.allow);\n }\n // Get the Default Access Control Agent Matcher Policy Matcher Thing or create it and return\n const agentMatcherPolicyUrlAll = getIriAll(defaultAgentMatcherPolicyThing, DEFAULT_POLICY_MATCHER_PREDICATE);\n if (!agentMatcherPolicyUrlAll.includes(matcherUrl)) {\n defaultAgentMatcherPolicyThing = buildThing(defaultAgentMatcherPolicyThing)\n .addUrl(DEFAULT_POLICY_MATCHER_PREDICATE, matcherUrl)\n .build();\n return setAccessControlResourceThing(resource, defaultAgentMatcherPolicyThing);\n }\n return resource;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/** @hidden */\nfunction setAgentAccessMode(resourceWithAcr, webId, name, mode, operation) {\n var _a;\n const matcherUrl = getDefaultAgentMatcherPolicyMatcherUrl(resourceWithAcr, name, mode);\n // Set default Matcher if not exists\n const resourceWithDefaultAgentMatcher = setDefaultAgentMatcherPolicyMatcherThingIfNotExist(resourceWithAcr, name, mode);\n const defaultAgentMatcherThing = (_a = getThing(internal_getAcr(resourceWithDefaultAgentMatcher), matcherUrl)) !== null && _a !== void 0 ? _a : createThing({ url: matcherUrl });\n return setAccessControlResourceThing(resourceWithDefaultAgentMatcher, operation === \"add\"\n ? addAgent(defaultAgentMatcherThing, webId)\n : removeAgent(defaultAgentMatcherThing, webId));\n}\n/**\n * Set access for a given Agent.\n *\n * @param resourceWithAcr URL of the Resource you want to set the access for.\n * @param webId WebID of the Agent you want to set the access for.\n * @param access Access Modes you want to set for the agent.\n * @since 1.16.0\n */\nasync function setAgentAccess$1(resourceWithAcr, webId, access) {\n const agentAccessModes = await getAgentAccess$1(resourceWithAcr, webId);\n // Add Agent to Default Matchers (including member) if access mode is different from what exists\n if (typeof access.read === \"boolean\" &&\n agentAccessModes.read !== access.read) {\n resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACCESS_CONTROL, \"read\", access.read ? \"add\" : \"remove\");\n }\n if (typeof access.append === \"boolean\" &&\n agentAccessModes.append !== access.append) {\n resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACCESS_CONTROL, \"append\", access.append ? \"add\" : \"remove\");\n }\n if (typeof access.write === \"boolean\" &&\n agentAccessModes.write !== access.write) {\n resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACCESS_CONTROL, \"write\", access.write ? \"add\" : \"remove\");\n }\n if (typeof access.controlRead === \"boolean\" &&\n agentAccessModes.controlRead !== access.controlRead) {\n resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACR_ACCESS_CONTROL, \"controlRead\", access.controlRead ? \"add\" : \"remove\");\n }\n if (typeof access.controlWrite === \"boolean\" &&\n agentAccessModes.controlWrite !== access.controlWrite) {\n resourceWithAcr = setAgentAccessMode(resourceWithAcr, webId, DEFAULT_ACR_ACCESS_CONTROL, \"controlWrite\", access.controlWrite ? \"add\" : \"remove\");\n }\n return resourceWithAcr;\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Set access to a resource for a given Agent.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably setting access.\n * - It will only set access explicitly for the given Agent. In other words,\n * additional restrictions could be present that further restrict or loosen\n * what access the given Agent has in particular circumstances.\n * - The provided access will only apply to the given Resource. In other words,\n * if the Resource is a Container, the configured Access will not apply to\n * contained Resources.\n * - If the current user does not have permission to view or change access for\n * the given Resource, this function will resolve to `null`.\n *\n * Additionally, two caveats apply to users with a Pod server that uses WAC:\n * - If the Resource did not have an ACL yet, a new one will be initialised.\n * This means that changes to the ACL of a parent Container can no longer\n * affect access people have to this Resource, although existing access will\n * be preserved.\n * - Setting different values for `controlRead` and `controlWrite` is not\n * supported, and **will throw an error**. If you expect (some of) your users\n * to have Pods implementing WAC, be sure to pass the same value for both.\n *\n * @param resourceUrl URL of the Resource you want to set access for.\n * @param webId WebID of the Agent you want to set access for.\n * @param access The Access Modes to add (true) or remove (false).\n * @param options Default Options such as a fetch function.\n * @since 1.19.0\n */\nasync function setAgentAccess(resourceUrl, webId, access, options) {\n // TODO: Change the standard getAgentAccess signatures to all take a T extends WithAcl\n const resourceInfo = await getResourceInfo(resourceUrl, options);\n const acr = await getResourceAcr(resourceInfo, options);\n if (acr === null) {\n await setAgentResourceAccess(resourceInfo, webId, access, options);\n return getAgentAccess$4(resourceInfo, webId, options);\n }\n // TODO: Make sure both setAgentAccessWac and setAgentAccessAcp don't save within the function, expose one standard saveAclFor function that is universal.\n try {\n await saveAcrFor(await setAgentAccess$1(acr, webId, access), options);\n return await getAgentAccess(resourceUrl, webId, options);\n }\n catch (e) {\n return null;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Set access for the public.\n *\n * @param resourceWithAcr URL of the Resource you want to read the access for.\n * @param access Access Modes you want to set for the agent.\n * @since 1.16.0\n */\nasync function setPublicAccess$1(resourceWithAcr, access) {\n return setAgentAccess$1(resourceWithAcr, ACP.PublicAgent, access);\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * Set access to a resource for the public.\n *\n * This function works with Solid Pods that implement either the Web Access\n * Control spec or the Access Control Policies proposal, with some caveats:\n *\n * - If access to the given Resource has been set using anything other than the\n * functions in this module, it is possible that it has been set in a way that\n * prevents this function from reliably setting access.\n * - It will only set access explicitly for the given Agent. In other words,\n * additional restrictions could be present that further restrict or loosen\n * what access the given Agent has in particular circumstances.\n * - The provided access will only apply to the given Resource. In other words,\n * if the Resource is a Container, the configured Access will not apply to\n * contained Resources.\n * - If the current user does not have permission to view or change access for\n * the given Resource, this function will resolve to `null`.\n *\n * Additionally, two caveats apply to users with a Pod server that uses WAC:\n * - If the Resource did not have an ACL yet, a new one will be initialised.\n * This means that changes to the ACL of a parent Container can no longer\n * affect access people have to this Resource, although existing access will\n * be preserved.\n * - Setting different values for `controlRead` and `controlWrite` is not\n * supported, and **will throw an error**. If you expect (some of) your users\n * to have Pods implementing WAC, be sure to pass the same value for both.\n *\n * @param resourceUrl URL of the Resource you want to set access for.\n * @param access The Access Modes to add (true) or remove (false).\n * @param options Default Options such as a fetch function.\n * @since 1.19.0\n */\nasync function setPublicAccess(resourceUrl, access, options) {\n const resourceInfo = await getResourceInfo(resourceUrl, options);\n const acr = await getResourceAcr(resourceInfo, options);\n if (acr === null) {\n await setPublicResourceAccess(resourceInfo, access, options);\n return getPublicAccess$4(resourceInfo, options);\n }\n try {\n await saveAcrFor(await setPublicAccess$1(acr, access), options);\n return await getPublicAccess(resourceUrl, options);\n }\n catch (e) {\n return null;\n }\n}\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * :::{admonition} Experimental API\n * :class: important\n *\n * This API is still experimental, and subject to change. It builds on top of\n * both ACP and WAC, aiming at being adaptable to any Access Control system that\n * may be implemented in Solid. That is why it is purely Resource-centric: the\n * library discovers metadata associated with the Resource itself, and calls the\n * appropriate underlying API to deal with the Access Control in place for the\n * target Resource.\n *\n * As it is still under development, the following export is *only* intended for\n * experimentation by early adopters, and is not recommended for production\n * applications.\n *\n * For more information see: [Tutorial: Managing\n * Access](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/manage-access/)\n * :::\n *\n * This module can be imported as an object from the main package, which results\n * in tree-shaking not being supported (so all the exported APIs will likely end\n * up in your bundle). This import style is used for environments such as nextjs\n * or create-react-app.\n *\n * ```typescript\n * import { universalAccess } from \"@inrupt/solid-client\";\n * ```\n *\n * Alternatively, if your environment supports [export\n * maps](https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#exports),\n * then you can import directly:\n *\n * ```typescript\n * import * as universalAccess from \"@inrupt/solid-client/universal\";\n * ```\n *\n * If you're using Typescript, and receive errors about type definitions not\n * being found, please see this\n * [documentation](https://www.typescriptlang.org/docs/handbook/esm-node.html)\n *\n * @packageDocumentation\n * @module universalAccess\n */\n\nvar index = /*#__PURE__*/Object.freeze({\n __proto__: null,\n getAclServerResourceInfo: getAclServerResourceInfo,\n getAgentAccess: getAgentAccess,\n getAgentAccessAll: getAgentAccessAll,\n getPublicAccess: getPublicAccess,\n setAgentAccess: setAgentAccess,\n setPublicAccess: setPublicAccess\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * :::{admonition} Experimental API\n * :class: important\n *\n * The Access Control Policies proposal has not yet been reviewed for inclusion in the Solid spec.\n * To enable early experimentation, solid-client exposes a low-level API. However, this API can and\n * will include breaking changes in non-major releases. Additionally, for most applications, a\n * higher-level API that is planned will be more applicable.\n *\n * Thus, the following export is *only* intended for experimentation by early adopters, and is not\n * recommended for production applications. Because of this, all ACP-related API's are exported on a\n * single object, which does not facilitate tree-shaking: if you use one ACP-related API, all of\n * them will be included in your bundle.\n *\n * For more information see: [Tutorial: Managing\n * Access](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/manage-access/)\n * :::\n *\n * This module supports Inrupt's ESS 1.1 ACP implementation.\n *\n * This module can be imported as an object from the main package, which results\n * in tree-shaking not being supported (so all the exported APIs will likely end\n * up in your bundle). This import style is used for environments such as nextjs\n * or create-react-app.\n *\n * ```typescript\n * import { acp_ess_1 } from \"@inrupt/solid-client\";\n * ```\n *\n * @packageDocumentation\n * @module acp_ess_1\n */\n\nvar ess1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n acrAsMarkdown: acrAsMarkdown,\n addAcrPolicyUrl: addAcrPolicyUrl$1,\n addAgent: addAgent$1,\n addAllOfRuleUrl: addAllOfRuleUrl,\n addAnyOfRuleUrl: addAnyOfRuleUrl,\n addClient: addClient$1,\n addGroup: addGroup,\n addMemberAcrPolicyUrl: addMemberAcrPolicyUrl$1,\n addMemberPolicyUrl: addMemberPolicyUrl$1,\n addMockAcrTo: addMockAcrTo,\n addNoneOfRuleUrl: addNoneOfRuleUrl,\n addPolicyUrl: addPolicyUrl$1,\n createPolicy: createPolicy,\n createResourcePolicyFor: createResourcePolicyFor,\n createResourceRuleFor: createResourceRuleFor,\n createRule: createRule,\n getAcrPolicyUrlAll: getAcrPolicyUrlAll$1,\n getAgentAll: getAgentAll$1,\n getAllOfRuleUrlAll: getAllOfRuleUrlAll,\n getAllowModes: getAllowModesV1,\n getAnyOfRuleUrlAll: getAnyOfRuleUrlAll,\n getClientAll: getClientAll$1,\n getDenyModes: getDenyModesV1,\n getFileWithAccessDatasets: getFileWithAccessDatasets,\n getFileWithAcr: getFileWithAcr,\n getGroupAll: getGroupAll,\n getLinkedAcrUrl: getLinkedAcrUrl,\n getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll$1,\n getMemberPolicyUrlAll: getMemberPolicyUrlAll$1,\n getNoneOfRuleUrlAll: getNoneOfRuleUrlAll,\n getPolicy: getPolicy,\n getPolicyAll: getPolicyAll,\n getPolicyUrlAll: getPolicyUrlAll$1,\n getReferencedPolicyUrlAll: getReferencedPolicyUrlAll,\n getResourceAcrPolicy: getResourceAcrPolicy,\n getResourceAcrPolicyAll: getResourceAcrPolicyAll,\n getResourceInfoWithAccessDatasets: getResourceInfoWithAccessDatasets,\n getResourceInfoWithAcr: getResourceInfoWithAcr,\n getResourcePolicy: getResourcePolicy,\n getResourcePolicyAll: getResourcePolicyAll,\n getResourceRule: getResourceRule,\n getResourceRuleAll: getResourceRuleAll,\n getRule: getRule,\n getRuleAll: getRuleAll,\n getSolidDatasetWithAccessDatasets: getSolidDatasetWithAccessDatasets,\n getSolidDatasetWithAcr: getSolidDatasetWithAcr,\n hasAccessibleAcr: hasAccessibleAcr,\n hasAnyClient: hasAnyClient$1,\n hasAuthenticated: hasAuthenticated$1,\n hasCreator: hasCreator$1,\n hasLinkedAcr: hasLinkedAcr,\n hasPublic: hasPublic$1,\n isAcpControlled: isAcpControlled,\n mockAcrFor: mockAcrFor,\n policyAsMarkdown: policyAsMarkdown,\n removeAcrPolicyUrl: removeAcrPolicyUrl$1,\n removeAcrPolicyUrlAll: removeAcrPolicyUrlAll,\n removeAgent: removeAgent$1,\n removeAllOfRuleUrl: removeAllOfRuleUrl,\n removeAnyClient: removeAnyClient$1,\n removeAnyOfRuleUrl: removeAnyOfRuleUrl,\n removeAuthenticated: removeAuthenticated$1,\n removeClient: removeClient$1,\n removeCreator: removeCreator$1,\n removeGroup: removeGroup,\n removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl$1,\n removeMemberAcrPolicyUrlAll: removeMemberAcrPolicyUrlAll,\n removeMemberPolicyUrl: removeMemberPolicyUrl$1,\n removeMemberPolicyUrlAll: removeMemberPolicyUrlAll,\n removeNoneOfRuleUrl: removeNoneOfRuleUrl,\n removePolicy: removePolicy,\n removePolicyUrl: removePolicyUrl$1,\n removePolicyUrlAll: removePolicyUrlAll,\n removePublic: removePublic$1,\n removeResourceAcrPolicy: removeResourceAcrPolicy,\n removeResourcePolicy: removeResourcePolicy,\n removeResourceRule: removeResourceRule,\n removeRule: removeRule,\n ruleAsMarkdown: ruleAsMarkdown,\n saveAcrFor: saveAcrFor,\n setAgent: setAgent$1,\n setAllOfRuleUrl: setAllOfRuleUrl,\n setAllowModes: setAllowModesV1,\n setAnyClient: setAnyClient$1,\n setAnyOfRuleUrl: setAnyOfRuleUrl,\n setAuthenticated: setAuthenticated$1,\n setClient: setClient$1,\n setCreator: setCreator$1,\n setDenyModes: setDenyModesV1,\n setGroup: setGroup,\n setNoneOfRuleUrl: setNoneOfRuleUrl,\n setPolicy: setPolicy,\n setPublic: setPublic$1,\n setResourceAcrPolicy: setResourceAcrPolicy,\n setResourcePolicy: setResourcePolicy$1,\n setResourceRule: setResourceRule,\n setRule: setRule\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n/**\n * :::{admonition} Experimental API\n * :class: important\n *\n * The Access Control Policies proposal has not yet been reviewed for inclusion in the Solid spec.\n * To enable early experimentation, solid-client exposes a low-level API. However, this API can and\n * will include breaking changes in non-major releases. Additionally, for most applications, a\n * higher-level API that is planned will be more applicable.\n *\n * Thus, the following export is *only* intended for experimentation by early adopters, and is not\n * recommended for production applications. Because of this, all ACP-related API's are exported on a\n * single object, which does not facilitate tree-shaking: if you use one ACP-related API, all of\n * them will be included in your bundle.\n *\n * For more information see: [Tutorial: Managing\n * Access](https://docs.inrupt.com/developer-tools/javascript/client-libraries/tutorial/manage-access/)\n * :::\n *\n * This module supports Inrupt's ESS 2.0 ACP implementation.\n *\n * This module can be imported as an object from the main package, which results\n * in tree-shaking not being supported (so all the exported APIs will likely end\n * up in your bundle). This import style is used for environments such as nextjs\n * or create-react-app.\n *\n * ```typescript\n * import { acp_ess_2 } from \"@inrupt/solid-client\";\n * ```\n *\n * @packageDocumentation\n * @module acp_ess_2\n */\n\nvar ess2 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n addAcrPolicyUrl: addAcrPolicyUrl,\n addAgent: addAgent,\n addAllOfMatcherUrl: addAllOfMatcherUrl,\n addAnyOfMatcherUrl: addAnyOfMatcherUrl,\n addClient: addClient,\n addMemberAcrPolicyUrl: addMemberAcrPolicyUrl,\n addMemberPolicyUrl: addMemberPolicyUrl,\n addMockAcrTo: addMockAcrTo,\n addNoneOfMatcherUrl: addNoneOfMatcherUrl,\n addPolicyUrl: addPolicyUrl,\n createMatcher: createMatcher,\n createPolicy: createPolicy,\n createResourceMatcherFor: createResourceMatcherFor,\n createResourcePolicyFor: createResourcePolicyFor,\n getAcrPolicyUrlAll: getAcrPolicyUrlAll,\n getAgentAll: getAgentAll,\n getAllOfMatcherUrlAll: getAllOfMatcherUrlAll,\n getAllowModes: getAllowModesV2,\n getAnyOfMatcherUrlAll: getAnyOfMatcherUrlAll,\n getClientAll: getClientAll,\n getDenyModes: getDenyModesV2,\n getFileWithAccessDatasets: getFileWithAccessDatasets,\n getFileWithAcr: getFileWithAcr,\n getLinkedAcrUrl: getLinkedAcrUrl,\n getMatcher: getMatcher,\n getMatcherAll: getMatcherAll,\n getMemberAcrPolicyUrlAll: getMemberAcrPolicyUrlAll,\n getMemberPolicyUrlAll: getMemberPolicyUrlAll,\n getNoneOfMatcherUrlAll: getNoneOfMatcherUrlAll,\n getPolicy: getPolicy,\n getPolicyAll: getPolicyAll,\n getPolicyUrlAll: getPolicyUrlAll,\n getReferencedPolicyUrlAll: getReferencedPolicyUrlAll,\n getResourceAcrPolicy: getResourceAcrPolicy,\n getResourceAcrPolicyAll: getResourceAcrPolicyAll,\n getResourceInfoWithAccessDatasets: getResourceInfoWithAccessDatasets,\n getResourceInfoWithAcr: getResourceInfoWithAcr,\n getResourceMatcher: getResourceMatcher,\n getResourceMatcherAll: getResourceMatcherAll,\n getResourcePolicy: getResourcePolicy,\n getResourcePolicyAll: getResourcePolicyAll,\n getSolidDatasetWithAccessDatasets: getSolidDatasetWithAccessDatasets,\n getSolidDatasetWithAcr: getSolidDatasetWithAcr,\n getVcAccess: getVcAccess,\n hasAccessibleAcr: hasAccessibleAcr,\n hasAuthenticated: hasAuthenticated,\n hasCreator: hasCreator,\n hasLinkedAcr: hasLinkedAcr,\n hasPublic: hasPublic,\n isAcpControlled: isAcpControlled,\n mockAcrFor: mockAcrFor,\n removeAcrPolicyUrl: removeAcrPolicyUrl,\n removeAcrPolicyUrlAll: removeAcrPolicyUrlAll,\n removeAgent: removeAgent,\n removeAllOfMatcherUrl: removeAllOfMatcherUrl,\n removeAnyOfMatcherUrl: removeAnyOfMatcherUrl,\n removeAuthenticated: removeAuthenticated,\n removeClient: removeClient,\n removeCreator: removeCreator,\n removeMatcher: removeMatcher,\n removeMemberAcrPolicyUrl: removeMemberAcrPolicyUrl,\n removeMemberAcrPolicyUrlAll: removeMemberAcrPolicyUrlAll,\n removeMemberPolicyUrl: removeMemberPolicyUrl,\n removeMemberPolicyUrlAll: removeMemberPolicyUrlAll,\n removeNoneOfMatcherUrl: removeNoneOfMatcherUrl,\n removePolicy: removePolicy,\n removePolicyUrl: removePolicyUrl,\n removePolicyUrlAll: removePolicyUrlAll,\n removePublic: removePublic,\n removeResourceAcrPolicy: removeResourceAcrPolicy,\n removeResourceMatcher: removeResourceMatcher,\n removeResourcePolicy: removeResourcePolicy,\n saveAcrFor: saveAcrFor,\n setAgent: setAgent,\n setAllOfMatcherUrl: setAllOfMatcherUrl,\n setAllowModes: setAllowModesV2,\n setAnyOfMatcherUrl: setAnyOfMatcherUrl,\n setAuthenticated: setAuthenticated,\n setCreator: setCreator,\n setDenyModes: setDenyModesV2,\n setMatcher: setMatcher,\n setNoneOfMatcherUrl: setNoneOfMatcherUrl,\n setPolicy: setPolicy,\n setPublic: setPublic,\n setResourceMatcher: setResourceMatcher,\n setResourcePolicy: setResourcePolicy,\n setVcAccess: setVcAccess\n});\n\n//\n// Copyright Inrupt Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to use,\n// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the\n// Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n//\n// Export the different formats methods from @inrupt/solid-client import, these\n// are not part of our Public API, but are needed to be exported for usage from\n// our other packages.\n//\n// NOTE: We have to export like this, otherwise rollup does some sort of\n// tree-shaking and breaks the build where `dist/formats/index.mjs` is no longer\n// built, and this causes the `@inrupt/solid-client/formats` subpath export to\n// no longer work.\nconst { getJsonLdParser, getTurtleParser, solidDatasetAsTurtle } = formats;\n\nexports.FetchError = FetchError;\nexports.SolidClientError = SolidClientError;\nexports.ThingExpectedError = ThingExpectedError;\nexports.access = universal;\nexports.access_v1 = universal_v1;\nexports.access_v2 = universal_v2;\nexports.acp_ess_1 = ess1;\nexports.acp_ess_2 = ess2;\nexports.acp_v1 = acp_v1;\nexports.acp_v2 = acp_v2;\nexports.acp_v3 = acp_v3;\nexports.acp_v4 = acp_v4;\nexports.addBoolean = addBoolean;\nexports.addDate = addDate;\nexports.addDatetime = addDatetime;\nexports.addDecimal = addDecimal;\nexports.addInteger = addInteger;\nexports.addIri = addIri;\nexports.addJwkToJwks = addJwkToJwks;\nexports.addLiteral = addLiteral;\nexports.addMockFallbackAclTo = addMockFallbackAclTo;\nexports.addMockResourceAclTo = addMockResourceAclTo;\nexports.addNamedNode = addNamedNode;\nexports.addPublicKeyToProfileJwks = addPublicKeyToProfileJwks;\nexports.addStringEnglish = addStringEnglish;\nexports.addStringNoLocale = addStringNoLocale;\nexports.addStringWithLocale = addStringWithLocale;\nexports.addTerm = addTerm;\nexports.addTime = addTime;\nexports.addUrl = addUrl;\nexports.asIri = asIri;\nexports.asUrl = asUrl;\nexports.buildThing = buildThing;\nexports.changeLogAsMarkdown = changeLogAsMarkdown;\nexports.createAcl = createAcl;\nexports.createAclFromFallbackAcl = createAclFromFallbackAcl;\nexports.createContainerAt = createContainerAt;\nexports.createContainerInContainer = createContainerInContainer;\nexports.createSolidDataset = createSolidDataset;\nexports.createThing = createThing;\nexports.deleteAclFor = deleteAclFor;\nexports.deleteContainer = deleteContainer;\nexports.deleteFile = deleteFile;\nexports.deleteSolidDataset = deleteSolidDataset;\nexports.fromRdfJsDataset = fromRdfJsDataset;\nexports.getAgentAccess = getAgentAccess$5;\nexports.getAgentAccessAll = getAgentAccessAll$5;\nexports.getAgentDefaultAccess = getAgentDefaultAccess;\nexports.getAgentDefaultAccessAll = getAgentDefaultAccessAll;\nexports.getAgentResourceAccess = getAgentResourceAccess;\nexports.getAgentResourceAccessAll = getAgentResourceAccessAll;\nexports.getAltProfileUrlAllFrom = getAltProfileUrlAllFrom;\nexports.getBoolean = getBoolean;\nexports.getBooleanAll = getBooleanAll;\nexports.getContainedResourceUrlAll = getContainedResourceUrlAll;\nexports.getContentType = getContentType$1;\nexports.getDate = getDate;\nexports.getDateAll = getDateAll;\nexports.getDatetime = getDatetime;\nexports.getDatetimeAll = getDatetimeAll;\nexports.getDecimal = getDecimal;\nexports.getDecimalAll = getDecimalAll;\nexports.getEffectiveAccess = getEffectiveAccess;\nexports.getFallbackAcl = getFallbackAcl;\nexports.getFile = getFile;\nexports.getFileWithAcl = getFileWithAcl;\nexports.getGroupAccess = getGroupAccess$2;\nexports.getGroupAccessAll = getGroupAccessAll$2;\nexports.getGroupDefaultAccess = getGroupDefaultAccess;\nexports.getGroupDefaultAccessAll = getGroupDefaultAccessAll;\nexports.getGroupResourceAccess = getGroupResourceAccess;\nexports.getGroupResourceAccessAll = getGroupResourceAccessAll;\nexports.getInteger = getInteger;\nexports.getIntegerAll = getIntegerAll;\nexports.getIri = getIri;\nexports.getIriAll = getIriAll;\nexports.getJsonLdParser = getJsonLdParser;\nexports.getLinkedResourceUrlAll = getLinkedResourceUrlAll;\nexports.getLiteral = getLiteral;\nexports.getLiteralAll = getLiteralAll;\nexports.getNamedNode = getNamedNode;\nexports.getNamedNodeAll = getNamedNodeAll;\nexports.getPodOwner = getPodOwner;\nexports.getPodUrlAll = getPodUrlAll;\nexports.getPodUrlAllFrom = getPodUrlAllFrom;\nexports.getProfileAll = getProfileAll;\nexports.getProfileJwksIri = getProfileJwksIri;\nexports.getPropertyAll = getPropertyAll;\nexports.getPublicAccess = getPublicAccess$5;\nexports.getPublicDefaultAccess = getPublicDefaultAccess;\nexports.getPublicResourceAccess = getPublicResourceAccess;\nexports.getResourceAcl = getResourceAcl;\nexports.getResourceInfo = getResourceInfo;\nexports.getResourceInfoWithAcl = getResourceInfoWithAcl;\nexports.getSolidDataset = getSolidDataset;\nexports.getSolidDatasetWithAcl = getSolidDatasetWithAcl;\nexports.getSourceIri = getSourceIri;\nexports.getSourceUrl = getSourceUrl;\nexports.getStringByLocaleAll = getStringByLocaleAll;\nexports.getStringEnglish = getStringEnglish;\nexports.getStringEnglishAll = getStringEnglishAll;\nexports.getStringNoLocale = getStringNoLocale;\nexports.getStringNoLocaleAll = getStringNoLocaleAll;\nexports.getStringWithLocale = getStringWithLocale;\nexports.getStringWithLocaleAll = getStringWithLocaleAll;\nexports.getTerm = getTerm;\nexports.getTermAll = getTermAll;\nexports.getThing = getThing;\nexports.getThingAll = getThingAll;\nexports.getTime = getTime;\nexports.getTimeAll = getTimeAll;\nexports.getTurtleParser = getTurtleParser;\nexports.getUrl = getUrl;\nexports.getUrlAll = getUrlAll;\nexports.getWebIdDataset = getWebIdDataset;\nexports.getWellKnownSolid = getWellKnownSolid;\nexports.hasAccessibleAcl = hasAccessibleAcl;\nexports.hasAcl = hasAcl;\nexports.hasFallbackAcl = hasFallbackAcl;\nexports.hasResourceAcl = hasResourceAcl;\nexports.hasResourceInfo = hasResourceInfo;\nexports.hasServerResourceInfo = hasServerResourceInfo;\nexports.isContainer = isContainer;\nexports.isPodOwner = isPodOwner;\nexports.isRawData = isRawData;\nexports.isThing = isThing;\nexports.isThingLocal = isThingLocal;\nexports.mockContainerFrom = mockContainerFrom;\nexports.mockFetchError = mockFetchError;\nexports.mockFileFrom = mockFileFrom;\nexports.mockSolidDatasetFrom = mockSolidDatasetFrom;\nexports.mockThingFrom = mockThingFrom;\nexports.overwriteFile = overwriteFile;\nexports.removeAll = removeAll;\nexports.removeBoolean = removeBoolean;\nexports.removeDate = removeDate;\nexports.removeDatetime = removeDatetime;\nexports.removeDecimal = removeDecimal;\nexports.removeInteger = removeInteger;\nexports.removeIri = removeIri;\nexports.removeLiteral = removeLiteral;\nexports.removeNamedNode = removeNamedNode;\nexports.removeStringEnglish = removeStringEnglish;\nexports.removeStringNoLocale = removeStringNoLocale;\nexports.removeStringWithLocale = removeStringWithLocale;\nexports.removeThing = removeThing;\nexports.removeTime = removeTime;\nexports.removeUrl = removeUrl;\nexports.responseToResourceInfo = responseToResourceInfo;\nexports.responseToSolidDataset = responseToSolidDataset;\nexports.saveAclFor = saveAclFor;\nexports.saveFileInContainer = saveFileInContainer;\nexports.saveSolidDatasetAt = saveSolidDatasetAt;\nexports.saveSolidDatasetInContainer = saveSolidDatasetInContainer;\nexports.setAgentDefaultAccess = setAgentDefaultAccess;\nexports.setAgentResourceAccess = setAgentResourceAccess$1;\nexports.setBoolean = setBoolean;\nexports.setDate = setDate;\nexports.setDatetime = setDatetime;\nexports.setDecimal = setDecimal;\nexports.setGroupDefaultAccess = setGroupDefaultAccess;\nexports.setGroupResourceAccess = setGroupResourceAccess$1;\nexports.setInteger = setInteger;\nexports.setIri = setIri;\nexports.setLiteral = setLiteral;\nexports.setNamedNode = setNamedNode;\nexports.setProfileJwks = setProfileJwks;\nexports.setPublicDefaultAccess = setPublicDefaultAccess;\nexports.setPublicResourceAccess = setPublicResourceAccess$1;\nexports.setStringNoLocale = setStringNoLocale;\nexports.setStringWithLocale = setStringWithLocale;\nexports.setTerm = setTerm;\nexports.setThing = setThing;\nexports.setTime = setTime;\nexports.setUrl = setUrl;\nexports.solidDatasetAsMarkdown = solidDatasetAsMarkdown;\nexports.solidDatasetAsTurtle = solidDatasetAsTurtle;\nexports.thingAsMarkdown = thingAsMarkdown;\nexports.toRdfJsDataset = toRdfJsDataset;\nexports.universalAccess = index;\nexports.validateContainedResourceAll = validateContainedResourceAll;\n","'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nvar indexBrowser = globalThis.fetch;\nconst { fetch, Response, Request, Headers } = globalThis;\n\nexports.Headers = Headers;\nexports.Request = Request;\nexports.Response = Response;\nexports.default = indexBrowser;\nexports.fetch = fetch;\n","var indexBrowser = globalThis.fetch;\nconst { fetch, Response, Request, Headers } = globalThis;\n\nexport { Headers, Request, Response, indexBrowser as default, fetch };\n","const DataFactory = require('./lib/DataFactory.js')\n\nmodule.exports = DataFactory\n","class BlankNode {\n constructor (id) {\n this.value = id || ('b' + (++BlankNode.nextId))\n }\n\n equals (other) {\n return !!other && other.termType === this.termType && other.value === this.value\n }\n}\n\nBlankNode.prototype.termType = 'BlankNode'\n\nBlankNode.nextId = 0\n\nmodule.exports = BlankNode\n","const BlankNode = require('./BlankNode.js')\nconst DefaultGraph = require('./DefaultGraph.js')\nconst fromTermRaw = require('./fromTerm.js')\nconst Literal = require('./Literal.js')\nconst NamedNode = require('./NamedNode.js')\nconst Quad = require('./Quad.js')\nconst Variable = require('./Variable.js')\n\nfunction namedNode (value) {\n return new NamedNode(value)\n}\n\nfunction blankNode (value) {\n return new BlankNode(value)\n}\n\nfunction literal (value, languageOrDatatype) {\n if (typeof languageOrDatatype === 'string') {\n if (languageOrDatatype.indexOf(':') === -1) {\n return new Literal(value, languageOrDatatype)\n }\n\n return new Literal(value, null, DataFactory.namedNode(languageOrDatatype))\n }\n\n return new Literal(value, null, languageOrDatatype)\n}\n\nfunction variable (value) {\n return new Variable(value)\n}\n\nfunction defaultGraph () {\n return DataFactory.defaultGraphInstance\n}\n\nfunction triple (subject, predicate, object) {\n return DataFactory.quad(subject, predicate, object)\n}\n\nfunction quad (subject, predicate, object, graph) {\n return new Quad(subject, predicate, object, graph || DataFactory.defaultGraphInstance)\n}\n\nfunction fromTerm (original) {\n return fromTermRaw.call(DataFactory, original)\n}\n\nfunction fromQuad (original) {\n return fromTermRaw.call(DataFactory, original)\n}\n\nconst DataFactory = {\n namedNode,\n blankNode,\n literal,\n variable,\n defaultGraph,\n triple,\n quad,\n fromTerm,\n fromQuad,\n defaultGraphInstance: new DefaultGraph()\n}\n\nmodule.exports = DataFactory\n","class DefaultGraph {\n equals (other) {\n return !!other && other.termType === this.termType\n }\n}\n\nDefaultGraph.prototype.termType = 'DefaultGraph'\nDefaultGraph.prototype.value = ''\n\nmodule.exports = DefaultGraph\n","const NamedNode = require('./NamedNode.js')\n\nclass Literal {\n constructor (value, language, datatype) {\n this.value = value\n this.datatype = Literal.stringDatatype\n this.language = ''\n\n if (language) {\n this.language = language\n this.datatype = Literal.langStringDatatype\n } else if (datatype) {\n this.datatype = datatype\n }\n }\n\n equals (other) {\n return !!other && other.termType === this.termType && other.value === this.value &&\n other.language === this.language && other.datatype.equals(this.datatype)\n }\n}\n\nLiteral.prototype.termType = 'Literal'\n\nLiteral.langStringDatatype = new NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString')\nLiteral.stringDatatype = new NamedNode('http://www.w3.org/2001/XMLSchema#string')\n\nmodule.exports = Literal\n","class NamedNode {\n constructor (iri) {\n this.value = iri\n }\n\n equals (other) {\n return !!other && other.termType === this.termType && other.value === this.value\n }\n}\n\nNamedNode.prototype.termType = 'NamedNode'\n\nmodule.exports = NamedNode\n","const DefaultGraph = require('./DefaultGraph.js')\n\nclass Quad {\n constructor (subject, predicate, object, graph) {\n this.subject = subject\n this.predicate = predicate\n this.object = object\n\n if (graph) {\n this.graph = graph\n } else {\n this.graph = new DefaultGraph()\n }\n }\n\n equals (other) {\n // `|| !other.termType` is for backwards-compatibility with old factories without RDF* support.\n return !!other && (other.termType === 'Quad' || !other.termType) &&\n other.subject.equals(this.subject) && other.predicate.equals(this.predicate) &&\n other.object.equals(this.object) && other.graph.equals(this.graph)\n }\n}\n\nQuad.prototype.termType = 'Quad'\nQuad.prototype.value = ''\n\nmodule.exports = Quad\n","class Variable {\n constructor (name) {\n this.value = name\n }\n\n equals (other) {\n return !!other && other.termType === this.termType && other.value === this.value\n }\n}\n\nVariable.prototype.termType = 'Variable'\n\nmodule.exports = Variable\n","function fromTerm (original) {\n if (!original) {\n return null\n }\n\n if (original.termType === 'BlankNode') {\n return this.blankNode(original.value)\n }\n\n if (original.termType === 'DefaultGraph') {\n return this.defaultGraph()\n }\n\n if (original.termType === 'Literal') {\n return this.literal(original.value, original.language || this.namedNode(original.datatype.value))\n }\n\n if (original.termType === 'NamedNode') {\n return this.namedNode(original.value)\n }\n\n if (original.termType === 'Quad') {\n const subject = this.fromTerm(original.subject)\n const predicate = this.fromTerm(original.predicate)\n const object = this.fromTerm(original.object)\n const graph = this.fromTerm(original.graph)\n\n return this.quad(subject, predicate, object, graph)\n }\n\n if (original.termType === 'Variable') {\n return this.variable(original.value)\n }\n\n throw new Error(`unknown termType ${original.termType}`)\n}\n\nmodule.exports = fromTerm\n","function isString (s) {\n return typeof s === 'string' || s instanceof String\n}\n\nconst xsdString = 'http://www.w3.org/2001/XMLSchema#string'\n\nfunction termToId (term) {\n if (typeof term === 'string') {\n return term\n }\n\n if (!term) {\n return ''\n }\n\n if (typeof term.id !== 'undefined' && term.termType !== 'Quad') {\n return term.id\n }\n\n let subject, predicate, object, graph\n\n // Term instantiated with another library\n switch (term.termType) {\n case 'NamedNode':\n return term.value\n\n case 'BlankNode':\n return `_:${term.value}`\n\n case 'Variable':\n return `?${term.value}`\n\n case 'DefaultGraph':\n return ''\n\n case 'Literal':\n if (term.language) {\n return `\"${term.value}\"@${term.language}`\n }\n\n return `\"${term.value}\"${term.datatype && term.datatype.value !== xsdString ? `^^${term.datatype.value}` : ''}`\n\n case 'Quad':\n // To identify RDF* quad components, we escape quotes by doubling them.\n // This avoids the overhead of backslash parsing of Turtle-like syntaxes.\n subject = escapeQuotes(termToId(term.subject))\n predicate = escapeQuotes(termToId(term.predicate))\n object = escapeQuotes(termToId(term.object))\n graph = term.graph.termType === 'DefaultGraph' ? '' : ` ${termToId(term.graph)}`\n\n return `<<${subject} ${predicate} ${object}${graph}>>`\n\n default:\n throw new Error(`Unexpected termType: ${term.termType}`)\n }\n}\n\nconst escapedLiteral = /^\"(.*\".*)(?=\"[^\"]*$)/\n\nfunction escapeQuotes (id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"/g, '\"\"')}`)\n}\n\nclass DatasetCore {\n constructor (quads) {\n // The number of quads is initially zero\n this._size = 0\n // `_graphs` contains subject, predicate, and object indexes per graph\n this._graphs = Object.create(null)\n // `_ids` maps entities such as `http://xmlns.com/foaf/0.1/name` to numbers,\n // saving memory by using only numbers as keys in `_graphs`\n this._id = 0\n this._ids = Object.create(null)\n this._ids['><'] = 0 // dummy entry, so the first actual key is non-zero\n this._entities = Object.create(null) // inverse of `_ids`\n\n this._quads = new Map()\n\n // Add quads if passed\n if (quads) {\n for (const quad of quads) {\n this.add(quad)\n }\n }\n }\n\n get size () {\n // Return the quad count if if was cached\n let size = this._size\n\n if (size !== null) {\n return size\n }\n\n // Calculate the number of quads by counting to the deepest level\n size = 0\n const graphs = this._graphs\n let subjects, subject\n\n for (const graphKey in graphs) {\n for (const subjectKey in (subjects = graphs[graphKey].subjects)) {\n for (const predicateKey in (subject = subjects[subjectKey])) {\n size += Object.keys(subject[predicateKey]).length\n }\n }\n }\n\n this._size = size\n\n return this._size\n }\n\n add (quad) {\n // Convert terms to internal string representation\n let subject = termToId(quad.subject)\n let predicate = termToId(quad.predicate)\n let object = termToId(quad.object)\n const graph = termToId(quad.graph)\n\n // Find the graph that will contain the triple\n let graphItem = this._graphs[graph]\n // Create the graph if it doesn't exist yet\n if (!graphItem) {\n graphItem = this._graphs[graph] = { subjects: {}, predicates: {}, objects: {} }\n // Freezing a graph helps subsequent `add` performance,\n // and properties will never be modified anyway\n Object.freeze(graphItem)\n }\n\n // Since entities can often be long IRIs, we avoid storing them in every index.\n // Instead, we have a separate index that maps entities to numbers,\n // which are then used as keys in the other indexes.\n const ids = this._ids\n const entities = this._entities\n subject = ids[subject] || (ids[entities[++this._id] = subject] = this._id)\n predicate = ids[predicate] || (ids[entities[++this._id] = predicate] = this._id)\n object = ids[object] || (ids[entities[++this._id] = object] = this._id)\n\n this._addToIndex(graphItem.subjects, subject, predicate, object)\n this._addToIndex(graphItem.predicates, predicate, object, subject)\n this._addToIndex(graphItem.objects, object, subject, predicate)\n\n this._setQuad(subject, predicate, object, graph, quad)\n\n // The cached quad count is now invalid\n this._size = null\n\n return this\n }\n\n delete (quad) {\n // Convert terms to internal string representation\n let subject = termToId(quad.subject)\n let predicate = termToId(quad.predicate)\n let object = termToId(quad.object)\n const graph = termToId(quad.graph)\n\n // Find internal identifiers for all components\n // and verify the quad exists.\n const ids = this._ids\n const graphs = this._graphs\n let graphItem, subjects, predicates\n\n if (!(subject = ids[subject]) || !(predicate = ids[predicate]) ||\n !(object = ids[object]) || !(graphItem = graphs[graph]) ||\n !(subjects = graphItem.subjects[subject]) ||\n !(predicates = subjects[predicate]) ||\n !(object in predicates)\n ) {\n return this\n }\n\n // Remove it from all indexes\n this._removeFromIndex(graphItem.subjects, subject, predicate, object)\n this._removeFromIndex(graphItem.predicates, predicate, object, subject)\n this._removeFromIndex(graphItem.objects, object, subject, predicate)\n\n if (this._size !== null) {\n this._size--\n }\n\n this._deleteQuad(subject, predicate, object, graph)\n\n // Remove the graph if it is empty\n for (subject in graphItem.subjects) { // eslint-disable-line no-unreachable-loop\n return this\n }\n\n delete graphs[graph]\n\n return this\n }\n\n has (quad) {\n // Convert terms to internal string representation\n const subject = termToId(quad.subject)\n const predicate = termToId(quad.predicate)\n const object = termToId(quad.object)\n const graph = termToId(quad.graph)\n\n const graphItem = this._graphs[graph]\n\n if (!graphItem) {\n return false\n }\n\n const ids = this._ids\n let subjectId, predicateId, objectId\n\n // Translate IRIs to internal index keys.\n if (\n (isString(subject) && !(subjectId = ids[subject])) ||\n (isString(predicate) && !(predicateId = ids[predicate])) ||\n (isString(object) && !(objectId = ids[object]))\n ) {\n return false\n }\n\n return this._countInIndex(graphItem.objects, objectId, subjectId, predicateId) === 1\n }\n\n match (subject, predicate, object, graph) {\n return this._createDataset(this._match(subject, predicate, object, graph))\n }\n\n [Symbol.iterator] () {\n return this._match()[Symbol.iterator]()\n }\n\n // ## Private methods\n\n // ### `_addToIndex` adds a quad to a three-layered index.\n // Returns if the index has changed, if the entry did not already exist.\n _addToIndex (index0, key0, key1, key2) {\n // Create layers as necessary\n const index1 = index0[key0] || (index0[key0] = {})\n const index2 = index1[key1] || (index1[key1] = {})\n // Setting the key to _any_ value signals the presence of the quad\n const existed = key2 in index2\n\n if (!existed) {\n index2[key2] = null\n }\n\n return !existed\n }\n\n // ### `_removeFromIndex` removes a quad from a three-layered index\n _removeFromIndex (index0, key0, key1, key2) {\n // Remove the quad from the index\n const index1 = index0[key0]\n const index2 = index1[key1]\n delete index2[key2]\n\n // Remove intermediary index layers if they are empty\n for (const key in index2) { // eslint-disable-line no-unreachable-loop\n return\n }\n\n delete index1[key1]\n\n for (const key in index1) { // eslint-disable-line no-unreachable-loop\n return\n }\n\n delete index0[key0]\n }\n\n // ### `_findInIndex` finds a set of quads in a three-layered index.\n // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`.\n // Any of these keys can be undefined, which is interpreted as a wildcard.\n // `name0`, `name1`, and `name2` are the names of the keys at each level,\n // used when reconstructing the resulting quad\n // (for instance: _subject_, _predicate_, and _object_).\n // Finally, `graph` will be the graph of the created quads.\n // If `callback` is given, each result is passed through it\n // and iteration halts when it returns truthy for any quad.\n // If instead `array` is given, each result is added to the array.\n _findInIndex (index0, key0, key1, key2, name0, name1, name2, graph, callback, array) {\n let tmp, index1, index2\n\n // If a key is specified, use only that part of index 0.\n if (key0) {\n (tmp = index0, index0 = {})[key0] = tmp[key0]\n }\n\n for (const value0 in index0) {\n index1 = index0[value0]\n\n if (index1) {\n // If a key is specified, use only that part of index 1.\n if (key1) {\n (tmp = index1, index1 = {})[key1] = tmp[key1]\n }\n\n for (const value1 in index1) {\n index2 = index1[value1]\n\n if (index2) {\n // If a key is specified, use only that part of index 2, if it exists.\n const values = key2 ? (key2 in index2 ? [key2] : []) : Object.keys(index2)\n // Create quads for all items found in index 2.\n for (let l = 0; l < values.length; l++) {\n const parts = {\n [name0]: value0,\n [name1]: value1,\n [name2]: values[l]\n }\n\n const quad = this._getQuad(parts.subject, parts.predicate, parts.object, graph)\n\n if (array) {\n array.push(quad)\n } else if (callback(quad)) {\n return true\n }\n }\n }\n }\n }\n }\n\n return array\n }\n\n // ### `_countInIndex` counts matching quads in a three-layered index.\n // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`.\n // Any of these keys can be undefined, which is interpreted as a wildcard.\n _countInIndex (index0, key0, key1, key2) {\n let count = 0\n let tmp, index1, index2\n\n // If a key is specified, count only that part of index 0\n if (key0) {\n (tmp = index0, index0 = {})[key0] = tmp[key0]\n }\n\n for (const value0 in index0) {\n index1 = index0[value0]\n\n if (index1) {\n // If a key is specified, count only that part of index 1\n if (key1) {\n (tmp = index1, index1 = {})[key1] = tmp[key1]\n }\n\n for (const value1 in index1) {\n index2 = index1[value1]\n\n if (index2) {\n if (key2) {\n // If a key is specified, count the quad if it exists\n (key2 in index2) && count++\n } else {\n // Otherwise, count all quads\n count += Object.keys(index2).length\n }\n }\n }\n }\n }\n\n return count\n }\n\n // ### `_getGraphs` returns an array with the given graph,\n // or all graphs if the argument is null or undefined.\n _getGraphs (graph) {\n if (!isString(graph)) {\n return this._graphs\n }\n\n return {\n [graph]: this._graphs[graph]\n }\n }\n\n _match (subject, predicate, object, graph) {\n // Convert terms to internal string representation\n subject = subject && termToId(subject)\n predicate = predicate && termToId(predicate)\n object = object && termToId(object)\n graph = graph && termToId(graph)\n\n const quads = []\n const graphs = this._getGraphs(graph)\n const ids = this._ids\n let content, subjectId, predicateId, objectId\n\n // Translate IRIs to internal index keys.\n if (\n (isString(subject) && !(subjectId = ids[subject])) ||\n (isString(predicate) && !(predicateId = ids[predicate])) ||\n (isString(object) && !(objectId = ids[object]))\n ) {\n return quads\n }\n\n for (const graphId in graphs) {\n content = graphs[graphId]\n\n // Only if the specified graph contains triples, there can be results\n if (content) {\n // Choose the optimal index, based on what fields are present\n if (subjectId) {\n if (objectId) {\n // If subject and object are given, the object index will be the fastest\n this._findInIndex(content.objects, objectId, subjectId, predicateId, 'object', 'subject', 'predicate', graphId, null, quads)\n } else {\n // If only subject and possibly predicate are given, the subject index will be the fastest\n this._findInIndex(content.subjects, subjectId, predicateId, null, 'subject', 'predicate', 'object', graphId, null, quads)\n }\n } else if (predicateId) {\n // if only predicate and possibly object are given, the predicate index will be the fastest\n this._findInIndex(content.predicates, predicateId, objectId, null, 'predicate', 'object', 'subject', graphId, null, quads)\n } else if (objectId) {\n // If only object is given, the object index will be the fastest\n this._findInIndex(content.objects, objectId, null, null, 'object', 'subject', 'predicate', graphId, null, quads)\n } else {\n // If nothing is given, iterate subjects and predicates first\n this._findInIndex(content.subjects, null, null, null, 'subject', 'predicate', 'object', graphId, null, quads)\n }\n }\n }\n\n return quads\n }\n\n _getQuad (subjectId, predicateId, objectId, graphId) {\n return this._quads.get(this._toId(subjectId, predicateId, objectId, graphId))\n }\n\n _setQuad (subjectId, predicateId, objectId, graphId, quad) {\n this._quads.set(this._toId(subjectId, predicateId, objectId, graphId), quad)\n }\n\n _deleteQuad (subjectId, predicateId, objectId, graphId) {\n this._quads.delete(this._toId(subjectId, predicateId, objectId, graphId))\n }\n\n _createDataset (quads) {\n return new this.constructor(quads)\n }\n\n _toId (subjectId, predicateId, objectId, graphId) {\n return `${subjectId}:${predicateId}:${objectId}:${graphId}`\n }\n}\n\nmodule.exports = DatasetCore\n","const rdf = require('@rdfjs/data-model')\nconst DatasetCore = require('./DatasetCore')\n\nfunction dataset (quads) {\n return new DatasetCore(quads)\n}\n\nmodule.exports = Object.assign({ dataset }, rdf)\n","/*globals self, window */\n\"use strict\"\n\n/*eslint-disable @mysticatea/prettier */\nconst { AbortController, AbortSignal } =\n typeof self !== \"undefined\" ? self :\n typeof window !== \"undefined\" ? window :\n /* otherwise */ undefined\n/*eslint-enable @mysticatea/prettier */\n\nmodule.exports = AbortController\nmodule.exports.AbortSignal = AbortSignal\nmodule.exports.default = AbortController\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/**\r\n * Create a blob builder even when vendor prefixes exist\r\n */\r\n\r\nvar BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :\r\n typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :\r\n typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :\r\n typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : \r\n false;\r\n\r\n/**\r\n * Check if Blob constructor is supported\r\n */\r\n\r\nvar blobSupported = (function() {\r\n try {\r\n var a = new Blob(['hi']);\r\n return a.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if Blob constructor supports ArrayBufferViews\r\n * Fails in Safari 6, so we need to map to ArrayBuffers there.\r\n */\r\n\r\nvar blobSupportsArrayBufferView = blobSupported && (function() {\r\n try {\r\n var b = new Blob([new Uint8Array([1,2])]);\r\n return b.size === 2;\r\n } catch(e) {\r\n return false;\r\n }\r\n})();\r\n\r\n/**\r\n * Check if BlobBuilder is supported\r\n */\r\n\r\nvar blobBuilderSupported = BlobBuilder\r\n && BlobBuilder.prototype.append\r\n && BlobBuilder.prototype.getBlob;\r\n\r\n/**\r\n * Helper function that maps ArrayBufferViews to ArrayBuffers\r\n * Used by BlobBuilder constructor and old browsers that didn't\r\n * support it in the Blob constructor.\r\n */\r\n\r\nfunction mapArrayBufferViews(ary) {\r\n return ary.map(function(chunk) {\r\n if (chunk.buffer instanceof ArrayBuffer) {\r\n var buf = chunk.buffer;\r\n\r\n // if this is a subarray, make a copy so we only\r\n // include the subarray region from the underlying buffer\r\n if (chunk.byteLength !== buf.byteLength) {\r\n var copy = new Uint8Array(chunk.byteLength);\r\n copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));\r\n buf = copy.buffer;\r\n }\r\n\r\n return buf;\r\n }\r\n\r\n return chunk;\r\n });\r\n}\r\n\r\nfunction BlobBuilderConstructor(ary, options) {\r\n options = options || {};\r\n\r\n var bb = new BlobBuilder();\r\n mapArrayBufferViews(ary).forEach(function(part) {\r\n bb.append(part);\r\n });\r\n\r\n return (options.type) ? bb.getBlob(options.type) : bb.getBlob();\r\n}\r\n\r\nfunction BlobConstructor(ary, options) {\r\n return new Blob(mapArrayBufferViews(ary), options || {});\r\n}\r\n\r\nif (typeof Blob !== 'undefined') {\r\n BlobBuilderConstructor.prototype = Blob.prototype;\r\n BlobConstructor.prototype = Blob.prototype;\r\n}\r\n\r\nexport default (function() {\r\n if (blobSupported) {\r\n return blobSupportsArrayBufferView ? Blob : BlobConstructor;\r\n } else if (blobBuilderSupported) {\r\n return BlobBuilderConstructor;\r\n } else {\r\n return undefined;\r\n }\r\n})();\r\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","/* jshint esversion: 6 */\n/* jslint node: true */\n'use strict';\n\nmodule.exports = function serialize (object) {\n if (object === null || typeof object !== 'object' || object.toJSON != null) {\n return JSON.stringify(object);\n }\n\n if (Array.isArray(object)) {\n return '[' + object.reduce((t, cv, ci) => {\n const comma = ci === 0 ? '' : ',';\n const value = cv === undefined || typeof cv === 'symbol' ? null : cv;\n return t + comma + serialize(value);\n }, '') + ']';\n }\n\n return '{' + Object.keys(object).sort().reduce((t, cv, ci) => {\n if (object[cv] === undefined ||\n typeof object[cv] === 'symbol') {\n return t;\n }\n const comma = t.length === 0 ? '' : ',';\n return t + comma + serialize(cv) + ':' + serialize(object[cv]);\n }, '') + '}';\n};\n","(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(typeof self !== 'undefined' ? self : this);\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","'use strict'\n\nvar COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i\nvar WS_TRIM_PATTERN = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g\nvar WS_CHAR_PATTERN = /\\s|\\uFEFF|\\xA0/\nvar WS_FOLD_PATTERN = /\\r?\\n[\\x20\\x09]+/g\nvar DELIMITER_PATTERN = /[;,\"]/\nvar WS_DELIMITER_PATTERN = /[;,\"]|\\s/\n\n/**\n * Token character pattern\n * @type {RegExp}\n * @see https://tools.ietf.org/html/rfc7230#section-3.2.6\n */\nvar TOKEN_PATTERN = /^[!#$%&'*+\\-\\.^_`|~\\da-zA-Z]+$/\n\nvar STATE = {\n IDLE: 1 << 0,\n URI: 1 << 1,\n ATTR: 1 << 2,\n}\n\nfunction trim( value ) {\n return value.replace( WS_TRIM_PATTERN, '' )\n}\n\nfunction hasWhitespace( value ) {\n return WS_CHAR_PATTERN.test( value )\n}\n\nfunction skipWhitespace( value, offset ) {\n while( hasWhitespace( value[offset] ) ) {\n offset++\n }\n return offset\n}\n\nfunction needsQuotes( value ) {\n return WS_DELIMITER_PATTERN.test( value ) ||\n !TOKEN_PATTERN.test( value )\n}\n\n/**\n * Shallow compares two objects to check if their properties match.\n * @param {object} object1 First object to compare.\n * @param {object} object2 Second object to compare.\n * @returns {boolean} Do the objects have matching properties.\n */\nfunction shallowCompareObjects( object1, object2 ) {\n return (\n Object.keys( object1 ).length === Object.keys( object2 ).length &&\n Object.keys( object1 ).every(\n ( key ) => key in object2 && object1[ key ] === object2[ key ]\n )\n );\n}\n\nclass Link {\n\n /**\n * Link\n * @constructor\n * @param {String} [value]\n * @returns {Link}\n */\n constructor( value ) {\n\n /** @type {Array} URI references */\n this.refs = []\n\n if( value ) {\n this.parse( value )\n }\n\n }\n\n /**\n * Get refs with given relation type\n * @param {String} value\n * @returns {Array}\n */\n rel( value ) {\n\n var links = []\n var type = value.toLowerCase()\n\n for( var i = 0; i < this.refs.length; i++ ) {\n if( this.refs[ i ].rel.toLowerCase() === type ) {\n links.push( this.refs[ i ] )\n }\n }\n\n return links\n\n }\n\n /**\n * Get refs where given attribute has a given value\n * @param {String} attr\n * @param {String} value\n * @returns {Array}\n */\n get( attr, value ) {\n\n attr = attr.toLowerCase()\n\n var links = []\n\n for( var i = 0; i < this.refs.length; i++ ) {\n if( this.refs[ i ][ attr ] === value ) {\n links.push( this.refs[ i ] )\n }\n }\n\n return links\n\n }\n\n /** Sets a reference. */\n set( link ) {\n this.refs.push( link )\n return this\n }\n\n /**\n * Sets a reference if a reference with similar properties isn’t already set.\n */\n setUnique( link ) {\n\n if( !this.refs.some(( ref ) => shallowCompareObjects( ref, link )) ) {\n this.refs.push( link )\n }\n\n return this\n\n }\n\n has( attr, value ) {\n\n attr = attr.toLowerCase()\n\n for( var i = 0; i < this.refs.length; i++ ) {\n if( this.refs[ i ][ attr ] === value ) {\n return true\n }\n }\n\n return false\n\n }\n\n parse( value, offset ) {\n\n offset = offset || 0\n value = offset ? value.slice( offset ) : value\n\n // Trim & unfold folded lines\n value = trim( value ).replace( WS_FOLD_PATTERN, '' )\n\n var state = STATE.IDLE\n var length = value.length\n var offset = 0\n var ref = null\n\n while( offset < length ) {\n if( state === STATE.IDLE ) {\n if( hasWhitespace( value[offset] ) ) {\n offset++\n continue\n } else if( value[offset] === '<' ) {\n if( ref != null ) {\n ref.rel != null ?\n this.refs.push( ...Link.expandRelations( ref ) ) :\n this.refs.push( ref )\n }\n var end = value.indexOf( '>', offset )\n if( end === -1 ) throw new Error( 'Expected end of URI delimiter at offset ' + offset )\n ref = { uri: value.slice( offset + 1, end ) }\n // this.refs.push( ref )\n offset = end\n state = STATE.URI\n } else {\n throw new Error( 'Unexpected character \"' + value[offset] + '\" at offset ' + offset )\n }\n offset++\n } else if( state === STATE.URI ) {\n if( hasWhitespace( value[offset] ) ) {\n offset++\n continue\n } else if( value[offset] === ';' ) {\n state = STATE.ATTR\n offset++\n } else if( value[offset] === ',' ) {\n state = STATE.IDLE\n offset++\n } else {\n throw new Error( 'Unexpected character \"' + value[offset] + '\" at offset ' + offset )\n }\n } else if( state === STATE.ATTR ) {\n if( value[offset] ===';' || hasWhitespace( value[offset] ) ) {\n offset++\n continue\n }\n var end = value.indexOf( '=', offset )\n if( end === -1 ) end = value.indexOf( ';', offset )\n if( end === -1 ) end = value.length\n var attr = trim( value.slice( offset, end ) ).toLowerCase()\n var attrValue = ''\n offset = end + 1\n offset = skipWhitespace( value, offset )\n if( value[offset] === '\"' ) {\n offset++\n while( offset < length ) {\n if( value[offset] === '\"' ) {\n offset++; break\n }\n if( value[offset] === '\\\\' ) {\n offset++\n }\n attrValue += value[offset]\n offset++\n }\n } else {\n var end = offset + 1\n while( !DELIMITER_PATTERN.test( value[end] ) && end < length ) {\n end++\n }\n attrValue = value.slice( offset, end )\n offset = end\n }\n if( ref[ attr ] && Link.isSingleOccurenceAttr( attr ) ) {\n // Ignore multiples of attributes which may only appear once\n } else if( attr[ attr.length - 1 ] === '*' ) {\n ref[ attr ] = Link.parseExtendedValue( attrValue )\n } else {\n attrValue = attr === 'type' ?\n attrValue.toLowerCase() : attrValue\n if( ref[ attr ] != null ) {\n if( Array.isArray( ref[ attr ] ) ) {\n ref[ attr ].push( attrValue )\n } else {\n ref[ attr ] = [ ref[ attr ], attrValue ]\n }\n } else {\n ref[ attr ] = attrValue\n }\n }\n switch( value[offset] ) {\n case ',': state = STATE.IDLE; break\n case ';': state = STATE.ATTR; break\n }\n offset++\n } else {\n throw new Error( 'Unknown parser state \"' + state + '\"' )\n }\n }\n\n if( ref != null ) {\n ref.rel != null ?\n this.refs.push( ...Link.expandRelations( ref ) ) :\n this.refs.push( ref )\n }\n\n ref = null\n\n return this\n\n }\n\n toString() {\n\n var refs = []\n var link = ''\n var ref = null\n\n for( var i = 0; i < this.refs.length; i++ ) {\n ref = this.refs[i]\n link = Object.keys( this.refs[i] ).reduce( function( link, attr ) {\n if( attr === 'uri' ) return link\n return link + '; ' + Link.formatAttribute( attr, ref[ attr ] )\n }, '<' + ref.uri + '>' )\n refs.push( link )\n }\n\n return refs.join( ', ' )\n\n }\n\n}\n\n/**\n * Determines whether an encoding can be\n * natively handled with a `Buffer`\n * @param {String} value\n * @returns {Boolean}\n */\nLink.isCompatibleEncoding = function( value ) {\n return COMPATIBLE_ENCODING_PATTERN.test( value )\n}\n\nLink.parse = function( value, offset ) {\n return new Link().parse( value, offset )\n}\n\nLink.isSingleOccurenceAttr = function( attr ) {\n return attr === 'rel' || attr === 'type' || attr === 'media' ||\n attr === 'title' || attr === 'title*'\n}\n\nLink.isTokenAttr = function( attr ) {\n return attr === 'rel' || attr === 'type' || attr === 'anchor'\n}\n\nLink.escapeQuotes = function( value ) {\n return value.replace( /\"/g, '\\\\\"' )\n}\n\nLink.expandRelations = function( ref ) {\n var rels = ref.rel.split( ' ' )\n return rels.map( function( rel ) {\n var value = Object.assign( {}, ref )\n value.rel = rel\n return value\n })\n}\n\n/**\n * Parses an extended value and attempts to decode it\n * @internal\n * @param {String} value\n * @return {Object}\n */\nLink.parseExtendedValue = function( value ) {\n var parts = /([^']+)?(?:'([^']*)')?(.+)/.exec( value )\n return {\n language: parts[2].toLowerCase(),\n encoding: Link.isCompatibleEncoding( parts[1] ) ?\n null : parts[1].toLowerCase(),\n value: Link.isCompatibleEncoding( parts[1] ) ?\n decodeURIComponent( parts[3] ) : parts[3]\n }\n}\n\n/**\n * Format a given extended attribute and it's value\n * @param {String} attr\n * @param {Object} data\n * @return {String}\n */\nLink.formatExtendedAttribute = function( attr, data ) {\n\n var encoding = ( data.encoding || 'utf-8' ).toUpperCase()\n var language = data.language || 'en'\n\n var encodedValue = ''\n\n if( Buffer.isBuffer( data.value ) && Link.isCompatibleEncoding( encoding ) ) {\n encodedValue = data.value.toString( encoding )\n } else if( Buffer.isBuffer( data.value ) ) {\n encodedValue = data.value.toString( 'hex' )\n .replace( /[0-9a-f]{2}/gi, '%$1' )\n } else {\n encodedValue = encodeURIComponent( data.value )\n }\n\n return attr + '=' + encoding + '\\'' +\n language + '\\'' + encodedValue\n\n}\n\n/**\n * Format a given attribute and it's value\n * @param {String} attr\n * @param {String|Object} value\n * @return {String}\n */\nLink.formatAttribute = function( attr, value ) {\n\n if( Array.isArray( value ) ) {\n return value.map(( item ) => {\n return Link.formatAttribute( attr, item )\n }).join( '; ' )\n }\n\n if( attr[ attr.length - 1 ] === '*' || typeof value !== 'string' ) {\n return Link.formatExtendedAttribute( attr, value )\n }\n\n if( Link.isTokenAttr( attr ) ) {\n value = needsQuotes( value ) ?\n '\"' + Link.escapeQuotes( value ) + '\"' :\n Link.escapeQuotes( value )\n } else if( needsQuotes( value ) ) {\n value = encodeURIComponent( value )\n // We don't need to escape <,> <;> within quotes\n value = value\n .replace( /%20/g, ' ' )\n .replace( /%2C/g, ',' )\n .replace( /%3B/g, ';' )\n\n value = '\"' + value + '\"'\n }\n\n return attr + '=' + value\n\n}\n\nmodule.exports = Link\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./lib/ContextParser\"), exports);\n__exportStar(require(\"./lib/ErrorCoded\"), exports);\n__exportStar(require(\"./lib/FetchDocumentLoader\"), exports);\n__exportStar(require(\"./lib/IDocumentLoader\"), exports);\n__exportStar(require(\"./lib/JsonLdContext\"), exports);\n__exportStar(require(\"./lib/JsonLdContextNormalized\"), exports);\n__exportStar(require(\"./lib/Util\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ContextParser = void 0;\nrequire(\"cross-fetch/polyfill\");\nconst relative_to_absolute_iri_1 = require(\"relative-to-absolute-iri\");\nconst ErrorCoded_1 = require(\"./ErrorCoded\");\nconst FetchDocumentLoader_1 = require(\"./FetchDocumentLoader\");\nconst JsonLdContextNormalized_1 = require(\"./JsonLdContextNormalized\");\nconst Util_1 = require(\"./Util\");\n/**\n * Parses JSON-LD contexts.\n */\nclass ContextParser {\n constructor(options) {\n options = options || {};\n this.documentLoader = options.documentLoader || new FetchDocumentLoader_1.FetchDocumentLoader();\n this.documentCache = {};\n this.validateContext = !options.skipValidation;\n this.expandContentTypeToBase = !!options.expandContentTypeToBase;\n this.remoteContextsDepthLimit = options.remoteContextsDepthLimit || 32;\n this.redirectSchemaOrgHttps = 'redirectSchemaOrgHttps' in options ? !!options.redirectSchemaOrgHttps : true;\n }\n /**\n * Validate the given @language value.\n * An error will be thrown if it is invalid.\n * @param value An @language value.\n * @param {boolean} strictRange If the string value should be strictly checked against a regex.\n * @param {string} errorCode The error code to emit on errors.\n * @return {boolean} If validation passed.\n * Can only be false if strictRange is false and the string value did not pass the regex.\n */\n static validateLanguage(value, strictRange, errorCode) {\n if (typeof value !== 'string') {\n throw new ErrorCoded_1.ErrorCoded(`The value of an '@language' must be a string, got '${JSON.stringify(value)}'`, errorCode);\n }\n if (!Util_1.Util.REGEX_LANGUAGE_TAG.test(value)) {\n if (strictRange) {\n throw new ErrorCoded_1.ErrorCoded(`The value of an '@language' must be a valid language tag, got '${JSON.stringify(value)}'`, errorCode);\n }\n else {\n return false;\n }\n }\n return true;\n }\n /**\n * Validate the given @direction value.\n * An error will be thrown if it is invalid.\n * @param value An @direction value.\n * @param {boolean} strictValues If the string value should be strictly checked against a regex.\n * @return {boolean} If validation passed.\n * Can only be false if strictRange is false and the string value did not pass the regex.\n */\n static validateDirection(value, strictValues) {\n if (typeof value !== 'string') {\n throw new ErrorCoded_1.ErrorCoded(`The value of an '@direction' must be a string, got '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_BASE_DIRECTION);\n }\n if (!Util_1.Util.REGEX_DIRECTION_TAG.test(value)) {\n if (strictValues) {\n throw new ErrorCoded_1.ErrorCoded(`The value of an '@direction' must be 'ltr' or 'rtl', got '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_BASE_DIRECTION);\n }\n else {\n return false;\n }\n }\n return true;\n }\n /**\n * Add an @id term for all @reverse terms.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @return {IJsonLdContextNormalizedRaw} The mutated input context.\n */\n idifyReverseTerms(context) {\n for (const key of Object.keys(context)) {\n let value = context[key];\n if (value && typeof value === 'object') {\n if (value['@reverse'] && !value['@id']) {\n if (typeof value['@reverse'] !== 'string' || Util_1.Util.isValidKeyword(value['@reverse'])) {\n throw new ErrorCoded_1.ErrorCoded(`Invalid @reverse value, must be absolute IRI or blank node: '${value['@reverse']}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n value = context[key] = Object.assign(Object.assign({}, value), { '@id': value['@reverse'] });\n value['@id'] = value['@reverse'];\n if (Util_1.Util.isPotentialKeyword(value['@reverse'])) {\n delete value['@reverse'];\n }\n else {\n value['@reverse'] = true;\n }\n }\n }\n }\n return context;\n }\n /**\n * Expand all prefixed terms in the given context.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @param {boolean} expandContentTypeToBase If @type inside the context may be expanded\n * via @base if @vocab is set to null.\n * @param {string[]} keys Optional set of keys from the context to expand. If left undefined, all\n * keys in the context will be expanded.\n */\n expandPrefixedTerms(context, expandContentTypeToBase, keys) {\n const contextRaw = context.getContextRaw();\n for (const key of (keys || Object.keys(contextRaw))) {\n // Only expand allowed keys\n if (Util_1.Util.EXPAND_KEYS_BLACKLIST.indexOf(key) < 0 && !Util_1.Util.isReservedInternalKeyword(key)) {\n // Error if we try to alias a keyword to something else.\n const keyValue = contextRaw[key];\n if (Util_1.Util.isPotentialKeyword(key) && Util_1.Util.ALIAS_DOMAIN_BLACKLIST.indexOf(key) >= 0) {\n if (key !== '@type' || typeof contextRaw[key] === 'object'\n && !(contextRaw[key]['@protected'] || contextRaw[key]['@container'] === '@set')) {\n throw new ErrorCoded_1.ErrorCoded(`Keywords can not be aliased to something else.\nTried mapping ${key} to ${JSON.stringify(keyValue)}`, ErrorCoded_1.ERROR_CODES.KEYWORD_REDEFINITION);\n }\n }\n // Error if we try to alias to an illegal keyword\n if (Util_1.Util.ALIAS_RANGE_BLACKLIST.indexOf(Util_1.Util.getContextValueId(keyValue)) >= 0) {\n throw new ErrorCoded_1.ErrorCoded(`Aliasing to certain keywords is not allowed.\nTried mapping ${key} to ${JSON.stringify(keyValue)}`, ErrorCoded_1.ERROR_CODES.INVALID_KEYWORD_ALIAS);\n }\n // Error if this term was marked as prefix as well\n if (keyValue && Util_1.Util.isPotentialKeyword(Util_1.Util.getContextValueId(keyValue))\n && keyValue['@prefix'] === true) {\n throw new ErrorCoded_1.ErrorCoded(`Tried to use keyword aliases as prefix: '${key}': '${JSON.stringify(keyValue)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION);\n }\n // Loop because prefixes might be nested\n while (Util_1.Util.isPrefixValue(contextRaw[key])) {\n const value = contextRaw[key];\n let changed = false;\n if (typeof value === 'string') {\n contextRaw[key] = context.expandTerm(value, true);\n changed = changed || value !== contextRaw[key];\n }\n else {\n const id = value['@id'];\n const type = value['@type'];\n // If @id is missing, don't allow @id to be added if @prefix: true and key not being a valid IRI.\n const canAddIdEntry = !('@prefix' in value) || Util_1.Util.isValidIri(key);\n if ('@id' in value) {\n // Use @id value for expansion\n if (id !== undefined && id !== null && typeof id === 'string') {\n contextRaw[key] = Object.assign(Object.assign({}, contextRaw[key]), { '@id': context.expandTerm(id, true) });\n changed = changed || id !== contextRaw[key]['@id'];\n }\n }\n else if (!Util_1.Util.isPotentialKeyword(key) && canAddIdEntry) {\n // Add an explicit @id value based on the expanded key value\n const newId = context.expandTerm(key, true);\n if (newId !== key) {\n // Don't set @id if expansion failed\n contextRaw[key] = Object.assign(Object.assign({}, contextRaw[key]), { '@id': newId });\n changed = true;\n }\n }\n if (type && typeof type === 'string' && type !== '@vocab'\n && (!value['@container'] || !value['@container']['@type'])\n && canAddIdEntry) {\n // First check @vocab, then fallback to @base\n let expandedType = context.expandTerm(type, true);\n if (expandContentTypeToBase && type === expandedType) {\n expandedType = context.expandTerm(type, false);\n }\n if (expandedType !== type) {\n changed = true;\n contextRaw[key] = Object.assign(Object.assign({}, contextRaw[key]), { '@type': expandedType });\n }\n }\n }\n if (!changed) {\n break;\n }\n }\n }\n }\n }\n /**\n * Normalize the @language entries in the given context to lowercase.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @param {IParseOptions} parseOptions The parsing options.\n */\n normalize(context, { processingMode, normalizeLanguageTags }) {\n // Lowercase language keys in 1.0\n if (normalizeLanguageTags || processingMode === 1.0) {\n for (const key of Object.keys(context)) {\n if (key === '@language' && typeof context[key] === 'string') {\n context[key] = context[key].toLowerCase();\n }\n else {\n const value = context[key];\n if (value && typeof value === 'object') {\n if (typeof value['@language'] === 'string') {\n const lowercase = value['@language'].toLowerCase();\n if (lowercase !== value['@language']) {\n context[key] = Object.assign(Object.assign({}, value), { '@language': lowercase });\n }\n }\n }\n }\n }\n }\n }\n /**\n * Convert all @container strings and array values to hash-based values.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n */\n containersToHash(context) {\n for (const key of Object.keys(context)) {\n const value = context[key];\n if (value && typeof value === 'object') {\n if (typeof value['@container'] === 'string') {\n context[key] = Object.assign(Object.assign({}, value), { '@container': { [value['@container']]: true } });\n }\n else if (Array.isArray(value['@container'])) {\n const newValue = {};\n for (const containerValue of value['@container']) {\n newValue[containerValue] = true;\n }\n context[key] = Object.assign(Object.assign({}, value), { '@container': newValue });\n }\n }\n }\n }\n /**\n * Normalize and apply context-level @protected terms onto each term separately.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @param {number} processingMode The processing mode.\n */\n applyScopedProtected(context, { processingMode }, expandOptions) {\n if (processingMode && processingMode >= 1.1) {\n if (context['@protected']) {\n for (const key of Object.keys(context)) {\n if (Util_1.Util.isReservedInternalKeyword(key)) {\n continue;\n }\n if (!Util_1.Util.isPotentialKeyword(key) && !Util_1.Util.isTermProtected(context, key)) {\n const value = context[key];\n if (value && typeof value === 'object') {\n if (!('@protected' in context[key])) {\n // Mark terms with object values as protected if they don't have an @protected: false annotation\n context[key] = Object.assign(Object.assign({}, context[key]), { '@protected': true });\n }\n }\n else {\n // Convert string-based term values to object-based values with @protected: true\n context[key] = {\n '@id': value,\n '@protected': true,\n };\n if (Util_1.Util.isSimpleTermDefinitionPrefix(value, expandOptions)) {\n context[key] = Object.assign(Object.assign({}, context[key]), { '@prefix': true });\n }\n }\n }\n }\n delete context['@protected'];\n }\n }\n }\n /**\n * Check if the given context inheritance does not contain any overrides of protected terms.\n * @param {IJsonLdContextNormalizedRaw} contextBefore The context that may contain some protected terms.\n * @param {IJsonLdContextNormalizedRaw} contextAfter A new context that is being applied on the first one.\n * @param {IExpandOptions} expandOptions Options that are needed for any expansions during this validation.\n * @param {string[]} keys Optional set of keys from the context to validate. If left undefined, all\n * keys defined in contextAfter will be checked.\n */\n validateKeywordRedefinitions(contextBefore, contextAfter, expandOptions, keys) {\n for (const key of (keys !== null && keys !== void 0 ? keys : Object.keys(contextAfter))) {\n if (Util_1.Util.isTermProtected(contextBefore, key)) {\n // The entry in the context before will always be in object-mode\n // If the new entry is in string-mode, convert it to object-mode\n // before checking if it is identical.\n if (typeof contextAfter[key] === 'string') {\n contextAfter[key] = { '@id': contextAfter[key], '@protected': true };\n }\n else {\n // We modify this deliberately,\n // as we need it for the value comparison (they must be identical modulo '@protected')),\n // and for the fact that this new value will override the first one.\n contextAfter[key] = Object.assign(Object.assign({}, contextAfter[key]), { '@protected': true });\n }\n // Error if they are not identical\n if (!Util_1.Util.deepEqual(contextBefore[key], contextAfter[key])) {\n throw new ErrorCoded_1.ErrorCoded(`Attempted to override the protected keyword ${key} from ${JSON.stringify(Util_1.Util.getContextValueId(contextBefore[key]))} to ${JSON.stringify(Util_1.Util.getContextValueId(contextAfter[key]))}`, ErrorCoded_1.ERROR_CODES.PROTECTED_TERM_REDEFINITION);\n }\n }\n }\n }\n /**\n * Validate the entries of the given context.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @param {IParseOptions} options The parse options.\n */\n validate(context, { processingMode }) {\n for (const key of Object.keys(context)) {\n // Ignore reserved internal keywords.\n if (Util_1.Util.isReservedInternalKeyword(key)) {\n continue;\n }\n // Do not allow empty term\n if (key === '') {\n throw new ErrorCoded_1.ErrorCoded(`The empty term is not allowed, got: '${key}': '${JSON.stringify(context[key])}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION);\n }\n const value = context[key];\n const valueType = typeof value;\n // First check if the key is a keyword\n if (Util_1.Util.isPotentialKeyword(key)) {\n switch (key.substr(1)) {\n case 'vocab':\n if (value !== null && valueType !== 'string') {\n throw new ErrorCoded_1.ErrorCoded(`Found an invalid @vocab IRI: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_VOCAB_MAPPING);\n }\n break;\n case 'base':\n if (value !== null && valueType !== 'string') {\n throw new ErrorCoded_1.ErrorCoded(`Found an invalid @base IRI: ${context[key]}`, ErrorCoded_1.ERROR_CODES.INVALID_BASE_IRI);\n }\n break;\n case 'language':\n if (value !== null) {\n ContextParser.validateLanguage(value, true, ErrorCoded_1.ERROR_CODES.INVALID_DEFAULT_LANGUAGE);\n }\n break;\n case 'version':\n if (value !== null && valueType !== 'number') {\n throw new ErrorCoded_1.ErrorCoded(`Found an invalid @version number: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_VERSION_VALUE);\n }\n break;\n case 'direction':\n if (value !== null) {\n ContextParser.validateDirection(value, true);\n }\n break;\n case 'propagate':\n if (processingMode === 1.0) {\n throw new ErrorCoded_1.ErrorCoded(`Found an illegal @propagate keyword: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_ENTRY);\n }\n if (value !== null && valueType !== 'boolean') {\n throw new ErrorCoded_1.ErrorCoded(`Found an invalid @propagate value: ${value}`, ErrorCoded_1.ERROR_CODES.INVALID_PROPAGATE_VALUE);\n }\n break;\n }\n // Don't allow keywords to be overridden\n if (Util_1.Util.isValidKeyword(key) && Util_1.Util.isValidKeyword(Util_1.Util.getContextValueId(value))) {\n throw new ErrorCoded_1.ErrorCoded(`Illegal keyword alias in term value, found: '${key}': '${Util_1.Util\n .getContextValueId(value)}'`, ErrorCoded_1.ERROR_CODES.KEYWORD_REDEFINITION);\n }\n continue;\n }\n // Otherwise, consider the key a term\n if (value !== null) {\n switch (valueType) {\n case 'string':\n if (Util_1.Util.getPrefix(value, context) === key) {\n throw new ErrorCoded_1.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${key}': '${JSON\n .stringify(value)}'`, ErrorCoded_1.ERROR_CODES.CYCLIC_IRI_MAPPING);\n }\n if (Util_1.Util.isValidIriWeak(key)) {\n if (value === '@type') {\n throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to @type, found: '${key}': '${value}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n else if (Util_1.Util.isValidIri(value) && value !== new JsonLdContextNormalized_1.JsonLdContextNormalized(context).expandTerm(key)) {\n throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${key}': '${value}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n }\n break;\n case 'object':\n if (!Util_1.Util.isCompactIri(key) && !('@id' in value)\n && (value['@type'] === '@id' ? !context['@base'] : !context['@vocab'])) {\n throw new ErrorCoded_1.ErrorCoded(`Missing @id in context entry: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n for (const objectKey of Object.keys(value)) {\n const objectValue = value[objectKey];\n if (!objectValue) {\n continue;\n }\n switch (objectKey) {\n case '@id':\n if (Util_1.Util.isValidKeyword(objectValue)\n && objectValue !== '@type' && objectValue !== '@id' && objectValue !== '@graph' && objectValue !== '@nest') {\n throw new ErrorCoded_1.ErrorCoded(`Illegal keyword alias in term value, found: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n if (Util_1.Util.isValidIriWeak(key)) {\n if (objectValue === '@type') {\n throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to @type, found: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n else if (Util_1.Util.isValidIri(objectValue)\n && objectValue !== new JsonLdContextNormalized_1.JsonLdContextNormalized(context).expandTerm(key)) {\n throw new ErrorCoded_1.ErrorCoded(`IRIs can not be mapped to other IRIs, found: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n }\n if (typeof objectValue !== 'string') {\n throw new ErrorCoded_1.ErrorCoded(`Detected non-string @id in context entry: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n if (Util_1.Util.getPrefix(objectValue, context) === key) {\n throw new ErrorCoded_1.ErrorCoded(`Detected cyclical IRI mapping in context entry: '${key}': '${JSON\n .stringify(value)}'`, ErrorCoded_1.ERROR_CODES.CYCLIC_IRI_MAPPING);\n }\n break;\n case '@type':\n if (value['@container'] === '@type' && objectValue !== '@id' && objectValue !== '@vocab') {\n throw new ErrorCoded_1.ErrorCoded(`@container: @type only allows @type: @id or @vocab, but got: '${key}': '${objectValue}'`, ErrorCoded_1.ERROR_CODES.INVALID_TYPE_MAPPING);\n }\n if (typeof objectValue !== 'string') {\n throw new ErrorCoded_1.ErrorCoded(`The value of an '@type' must be a string, got '${JSON.stringify(valueType)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TYPE_MAPPING);\n }\n if (objectValue !== '@id' && objectValue !== '@vocab'\n && (processingMode === 1.0 || objectValue !== '@json')\n && (processingMode === 1.0 || objectValue !== '@none')\n && (objectValue[0] === '_' || !Util_1.Util.isValidIri(objectValue))) {\n throw new ErrorCoded_1.ErrorCoded(`A context @type must be an absolute IRI, found: '${key}': '${objectValue}'`, ErrorCoded_1.ERROR_CODES.INVALID_TYPE_MAPPING);\n }\n break;\n case '@reverse':\n if (typeof objectValue === 'string' && value['@id'] && value['@id'] !== objectValue) {\n throw new ErrorCoded_1.ErrorCoded(`Found non-matching @id and @reverse term values in '${key}':\\\n'${objectValue}' and '${value['@id']}'`, ErrorCoded_1.ERROR_CODES.INVALID_REVERSE_PROPERTY);\n }\n if ('@nest' in value) {\n throw new ErrorCoded_1.ErrorCoded(`@nest is not allowed in the reverse property '${key}'`, ErrorCoded_1.ERROR_CODES.INVALID_REVERSE_PROPERTY);\n }\n break;\n case '@container':\n if (processingMode === 1.0) {\n if (Object.keys(objectValue).length > 1\n || Util_1.Util.CONTAINERS_1_0.indexOf(Object.keys(objectValue)[0]) < 0) {\n throw new ErrorCoded_1.ErrorCoded(`Invalid term @container for '${key}' ('${Object.keys(objectValue)}') in 1.0, \\\nmust be only one of ${Util_1.Util.CONTAINERS_1_0.join(', ')}`, ErrorCoded_1.ERROR_CODES.INVALID_CONTAINER_MAPPING);\n }\n }\n for (const containerValue of Object.keys(objectValue)) {\n if (containerValue === '@list' && value['@reverse']) {\n throw new ErrorCoded_1.ErrorCoded(`Term value can not be @container: @list and @reverse at the same time on '${key}'`, ErrorCoded_1.ERROR_CODES.INVALID_REVERSE_PROPERTY);\n }\n if (Util_1.Util.CONTAINERS.indexOf(containerValue) < 0) {\n throw new ErrorCoded_1.ErrorCoded(`Invalid term @container for '${key}' ('${containerValue}'), \\\nmust be one of ${Util_1.Util.CONTAINERS.join(', ')}`, ErrorCoded_1.ERROR_CODES.INVALID_CONTAINER_MAPPING);\n }\n }\n break;\n case '@language':\n ContextParser.validateLanguage(objectValue, true, ErrorCoded_1.ERROR_CODES.INVALID_LANGUAGE_MAPPING);\n break;\n case '@direction':\n ContextParser.validateDirection(objectValue, true);\n break;\n case '@prefix':\n if (objectValue !== null && typeof objectValue !== 'boolean') {\n throw new ErrorCoded_1.ErrorCoded(`Found an invalid term @prefix boolean in: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_PREFIX_VALUE);\n }\n if (!('@id' in value) && !Util_1.Util.isValidIri(key)) {\n throw new ErrorCoded_1.ErrorCoded(`Invalid @prefix definition for '${key}' ('${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION);\n }\n break;\n case '@index':\n if (processingMode === 1.0 || !value['@container'] || !value['@container']['@index']) {\n throw new ErrorCoded_1.ErrorCoded(`Attempt to add illegal key to value object: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION);\n }\n break;\n case '@nest':\n if (Util_1.Util.isPotentialKeyword(objectValue) && objectValue !== '@nest') {\n throw new ErrorCoded_1.ErrorCoded(`Found an invalid term @nest value in: '${key}': '${JSON.stringify(value)}'`, ErrorCoded_1.ERROR_CODES.INVALID_NEST_VALUE);\n }\n }\n }\n break;\n default:\n throw new ErrorCoded_1.ErrorCoded(`Found an invalid term value: '${key}': '${value}'`, ErrorCoded_1.ERROR_CODES.INVALID_TERM_DEFINITION);\n }\n }\n }\n }\n /**\n * Apply the @base context entry to the given context under certain circumstances.\n * @param context A context.\n * @param options Parsing options.\n * @param inheritFromParent If the @base value from the parent context can be inherited.\n * @return The given context.\n */\n applyBaseEntry(context, options, inheritFromParent) {\n // In some special cases, this can be a string, so ignore those.\n if (typeof context === 'string') {\n return context;\n }\n // Give priority to @base in the parent context\n if (inheritFromParent && !('@base' in context) && options.parentContext\n && typeof options.parentContext === 'object' && '@base' in options.parentContext) {\n context['@base'] = options.parentContext['@base'];\n if (options.parentContext['@__baseDocument']) {\n context['@__baseDocument'] = true;\n }\n }\n // Override the base IRI if provided.\n if (options.baseIRI && !options.external) {\n if (!('@base' in context)) {\n // The context base is the document base\n context['@base'] = options.baseIRI;\n context['@__baseDocument'] = true;\n }\n else if (context['@base'] !== null && typeof context['@base'] === 'string'\n && !Util_1.Util.isValidIri(context['@base'])) {\n // The context base is relative to the document base\n context['@base'] = (0, relative_to_absolute_iri_1.resolve)(context['@base'], options.parentContext && options.parentContext['@base'] || options.baseIRI);\n }\n }\n return context;\n }\n /**\n * Resolve relative context IRIs, or return full IRIs as-is.\n * @param {string} contextIri A context IRI.\n * @param {string} baseIRI A base IRI.\n * @return {string} The normalized context IRI.\n */\n normalizeContextIri(contextIri, baseIRI) {\n if (!Util_1.Util.isValidIri(contextIri)) {\n try {\n contextIri = (0, relative_to_absolute_iri_1.resolve)(contextIri, baseIRI);\n }\n catch (_a) {\n throw new Error(`Invalid context IRI: ${contextIri}`);\n }\n }\n // TODO: Temporary workaround for fixing schema.org CORS issues (https://github.com/schemaorg/schemaorg/issues/2578#issuecomment-652324465)\n if (this.redirectSchemaOrgHttps && contextIri.startsWith('http://schema.org')) {\n contextIri = 'https://schema.org/';\n }\n return contextIri;\n }\n /**\n * Parse scoped contexts in the given context.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @param {IParseOptions} options Parsing options.\n * @return {IJsonLdContextNormalizedRaw} The mutated input context.\n * @param {string[]} keys Optional set of keys from the context to parseInnerContexts of. If left undefined, all\n * keys in the context will be iterated over.\n */\n async parseInnerContexts(context, options, keys) {\n for (const key of (keys !== null && keys !== void 0 ? keys : Object.keys(context))) {\n const value = context[key];\n if (value && typeof value === 'object') {\n if ('@context' in value && value['@context'] !== null && !options.ignoreScopedContexts) {\n // Simulate a processing based on the parent context to check if there are any (potential errors).\n // Honestly, I find it a bit weird to do this here, as the context may be unused,\n // and the final effective context may differ based on any other embedded/scoped contexts.\n // But hey, it's part of the spec, so we have no choice...\n // https://w3c.github.io/json-ld-api/#h-note-10\n if (this.validateContext) {\n try {\n const parentContext = Object.assign(Object.assign({}, context), { [key]: Object.assign({}, context[key]) });\n delete parentContext[key]['@context'];\n await this.parse(value['@context'], Object.assign(Object.assign({}, options), { external: false, parentContext, ignoreProtection: true, ignoreRemoteScopedContexts: true, ignoreScopedContexts: true }));\n }\n catch (e) {\n throw new ErrorCoded_1.ErrorCoded(e.message, ErrorCoded_1.ERROR_CODES.INVALID_SCOPED_CONTEXT);\n }\n }\n context[key] = Object.assign(Object.assign({}, value), { '@context': (await this.parse(value['@context'], Object.assign(Object.assign({}, options), { external: false, minimalProcessing: true, ignoreRemoteScopedContexts: true, parentContext: context })))\n .getContextRaw() });\n }\n }\n }\n return context;\n }\n async parse(context, options = {}, \n // These options are only for internal use on recursive calls and should not be used by\n // libraries consuming this function\n internalOptions = {}) {\n const { baseIRI, parentContext, external, processingMode = ContextParser.DEFAULT_PROCESSING_MODE, normalizeLanguageTags, ignoreProtection, minimalProcessing, } = options;\n const remoteContexts = options.remoteContexts || {};\n // Avoid remote context overflows\n if (Object.keys(remoteContexts).length >= this.remoteContextsDepthLimit) {\n throw new ErrorCoded_1.ErrorCoded('Detected an overflow in remote context inclusions: ' + Object.keys(remoteContexts), ErrorCoded_1.ERROR_CODES.CONTEXT_OVERFLOW);\n }\n if (context === null || context === undefined) {\n // Don't allow context nullification and there are protected terms\n if (!ignoreProtection && parentContext && Util_1.Util.hasProtectedTerms(parentContext)) {\n throw new ErrorCoded_1.ErrorCoded('Illegal context nullification when terms are protected', ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_NULLIFICATION);\n }\n // Context that are explicitly set to null are empty.\n return new JsonLdContextNormalized_1.JsonLdContextNormalized(this.applyBaseEntry({}, options, false));\n }\n else if (typeof context === 'string') {\n const contextIri = this.normalizeContextIri(context, baseIRI);\n const overriddenLoad = this.getOverriddenLoad(contextIri, options);\n if (overriddenLoad) {\n return new JsonLdContextNormalized_1.JsonLdContextNormalized(overriddenLoad);\n }\n const parsedStringContext = await this.parse(await this.load(contextIri), Object.assign(Object.assign({}, options), { baseIRI: contextIri, external: true, remoteContexts: Object.assign(Object.assign({}, remoteContexts), { [contextIri]: true }) }));\n this.applyBaseEntry(parsedStringContext.getContextRaw(), options, true);\n return parsedStringContext;\n }\n else if (Array.isArray(context)) {\n // As a performance consideration, first load all external contexts in parallel.\n const contextIris = [];\n const contexts = await Promise.all(context.map((subContext, i) => {\n if (typeof subContext === 'string') {\n const contextIri = this.normalizeContextIri(subContext, baseIRI);\n contextIris[i] = contextIri;\n const overriddenLoad = this.getOverriddenLoad(contextIri, options);\n if (overriddenLoad) {\n return overriddenLoad;\n }\n return this.load(contextIri);\n }\n else {\n return subContext;\n }\n }));\n // Don't apply inheritance logic on minimal processing\n if (minimalProcessing) {\n return new JsonLdContextNormalized_1.JsonLdContextNormalized(contexts);\n }\n const reducedContexts = await contexts.reduce((accContextPromise, contextEntry, i) => accContextPromise\n .then((accContext) => this.parse(contextEntry, Object.assign(Object.assign({}, options), { baseIRI: contextIris[i] || options.baseIRI, external: !!contextIris[i] || options.external, parentContext: accContext.getContextRaw(), remoteContexts: contextIris[i] ? Object.assign(Object.assign({}, remoteContexts), { [contextIris[i]]: true }) : remoteContexts }), \n // @ts-expect-error: This third argument causes a type error because we have hidden it from consumers\n {\n skipValidation: i < contexts.length - 1,\n })), Promise.resolve(new JsonLdContextNormalized_1.JsonLdContextNormalized(parentContext || {})));\n // Override the base IRI if provided.\n this.applyBaseEntry(reducedContexts.getContextRaw(), options, true);\n return reducedContexts;\n }\n else if (typeof context === 'object') {\n if ('@context' in context) {\n return await this.parse(context['@context'], options);\n }\n // Make a deep clone of the given context, to avoid modifying it.\n context = Object.assign({}, context);\n // According to the JSON-LD spec, @base must be ignored from external contexts.\n if (external) {\n delete context['@base'];\n }\n // Override the base IRI if provided.\n this.applyBaseEntry(context, options, true);\n // Hashify container entries\n // Do this before protected term validation as that influences term format\n this.containersToHash(context);\n // Don't perform any other modifications if only minimal processing is needed.\n if (minimalProcessing) {\n return new JsonLdContextNormalized_1.JsonLdContextNormalized(context);\n }\n // In JSON-LD 1.1, load @import'ed context prior to processing.\n let importContext = {};\n if ('@import' in context) {\n if (processingMode >= 1.1) {\n // Only accept string values\n if (typeof context['@import'] !== 'string') {\n throw new ErrorCoded_1.ErrorCoded('An @import value must be a string, but got ' + typeof context['@import'], ErrorCoded_1.ERROR_CODES.INVALID_IMPORT_VALUE);\n }\n // Load context\n importContext = await this.loadImportContext(this.normalizeContextIri(context['@import'], baseIRI));\n delete context['@import'];\n }\n else {\n throw new ErrorCoded_1.ErrorCoded('Context importing is not supported in JSON-LD 1.0', ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_ENTRY);\n }\n }\n this.applyScopedProtected(importContext, { processingMode }, JsonLdContextNormalized_1.defaultExpandOptions);\n const newContext = Object.assign(importContext, context);\n // Handle terms (before protection checks)\n this.idifyReverseTerms(newContext);\n this.normalize(newContext, { processingMode, normalizeLanguageTags });\n this.applyScopedProtected(newContext, { processingMode }, JsonLdContextNormalized_1.defaultExpandOptions);\n const keys = Object.keys(newContext);\n const overlappingKeys = [];\n if (typeof parentContext === 'object') {\n // Merge different parts of the final context in order\n for (const key in parentContext) {\n if (key in newContext) {\n overlappingKeys.push(key);\n }\n else {\n newContext[key] = parentContext[key];\n }\n }\n }\n // Parse inner contexts with minimal processing\n await this.parseInnerContexts(newContext, options, keys);\n const newContextWrapped = new JsonLdContextNormalized_1.JsonLdContextNormalized(newContext);\n // In JSON-LD 1.1, @vocab can be relative to @vocab in the parent context, or a compact IRI.\n if ((newContext && newContext['@version'] || ContextParser.DEFAULT_PROCESSING_MODE) >= 1.1\n && ((context['@vocab'] && typeof context['@vocab'] === 'string') || context['@vocab'] === '')) {\n if (parentContext && '@vocab' in parentContext && context['@vocab'].indexOf(':') < 0) {\n newContext['@vocab'] = parentContext['@vocab'] + context['@vocab'];\n }\n else if (Util_1.Util.isCompactIri(context['@vocab']) || context['@vocab'] in newContext) {\n // @vocab is a compact IRI or refers exactly to a prefix\n newContext['@vocab'] = newContextWrapped.expandTerm(context['@vocab'], true);\n }\n }\n this.expandPrefixedTerms(newContextWrapped, this.expandContentTypeToBase, keys);\n // In JSON-LD 1.1, check if we are not redefining any protected keywords\n if (!ignoreProtection && parentContext && processingMode >= 1.1) {\n this.validateKeywordRedefinitions(parentContext, newContext, JsonLdContextNormalized_1.defaultExpandOptions, overlappingKeys);\n }\n if (this.validateContext && !internalOptions.skipValidation) {\n this.validate(newContext, { processingMode });\n }\n return newContextWrapped;\n }\n else {\n throw new ErrorCoded_1.ErrorCoded(`Tried parsing a context that is not a string, array or object, but got ${context}`, ErrorCoded_1.ERROR_CODES.INVALID_LOCAL_CONTEXT);\n }\n }\n /**\n * Fetch the given URL as a raw JSON-LD context.\n * @param url An URL.\n * @return A promise resolving to a raw JSON-LD context.\n */\n async load(url) {\n // First try to retrieve the context from cache\n const cached = this.documentCache[url];\n if (cached) {\n return cached;\n }\n // If not in cache, load it\n let document;\n try {\n document = await this.documentLoader.load(url);\n }\n catch (e) {\n throw new ErrorCoded_1.ErrorCoded(`Failed to load remote context ${url}: ${e.message}`, ErrorCoded_1.ERROR_CODES.LOADING_REMOTE_CONTEXT_FAILED);\n }\n // Validate the context\n if (!('@context' in document)) {\n throw new ErrorCoded_1.ErrorCoded(`Missing @context in remote context at ${url}`, ErrorCoded_1.ERROR_CODES.INVALID_REMOTE_CONTEXT);\n }\n return this.documentCache[url] = document['@context'];\n }\n /**\n * Override the given context that may be loaded.\n *\n * This will check whether or not the url is recursively being loaded.\n * @param url An URL.\n * @param options Parsing options.\n * @return An overridden context, or null.\n * Optionally an error can be thrown if a cyclic context is detected.\n */\n getOverriddenLoad(url, options) {\n if (url in (options.remoteContexts || {})) {\n if (options.ignoreRemoteScopedContexts) {\n return url;\n }\n else {\n throw new ErrorCoded_1.ErrorCoded('Detected a cyclic context inclusion of ' + url, ErrorCoded_1.ERROR_CODES.RECURSIVE_CONTEXT_INCLUSION);\n }\n }\n return null;\n }\n /**\n * Load an @import'ed context.\n * @param importContextIri The full URI of an @import value.\n */\n async loadImportContext(importContextIri) {\n // Load the context - and do a deep clone since we are about to mutate it\n let importContext = await this.load(importContextIri);\n // Require the context to be a non-array object\n if (typeof importContext !== 'object' || Array.isArray(importContext)) {\n throw new ErrorCoded_1.ErrorCoded('An imported context must be a single object: ' + importContextIri, ErrorCoded_1.ERROR_CODES.INVALID_REMOTE_CONTEXT);\n }\n // Error if the context contains another @import\n if ('@import' in importContext) {\n throw new ErrorCoded_1.ErrorCoded('An imported context can not import another context: ' + importContextIri, ErrorCoded_1.ERROR_CODES.INVALID_CONTEXT_ENTRY);\n }\n importContext = Object.assign({}, importContext);\n // Containers have to be converted into hash values the same way as for the importing context\n // Otherwise context validation will fail for container values\n this.containersToHash(importContext);\n return importContext;\n }\n}\nContextParser.DEFAULT_PROCESSING_MODE = 1.1;\nexports.ContextParser = ContextParser;\n//# sourceMappingURL=ContextParser.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ERROR_CODES = exports.ErrorCoded = void 0;\n/**\n * An error that has a certain error code.\n *\n * The error code can be any string.\n * All standardized error codes are listed in {@link ERROR_CODES}.\n */\nclass ErrorCoded extends Error {\n /* istanbul ignore next */\n constructor(message, code) {\n super(message);\n this.code = code;\n }\n}\nexports.ErrorCoded = ErrorCoded;\n/**\n * All standardized JSON-LD error codes.\n * @see https://w3c.github.io/json-ld-api/#dom-jsonlderrorcode\n */\n// tslint:disable:object-literal-sort-keys\nvar ERROR_CODES;\n(function (ERROR_CODES) {\n ERROR_CODES[\"COLLIDING_KEYWORDS\"] = \"colliding keywords\";\n ERROR_CODES[\"CONFLICTING_INDEXES\"] = \"conflicting indexes\";\n ERROR_CODES[\"CYCLIC_IRI_MAPPING\"] = \"cyclic IRI mapping\";\n ERROR_CODES[\"INVALID_ID_VALUE\"] = \"invalid @id value\";\n ERROR_CODES[\"INVALID_INDEX_VALUE\"] = \"invalid @index value\";\n ERROR_CODES[\"INVALID_NEST_VALUE\"] = \"invalid @nest value\";\n ERROR_CODES[\"INVALID_PREFIX_VALUE\"] = \"invalid @prefix value\";\n ERROR_CODES[\"INVALID_PROPAGATE_VALUE\"] = \"invalid @propagate value\";\n ERROR_CODES[\"INVALID_REVERSE_VALUE\"] = \"invalid @reverse value\";\n ERROR_CODES[\"INVALID_IMPORT_VALUE\"] = \"invalid @import value\";\n ERROR_CODES[\"INVALID_VERSION_VALUE\"] = \"invalid @version value\";\n ERROR_CODES[\"INVALID_BASE_IRI\"] = \"invalid base IRI\";\n ERROR_CODES[\"INVALID_CONTAINER_MAPPING\"] = \"invalid container mapping\";\n ERROR_CODES[\"INVALID_CONTEXT_ENTRY\"] = \"invalid context entry\";\n ERROR_CODES[\"INVALID_CONTEXT_NULLIFICATION\"] = \"invalid context nullification\";\n ERROR_CODES[\"INVALID_DEFAULT_LANGUAGE\"] = \"invalid default language\";\n ERROR_CODES[\"INVALID_INCLUDED_VALUE\"] = \"invalid @included value\";\n ERROR_CODES[\"INVALID_IRI_MAPPING\"] = \"invalid IRI mapping\";\n ERROR_CODES[\"INVALID_JSON_LITERAL\"] = \"invalid JSON literal\";\n ERROR_CODES[\"INVALID_KEYWORD_ALIAS\"] = \"invalid keyword alias\";\n ERROR_CODES[\"INVALID_LANGUAGE_MAP_VALUE\"] = \"invalid language map value\";\n ERROR_CODES[\"INVALID_LANGUAGE_MAPPING\"] = \"invalid language mapping\";\n ERROR_CODES[\"INVALID_LANGUAGE_TAGGED_STRING\"] = \"invalid language-tagged string\";\n ERROR_CODES[\"INVALID_LANGUAGE_TAGGED_VALUE\"] = \"invalid language-tagged value\";\n ERROR_CODES[\"INVALID_LOCAL_CONTEXT\"] = \"invalid local context\";\n ERROR_CODES[\"INVALID_REMOTE_CONTEXT\"] = \"invalid remote context\";\n ERROR_CODES[\"INVALID_REVERSE_PROPERTY\"] = \"invalid reverse property\";\n ERROR_CODES[\"INVALID_REVERSE_PROPERTY_MAP\"] = \"invalid reverse property map\";\n ERROR_CODES[\"INVALID_REVERSE_PROPERTY_VALUE\"] = \"invalid reverse property value\";\n ERROR_CODES[\"INVALID_SCOPED_CONTEXT\"] = \"invalid scoped context\";\n ERROR_CODES[\"INVALID_SCRIPT_ELEMENT\"] = \"invalid script element\";\n ERROR_CODES[\"INVALID_SET_OR_LIST_OBJECT\"] = \"invalid set or list object\";\n ERROR_CODES[\"INVALID_TERM_DEFINITION\"] = \"invalid term definition\";\n ERROR_CODES[\"INVALID_TYPE_MAPPING\"] = \"invalid type mapping\";\n ERROR_CODES[\"INVALID_TYPE_VALUE\"] = \"invalid type value\";\n ERROR_CODES[\"INVALID_TYPED_VALUE\"] = \"invalid typed value\";\n ERROR_CODES[\"INVALID_VALUE_OBJECT\"] = \"invalid value object\";\n ERROR_CODES[\"INVALID_VALUE_OBJECT_VALUE\"] = \"invalid value object value\";\n ERROR_CODES[\"INVALID_VOCAB_MAPPING\"] = \"invalid vocab mapping\";\n ERROR_CODES[\"IRI_CONFUSED_WITH_PREFIX\"] = \"IRI confused with prefix\";\n ERROR_CODES[\"KEYWORD_REDEFINITION\"] = \"keyword redefinition\";\n ERROR_CODES[\"LOADING_DOCUMENT_FAILED\"] = \"loading document failed\";\n ERROR_CODES[\"LOADING_REMOTE_CONTEXT_FAILED\"] = \"loading remote context failed\";\n ERROR_CODES[\"MULTIPLE_CONTEXT_LINK_HEADERS\"] = \"multiple context link headers\";\n ERROR_CODES[\"PROCESSING_MODE_CONFLICT\"] = \"processing mode conflict\";\n ERROR_CODES[\"PROTECTED_TERM_REDEFINITION\"] = \"protected term redefinition\";\n ERROR_CODES[\"CONTEXT_OVERFLOW\"] = \"context overflow\";\n ERROR_CODES[\"INVALID_BASE_DIRECTION\"] = \"invalid base direction\";\n ERROR_CODES[\"RECURSIVE_CONTEXT_INCLUSION\"] = \"recursive context inclusion\";\n ERROR_CODES[\"INVALID_STREAMING_KEY_ORDER\"] = \"invalid streaming key order\";\n /**\n * JSON-LD-star\n */\n ERROR_CODES[\"INVALID_EMBEDDED_NODE\"] = \"invalid embedded node\";\n ERROR_CODES[\"INVALID_ANNOTATION\"] = \"invalid annotation\";\n})(ERROR_CODES = exports.ERROR_CODES || (exports.ERROR_CODES = {}));\n//# sourceMappingURL=ErrorCoded.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FetchDocumentLoader = void 0;\nrequire(\"cross-fetch/polyfill\");\nconst ErrorCoded_1 = require(\"./ErrorCoded\");\nconst http_link_header_1 = require(\"http-link-header\");\nconst relative_to_absolute_iri_1 = require(\"relative-to-absolute-iri\");\n/**\n * Loads documents via the fetch API.\n */\nclass FetchDocumentLoader {\n constructor(fetcher) {\n this.fetcher = fetcher;\n }\n async load(url) {\n const response = await (this.fetcher || fetch)(url, { headers: new Headers({ accept: 'application/ld+json' }) });\n if (response.ok && response.headers) {\n let mediaType = response.headers.get('Content-Type');\n if (mediaType) {\n const colonPos = mediaType.indexOf(';');\n if (colonPos > 0) {\n mediaType = mediaType.substr(0, colonPos);\n }\n }\n if (mediaType === 'application/ld+json') {\n // Return JSON-LD if proper content type was returned\n return (await response.json());\n }\n else {\n // Check for alternate link for a non-JSON-LD response\n if (response.headers.has('Link')) {\n let alternateUrl;\n response.headers.forEach((value, key) => {\n if (key === 'link') {\n const linkHeader = (0, http_link_header_1.parse)(value);\n for (const link of linkHeader.get('type', 'application/ld+json')) {\n if (link.rel === 'alternate') {\n if (alternateUrl) {\n throw new Error('Multiple JSON-LD alternate links were found on ' + url);\n }\n alternateUrl = (0, relative_to_absolute_iri_1.resolve)(link.uri, url);\n }\n }\n }\n });\n if (alternateUrl) {\n return this.load(alternateUrl);\n }\n }\n throw new ErrorCoded_1.ErrorCoded(`Unsupported JSON-LD media type ${mediaType}`, ErrorCoded_1.ERROR_CODES.LOADING_DOCUMENT_FAILED);\n }\n }\n else {\n throw new Error(response.statusText || `Status code: ${response.status}`);\n }\n }\n}\nexports.FetchDocumentLoader = FetchDocumentLoader;\n//# sourceMappingURL=FetchDocumentLoader.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=IDocumentLoader.js.map","\"use strict\";\n// tslint:disable:max-line-length\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=JsonLdContext.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.defaultExpandOptions = exports.JsonLdContextNormalized = void 0;\nconst relative_to_absolute_iri_1 = require(\"relative-to-absolute-iri\");\nconst ErrorCoded_1 = require(\"./ErrorCoded\");\nconst Util_1 = require(\"./Util\");\n/**\n * A class exposing operations over a normalized JSON-LD context.\n */\nclass JsonLdContextNormalized {\n constructor(contextRaw) {\n this.contextRaw = contextRaw;\n }\n /**\n * @return The raw inner context.\n */\n getContextRaw() {\n return this.contextRaw;\n }\n /**\n * Expand the term or prefix of the given term if it has one,\n * otherwise return the term as-is.\n *\n * This will try to expand the IRI as much as possible.\n *\n * Iff in vocab-mode, then other references to other terms in the context can be used,\n * such as to `myTerm`:\n * ```\n * {\n * \"myTerm\": \"http://example.org/myLongTerm\"\n * }\n * ```\n *\n * @param {string} term A term that is an URL or a prefixed URL.\n * @param {boolean} expandVocab If the term is a predicate or type and should be expanded based on @vocab,\n * otherwise it is considered a regular term that is expanded based on @base.\n * @param {IExpandOptions} options Options that define the way how expansion must be done.\n * @return {string} The expanded term, the term as-is, or null if it was explicitly disabled in the context.\n * @throws If the term is aliased to an invalid value (not a string, IRI or keyword).\n */\n expandTerm(term, expandVocab, options = exports.defaultExpandOptions) {\n const contextValue = this.contextRaw[term];\n // Immediately return if the term was disabled in the context\n if (contextValue === null || (contextValue && contextValue['@id'] === null)) {\n return null;\n }\n // Check the @id\n let validIriMapping = true;\n if (contextValue && expandVocab) {\n const value = Util_1.Util.getContextValueId(contextValue);\n if (value && value !== term) {\n if (typeof value !== 'string' || (!Util_1.Util.isValidIri(value) && !Util_1.Util.isValidKeyword(value))) {\n // Don't mark this mapping as invalid if we have an unknown keyword, but of the correct form.\n if (!Util_1.Util.isPotentialKeyword(value)) {\n validIriMapping = false;\n }\n }\n else {\n return value;\n }\n }\n }\n // Check if the term is prefixed\n const prefix = Util_1.Util.getPrefix(term, this.contextRaw);\n const vocab = this.contextRaw['@vocab'];\n const vocabRelative = (!!vocab || vocab === '') && vocab.indexOf(':') < 0;\n const base = this.contextRaw['@base'];\n const potentialKeyword = Util_1.Util.isPotentialKeyword(term);\n if (prefix) {\n const contextPrefixValue = this.contextRaw[prefix];\n const value = Util_1.Util.getContextValueId(contextPrefixValue);\n if (value) {\n if (typeof contextPrefixValue === 'string' || !options.allowPrefixForcing) {\n // If we have a simple term definition,\n // check the last character of the prefix to determine whether or not it is a prefix.\n // Validate that prefix ends with gen-delim character, unless @prefix is true\n if (!Util_1.Util.isSimpleTermDefinitionPrefix(value, options)) {\n // Treat the term as an absolute IRI\n return term;\n }\n }\n else {\n // If we have an expanded term definition, default to @prefix: false\n if (value[0] !== '_' && !potentialKeyword && !contextPrefixValue['@prefix'] && !(term in this.contextRaw)) {\n // Treat the term as an absolute IRI\n return term;\n }\n }\n return value + term.substr(prefix.length + 1);\n }\n }\n else if (expandVocab && ((vocab || vocab === '') || (options.allowVocabRelativeToBase && (base && vocabRelative)))\n && !potentialKeyword && !Util_1.Util.isCompactIri(term)) {\n if (vocabRelative) {\n if (options.allowVocabRelativeToBase) {\n return ((vocab || base) ? (0, relative_to_absolute_iri_1.resolve)(vocab, base) : '') + term;\n }\n else {\n throw new ErrorCoded_1.ErrorCoded(`Relative vocab expansion for term '${term}' with vocab '${vocab}' is not allowed.`, ErrorCoded_1.ERROR_CODES.INVALID_VOCAB_MAPPING);\n }\n }\n else {\n return vocab + term;\n }\n }\n else if (!expandVocab && base && !potentialKeyword && !Util_1.Util.isCompactIri(term)) {\n return (0, relative_to_absolute_iri_1.resolve)(term, base);\n }\n // Return the term as-is, unless we discovered an invalid IRI mapping for this term in the context earlier.\n if (validIriMapping) {\n return term;\n }\n else {\n throw new ErrorCoded_1.ErrorCoded(`Invalid IRI mapping found for context entry '${term}': '${JSON.stringify(contextValue)}'`, ErrorCoded_1.ERROR_CODES.INVALID_IRI_MAPPING);\n }\n }\n /**\n * Compact the given term using @base, @vocab, an aliased term, or a prefixed term.\n *\n * This will try to compact the IRI as much as possible.\n *\n * @param {string} iri An IRI to compact.\n * @param {boolean} vocab If the term is a predicate or type and should be compacted based on @vocab,\n * otherwise it is considered a regular term that is compacted based on @base.\n * @return {string} The compacted term or the IRI as-is.\n */\n compactIri(iri, vocab) {\n // Try @vocab compacting\n if (vocab && this.contextRaw['@vocab'] && iri.startsWith(this.contextRaw['@vocab'])) {\n return iri.substr(this.contextRaw['@vocab'].length);\n }\n // Try @base compacting\n if (!vocab && this.contextRaw['@base'] && iri.startsWith(this.contextRaw['@base'])) {\n return iri.substr(this.contextRaw['@base'].length);\n }\n // Loop over all terms in the context\n // This will try to prefix as short as possible.\n // Once a fully compacted alias is found, return immediately, as we can not go any shorter.\n const shortestPrefixing = { prefix: '', suffix: iri };\n for (const key in this.contextRaw) {\n const value = this.contextRaw[key];\n if (value && !Util_1.Util.isPotentialKeyword(key)) {\n const contextIri = Util_1.Util.getContextValueId(value);\n if (iri.startsWith(contextIri)) {\n const suffix = iri.substr(contextIri.length);\n if (!suffix) {\n if (vocab) {\n // Immediately return on compacted alias\n return key;\n }\n }\n else if (suffix.length < shortestPrefixing.suffix.length) {\n // Overwrite the shortest prefix\n shortestPrefixing.prefix = key;\n shortestPrefixing.suffix = suffix;\n }\n }\n }\n }\n // Return the shortest prefix\n if (shortestPrefixing.prefix) {\n return shortestPrefixing.prefix + ':' + shortestPrefixing.suffix;\n }\n return iri;\n }\n}\nexports.JsonLdContextNormalized = JsonLdContextNormalized;\nexports.defaultExpandOptions = {\n allowPrefixForcing: true,\n allowPrefixNonGenDelims: false,\n allowVocabRelativeToBase: true,\n};\n//# sourceMappingURL=JsonLdContextNormalized.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Util = void 0;\nclass Util {\n /**\n * Check if the given term is a valid compact IRI.\n * Otherwise, it may be an IRI.\n * @param {string} term A term.\n * @return {boolean} If it is a compact IRI.\n */\n static isCompactIri(term) {\n return term.indexOf(':') > 0 && !(term && term[0] === '#');\n }\n /**\n * Get the prefix from the given term.\n * @see https://json-ld.org/spec/latest/json-ld/#compact-iris\n * @param {string} term A term that is an URL or a prefixed URL.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @return {string} The prefix or null.\n */\n static getPrefix(term, context) {\n // Do not consider relative IRIs starting with a hash as compact IRIs\n if (term && term[0] === '#') {\n return null;\n }\n const separatorPos = term.indexOf(':');\n if (separatorPos >= 0) {\n // Suffix can not begin with two slashes\n if (term.length > separatorPos + 1\n && term.charAt(separatorPos + 1) === '/'\n && term.charAt(separatorPos + 2) === '/') {\n return null;\n }\n const prefix = term.substr(0, separatorPos);\n // Prefix can not be an underscore (this is a blank node)\n if (prefix === '_') {\n return null;\n }\n // Prefix must match a term in the active context\n if (context[prefix]) {\n return prefix;\n }\n }\n return null;\n }\n /**\n * From a given context entry value, get the string value, or the @id field.\n * @param contextValue A value for a term in a context.\n * @return {string} The id value, or null.\n */\n static getContextValueId(contextValue) {\n if (contextValue === null || typeof contextValue === 'string') {\n return contextValue;\n }\n const id = contextValue['@id'];\n return id ? id : null;\n }\n /**\n * Check if the given simple term definition (string-based value of a context term)\n * should be considered a prefix.\n * @param value A simple term definition value.\n * @param options Options that define the way how expansion must be done.\n */\n static isSimpleTermDefinitionPrefix(value, options) {\n return !Util.isPotentialKeyword(value)\n && (options.allowPrefixNonGenDelims || (typeof value === 'string' && (value[0] === '_' || Util.isPrefixIriEndingWithGenDelim(value))));\n }\n /**\n * Check if the given keyword is of the keyword format \"@\"1*ALPHA.\n * @param {string} keyword A potential keyword.\n * @return {boolean} If the given keyword is of the keyword format.\n */\n static isPotentialKeyword(keyword) {\n return typeof keyword === 'string' && Util.KEYWORD_REGEX.test(keyword);\n }\n /**\n * Check if the given prefix ends with a gen-delim character.\n * @param {string} prefixIri A prefix IRI.\n * @return {boolean} If the given prefix IRI is valid.\n */\n static isPrefixIriEndingWithGenDelim(prefixIri) {\n return Util.ENDS_WITH_GEN_DELIM.test(prefixIri);\n }\n /**\n * Check if the given context value can be a prefix value.\n * @param value A context value.\n * @return {boolean} If it can be a prefix value.\n */\n static isPrefixValue(value) {\n return value && (typeof value === 'string' || (value && typeof value === 'object'));\n }\n /**\n * Check if the given IRI is valid.\n * @param {string} iri A potential IRI.\n * @return {boolean} If the given IRI is valid.\n */\n static isValidIri(iri) {\n return Boolean(iri && Util.IRI_REGEX.test(iri));\n }\n /**\n * Check if the given IRI is valid, this includes the possibility of being a relative IRI.\n * @param {string} iri A potential IRI.\n * @return {boolean} If the given IRI is valid.\n */\n static isValidIriWeak(iri) {\n return !!iri && iri[0] !== ':' && Util.IRI_REGEX_WEAK.test(iri);\n }\n /**\n * Check if the given keyword is a defined according to the JSON-LD specification.\n * @param {string} keyword A potential keyword.\n * @return {boolean} If the given keyword is valid.\n */\n static isValidKeyword(keyword) {\n return Util.VALID_KEYWORDS[keyword];\n }\n /**\n * Check if the given term is protected in the context.\n * @param {IJsonLdContextNormalizedRaw} context A context.\n * @param {string} key A context term.\n * @return {boolean} If the given term has an @protected flag.\n */\n static isTermProtected(context, key) {\n const value = context[key];\n return !(typeof value === 'string') && value && value['@protected'];\n }\n /**\n * Check if the given context has at least one protected term.\n * @param context A context.\n * @return If the context has a protected term.\n */\n static hasProtectedTerms(context) {\n for (const key of Object.keys(context)) {\n if (Util.isTermProtected(context, key)) {\n return true;\n }\n }\n return false;\n }\n /**\n * Check if the given key is an internal reserved keyword.\n * @param key A context key.\n */\n static isReservedInternalKeyword(key) {\n return key.startsWith('@__');\n }\n /**\n * Check if two objects are deepEqual to on another.\n * @param object1 The first object to test.\n * @param object2 The second object to test.\n */\n static deepEqual(object1, object2) {\n const objKeys1 = Object.keys(object1);\n const objKeys2 = Object.keys(object2);\n if (objKeys1.length !== objKeys2.length)\n return false;\n return objKeys1.every((key) => {\n const value1 = object1[key];\n const value2 = object2[key];\n return (value1 === value2) || (value1 !== null &&\n value2 !== null &&\n typeof value1 === \"object\" &&\n typeof value2 === \"object\" &&\n this.deepEqual(value1, value2));\n });\n }\n ;\n}\n// Regex for valid IRIs\nUtil.IRI_REGEX = /^([A-Za-z][A-Za-z0-9+-.]*|_):[^ \"<>{}|\\\\\\[\\]`#]*(#[^#]*)?$/;\n// Weaker regex for valid IRIs, this includes relative IRIs\nUtil.IRI_REGEX_WEAK = /(?::[^:])|\\//;\n// Regex for keyword form\nUtil.KEYWORD_REGEX = /^@[a-z]+$/i;\n// Regex to see if an IRI ends with a gen-delim character (see RFC 3986)\nUtil.ENDS_WITH_GEN_DELIM = /[:/?#\\[\\]@]$/;\n// Regex for language tags\nUtil.REGEX_LANGUAGE_TAG = /^[a-zA-Z]+(-[a-zA-Z0-9]+)*$/;\n// Regex for base directions\nUtil.REGEX_DIRECTION_TAG = /^(ltr)|(rtl)$/;\n// All known valid JSON-LD keywords\n// @see https://www.w3.org/TR/json-ld11/#keywords\nUtil.VALID_KEYWORDS = {\n '@annotation': true,\n '@base': true,\n '@container': true,\n '@context': true,\n '@direction': true,\n '@graph': true,\n '@id': true,\n '@import': true,\n '@included': true,\n '@index': true,\n '@json': true,\n '@language': true,\n '@list': true,\n '@nest': true,\n '@none': true,\n '@prefix': true,\n '@propagate': true,\n '@protected': true,\n '@reverse': true,\n '@set': true,\n '@type': true,\n '@value': true,\n '@version': true,\n '@vocab': true,\n};\n// Keys in the contexts that will not be expanded based on the base IRI\nUtil.EXPAND_KEYS_BLACKLIST = [\n '@base',\n '@vocab',\n '@language',\n '@version',\n '@direction',\n];\n// Keys in the contexts that may not be aliased from\nUtil.ALIAS_DOMAIN_BLACKLIST = [\n '@container',\n '@graph',\n '@id',\n '@index',\n '@list',\n '@nest',\n '@none',\n '@prefix',\n '@reverse',\n '@set',\n '@type',\n '@value',\n '@version',\n];\n// Keys in the contexts that may not be aliased to\nUtil.ALIAS_RANGE_BLACKLIST = [\n '@context',\n '@preserve',\n];\n// All valid @container values\nUtil.CONTAINERS = [\n '@list',\n '@set',\n '@index',\n '@language',\n '@graph',\n '@id',\n '@type',\n];\n// All valid @container values under processing mode 1.0\nUtil.CONTAINERS_1_0 = [\n '@list',\n '@set',\n '@index',\n];\nexports.Util = Util;\n//# sourceMappingURL=Util.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./lib/JsonLdParser\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ContextTree = void 0;\n/**\n * A tree structure that holds all contexts,\n * based on their position in the JSON object.\n *\n * Positions are identified by a path of keys.\n */\nclass ContextTree {\n constructor() {\n this.subTrees = {};\n }\n getContext(keys) {\n if (keys.length > 0) {\n const [head, ...tail] = keys;\n const subTree = this.subTrees[head];\n if (subTree) {\n const subContext = subTree.getContext(tail);\n if (subContext) {\n return subContext.then(({ context, depth }) => ({ context, depth: depth + 1 }));\n }\n }\n }\n return this.context ? this.context.then((context) => ({ context, depth: 0 })) : null;\n }\n setContext(keys, context) {\n if (keys.length === 0) {\n this.context = context;\n }\n else {\n const [head, ...tail] = keys;\n let subTree = this.subTrees[head];\n if (!subTree) {\n subTree = this.subTrees[head] = new ContextTree();\n }\n subTree.setContext(tail, context);\n }\n }\n removeContext(path) {\n this.setContext(path, null);\n }\n}\nexports.ContextTree = ContextTree;\n//# sourceMappingURL=ContextTree.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.JsonLdParser = void 0;\n// tslint:disable-next-line:no-var-requires\nconst Parser = require('@bergos/jsonparse');\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst readable_stream_1 = require(\"readable-stream\");\nconst EntryHandlerArrayValue_1 = require(\"./entryhandler/EntryHandlerArrayValue\");\nconst EntryHandlerContainer_1 = require(\"./entryhandler/EntryHandlerContainer\");\nconst EntryHandlerInvalidFallback_1 = require(\"./entryhandler/EntryHandlerInvalidFallback\");\nconst EntryHandlerPredicate_1 = require(\"./entryhandler/EntryHandlerPredicate\");\nconst EntryHandlerKeywordContext_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordContext\");\nconst EntryHandlerKeywordGraph_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordGraph\");\nconst EntryHandlerKeywordId_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordId\");\nconst EntryHandlerKeywordIncluded_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordIncluded\");\nconst EntryHandlerKeywordNest_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordNest\");\nconst EntryHandlerKeywordType_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordType\");\nconst EntryHandlerKeywordUnknownFallback_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordUnknownFallback\");\nconst EntryHandlerKeywordValue_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordValue\");\nconst ParsingContext_1 = require(\"./ParsingContext\");\nconst Util_1 = require(\"./Util\");\nconst http_link_header_1 = require(\"http-link-header\");\nconst EntryHandlerKeywordAnnotation_1 = require(\"./entryhandler/keyword/EntryHandlerKeywordAnnotation\");\n/**\n * A stream transformer that parses JSON-LD (text) streams to an {@link RDF.Stream}.\n */\nclass JsonLdParser extends readable_stream_1.Transform {\n constructor(options) {\n super({ readableObjectMode: true });\n options = options || {};\n this.options = options;\n this.parsingContext = new ParsingContext_1.ParsingContext(Object.assign({ parser: this }, options));\n this.util = new Util_1.Util({ dataFactory: options.dataFactory, parsingContext: this.parsingContext });\n this.jsonParser = new Parser();\n this.contextJobs = [];\n this.typeJobs = [];\n this.contextAwaitingJobs = [];\n this.lastDepth = 0;\n this.lastKeys = [];\n this.lastOnValueJob = Promise.resolve();\n this.attachJsonParserListeners();\n this.on('end', () => {\n if (typeof this.jsonParser.mode !== 'undefined') {\n this.emit('error', new Error('Unclosed document'));\n }\n });\n }\n /**\n * Construct a JsonLdParser from the given HTTP response.\n *\n * This will throw an error if no valid JSON response is received\n * (application/ld+json, application/json, or something+json).\n *\n * For raw JSON responses, exactly one link header pointing to a JSON-LD context is required.\n *\n * This method is not responsible for handling redirects.\n *\n * @param baseIRI The URI of the received response.\n * @param mediaType The received content type.\n * @param headers Optional HTTP headers.\n * @param options Optional parser options.\n */\n static fromHttpResponse(baseIRI, mediaType, headers, options) {\n let context;\n // Special cases when receiving something else than the JSON-LD media type\n if (mediaType !== 'application/ld+json') {\n // Only accept JSON or JSON extension types\n if (mediaType !== 'application/json' && !mediaType.endsWith('+json')) {\n throw new jsonld_context_parser_1.ErrorCoded(`Unsupported JSON-LD media type ${mediaType}`, jsonld_context_parser_1.ERROR_CODES.LOADING_DOCUMENT_FAILED);\n }\n // We need exactly one JSON-LD context in the link header\n if (headers && headers.has('Link')) {\n headers.forEach((value, key) => {\n if (key === 'link') {\n const linkHeader = (0, http_link_header_1.parse)(value);\n for (const link of linkHeader.get('rel', 'http://www.w3.org/ns/json-ld#context')) {\n if (context) {\n throw new jsonld_context_parser_1.ErrorCoded('Multiple JSON-LD context link headers were found on ' + baseIRI, jsonld_context_parser_1.ERROR_CODES.MULTIPLE_CONTEXT_LINK_HEADERS);\n }\n context = link.uri;\n }\n }\n });\n }\n if (!context && !(options === null || options === void 0 ? void 0 : options.ignoreMissingContextLinkHeader)) {\n throw new jsonld_context_parser_1.ErrorCoded(`Missing context link header for media type ${mediaType} on ${baseIRI}`, jsonld_context_parser_1.ERROR_CODES.LOADING_DOCUMENT_FAILED);\n }\n }\n // Check if the streaming profile is present\n let streamingProfile;\n if (headers && headers.has('Content-Type')) {\n const contentType = headers.get('Content-Type');\n const match = /; *profile=([^\"]*)/.exec(contentType);\n if (match && match[1] === 'http://www.w3.org/ns/json-ld#streaming') {\n streamingProfile = true;\n }\n }\n return new JsonLdParser(Object.assign({ baseIRI,\n context,\n streamingProfile }, options ? options : {}));\n }\n /**\n * Parses the given text stream into a quad stream.\n * @param {NodeJS.EventEmitter} stream A text stream.\n * @return {RDF.Stream} A quad stream.\n */\n import(stream) {\n if ('pipe' in stream) {\n stream.on('error', (error) => parsed.emit('error', error));\n const parsed = stream.pipe(new JsonLdParser(this.options));\n return parsed;\n }\n else {\n const output = new readable_stream_1.PassThrough({ readableObjectMode: true });\n stream.on('error', (error) => parsed.emit('error', error));\n stream.on('data', (data) => output.push(data));\n stream.on('end', () => output.push(null));\n const parsed = output.pipe(new JsonLdParser(this.options));\n return parsed;\n }\n }\n _transform(chunk, encoding, callback) {\n this.jsonParser.write(chunk);\n this.lastOnValueJob\n .then(() => callback(), (error) => callback(error));\n }\n /**\n * Start a new job for parsing the given value.\n *\n * This will let the first valid {@link IEntryHandler} handle the entry.\n *\n * @param {any[]} keys The stack of keys.\n * @param value The value to parse.\n * @param {number} depth The depth to parse at.\n * @param {boolean} lastDepthCheck If the lastDepth check should be done for buffer draining.\n * @return {Promise} A promise resolving when the job is done.\n */\n async newOnValueJob(keys, value, depth, lastDepthCheck) {\n let flushStacks = true;\n // When we go up the stack, emit all unidentified values\n // We need to do this before the new job, because the new job may require determined values from the flushed jobs.\n if (lastDepthCheck && depth < this.lastDepth) {\n // Check if we had any RDF lists that need to be terminated with an rdf:nil\n const listPointer = this.parsingContext.listPointerStack[this.lastDepth];\n if (listPointer) {\n // Terminate the list if the had at least one value\n if (listPointer.value) {\n this.push(this.util.dataFactory.quad(listPointer.value, this.util.rdfRest, this.util.rdfNil, this.util.getDefaultGraph()));\n }\n // Add the list id to the id stack, so it can be used higher up in the stack\n listPointer.listId.listHead = true;\n this.parsingContext.idStack[listPointer.listRootDepth + 1] = [listPointer.listId];\n this.parsingContext.listPointerStack.splice(this.lastDepth, 1);\n }\n // Flush the buffer for lastDepth\n // If the parent key is a special type of container, postpone flushing until that parent is handled.\n if (await EntryHandlerContainer_1.EntryHandlerContainer.isBufferableContainerHandler(this.parsingContext, this.lastKeys, this.lastDepth)) {\n this.parsingContext.pendingContainerFlushBuffers\n .push({ depth: this.lastDepth, keys: this.lastKeys.slice(0, this.lastKeys.length) });\n flushStacks = false;\n }\n else {\n await this.flushBuffer(this.lastDepth, this.lastKeys);\n }\n }\n const key = await this.util.unaliasKeyword(keys[depth], keys, depth);\n const parentKey = await this.util.unaliasKeywordParent(keys, depth);\n this.parsingContext.emittedStack[depth] = true;\n let handleKey = true;\n // Keywords inside @reverse is not allowed apart from @context\n if (jsonld_context_parser_1.Util.isValidKeyword(key) && parentKey === '@reverse' && key !== '@context') {\n this.emit('error', new jsonld_context_parser_1.ErrorCoded(`Found the @id '${value}' inside an @reverse property`, jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_PROPERTY_MAP));\n }\n // Skip further processing if one of the parent nodes are invalid.\n // We use the validationStack to reuse validation results that were produced before with common key stacks.\n let inProperty = false;\n if (this.parsingContext.validationStack.length > 1) {\n inProperty = this.parsingContext.validationStack[this.parsingContext.validationStack.length - 1].property;\n }\n for (let i = Math.max(1, this.parsingContext.validationStack.length - 1); i < keys.length - 1; i++) {\n const validationResult = this.parsingContext.validationStack[i]\n || (this.parsingContext.validationStack[i] = await this.validateKey(keys.slice(0, i + 1), i, inProperty));\n if (!validationResult.valid) {\n this.parsingContext.emittedStack[depth] = false;\n handleKey = false;\n break;\n }\n else if (!inProperty && validationResult.property) {\n inProperty = true;\n }\n }\n // Skip further processing if this node is part of a literal\n if (await this.util.isLiteral(keys, depth)) {\n handleKey = false;\n }\n // Get handler\n if (handleKey) {\n for (const entryHandler of JsonLdParser.ENTRY_HANDLERS) {\n const testResult = await entryHandler.test(this.parsingContext, this.util, key, keys, depth);\n if (testResult) {\n // Pass processing over to the handler\n await entryHandler.handle(this.parsingContext, this.util, key, keys, value, depth, testResult);\n // Flag that this depth is processed\n if (entryHandler.isStackProcessor()) {\n this.parsingContext.processingStack[depth] = true;\n }\n break;\n }\n }\n }\n // Validate value indexes on the root.\n if (depth === 0 && Array.isArray(value)) {\n await this.util.validateValueIndexes(value);\n }\n // When we go up the stack, flush the old stack\n if (flushStacks && depth < this.lastDepth) {\n // Reset our stacks\n this.flushStacks(this.lastDepth);\n }\n this.lastDepth = depth;\n this.lastKeys = keys;\n // Clear the keyword cache at this depth, and everything underneath.\n this.parsingContext.unaliasedKeywordCacheStack.splice(depth - 1);\n }\n /**\n * Flush the processing stacks at the given depth.\n * @param {number} depth A depth.\n */\n flushStacks(depth) {\n this.parsingContext.processingStack.splice(depth, 1);\n this.parsingContext.processingType.splice(depth, 1);\n this.parsingContext.emittedStack.splice(depth, 1);\n this.parsingContext.idStack.splice(depth, 1);\n this.parsingContext.graphStack.splice(depth + 1, 1);\n this.parsingContext.graphContainerTermStack.splice(depth, 1);\n this.parsingContext.jsonLiteralStack.splice(depth, 1);\n this.parsingContext.validationStack.splice(depth - 1, 2);\n this.parsingContext.literalStack.splice(depth, this.parsingContext.literalStack.length - depth);\n this.parsingContext.annotationsBuffer.splice(depth, 1);\n // TODO: just like the literal stack, splice all other stack until the end as well?\n }\n /**\n * Flush buffers for the given depth.\n *\n * This should be called after the last entry at a given depth was processed.\n *\n * @param {number} depth A depth.\n * @param {any[]} keys A stack of keys.\n * @return {Promise} A promise resolving if flushing is done.\n */\n async flushBuffer(depth, keys) {\n let subjects = this.parsingContext.idStack[depth];\n const subjectsWasDefined = !!subjects;\n if (!subjectsWasDefined) {\n subjects = this.parsingContext.idStack[depth] = [this.util.dataFactory.blankNode()];\n }\n // Flush values at this level\n const valueBuffer = this.parsingContext.unidentifiedValuesBuffer[depth];\n if (valueBuffer) {\n for (const subject of subjects) {\n const depthOffsetGraph = await this.util.getDepthOffsetGraph(depth, keys);\n const graphs = (this.parsingContext.graphStack[depth] || depthOffsetGraph >= 0)\n ? this.parsingContext.idStack[depth - depthOffsetGraph - 1]\n : [await this.util.getGraphContainerValue(keys, depth)];\n if (graphs) {\n for (const graph of graphs) {\n // Flush values to stream if the graph @id is known\n this.parsingContext.emittedStack[depth] = true;\n for (const bufferedValue of valueBuffer) {\n this.util.emitQuadChecked(depth, subject, bufferedValue.predicate, bufferedValue.object, graph, bufferedValue.reverse, bufferedValue.isEmbedded);\n }\n }\n }\n else {\n // Place the values in the graphs buffer if the graph @id is not yet known\n const subGraphBuffer = this.parsingContext.getUnidentifiedGraphBufferSafe(depth - await this.util.getDepthOffsetGraph(depth, keys) - 1);\n for (const bufferedValue of valueBuffer) {\n if (bufferedValue.reverse) {\n subGraphBuffer.push({\n object: subject,\n predicate: bufferedValue.predicate,\n subject: bufferedValue.object,\n isEmbedded: bufferedValue.isEmbedded,\n });\n }\n else {\n subGraphBuffer.push({\n object: bufferedValue.object,\n predicate: bufferedValue.predicate,\n subject,\n isEmbedded: bufferedValue.isEmbedded,\n });\n }\n }\n }\n }\n this.parsingContext.unidentifiedValuesBuffer.splice(depth, 1);\n this.parsingContext.literalStack.splice(depth, 1);\n this.parsingContext.jsonLiteralStack.splice(depth, 1);\n }\n // Flush graphs at this level\n const graphBuffer = this.parsingContext.unidentifiedGraphsBuffer[depth];\n if (graphBuffer) {\n for (const subject of subjects) {\n // A @graph statement at the root without @id relates to the default graph,\n // unless there are top-level properties,\n // others relate to blank nodes.\n const graph = depth === 1 && subject.termType === 'BlankNode'\n && !this.parsingContext.topLevelProperties ? this.util.getDefaultGraph() : subject;\n this.parsingContext.emittedStack[depth] = true;\n for (const bufferedValue of graphBuffer) {\n this.parsingContext.emitQuad(depth, this.util.dataFactory.quad(bufferedValue.subject, bufferedValue.predicate, bufferedValue.object, graph));\n }\n }\n this.parsingContext.unidentifiedGraphsBuffer.splice(depth, 1);\n }\n // Push unhandled annotations up the stack as nested annotations\n const annotationsBuffer = this.parsingContext.annotationsBuffer[depth];\n if (annotationsBuffer) {\n // Throw an error if we reach the top, and still have annotations\n if (annotationsBuffer.length > 0 && depth === 1) {\n this.parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Annotations can not be made on top-level nodes`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION));\n }\n // Pass the annotations buffer up one level in the stack\n const annotationsBufferParent = this.parsingContext.getAnnotationsBufferSafe(depth - 1);\n for (const annotation of annotationsBuffer) {\n annotationsBufferParent.push(annotation);\n }\n delete this.parsingContext.annotationsBuffer[depth];\n }\n }\n /**\n * Check if at least one {@link IEntryHandler} validates the entry to true.\n * @param {any[]} keys A stack of keys.\n * @param {number} depth A depth.\n * @param {boolean} inProperty If the current depth is part of a valid property node.\n * @return {Promise<{ valid: boolean, property: boolean }>} A promise resolving to true or false.\n */\n async validateKey(keys, depth, inProperty) {\n for (const entryHandler of JsonLdParser.ENTRY_HANDLERS) {\n if (await entryHandler.validate(this.parsingContext, this.util, keys, depth, inProperty)) {\n return { valid: true, property: inProperty || entryHandler.isPropertyHandler() };\n }\n }\n return { valid: false, property: false };\n }\n /**\n * Attach all required listeners to the JSON parser.\n *\n * This should only be called once.\n */\n attachJsonParserListeners() {\n // Listen to json parser events\n this.jsonParser.onValue = (value) => {\n const depth = this.jsonParser.stack.length;\n const keys = (new Array(depth + 1).fill(0)).map((v, i) => {\n return i === depth ? this.jsonParser.key : this.jsonParser.stack[i].key;\n });\n if (!this.isParsingContextInner(depth)) { // Don't parse inner nodes inside @context\n const valueJobCb = () => this.newOnValueJob(keys, value, depth, true);\n if (!this.parsingContext.streamingProfile\n && !this.parsingContext.contextTree.getContext(keys.slice(0, -1))) {\n // If an out-of-order context is allowed,\n // we have to buffer everything.\n // We store jobs for @context's and @type's separately,\n // because at the end, we have to process them first.\n // We also handle @type because these *could* introduce a type-scoped context.\n if (keys[depth] === '@context') {\n let jobs = this.contextJobs[depth];\n if (!jobs) {\n jobs = this.contextJobs[depth] = [];\n }\n jobs.push(valueJobCb);\n }\n else {\n this.contextAwaitingJobs.push({ job: valueJobCb, keys, depth });\n }\n }\n else {\n // Make sure that our value jobs are chained synchronously\n this.lastOnValueJob = this.lastOnValueJob.then(valueJobCb);\n }\n // Execute all buffered jobs on deeper levels\n if (!this.parsingContext.streamingProfile && depth === 0) {\n this.lastOnValueJob = this.lastOnValueJob\n .then(() => this.executeBufferedJobs());\n }\n }\n };\n this.jsonParser.onError = (error) => {\n this.emit('error', error);\n };\n }\n /**\n * Check if the parser is currently parsing an element that is part of an @context entry.\n * @param {number} depth A depth.\n * @return {boolean} A boolean.\n */\n isParsingContextInner(depth) {\n for (let i = depth; i > 0; i--) {\n if (this.jsonParser.stack[i - 1].key === '@context') {\n return true;\n }\n }\n return false;\n }\n /**\n * Execute all buffered jobs.\n * @return {Promise} A promise resolving if all jobs are finished.\n */\n async executeBufferedJobs() {\n // Handle context jobs\n for (const jobs of this.contextJobs) {\n if (jobs) {\n for (const job of jobs) {\n await job();\n }\n }\n }\n // Clear the keyword cache.\n this.parsingContext.unaliasedKeywordCacheStack.splice(0);\n const contextAwaitingJobs = [];\n for (const job of this.contextAwaitingJobs) {\n if ((await this.util.unaliasKeyword(job.keys[job.depth], job.keys, job.depth, true)) === '@type'\n || typeof job.keys[job.depth] === 'number' && (await this.util.unaliasKeyword(job.keys[job.depth - 1], job.keys, job.depth - 1, true)) === '@type') { // Also capture @type with array values\n // Remove @type from keys, because we want it to apply to parent later on\n this.typeJobs.push({ job: job.job, keys: job.keys.slice(0, job.keys.length - 1) });\n }\n else {\n contextAwaitingJobs.push(job);\n }\n }\n // Handle non-context jobs\n for (const job of contextAwaitingJobs) {\n // Check if we have a type (with possible type-scoped context) that should be handled before.\n // We check all possible parent nodes for the current job, from root to leaves.\n if (this.typeJobs.length > 0) {\n // First collect all applicable type jobs\n const applicableTypeJobs = [];\n const applicableTypeJobIds = [];\n for (let i = 0; i < this.typeJobs.length; i++) {\n const typeJob = this.typeJobs[i];\n if (Util_1.Util.isPrefixArray(typeJob.keys, job.keys)) {\n applicableTypeJobs.push(typeJob);\n applicableTypeJobIds.push(i);\n }\n }\n // Next, sort the jobs from short to long key length (to ensure types higher up in the tree to be handled first)\n const sortedTypeJobs = applicableTypeJobs.sort((job1, job2) => job1.keys.length - job2.keys.length);\n // Finally, execute the jobs in order\n for (const typeJob of sortedTypeJobs) {\n await typeJob.job();\n }\n // Remove the executed type jobs\n // Sort first, so we can efficiently splice\n const sortedApplicableTypeJobIds = applicableTypeJobIds.sort().reverse();\n for (const jobId of sortedApplicableTypeJobIds) {\n this.typeJobs.splice(jobId, 1);\n }\n }\n await job.job();\n }\n }\n}\nJsonLdParser.DEFAULT_PROCESSING_MODE = '1.1';\nJsonLdParser.ENTRY_HANDLERS = [\n new EntryHandlerArrayValue_1.EntryHandlerArrayValue(),\n new EntryHandlerKeywordContext_1.EntryHandlerKeywordContext(),\n new EntryHandlerKeywordId_1.EntryHandlerKeywordId(),\n new EntryHandlerKeywordIncluded_1.EntryHandlerKeywordIncluded(),\n new EntryHandlerKeywordGraph_1.EntryHandlerKeywordGraph(),\n new EntryHandlerKeywordNest_1.EntryHandlerKeywordNest(),\n new EntryHandlerKeywordType_1.EntryHandlerKeywordType(),\n new EntryHandlerKeywordValue_1.EntryHandlerKeywordValue(),\n new EntryHandlerKeywordAnnotation_1.EntryHandlerKeywordAnnotation(),\n new EntryHandlerContainer_1.EntryHandlerContainer(),\n new EntryHandlerKeywordUnknownFallback_1.EntryHandlerKeywordUnknownFallback(),\n new EntryHandlerPredicate_1.EntryHandlerPredicate(),\n new EntryHandlerInvalidFallback_1.EntryHandlerInvalidFallback(),\n];\nexports.JsonLdParser = JsonLdParser;\n//# sourceMappingURL=JsonLdParser.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ParsingContext = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst ErrorCoded_1 = require(\"jsonld-context-parser/lib/ErrorCoded\");\nconst ContextTree_1 = require(\"./ContextTree\");\nconst JsonLdParser_1 = require(\"./JsonLdParser\");\n/**\n * Data holder for parsing information.\n */\nclass ParsingContext {\n constructor(options) {\n // Initialize settings\n this.contextParser = new jsonld_context_parser_1.ContextParser({ documentLoader: options.documentLoader, skipValidation: options.skipContextValidation });\n this.streamingProfile = !!options.streamingProfile;\n this.baseIRI = options.baseIRI;\n this.produceGeneralizedRdf = !!options.produceGeneralizedRdf;\n this.allowSubjectList = !!options.allowSubjectList;\n this.processingMode = options.processingMode || JsonLdParser_1.JsonLdParser.DEFAULT_PROCESSING_MODE;\n this.strictValues = !!options.strictValues;\n this.validateValueIndexes = !!options.validateValueIndexes;\n this.defaultGraph = options.defaultGraph;\n this.rdfDirection = options.rdfDirection;\n this.normalizeLanguageTags = options.normalizeLanguageTags;\n this.streamingProfileAllowOutOfOrderPlainType = options.streamingProfileAllowOutOfOrderPlainType;\n this.rdfstar = options.rdfstar !== false;\n this.rdfstarReverseInEmbedded = options.rdfstarReverseInEmbedded;\n this.topLevelProperties = false;\n this.activeProcessingMode = parseFloat(this.processingMode);\n // Initialize stacks\n this.processingStack = [];\n this.processingType = [];\n this.emittedStack = [];\n this.idStack = [];\n this.graphStack = [];\n this.graphContainerTermStack = [];\n this.listPointerStack = [];\n this.contextTree = new ContextTree_1.ContextTree();\n this.literalStack = [];\n this.validationStack = [];\n this.unaliasedKeywordCacheStack = [];\n this.jsonLiteralStack = [];\n this.unidentifiedValuesBuffer = [];\n this.unidentifiedGraphsBuffer = [];\n this.annotationsBuffer = [];\n this.pendingContainerFlushBuffers = [];\n this.parser = options.parser;\n if (options.context) {\n this.rootContext = this.parseContext(options.context);\n this.rootContext.then((context) => this.validateContext(context));\n }\n else {\n this.rootContext = Promise.resolve(new jsonld_context_parser_1.JsonLdContextNormalized(this.baseIRI ? { '@base': this.baseIRI, '@__baseDocument': true } : {}));\n }\n }\n /**\n * Parse the given context with the configured options.\n * @param {JsonLdContext} context A context to parse.\n * @param {JsonLdContextNormalized} parentContext An optional parent context.\n * @param {boolean} ignoreProtection If @protected term checks should be ignored.\n * @return {Promise} A promise resolving to the parsed context.\n */\n async parseContext(context, parentContext, ignoreProtection) {\n return this.contextParser.parse(context, {\n baseIRI: this.baseIRI,\n ignoreProtection,\n normalizeLanguageTags: this.normalizeLanguageTags,\n parentContext,\n processingMode: this.activeProcessingMode,\n });\n }\n /**\n * Check if the given context is valid.\n * If not, an error will be thrown.\n * @param {JsonLdContextNormalized} context A context.\n */\n validateContext(context) {\n const activeVersion = context.getContextRaw()['@version'];\n if (activeVersion) {\n if (this.activeProcessingMode && activeVersion > this.activeProcessingMode) {\n throw new ErrorCoded_1.ErrorCoded(`Unsupported JSON-LD version '${activeVersion}' under active processing mode ${this.activeProcessingMode}.`, ErrorCoded_1.ERROR_CODES.PROCESSING_MODE_CONFLICT);\n }\n else {\n if (this.activeProcessingMode && activeVersion < this.activeProcessingMode) {\n throw new ErrorCoded_1.ErrorCoded(`Invalid JSON-LD version ${activeVersion} under active processing mode ${this.activeProcessingMode}.`, ErrorCoded_1.ERROR_CODES.INVALID_VERSION_VALUE);\n }\n this.activeProcessingMode = activeVersion;\n }\n }\n }\n /**\n * Get the context at the given path.\n * @param {keys} keys The path of keys to get the context at.\n * @param {number} offset The path offset, defaults to 1.\n * @return {Promise} A promise resolving to a context.\n */\n async getContext(keys, offset = 1) {\n const keysOriginal = keys;\n // Ignore array keys at the end\n while (typeof keys[keys.length - 1] === 'number') {\n keys = keys.slice(0, keys.length - 1);\n }\n // Handle offset on keys\n if (offset) {\n keys = keys.slice(0, -offset);\n }\n // Determine the closest context\n const contextData = await this.getContextPropagationAware(keys);\n const context = contextData.context;\n // Process property-scoped contexts (high-to-low)\n let contextRaw = context.getContextRaw();\n for (let i = contextData.depth; i < keysOriginal.length - offset; i++) {\n const key = keysOriginal[i];\n const contextKeyEntry = contextRaw[key];\n if (contextKeyEntry && typeof contextKeyEntry === 'object' && '@context' in contextKeyEntry) {\n const scopedContext = (await this.parseContext(contextKeyEntry, contextRaw, true)).getContextRaw();\n const propagate = !(key in scopedContext)\n || scopedContext[key]['@context']['@propagate']; // Propagation is true by default\n if (propagate !== false || i === keysOriginal.length - 1 - offset) {\n contextRaw = Object.assign({}, scopedContext);\n // Clean up final context\n delete contextRaw['@propagate'];\n contextRaw[key] = Object.assign({}, contextRaw[key]);\n if ('@id' in contextKeyEntry) {\n contextRaw[key]['@id'] = contextKeyEntry['@id'];\n }\n delete contextRaw[key]['@context'];\n if (propagate !== false) {\n this.contextTree.setContext(keysOriginal.slice(0, i + offset), Promise.resolve(new jsonld_context_parser_1.JsonLdContextNormalized(contextRaw)));\n }\n }\n }\n }\n return new jsonld_context_parser_1.JsonLdContextNormalized(contextRaw);\n }\n /**\n * Get the context at the given path.\n * Non-propagating contexts will be skipped,\n * unless the context at that exact depth is retrieved.\n *\n * This ONLY takes into account context propagation logic,\n * so this should usually not be called directly,\n * call {@link #getContext} instead.\n *\n * @param keys The path of keys to get the context at.\n * @return {Promise<{ context: JsonLdContextNormalized, depth: number }>} A context and its depth.\n */\n async getContextPropagationAware(keys) {\n const originalDepth = keys.length;\n let contextData = null;\n let hasApplicablePropertyScopedContext;\n do {\n hasApplicablePropertyScopedContext = false;\n if (contextData && '@__propagateFallback' in contextData.context.getContextRaw()) {\n // If a propagation fallback context has been set,\n // fallback to that context and retry for the same depth.\n contextData.context = new jsonld_context_parser_1.JsonLdContextNormalized(contextData.context.getContextRaw()['@__propagateFallback']);\n }\n else {\n if (contextData) {\n // If we had a previous iteration, jump to the parent of context depth.\n // We must do this because once we get here, last context had propagation disabled,\n // so we check its first parent instead.\n keys = keys.slice(0, contextData.depth - 1);\n }\n contextData = await this.contextTree.getContext(keys) || { context: await this.rootContext, depth: 0 };\n }\n // Allow non-propagating contexts to propagate one level deeper\n // if it defines a property-scoped context that is applicable for the current key.\n // @see https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tc012\n const lastKey = keys[keys.length - 1];\n if (lastKey in contextData.context.getContextRaw()) {\n const lastKeyValue = contextData.context.getContextRaw()[lastKey];\n if (lastKeyValue && typeof lastKeyValue === 'object' && '@context' in lastKeyValue) {\n hasApplicablePropertyScopedContext = true;\n }\n }\n } while (contextData.depth > 0 // Root context has a special case\n && contextData.context.getContextRaw()['@propagate'] === false // Stop loop if propagation is true\n && contextData.depth !== originalDepth // Stop loop if requesting exact depth of non-propagating\n && !hasApplicablePropertyScopedContext);\n // Special case for root context that does not allow propagation.\n // Fallback to empty context in that case.\n if (contextData.depth === 0\n && contextData.context.getContextRaw()['@propagate'] === false\n && contextData.depth !== originalDepth) {\n contextData.context = new jsonld_context_parser_1.JsonLdContextNormalized({});\n }\n return contextData;\n }\n /**\n * Start a new job for parsing the given value.\n * @param {any[]} keys The stack of keys.\n * @param value The value to parse.\n * @param {number} depth The depth to parse at.\n * @param {boolean} lastDepthCheck If the lastDepth check should be done for buffer draining.\n * @return {Promise} A promise resolving when the job is done.\n */\n async newOnValueJob(keys, value, depth, lastDepthCheck) {\n await this.parser.newOnValueJob(keys, value, depth, lastDepthCheck);\n }\n /**\n * Flush the pending container flush buffers\n * @return {boolean} If any pending buffers were flushed.\n */\n async handlePendingContainerFlushBuffers() {\n if (this.pendingContainerFlushBuffers.length > 0) {\n for (const pendingFlushBuffer of this.pendingContainerFlushBuffers) {\n await this.parser.flushBuffer(pendingFlushBuffer.depth, pendingFlushBuffer.keys);\n this.parser.flushStacks(pendingFlushBuffer.depth);\n }\n this.pendingContainerFlushBuffers.splice(0, this.pendingContainerFlushBuffers.length);\n return true;\n }\n else {\n return false;\n }\n }\n /**\n * Emit the given quad into the output stream.\n * @param {number} depth The depth the quad was generated at.\n * @param {Quad} quad A quad to emit.\n */\n emitQuad(depth, quad) {\n if (depth === 1) {\n this.topLevelProperties = true;\n }\n this.parser.push(quad);\n }\n /**\n * Emit the given error into the output stream.\n * @param {Error} error An error to emit.\n */\n emitError(error) {\n this.parser.emit('error', error);\n }\n /**\n * Emit the given context into the output stream under the 'context' event.\n * @param {JsonLdContext} context A context to emit.\n */\n emitContext(context) {\n this.parser.emit('context', context);\n }\n /**\n * Safely get or create the depth value of {@link ParsingContext.unidentifiedValuesBuffer}.\n * @param {number} depth A depth.\n * @return {{predicate: Term; object: Term; reverse: boolean}[]} An element of\n * {@link ParsingContext.unidentifiedValuesBuffer}.\n */\n getUnidentifiedValueBufferSafe(depth) {\n let buffer = this.unidentifiedValuesBuffer[depth];\n if (!buffer) {\n buffer = [];\n this.unidentifiedValuesBuffer[depth] = buffer;\n }\n return buffer;\n }\n /**\n * Safely get or create the depth value of {@link ParsingContext.unidentifiedGraphsBuffer}.\n * @param {number} depth A depth.\n * @return {{predicate: Term; object: Term; reverse: boolean}[]} An element of\n * {@link ParsingContext.unidentifiedGraphsBuffer}.\n */\n getUnidentifiedGraphBufferSafe(depth) {\n let buffer = this.unidentifiedGraphsBuffer[depth];\n if (!buffer) {\n buffer = [];\n this.unidentifiedGraphsBuffer[depth] = buffer;\n }\n return buffer;\n }\n /**\n * Safely get or create the depth value of {@link ParsingContext.annotationsBuffer}.\n * @param {number} depth A depth.\n * @return {} An element of {@link ParsingContext.annotationsBuffer}.\n */\n getAnnotationsBufferSafe(depth) {\n let buffer = this.annotationsBuffer[depth];\n if (!buffer) {\n buffer = [];\n this.annotationsBuffer[depth] = buffer;\n }\n return buffer;\n }\n /**\n * @return IExpandOptions The expand options for the active processing mode.\n */\n getExpandOptions() {\n return ParsingContext.EXPAND_OPTIONS[this.activeProcessingMode];\n }\n /**\n * Shift the stack at the given offset to the given depth.\n *\n * This will override anything in the stack at `depth`,\n * and this will remove anything at `depth + depthOffset`\n *\n * @param depth The target depth.\n * @param depthOffset The origin depth, relative to `depth`.\n */\n shiftStack(depth, depthOffset) {\n // Copy the id stack value up one level so that the next job can access the id.\n const deeperIdStack = this.idStack[depth + depthOffset];\n if (deeperIdStack) {\n this.idStack[depth] = deeperIdStack;\n this.emittedStack[depth] = true;\n delete this.idStack[depth + depthOffset];\n }\n // Shorten key stack\n if (this.pendingContainerFlushBuffers.length) {\n for (const buffer of this.pendingContainerFlushBuffers) {\n if (buffer.depth >= depth + depthOffset) {\n buffer.depth -= depthOffset;\n buffer.keys.splice(depth, depthOffset);\n }\n }\n }\n // Splice stacks\n if (this.unidentifiedValuesBuffer[depth + depthOffset]) {\n this.unidentifiedValuesBuffer[depth] = this.unidentifiedValuesBuffer[depth + depthOffset];\n delete this.unidentifiedValuesBuffer[depth + depthOffset];\n }\n if (this.annotationsBuffer[depth + depthOffset - 1]) {\n if (!this.annotationsBuffer[depth - 1]) {\n this.annotationsBuffer[depth - 1] = [];\n }\n this.annotationsBuffer[depth - 1] = [\n ...this.annotationsBuffer[depth - 1],\n ...this.annotationsBuffer[depth + depthOffset - 1],\n ];\n delete this.annotationsBuffer[depth + depthOffset - 1];\n }\n // TODO: also do the same for other stacks\n }\n}\nParsingContext.EXPAND_OPTIONS = {\n 1.0: {\n allowPrefixForcing: false,\n allowPrefixNonGenDelims: false,\n allowVocabRelativeToBase: false,\n },\n 1.1: {\n allowPrefixForcing: true,\n allowPrefixNonGenDelims: false,\n allowVocabRelativeToBase: true,\n },\n};\nexports.ParsingContext = ParsingContext;\n//# sourceMappingURL=ParsingContext.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Util = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst rdf_data_factory_1 = require(\"rdf-data-factory\");\nconst EntryHandlerContainer_1 = require(\"./entryhandler/EntryHandlerContainer\");\n// tslint:disable-next-line:no-var-requires\nconst canonicalizeJson = require('canonicalize');\n/**\n * Utility functions and methods.\n */\nclass Util {\n constructor(options) {\n this.parsingContext = options.parsingContext;\n this.dataFactory = options.dataFactory || new rdf_data_factory_1.DataFactory();\n this.rdfFirst = this.dataFactory.namedNode(Util.RDF + 'first');\n this.rdfRest = this.dataFactory.namedNode(Util.RDF + 'rest');\n this.rdfNil = this.dataFactory.namedNode(Util.RDF + 'nil');\n this.rdfType = this.dataFactory.namedNode(Util.RDF + 'type');\n this.rdfJson = this.dataFactory.namedNode(Util.RDF + 'JSON');\n }\n /**\n * Helper function to get the value of a context entry,\n * or fallback to a certain value.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} contextKey A pre-defined JSON-LD key in context entries.\n * @param {string} key A context entry key.\n * @param {string} fallback A fallback value for when the given contextKey\n * could not be found in the value with the given key.\n * @return {string} The value of the given contextKey in the entry behind key in the given context,\n * or the given fallback value.\n */\n static getContextValue(context, contextKey, key, fallback) {\n const entry = context.getContextRaw()[key];\n if (!entry) {\n return fallback;\n }\n const type = entry[contextKey];\n return type === undefined ? fallback : type;\n }\n /**\n * Get the container type of the given key in the context.\n *\n * Should any context-scoping bugs should occur related to this in the future,\n * it may be required to increase the offset from the depth at which the context is retrieved by one (to 2).\n * This is because containers act 2 levels deep.\n *\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key A context entry key.\n * @return {string} The container type.\n */\n static getContextValueContainer(context, key) {\n return Util.getContextValue(context, '@container', key, { '@set': true });\n }\n /**\n * Get the value type of the given key in the context.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key A context entry key.\n * @return {string} The node type.\n */\n static getContextValueType(context, key) {\n const valueType = Util.getContextValue(context, '@type', key, null);\n if (valueType === '@none') {\n return null;\n }\n return valueType;\n }\n /**\n * Get the language of the given key in the context.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key A context entry key.\n * @return {string} The node type.\n */\n static getContextValueLanguage(context, key) {\n return Util.getContextValue(context, '@language', key, context.getContextRaw()['@language'] || null);\n }\n /**\n * Get the direction of the given key in the context.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key A context entry key.\n * @return {string} The node type.\n */\n static getContextValueDirection(context, key) {\n return Util.getContextValue(context, '@direction', key, context.getContextRaw()['@direction'] || null);\n }\n /**\n * Check if the given key in the context is a reversed property.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key A context entry key.\n * @return {boolean} If the context value has a @reverse key.\n */\n static isContextValueReverse(context, key) {\n return !!Util.getContextValue(context, '@reverse', key, null);\n }\n /**\n * Get the @index of the given key in the context.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key A context entry key.\n * @return {string} The index.\n */\n static getContextValueIndex(context, key) {\n return Util.getContextValue(context, '@index', key, context.getContextRaw()['@index'] || null);\n }\n /**\n * Check if the given key refers to a reversed property.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key The property key.\n * @param {string} parentKey The parent key.\n * @return {boolean} If the property must be reversed.\n */\n static isPropertyReverse(context, key, parentKey) {\n // '!==' is needed because reversed properties in a @reverse container should cancel each other out.\n return parentKey === '@reverse' !== Util.isContextValueReverse(context, key);\n }\n /**\n * Check if the given key exists inside an embedded node as direct child.\n * @param {string} parentKey The parent key.\n * @return {boolean} If the property is embedded.\n */\n static isPropertyInEmbeddedNode(parentKey) {\n return parentKey === '@id';\n }\n /**\n * Check if the given key exists inside an annotation object as direct child.\n * @param {string} parentKey The parent key.\n * @return {boolean} If the property is an annotation.\n */\n static isPropertyInAnnotationObject(parentKey) {\n return parentKey === '@annotation';\n }\n /**\n * Check if the given IRI is valid.\n * @param {string} iri A potential IRI.\n * @return {boolean} If the given IRI is valid.\n */\n static isValidIri(iri) {\n return iri !== null && jsonld_context_parser_1.Util.isValidIri(iri);\n }\n /**\n * Check if the given first array (needle) is a prefix of the given second array (haystack).\n * @param needle An array to check if it is a prefix.\n * @param haystack An array to look in.\n */\n static isPrefixArray(needle, haystack) {\n if (needle.length > haystack.length) {\n return false;\n }\n for (let i = 0; i < needle.length; i++) {\n if (needle[i] !== haystack[i]) {\n return false;\n }\n }\n return true;\n }\n /**\n * Make sure that @id-@index pairs are equal over all array values.\n * Reject otherwise.\n * @param {any[]} value An array value.\n * @return {Promise} A promise rejecting if conflicts are present.\n */\n async validateValueIndexes(value) {\n if (this.parsingContext.validateValueIndexes) {\n const indexHashes = {};\n for (const entry of value) {\n if (entry && typeof entry === 'object') {\n const id = entry['@id'];\n const index = entry['@index'];\n if (id && index) {\n const existingIndexValue = indexHashes[id];\n if (existingIndexValue && existingIndexValue !== index) {\n throw new jsonld_context_parser_1.ErrorCoded(`Conflicting @index value for ${id}`, jsonld_context_parser_1.ERROR_CODES.CONFLICTING_INDEXES);\n }\n indexHashes[id] = index;\n }\n }\n }\n }\n }\n /**\n * Convert a given JSON value to an RDF term.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key The current JSON key.\n * @param value A JSON value.\n * @param {number} depth The depth the value is at.\n * @param {string[]} keys The path of keys.\n * @return {Promise} An RDF term array.\n */\n async valueToTerm(context, key, value, depth, keys) {\n // Skip further processing if we have an @type: @json\n if (Util.getContextValueType(context, key) === '@json') {\n return [this.dataFactory.literal(this.valueToJsonString(value), this.rdfJson)];\n }\n const type = typeof value;\n switch (type) {\n case 'object':\n // Skip if we have a null or undefined object\n if (value === null || value === undefined) {\n return [];\n }\n // Special case for arrays\n if (Array.isArray(value)) {\n // We handle arrays at value level so we can emit earlier, so this is handled already when we get here.\n // Empty context-based lists are emitted at this place, because our streaming algorithm doesn't detect those.\n if ('@list' in Util.getContextValueContainer(context, key)) {\n if (value.length === 0) {\n return [this.rdfNil];\n }\n else {\n return this.parsingContext.idStack[depth + 1] || [];\n }\n }\n await this.validateValueIndexes(value);\n return [];\n }\n // Handle property-scoped contexts\n context = await this.getContextSelfOrPropertyScoped(context, key);\n // Handle local context in the value\n if ('@context' in value) {\n context = await this.parsingContext.parseContext(value['@context'], (await this.parsingContext.getContext(keys, 0)).getContextRaw());\n }\n // In all other cases, we have a hash\n value = await this.unaliasKeywords(value, keys, depth, context); // Un-alias potential keywords in this hash\n if ('@value' in value) {\n let val;\n let valueLanguage;\n let valueDirection;\n let valueType;\n let valueIndex; // We don't use the index, but we need to check its type for spec-compliance\n for (key in value) {\n const subValue = value[key];\n switch (key) {\n case '@value':\n val = subValue;\n break;\n case '@language':\n valueLanguage = subValue;\n break;\n case '@direction':\n valueDirection = subValue;\n break;\n case '@type':\n valueType = subValue;\n break;\n case '@index':\n valueIndex = subValue;\n break;\n case '@annotation':\n // This keyword is allowed, but is processed like normal nodes\n break;\n default:\n throw new jsonld_context_parser_1.ErrorCoded(`Unknown value entry '${key}' in @value: ${JSON.stringify(value)}`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT);\n }\n }\n // Skip further processing if we have an @type: @json\n if (await this.unaliasKeyword(valueType, keys, depth, true, context) === '@json') {\n return [this.dataFactory.literal(this.valueToJsonString(val), this.rdfJson)];\n }\n // Validate @value\n if (val === null) {\n return [];\n }\n if (typeof val === 'object') {\n throw new jsonld_context_parser_1.ErrorCoded(`The value of an '@value' can not be an object, got '${JSON.stringify(val)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT_VALUE);\n }\n // Validate @index\n if (this.parsingContext.validateValueIndexes && valueIndex && typeof valueIndex !== 'string') {\n throw new jsonld_context_parser_1.ErrorCoded(`The value of an '@index' must be a string, got '${JSON.stringify(valueIndex)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INDEX_VALUE);\n }\n // Validate @language and @direction\n if (valueLanguage) {\n if (typeof val !== 'string') {\n throw new jsonld_context_parser_1.ErrorCoded(`When an '@language' is set, the value of '@value' must be a string, got '${JSON.stringify(val)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_LANGUAGE_TAGGED_VALUE);\n }\n if (!jsonld_context_parser_1.ContextParser.validateLanguage(valueLanguage, this.parsingContext.strictValues, jsonld_context_parser_1.ERROR_CODES.INVALID_LANGUAGE_TAGGED_STRING)) {\n return [];\n }\n // Language tags are always normalized to lowercase in 1.0.\n if (this.parsingContext.normalizeLanguageTags || this.parsingContext.activeProcessingMode === 1.0) {\n valueLanguage = valueLanguage.toLowerCase();\n }\n }\n if (valueDirection) {\n if (typeof val !== 'string') {\n throw new Error(`When an '@direction' is set, the value of '@value' must be a string, got '${JSON.stringify(val)}'`);\n }\n if (!jsonld_context_parser_1.ContextParser.validateDirection(valueDirection, this.parsingContext.strictValues)) {\n return [];\n }\n }\n // Check @language and @direction\n if (valueLanguage && valueDirection && this.parsingContext.rdfDirection) {\n if (valueType) {\n throw new jsonld_context_parser_1.ErrorCoded(`Can not have '@language', '@direction' and '@type' in a value: '${JSON\n .stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT);\n }\n return this.nullableTermToArray(this\n .createLanguageDirectionLiteral(depth, val, valueLanguage, valueDirection));\n }\n else if (valueLanguage) { // Check @language\n if (valueType) {\n throw new jsonld_context_parser_1.ErrorCoded(`Can not have both '@language' and '@type' in a value: '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT);\n }\n return [this.dataFactory.literal(val, valueLanguage)];\n }\n else if (valueDirection && this.parsingContext.rdfDirection) { // Check @direction\n if (valueType) {\n throw new jsonld_context_parser_1.ErrorCoded(`Can not have both '@direction' and '@type' in a value: '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT);\n }\n return this.nullableTermToArray(this\n .createLanguageDirectionLiteral(depth, val, valueLanguage, valueDirection));\n }\n else if (valueType) { // Validate @type\n if (typeof valueType !== 'string') {\n throw new jsonld_context_parser_1.ErrorCoded(`The value of an '@type' must be a string, got '${JSON.stringify(valueType)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPED_VALUE);\n }\n const typeTerm = this.createVocabOrBaseTerm(context, valueType);\n if (!typeTerm) {\n throw new jsonld_context_parser_1.ErrorCoded(`Invalid '@type' value, got '${JSON.stringify(valueType)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPED_VALUE);\n }\n if (typeTerm.termType !== 'NamedNode') {\n throw new jsonld_context_parser_1.ErrorCoded(`Illegal value type (${typeTerm.termType}): ${valueType}`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPED_VALUE);\n }\n return [this.dataFactory.literal(val, typeTerm)];\n }\n // We don't pass the context, because context-based things like @language should be ignored\n return await this.valueToTerm(new jsonld_context_parser_1.JsonLdContextNormalized({}), key, val, depth, keys);\n }\n else if ('@set' in value) {\n // No other entries are allow in this value\n if (Object.keys(value).length > 1) {\n throw new jsonld_context_parser_1.ErrorCoded(`Found illegal neighbouring entries next to @set for key: '${key}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);\n }\n // No need to do anything here, this is handled at the deeper level.\n return [];\n }\n else if ('@list' in value) {\n // No other entries are allowed in this value\n if (Object.keys(value).length > 1) {\n throw new jsonld_context_parser_1.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${key}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT);\n }\n const listValue = value[\"@list\"];\n // We handle lists at value level so we can emit earlier, so this is handled already when we get here.\n // Empty anonymous lists are emitted at this place, because our streaming algorithm doesn't detect those.\n if (Array.isArray(listValue)) {\n if (listValue.length === 0) {\n return [this.rdfNil];\n }\n else {\n return this.parsingContext.idStack[depth + 1] || [];\n }\n }\n else {\n // We only have a single list element here, so emit this directly as single element\n return await this.valueToTerm(await this.parsingContext.getContext(keys), key, listValue, depth - 1, keys.slice(0, -1));\n }\n }\n else if ('@reverse' in value && typeof value['@reverse'] === 'boolean') {\n // We handle reverse properties at value level so we can emit earlier,\n // so this is handled already when we get here.\n return [];\n }\n else if ('@graph' in Util.getContextValueContainer(await this.parsingContext.getContext(keys), key)) {\n // We are processing a graph container\n const graphContainerEntries = this.parsingContext.graphContainerTermStack[depth + 1];\n return graphContainerEntries ? Object.values(graphContainerEntries) : [this.dataFactory.blankNode()];\n }\n else if (\"@id\" in value) {\n // Use deeper context if the value node contains other properties next to @id.\n if (Object.keys(value).length > 1) {\n context = await this.parsingContext.getContext(keys, 0);\n }\n // Handle local context in the value\n if ('@context' in value) {\n context = await this.parsingContext.parseContext(value['@context'], context.getContextRaw());\n }\n if (value[\"@type\"] === '@vocab') {\n return this.nullableTermToArray(this.createVocabOrBaseTerm(context, value[\"@id\"]));\n }\n else {\n const valueId = value[\"@id\"];\n let valueTerm;\n if (typeof valueId === 'object') {\n if (this.parsingContext.rdfstar) {\n valueTerm = this.parsingContext.idStack[depth + 1][0];\n }\n else {\n throw new jsonld_context_parser_1.ErrorCoded(`Found illegal @id '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_ID_VALUE);\n }\n }\n else {\n valueTerm = this.resourceToTerm(context, valueId);\n }\n return this.nullableTermToArray(valueTerm);\n }\n }\n else {\n // Only make a blank node if at least one triple was emitted at the value's level.\n if (this.parsingContext.emittedStack[depth + 1]\n || (value && typeof value === 'object' && Object.keys(value).length === 0)) {\n return (this.parsingContext.idStack[depth + 1]\n || (this.parsingContext.idStack[depth + 1] = [this.dataFactory.blankNode()]));\n }\n else {\n return [];\n }\n }\n case 'string':\n return this.nullableTermToArray(this.stringValueToTerm(depth, await this.getContextSelfOrPropertyScoped(context, key), key, value, null));\n case 'boolean':\n return this.nullableTermToArray(this.stringValueToTerm(depth, await this.getContextSelfOrPropertyScoped(context, key), key, Boolean(value).toString(), this.dataFactory.namedNode(Util.XSD_BOOLEAN)));\n case 'number':\n return this.nullableTermToArray(this.stringValueToTerm(depth, await this.getContextSelfOrPropertyScoped(context, key), key, value, this.dataFactory.namedNode(value % 1 === 0 && value < 1e21 ? Util.XSD_INTEGER : Util.XSD_DOUBLE)));\n default:\n this.parsingContext.emitError(new Error(`Could not determine the RDF type of a ${type}`));\n return [];\n }\n }\n /**\n * If the context defines a property-scoped context for the given key,\n * that context will be returned.\n * Otherwise, the given context will be returned as-is.\n *\n * This should be used for valueToTerm cases that are not objects.\n * @param context A context.\n * @param key A JSON key.\n */\n async getContextSelfOrPropertyScoped(context, key) {\n const contextKeyEntry = context.getContextRaw()[key];\n if (contextKeyEntry && typeof contextKeyEntry === 'object' && '@context' in contextKeyEntry) {\n context = await this.parsingContext.parseContext(contextKeyEntry, context.getContextRaw(), true);\n }\n return context;\n }\n /**\n * If the given term is null, return an empty array, otherwise return an array with the single given term.\n * @param term A term.\n */\n nullableTermToArray(term) {\n return term ? [term] : [];\n }\n /**\n * Convert a given JSON key to an RDF predicate term,\n * based on @vocab.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param key A JSON key.\n * @return {RDF.NamedNode} An RDF named node.\n */\n predicateToTerm(context, key) {\n const expanded = context.expandTerm(key, true, this.parsingContext.getExpandOptions());\n // Immediately return if the predicate was disabled in the context\n if (!expanded) {\n return null;\n }\n // Check if the predicate is a blank node\n if (expanded[0] === '_' && expanded[1] === ':') {\n if (this.parsingContext.produceGeneralizedRdf) {\n return this.dataFactory.blankNode(expanded.substr(2));\n }\n else {\n return null;\n }\n }\n // Check if the predicate is a valid IRI\n if (Util.isValidIri(expanded)) {\n return this.dataFactory.namedNode(expanded);\n }\n else {\n if (expanded && this.parsingContext.strictValues) {\n this.parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Invalid predicate IRI: ${expanded}`, jsonld_context_parser_1.ERROR_CODES.INVALID_IRI_MAPPING));\n }\n else {\n return null;\n }\n }\n return null;\n }\n /**\n * Convert a given JSON key to an RDF resource term or blank node,\n * based on @base.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param key A JSON key.\n * @return {RDF.NamedNode} An RDF named node or null.\n */\n resourceToTerm(context, key) {\n if (key.startsWith('_:')) {\n return this.dataFactory.blankNode(key.substr(2));\n }\n const iri = context.expandTerm(key, false, this.parsingContext.getExpandOptions());\n if (!Util.isValidIri(iri)) {\n if (iri && this.parsingContext.strictValues) {\n this.parsingContext.emitError(new Error(`Invalid resource IRI: ${iri}`));\n }\n else {\n return null;\n }\n }\n return this.dataFactory.namedNode(iri);\n }\n /**\n * Convert a given JSON key to an RDF resource term.\n * It will do this based on the @vocab,\n * and fallback to @base.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param key A JSON key.\n * @return {RDF.NamedNode} An RDF named node or null.\n */\n createVocabOrBaseTerm(context, key) {\n if (key.startsWith('_:')) {\n return this.dataFactory.blankNode(key.substr(2));\n }\n const expandOptions = this.parsingContext.getExpandOptions();\n let expanded = context.expandTerm(key, true, expandOptions);\n if (expanded === key) {\n expanded = context.expandTerm(key, false, expandOptions);\n }\n if (!Util.isValidIri(expanded)) {\n if (expanded && this.parsingContext.strictValues && !expanded.startsWith('@')) {\n this.parsingContext.emitError(new Error(`Invalid term IRI: ${expanded}`));\n }\n else {\n return null;\n }\n }\n return this.dataFactory.namedNode(expanded);\n }\n /**\n * Ensure that the given value becomes a string.\n * @param {string | number} value A string or number.\n * @param {NamedNode} datatype The intended datatype.\n * @return {string} The returned string.\n */\n intToString(value, datatype) {\n if (typeof value === 'number') {\n if (Number.isFinite(value)) {\n const isInteger = value % 1 === 0;\n if (isInteger && (!datatype || datatype.value !== Util.XSD_DOUBLE)) {\n return Number(value).toString();\n }\n else {\n return value.toExponential(15).replace(/(\\d)0*e\\+?/, '$1E');\n }\n }\n else {\n return value > 0 ? 'INF' : '-INF';\n }\n }\n else {\n return value;\n }\n }\n /**\n * Convert a given JSON string value to an RDF term.\n * @param {number} depth The current stack depth.\n * @param {JsonLdContextNormalized} context A JSON-LD context.\n * @param {string} key The current JSON key.\n * @param {string} value A JSON value.\n * @param {NamedNode} defaultDatatype The default datatype for the given value.\n * @return {RDF.Term} An RDF term or null.\n */\n stringValueToTerm(depth, context, key, value, defaultDatatype) {\n // Check the datatype from the context\n const contextType = Util.getContextValueType(context, key);\n if (contextType) {\n if (contextType === '@id') {\n if (!defaultDatatype) {\n return this.resourceToTerm(context, this.intToString(value, defaultDatatype));\n }\n }\n else if (contextType === '@vocab') {\n if (!defaultDatatype) {\n return this.createVocabOrBaseTerm(context, this.intToString(value, defaultDatatype));\n }\n }\n else {\n defaultDatatype = this.dataFactory.namedNode(contextType);\n }\n }\n // If we don't find such a datatype, check the language from the context\n if (!defaultDatatype) {\n const contextLanguage = Util.getContextValueLanguage(context, key);\n const contextDirection = Util.getContextValueDirection(context, key);\n if (contextDirection && this.parsingContext.rdfDirection) {\n return this.createLanguageDirectionLiteral(depth, this.intToString(value, defaultDatatype), contextLanguage, contextDirection);\n }\n else {\n return this.dataFactory.literal(this.intToString(value, defaultDatatype), contextLanguage);\n }\n }\n // If all else fails, make a literal based on the default content type\n return this.dataFactory.literal(this.intToString(value, defaultDatatype), defaultDatatype);\n }\n /**\n * Create a literal for the given value with the given language and direction.\n * Auxiliary quads may be emitted.\n * @param {number} depth The current stack depth.\n * @param {string} value A string value.\n * @param {string} language A language tag.\n * @param {string} direction A direction.\n * @return {Term} An RDF term.\n */\n createLanguageDirectionLiteral(depth, value, language, direction) {\n if (this.parsingContext.rdfDirection === 'i18n-datatype') {\n // Create a datatyped literal, by encoding the language and direction into https://www.w3.org/ns/i18n#.\n if (!language) {\n language = '';\n }\n return this.dataFactory.literal(value, this.dataFactory.namedNode(`https://www.w3.org/ns/i18n#${language}_${direction}`));\n }\n else {\n // Reify the literal.\n const valueNode = this.dataFactory.blankNode();\n const graph = this.getDefaultGraph();\n this.parsingContext.emitQuad(depth, this.dataFactory.quad(valueNode, this.dataFactory.namedNode(Util.RDF + 'value'), this.dataFactory.literal(value), graph));\n if (language) {\n this.parsingContext.emitQuad(depth, this.dataFactory.quad(valueNode, this.dataFactory.namedNode(Util.RDF + 'language'), this.dataFactory.literal(language), graph));\n }\n this.parsingContext.emitQuad(depth, this.dataFactory.quad(valueNode, this.dataFactory.namedNode(Util.RDF + 'direction'), this.dataFactory.literal(direction), graph));\n return valueNode;\n }\n }\n /**\n * Stringify the given JSON object to a canonical JSON string.\n * @param value Any valid JSON value.\n * @return {string} A canonical JSON string.\n */\n valueToJsonString(value) {\n return canonicalizeJson(value);\n }\n /**\n * If the key is not a keyword, try to check if it is an alias for a keyword,\n * and if so, un-alias it.\n * @param {string} key A key, can be falsy.\n * @param {string[]} keys The path of keys.\n * @param {number} depth The depth to\n * @param {boolean} disableCache If the cache should be disabled\n * @param {JsonLdContextNormalized} context A context to unalias with,\n * will fallback to retrieving the context for the given keys.\n * @return {Promise} A promise resolving to the key itself, or another key.\n */\n async unaliasKeyword(key, keys, depth, disableCache, context) {\n // Numbers can not be an alias\n if (Number.isInteger(key)) {\n return key;\n }\n // Try to grab from cache if it was already un-aliased before.\n if (!disableCache) {\n const cachedUnaliasedKeyword = this.parsingContext.unaliasedKeywordCacheStack[depth];\n if (cachedUnaliasedKeyword) {\n return cachedUnaliasedKeyword;\n }\n }\n if (!jsonld_context_parser_1.Util.isPotentialKeyword(key)) {\n context = context || await this.parsingContext.getContext(keys);\n let unliased = context.getContextRaw()[key];\n if (unliased && typeof unliased === 'object') {\n unliased = unliased['@id'];\n }\n if (jsonld_context_parser_1.Util.isValidKeyword(unliased)) {\n key = unliased;\n }\n }\n return disableCache ? key : (this.parsingContext.unaliasedKeywordCacheStack[depth] = key);\n }\n /**\n * Unalias the keyword of the parent.\n * This adds a safety check if no parent exist.\n * @param {any[]} keys A stack of keys.\n * @param {number} depth The current depth.\n * @return {Promise} A promise resolving to the parent key, or another key.\n */\n async unaliasKeywordParent(keys, depth) {\n return await this.unaliasKeyword(depth > 0 && keys[depth - 1], keys, depth - 1);\n }\n /**\n * Un-alias all keywords in the given hash.\n * @param {{[p: string]: any}} hash A hash object.\n * @param {string[]} keys The path of keys.\n * @param {number} depth The depth.\n * @param {JsonLdContextNormalized} context A context to unalias with,\n * will fallback to retrieving the context for the given keys.\n * @return {Promise<{[p: string]: any}>} A promise resolving to the new hash.\n */\n async unaliasKeywords(hash, keys, depth, context) {\n const newHash = {};\n for (const key in hash) {\n newHash[await this.unaliasKeyword(key, keys, depth + 1, true, context)] = hash[key];\n }\n return newHash;\n }\n /**\n * Check if we are processing a literal (including JSON literals) at the given depth.\n * This will also check higher levels,\n * because if a parent is a literal,\n * then the deeper levels are definitely a literal as well.\n * @param {any[]} keys The keys.\n * @param {number} depth The depth.\n * @return {boolean} If we are processing a literal.\n */\n async isLiteral(keys, depth) {\n for (let i = depth; i >= 0; i--) {\n if (await this.unaliasKeyword(keys[i], keys, i) === '@annotation') {\n // Literals may have annotations, which require processing of inner nodes.\n return false;\n }\n if (this.parsingContext.literalStack[i] || this.parsingContext.jsonLiteralStack[i]) {\n return true;\n }\n }\n return false;\n }\n /**\n * Check how many parents should be skipped for checking the @graph for the given node.\n *\n * @param {number} depth The depth of the node.\n * @param {any[]} keys An array of keys.\n * @return {number} The graph depth offset.\n */\n async getDepthOffsetGraph(depth, keys) {\n for (let i = depth - 1; i > 0; i--) {\n if (await this.unaliasKeyword(keys[i], keys, i) === '@graph') {\n // Skip further processing if we are already in an @graph-@id or @graph-@index container\n const containers = (await EntryHandlerContainer_1.EntryHandlerContainer.getContainerHandler(this.parsingContext, keys, i)).containers;\n if (EntryHandlerContainer_1.EntryHandlerContainer.isComplexGraphContainer(containers)) {\n return -1;\n }\n return depth - i - 1;\n }\n }\n return -1;\n }\n /**\n * Check if the given subject is of a valid type.\n * This should be called when applying @reverse'd properties.\n * @param {Term} subject A subject.\n */\n validateReverseSubject(subject) {\n if (subject.termType === 'Literal') {\n throw new jsonld_context_parser_1.ErrorCoded(`Found illegal literal in subject position: ${subject.value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE);\n }\n }\n /**\n * Get the default graph.\n * @return {Term} An RDF term.\n */\n getDefaultGraph() {\n return this.parsingContext.defaultGraph || this.dataFactory.defaultGraph();\n }\n /**\n * Get the current graph, while taking into account a graph that can be defined via @container: @graph.\n * If not within a graph container, the default graph will be returned.\n * @param keys The current keys.\n * @param depth The current depth.\n */\n async getGraphContainerValue(keys, depth) {\n // Default to default graph\n let graph = this.getDefaultGraph();\n // Check if we are in an @container: @graph.\n const { containers, depth: depthContainer } = await EntryHandlerContainer_1.EntryHandlerContainer\n .getContainerHandler(this.parsingContext, keys, depth);\n if ('@graph' in containers) {\n // Get the graph from the stack.\n const graphContainerIndex = EntryHandlerContainer_1.EntryHandlerContainer.getContainerGraphIndex(containers, depthContainer, keys);\n const entry = this.parsingContext.graphContainerTermStack[depthContainer];\n graph = entry ? entry[graphContainerIndex] : null;\n // Set the graph in the stack if none has been set yet.\n if (!graph) {\n let graphId = null;\n if ('@id' in containers) {\n const keyUnaliased = await this.getContainerKey(keys[depthContainer], keys, depthContainer);\n if (keyUnaliased !== null) {\n graphId = await this.resourceToTerm(await this.parsingContext.getContext(keys), keyUnaliased);\n }\n }\n if (!graphId) {\n graphId = this.dataFactory.blankNode();\n }\n if (!this.parsingContext.graphContainerTermStack[depthContainer]) {\n this.parsingContext.graphContainerTermStack[depthContainer] = {};\n }\n graph = this.parsingContext.graphContainerTermStack[depthContainer][graphContainerIndex] = graphId;\n }\n }\n return graph;\n }\n /**\n * Get the properties depth for retrieving properties.\n *\n * Typically, the properties depth will be identical to the given depth.\n *\n * The following exceptions apply:\n * * When the parent is @reverse, the depth is decremented by one.\n * * When @nest parents are found, the depth is decremented by the number of @nest parents.\n * If in combination with the exceptions above an intermediary array is discovered,\n * the depth is also decremented by this number of arrays.\n *\n * @param keys The current key chain.\n * @param depth The current depth.\n */\n async getPropertiesDepth(keys, depth) {\n let lastValidDepth = depth;\n for (let i = depth - 1; i > 0; i--) {\n if (typeof keys[i] !== 'number') { // Skip array keys\n const parentKey = await this.unaliasKeyword(keys[i], keys, i);\n if (parentKey === '@reverse') {\n return i;\n }\n else if (parentKey === '@nest') {\n lastValidDepth = i;\n }\n else {\n return lastValidDepth;\n }\n }\n }\n return lastValidDepth;\n }\n /**\n * Get the key for the current container entry.\n * @param key A key, can be falsy.\n * @param keys The key chain.\n * @param depth The current depth to get the key from.\n * @return Promise resolving to the key.\n * Null will be returned for @none entries, with aliasing taken into account.\n */\n async getContainerKey(key, keys, depth) {\n const keyUnaliased = await this.unaliasKeyword(key, keys, depth);\n return keyUnaliased === '@none' ? null : keyUnaliased;\n }\n /**\n * Check if no reverse properties are present in embedded nodes.\n * @param key The current key.\n * @param reverse If a reverse property is active.\n * @param isEmbedded If we're in an embedded node.\n */\n validateReverseInEmbeddedNode(key, reverse, isEmbedded) {\n if (isEmbedded && reverse && !this.parsingContext.rdfstarReverseInEmbedded) {\n throw new jsonld_context_parser_1.ErrorCoded(`Illegal reverse property in embedded node in ${key}`, jsonld_context_parser_1.ERROR_CODES.INVALID_EMBEDDED_NODE);\n }\n }\n /**\n * Emit a quad, with checks.\n * @param depth The current depth.\n * @param subject S\n * @param predicate P\n * @param object O\n * @param graph G\n * @param reverse If a reverse property is active.\n * @param isEmbedded If we're in an embedded node.\n */\n emitQuadChecked(depth, subject, predicate, object, graph, reverse, isEmbedded) {\n // Create a quad\n let quad;\n if (reverse) {\n this.validateReverseSubject(object);\n quad = this.dataFactory.quad(object, predicate, subject, graph);\n }\n else {\n quad = this.dataFactory.quad(subject, predicate, object, graph);\n }\n // Emit the quad, unless it was created in an embedded node\n if (isEmbedded) {\n // Embedded nodes don't inherit the active graph\n if (quad.graph.termType !== 'DefaultGraph') {\n quad = this.dataFactory.quad(quad.subject, quad.predicate, quad.object);\n }\n // Multiple embedded nodes are not allowed\n if (this.parsingContext.idStack[depth - 1]) {\n throw new jsonld_context_parser_1.ErrorCoded(`Illegal multiple properties in an embedded node`, jsonld_context_parser_1.ERROR_CODES.INVALID_EMBEDDED_NODE);\n }\n this.parsingContext.idStack[depth - 1] = [quad];\n }\n else {\n this.parsingContext.emitQuad(depth, quad);\n }\n // Flush annotations\n const annotationsBuffer = this.parsingContext.annotationsBuffer[depth];\n if (annotationsBuffer) {\n for (const annotation of annotationsBuffer) {\n this.emitAnnotation(depth, quad, annotation);\n }\n delete this.parsingContext.annotationsBuffer[depth];\n }\n }\n // This is a separate function to enable recursion\n emitAnnotation(depth, quad, annotation) {\n // Construct annotation quad\n let annotationQuad;\n if (annotation.reverse) {\n this.validateReverseSubject(annotation.object);\n annotationQuad = this.dataFactory.quad(annotation.object, annotation.predicate, quad);\n }\n else {\n annotationQuad = this.dataFactory.quad(quad, annotation.predicate, annotation.object);\n }\n // Emit annotated quad\n this.parsingContext.emitQuad(depth, annotationQuad);\n // Also emit nested annotations\n for (const nestedAnnotation of annotation.nestedAnnotations) {\n this.emitAnnotation(depth, annotationQuad, nestedAnnotation);\n }\n }\n}\nUtil.XSD = 'http://www.w3.org/2001/XMLSchema#';\nUtil.XSD_BOOLEAN = Util.XSD + 'boolean';\nUtil.XSD_INTEGER = Util.XSD + 'integer';\nUtil.XSD_DOUBLE = Util.XSD + 'double';\nUtil.RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';\nexports.Util = Util;\n//# sourceMappingURL=Util.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ContainerHandlerIdentifier = void 0;\n/**\n * Container handler for @id.\n *\n * It assumes that the current key is the identifier of the current value.\n * This will add this value to the parent node.\n */\nclass ContainerHandlerIdentifier {\n canCombineWithGraph() {\n return true;\n }\n async handle(containers, parsingContext, util, keys, value, depth) {\n let id;\n // First check if the child node already has a defined id.\n if (parsingContext.emittedStack[depth + 1] && parsingContext.idStack[depth + 1]) {\n // Use the existing identifier\n id = parsingContext.idStack[depth + 1][0];\n }\n else {\n // Create the identifier\n const keyUnaliased = await util.getContainerKey(keys[depth], keys, depth);\n const maybeId = keyUnaliased !== null\n ? await util.resourceToTerm(await parsingContext.getContext(keys), keys[depth])\n : util.dataFactory.blankNode();\n // Do nothing if the id is invalid\n if (!maybeId) {\n parsingContext.emittedStack[depth] = false; // Don't emit the predicate owning this container.\n return;\n }\n id = maybeId;\n // Insert the id into the stack so that buffered children can make us of it.\n parsingContext.idStack[depth + 1] = [id];\n }\n // Insert the id into the stack so that parents can make use of it.\n // Insert it as an array because multiple id container entries may exist\n let ids = parsingContext.idStack[depth];\n if (!ids) {\n ids = parsingContext.idStack[depth] = [];\n }\n // Only insert the term if it does not exist yet in the array.\n if (!ids.some((term) => term.equals(id))) {\n ids.push(id);\n }\n // Flush any pending flush buffers\n if (!await parsingContext.handlePendingContainerFlushBuffers()) {\n parsingContext.emittedStack[depth] = false; // Don't emit the predicate owning this container.\n }\n }\n}\nexports.ContainerHandlerIdentifier = ContainerHandlerIdentifier;\n//# sourceMappingURL=ContainerHandlerIdentifier.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ContainerHandlerIndex = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst EntryHandlerPredicate_1 = require(\"../entryhandler/EntryHandlerPredicate\");\nconst Util_1 = require(\"../Util\");\n/**\n * Container handler for @index.\n *\n * This will ignore the current key and add this entry to the parent node.\n */\nclass ContainerHandlerIndex {\n canCombineWithGraph() {\n return true;\n }\n async handle(containers, parsingContext, util, keys, value, depth) {\n if (!Array.isArray(value)) {\n const graphContainer = '@graph' in containers;\n // Check if the container is a property-based container by checking if there is a valid @index.\n const context = await parsingContext.getContext(keys);\n const indexKey = keys[depth - 1];\n const indexPropertyRaw = Util_1.Util.getContextValueIndex(context, indexKey);\n if (indexPropertyRaw) {\n // Validate the @index value\n if (jsonld_context_parser_1.Util.isPotentialKeyword(indexPropertyRaw)) {\n throw new jsonld_context_parser_1.ErrorCoded(`Keywords can not be used as @index value, got: ${indexPropertyRaw}`, jsonld_context_parser_1.ERROR_CODES.INVALID_TERM_DEFINITION);\n }\n if (typeof indexPropertyRaw !== 'string') {\n throw new jsonld_context_parser_1.ErrorCoded(`@index values must be strings, got: ${indexPropertyRaw}`, jsonld_context_parser_1.ERROR_CODES.INVALID_TERM_DEFINITION);\n }\n // When @index is used, values must be node values, unless @type: @id is defined in the context\n if (typeof value !== 'object') {\n // Error if we don't have @type: @id\n if (Util_1.Util.getContextValueType(context, indexKey) !== '@id') {\n throw new jsonld_context_parser_1.ErrorCoded(`Property-based index containers require nodes as values or strings with @type: @id, but got: ${value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_VALUE_OBJECT);\n }\n // Add an @id to the stack, so our expanded @index value can make use of it\n const id = util.resourceToTerm(context, value);\n if (id) {\n parsingContext.idStack[depth + 1] = [id];\n }\n }\n // Expand the @index value\n const indexProperty = util.createVocabOrBaseTerm(context, indexPropertyRaw);\n if (indexProperty) {\n const indexValues = await util.valueToTerm(context, indexPropertyRaw, await util.getContainerKey(keys[depth], keys, depth), depth, keys);\n if (graphContainer) {\n // When we're in a graph container, attach the index to the graph identifier\n const graphId = await util.getGraphContainerValue(keys, depth + 1);\n for (const indexValue of indexValues) {\n parsingContext.emitQuad(depth, util.dataFactory.quad(graphId, indexProperty, indexValue, util.getDefaultGraph()));\n }\n }\n else {\n // Otherwise, attach the index to the node identifier\n for (const indexValue of indexValues) {\n await EntryHandlerPredicate_1.EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth + 1, indexProperty, indexValue, false, false, false);\n }\n }\n }\n }\n const depthOffset = graphContainer ? 2 : 1;\n await parsingContext.newOnValueJob(keys.slice(0, keys.length - depthOffset), value, depth - depthOffset, true);\n // Flush any pending flush buffers\n await parsingContext.handlePendingContainerFlushBuffers();\n }\n parsingContext.emittedStack[depth] = false; // We have emitted a level higher\n }\n}\nexports.ContainerHandlerIndex = ContainerHandlerIndex;\n//# sourceMappingURL=ContainerHandlerIndex.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ContainerHandlerLanguage = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\n/**\n * Container handler for @language.\n *\n * It assumes that the current key is the language of the current value.\n * This will add this value to the parent node.\n */\nclass ContainerHandlerLanguage {\n canCombineWithGraph() {\n return false;\n }\n async handle(containers, parsingContext, util, keys, value, depth) {\n const language = await util.getContainerKey(keys[depth], keys, depth);\n if (Array.isArray(value)) {\n // No type-checking needed, will be handled on each value when this handler is called recursively.\n value = value.map((subValue) => ({ '@value': subValue, '@language': language }));\n }\n else {\n if (typeof value !== 'string') {\n throw new jsonld_context_parser_1.ErrorCoded(`Got invalid language map value, got '${JSON.stringify(value)}', but expected string`, jsonld_context_parser_1.ERROR_CODES.INVALID_LANGUAGE_MAP_VALUE);\n }\n value = { '@value': value, '@language': language };\n }\n await parsingContext.newOnValueJob(keys.slice(0, keys.length - 1), value, depth - 1, true);\n parsingContext.emittedStack[depth] = false; // We have emitted a level higher\n }\n}\nexports.ContainerHandlerLanguage = ContainerHandlerLanguage;\n//# sourceMappingURL=ContainerHandlerLanguage.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ContainerHandlerType = void 0;\nconst EntryHandlerPredicate_1 = require(\"../entryhandler/EntryHandlerPredicate\");\nconst Util_1 = require(\"../Util\");\n/**\n * Container handler for @type.\n *\n * This will add this entry to the parent node, and use the current key as an rdf:type value.\n */\nclass ContainerHandlerType {\n canCombineWithGraph() {\n return false;\n }\n async handle(containers, parsingContext, util, keys, value, depth) {\n if (!Array.isArray(value)) {\n if (typeof value === 'string') {\n // Determine the @type of the container\n const context = await parsingContext.getContext(keys);\n const containerTypeType = Util_1.Util.getContextValueType(context, keys[depth - 1]);\n // String values refer to node references\n const id = containerTypeType === '@vocab'\n ? await util.createVocabOrBaseTerm(context, value)\n : await util.resourceToTerm(context, value);\n if (id) {\n // Handle the value of this node as @id, which will also cause the predicate from above to be emitted.\n const subValue = { '@id': id.termType === 'NamedNode' ? id.value : value };\n await parsingContext.newOnValueJob(keys.slice(0, keys.length - 1), subValue, depth - 1, true);\n // Set the id in the stack so it can be used for the rdf:type handling later on\n parsingContext.idStack[depth + 1] = [id];\n }\n }\n else {\n // Other values are handled by handling them as a proper job\n // Check needed for cases where entries don't have an explicit @id\n const entryHasIdentifier = !!parsingContext.idStack[depth + 1];\n // Handle the value of this node, which will also cause the predicate from above to be emitted.\n if (!entryHasIdentifier) {\n delete parsingContext.idStack[depth]; // Force new (blank node) identifier\n }\n await parsingContext.newOnValueJob(keys.slice(0, keys.length - 1), value, depth - 1, true);\n if (!entryHasIdentifier) {\n parsingContext.idStack[depth + 1] = parsingContext.idStack[depth]; // Copy the id to the child node, for @type\n }\n }\n // Identify the type to emit.\n const keyOriginal = await util.getContainerKey(keys[depth], keys, depth);\n const type = keyOriginal !== null\n ? util.createVocabOrBaseTerm(await parsingContext.getContext(keys), keyOriginal)\n : null;\n if (type) {\n // Push the type to the stack using the rdf:type predicate\n await EntryHandlerPredicate_1.EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth + 1, util.rdfType, type, false, false, false);\n }\n // Flush any pending flush buffers\n await parsingContext.handlePendingContainerFlushBuffers();\n }\n parsingContext.emittedStack[depth] = false; // Don't emit the predicate owning this container.\n }\n}\nexports.ContainerHandlerType = ContainerHandlerType;\n//# sourceMappingURL=ContainerHandlerType.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerArrayValue = void 0;\nconst Util_1 = require(\"../Util\");\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\n/**\n * Handles values that are part of an array.\n */\nclass EntryHandlerArrayValue {\n isPropertyHandler() {\n return false;\n }\n isStackProcessor() {\n return true;\n }\n async validate(parsingContext, util, keys, depth, inProperty) {\n return this.test(parsingContext, util, null, keys, depth);\n }\n async test(parsingContext, util, key, keys, depth) {\n return typeof keys[depth] === 'number';\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n let parentKey = await util.unaliasKeywordParent(keys, depth);\n // Check if we have an anonymous list\n if (parentKey === '@list') {\n // Our value is part of an array\n // Determine the list root key\n let listRootKey = null;\n let listRootDepth = 0;\n for (let i = depth - 2; i > 0; i--) {\n const keyOption = keys[i];\n if (typeof keyOption === 'string' || typeof keyOption === 'number') {\n listRootDepth = i;\n listRootKey = keyOption;\n break;\n }\n }\n if (listRootKey !== null) {\n // Emit the given objects as list elements\n const values = await util.valueToTerm(await parsingContext.getContext(keys), listRootKey, value, depth, keys);\n for (const object of values) {\n await this.handleListElement(parsingContext, util, object, value, depth, keys.slice(0, listRootDepth), listRootDepth);\n }\n // If no values were found, emit a falsy list element to force an empty RDF list to be emitted.\n if (values.length === 0) {\n await this.handleListElement(parsingContext, util, null, value, depth, keys.slice(0, listRootDepth), listRootDepth);\n }\n }\n }\n else if (parentKey === '@set') {\n // Our value is part of a set, so we just add it to the parent-parent\n await parsingContext.newOnValueJob(keys.slice(0, -2), value, depth - 2, false);\n }\n else if (parentKey !== undefined && parentKey !== '@type') {\n // Buffer our value using the parent key as predicate\n // Determine the first parent key that is *not* an array key\n // This is needed in case we have an @list container with nested arrays,\n // where each of them should produce nested RDF lists.\n for (let i = depth - 1; i > 0; i--) {\n if (typeof keys[i] !== 'number') {\n parentKey = await util.unaliasKeyword(keys[i], keys, i);\n break;\n }\n }\n // Check if the predicate is marked as an @list in the context\n const parentContext = await parsingContext.getContext(keys.slice(0, -1));\n if ('@list' in Util_1.Util.getContextValueContainer(parentContext, parentKey)) {\n // Our value is part of an array\n // Emit the given objects as list elements\n parsingContext.emittedStack[depth + 1] = true; // Ensure the creation of bnodes for empty nodes\n const values = await util.valueToTerm(await parsingContext.getContext(keys), parentKey, value, depth, keys);\n for (const object of values) {\n await this.handleListElement(parsingContext, util, object, value, depth, keys.slice(0, -1), depth - 1);\n }\n // If no values were found, emit a falsy list element to force an empty RDF list to be emitted.\n if (values.length === 0) {\n await this.handleListElement(parsingContext, util, null, value, depth, keys.slice(0, -1), depth - 1);\n }\n }\n else {\n // Copy the stack values up one level so that the next job can access them.\n parsingContext.shiftStack(depth, 1);\n // Execute the job one level higher\n await parsingContext.newOnValueJob(keys.slice(0, -1), value, depth - 1, false);\n // Remove any defined contexts at this level to avoid it to propagate to the next array element.\n parsingContext.contextTree.removeContext(keys.slice(0, -1));\n }\n }\n }\n async handleListElement(parsingContext, util, value, valueOriginal, depth, listRootKeys, listRootDepth) {\n // Buffer our value as an RDF list using the listRootKey as predicate\n let listPointer = parsingContext.listPointerStack[depth];\n if (valueOriginal !== null && (await util.unaliasKeywords(valueOriginal, listRootKeys, depth))['@value'] !== null) {\n if (!listPointer || !listPointer.value) {\n const linkTerm = util.dataFactory.blankNode();\n listPointer = { value: linkTerm, listRootDepth, listId: linkTerm };\n }\n else {\n // rdf:rest links are always emitted before the next element,\n // as the blank node identifier is only created at that point.\n // Because of this reason, the final rdf:nil is emitted when the stack depth is decreased.\n const newLinkTerm = util.dataFactory.blankNode();\n parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer.value, util.rdfRest, newLinkTerm, util.getDefaultGraph()));\n // Update the list pointer for the next element\n listPointer.value = newLinkTerm;\n }\n // Emit a list element for the current value\n // Omit rdf:first if the value is invalid\n if (value) {\n parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer.value, util.rdfFirst, value, util.getDefaultGraph()));\n }\n }\n else {\n // A falsy list element if found.\n // Mark it as an rdf:nil list until another valid list element comes in\n if (!listPointer) {\n listPointer = { listRootDepth, listId: util.rdfNil };\n }\n }\n parsingContext.listPointerStack[depth] = listPointer;\n // Error if an annotation was defined\n if (parsingContext.rdfstar && parsingContext.annotationsBuffer[depth]) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal annotation inside a list`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION));\n }\n }\n}\nexports.EntryHandlerArrayValue = EntryHandlerArrayValue;\n//# sourceMappingURL=EntryHandlerArrayValue.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerContainer = void 0;\nconst ContainerHandlerIdentifier_1 = require(\"../containerhandler/ContainerHandlerIdentifier\");\nconst ContainerHandlerIndex_1 = require(\"../containerhandler/ContainerHandlerIndex\");\nconst ContainerHandlerLanguage_1 = require(\"../containerhandler/ContainerHandlerLanguage\");\nconst ContainerHandlerType_1 = require(\"../containerhandler/ContainerHandlerType\");\nconst Util_1 = require(\"../Util\");\n/**\n * Handles values that are part of a container type (like @index),\n * as specified by {@link IContainerHandler}.\n */\nclass EntryHandlerContainer {\n /**\n * Check fit the given container is a simple @graph container.\n * Concretely, it will check if no @index or @id is active as well.\n * @param containers A container hash.\n */\n static isSimpleGraphContainer(containers) {\n return '@graph' in containers\n && (('@set' in containers && Object.keys(containers).length === 2) || Object.keys(containers).length === 1);\n }\n /**\n * Check fit the given container is a complex @graph container.\n * Concretely, it will check if @index or @id is active as well next to @graph.\n * @param containers A container hash.\n */\n static isComplexGraphContainer(containers) {\n return '@graph' in containers\n && (('@set' in containers && Object.keys(containers).length > 2)\n || (!('@set' in containers) && Object.keys(containers).length > 1));\n }\n /**\n * Create an graph container index that can be used for identifying a graph term inside the graphContainerTermStack.\n * @param containers The applicable containers.\n * @param depth The container depth.\n * @param keys The array of keys.\n * @return The graph index.\n */\n static getContainerGraphIndex(containers, depth, keys) {\n let isSimpleGraphContainer = EntryHandlerContainer.isSimpleGraphContainer(containers);\n let index = '';\n for (let i = depth; i < keys.length; i++) {\n if (!isSimpleGraphContainer || typeof keys[i] === 'number') {\n index += ':' + keys[i];\n }\n // Only allow a second 'real' key if in a non-simple graph container.\n if (!isSimpleGraphContainer && typeof keys[i] !== 'number') {\n isSimpleGraphContainer = true;\n }\n }\n return index;\n }\n /**\n * Return the applicable container type at the given depth.\n *\n * This will ignore any arrays in the key chain.\n *\n * @param {ParsingContext} parsingContext A parsing context.\n * @param {any[]} keys The array of keys.\n * @param {number} depth The current depth.\n * @return {Promise<{ containers: {[typeName: string]: boolean}, depth: number, fallback: boolean }>}\n * All applicable containers for the given depth,\n * the `depth` of the container root (can change when arrays are in the key chain),\n * and the `fallback` flag that indicates if the default container type was returned\n * (i.e., no dedicated container type is defined).\n */\n static async getContainerHandler(parsingContext, keys, depth) {\n const fallback = {\n containers: { '@set': true },\n depth,\n fallback: true,\n };\n // A flag that is enabled when @graph container should be tested in next iteration\n let checkGraphContainer = false;\n // Iterate from deeper to higher\n const context = await parsingContext.getContext(keys, 2);\n for (let i = depth - 1; i >= 0; i--) {\n if (typeof keys[i] !== 'number') { // Skip array keys\n // @graph containers without any other types are one level less deep, and require special handling\n const containersSelf = Util_1.Util.getContextValue(context, '@container', keys[i], false);\n if (containersSelf && EntryHandlerContainer.isSimpleGraphContainer(containersSelf)) {\n return {\n containers: containersSelf,\n depth: i + 1,\n fallback: false,\n };\n }\n const containersParent = Util_1.Util.getContextValue(context, '@container', keys[i - 1], false);\n if (!containersParent) { // If we have the fallback container value\n if (checkGraphContainer) {\n // Return false if we were already expecting a @graph-@id of @graph-@index container\n return fallback;\n }\n // Check parent-parent, we may be in a @graph-@id of @graph-@index container, which have two levels\n checkGraphContainer = true;\n }\n else {\n // We had an invalid container next iteration, so we now have to check if we were in an @graph container\n const graphContainer = '@graph' in containersParent;\n // We're in a regular container\n for (const containerHandleName in EntryHandlerContainer.CONTAINER_HANDLERS) {\n if (containersParent[containerHandleName]) {\n if (graphContainer) {\n // Only accept graph containers if their combined handlers can handle them.\n if (EntryHandlerContainer.CONTAINER_HANDLERS[containerHandleName].canCombineWithGraph()) {\n return {\n containers: containersParent,\n depth: i,\n fallback: false,\n };\n }\n else {\n return fallback;\n }\n }\n else {\n // Only accept if we were not expecting a @graph-@id of @graph-@index container\n if (checkGraphContainer) {\n return fallback;\n }\n else {\n return {\n containers: containersParent,\n depth: i,\n fallback: false,\n };\n }\n }\n }\n }\n // Fail if no valid container handlers were found\n return fallback;\n }\n }\n }\n return fallback;\n }\n /**\n * Check if we are handling a value at the given depth\n * that is part of something that should be handled as a container,\n * AND if this container should be buffered, so that it can be handled by a dedicated container handler.\n *\n * For instance, any container with @graph will NOT be buffered.\n *\n * This will ignore any arrays in the key chain.\n *\n * @param {ParsingContext} parsingContext A parsing context.\n * @param {any[]} keys The array of keys.\n * @param {number} depth The current depth.\n * @return {Promise} If we are in the scope of a container handler.\n */\n static async isBufferableContainerHandler(parsingContext, keys, depth) {\n const handler = await EntryHandlerContainer.getContainerHandler(parsingContext, keys, depth);\n return !handler.fallback && !('@graph' in handler.containers);\n }\n isPropertyHandler() {\n return false;\n }\n isStackProcessor() {\n return true;\n }\n async validate(parsingContext, util, keys, depth, inProperty) {\n return !!await this.test(parsingContext, util, null, keys, depth);\n }\n async test(parsingContext, util, key, keys, depth) {\n const containers = Util_1.Util.getContextValueContainer(await parsingContext.getContext(keys, 2), keys[depth - 1]);\n for (const containerName in EntryHandlerContainer.CONTAINER_HANDLERS) {\n if (containers[containerName]) {\n return {\n containers,\n handler: EntryHandlerContainer.CONTAINER_HANDLERS[containerName],\n };\n }\n }\n return null;\n }\n async handle(parsingContext, util, key, keys, value, depth, testResult) {\n return testResult.handler.handle(testResult.containers, parsingContext, util, keys, value, depth);\n }\n}\nEntryHandlerContainer.CONTAINER_HANDLERS = {\n '@id': new ContainerHandlerIdentifier_1.ContainerHandlerIdentifier(),\n '@index': new ContainerHandlerIndex_1.ContainerHandlerIndex(),\n '@language': new ContainerHandlerLanguage_1.ContainerHandlerLanguage(),\n '@type': new ContainerHandlerType_1.ContainerHandlerType(),\n};\nexports.EntryHandlerContainer = EntryHandlerContainer;\n//# sourceMappingURL=EntryHandlerContainer.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerInvalidFallback = void 0;\n/**\n * A catch-all for properties, that will either emit an error or ignore,\n * depending on whether or not the `strictValues` property is set.\n */\nclass EntryHandlerInvalidFallback {\n isPropertyHandler() {\n return false;\n }\n isStackProcessor() {\n return true;\n }\n async validate(parsingContext, util, keys, depth, inProperty) {\n return false;\n }\n async test(parsingContext, util, key, keys, depth) {\n return true;\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n parsingContext.emittedStack[depth] = false;\n }\n}\nexports.EntryHandlerInvalidFallback = EntryHandlerInvalidFallback;\n//# sourceMappingURL=EntryHandlerInvalidFallback.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerPredicate = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst Util_1 = require(\"../Util\");\n/**\n * Interprets keys as predicates.\n * The most common case in JSON-LD processing.\n */\nclass EntryHandlerPredicate {\n /**\n * Handle the given predicate-object by either emitting it,\n * or by placing it in the appropriate stack for later emission when no @graph and/or @id has been defined.\n * @param {ParsingContext} parsingContext A parsing context.\n * @param {Util} util A utility instance.\n * @param {any[]} keys A stack of keys.\n * @param {number} depth The current depth.\n * @param {Term} predicate The predicate.\n * @param {Term} object The object.\n * @param {boolean} reverse If the property is reversed.\n * @param {boolean} isEmbedded If the property exists in an embedded node as direct child.\n * @param {boolean} isAnnotation If the property exists in an annotation object.\n * @return {Promise} A promise resolving when handling is done.\n */\n static async handlePredicateObject(parsingContext, util, keys, depth, predicate, object, reverse, isEmbedded, isAnnotation) {\n const depthProperties = await util.getPropertiesDepth(keys, depth);\n const depthOffsetGraph = await util.getDepthOffsetGraph(depth, keys);\n const depthPropertiesGraph = depth - depthOffsetGraph;\n const subjects = parsingContext.idStack[depthProperties];\n if (subjects && !isAnnotation) {\n // Emit directly if the @id was already defined\n for (const subject of subjects) {\n // Check if we're in a @graph context\n const atGraph = depthOffsetGraph >= 0;\n if (atGraph) {\n const graphs = parsingContext.idStack[depthPropertiesGraph - 1];\n if (graphs) {\n for (const graph of graphs) {\n // Emit our quad if graph @id is known\n util.emitQuadChecked(depth, subject, predicate, object, graph, reverse, isEmbedded);\n }\n }\n else {\n // Buffer our triple if graph @id is not known yet.\n if (reverse) {\n util.validateReverseSubject(object);\n parsingContext.getUnidentifiedGraphBufferSafe(depthPropertiesGraph - 1).push({ subject: object, predicate, object: subject, isEmbedded });\n }\n else {\n parsingContext.getUnidentifiedGraphBufferSafe(depthPropertiesGraph - 1)\n .push({ subject, predicate, object, isEmbedded });\n }\n }\n }\n else {\n // Emit if no @graph was applicable\n const graph = await util.getGraphContainerValue(keys, depthProperties);\n util.emitQuadChecked(depth, subject, predicate, object, graph, reverse, isEmbedded);\n }\n }\n }\n else {\n // Buffer until our @id becomes known, or we go up the stack\n if (reverse) {\n util.validateReverseSubject(object);\n }\n // Either push to the annotations or the actual value buffer\n if (isAnnotation) {\n // Only add to buffer if rdfstar is enabled\n if (parsingContext.rdfstar) {\n // Error if an @id was defined\n if (parsingContext.idStack[depth]) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @id inside an annotation: ${parsingContext.idStack[depth][0].value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION));\n }\n // Error if we're in an embedded node\n for (let i = 0; i < depth; i++) {\n if (await util.unaliasKeyword(keys[i], keys, i) === '@id') {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal annotation inside an embedded node`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION));\n }\n }\n // Store new annotation in the buffer\n const annotationsBuffer = parsingContext.getAnnotationsBufferSafe(depthProperties);\n const newAnnotation = { predicate, object, reverse, nestedAnnotations: [], depth: depthProperties };\n annotationsBuffer.push(newAnnotation);\n // Check in the buffer if any annotations were defined at a deeper depth,\n // if so, they are considered nested annotations.\n for (let i = annotationsBuffer.length - 2; i >= 0; i--) {\n // We iterate in reverse order, to enable easy item removal from the back.\n const existingAnnotation = annotationsBuffer[i];\n if (existingAnnotation.depth > depthProperties) {\n newAnnotation.nestedAnnotations.push(existingAnnotation);\n annotationsBuffer.splice(i, 1);\n }\n }\n }\n }\n else {\n parsingContext.getUnidentifiedValueBufferSafe(depthProperties).push({ predicate, object, reverse, isEmbedded });\n }\n }\n }\n isPropertyHandler() {\n return true;\n }\n isStackProcessor() {\n return true;\n }\n async validate(parsingContext, util, keys, depth, inProperty) {\n const key = keys[depth];\n if (key) {\n const context = await parsingContext.getContext(keys);\n if (!parsingContext.jsonLiteralStack[depth] && await util.predicateToTerm(context, keys[depth])) {\n // If this valid predicate is of type @json, mark it so in the stack so that no deeper handling of nodes occurs.\n if (Util_1.Util.getContextValueType(context, key) === '@json') {\n parsingContext.jsonLiteralStack[depth + 1] = true;\n }\n return true;\n }\n }\n return false;\n }\n async test(parsingContext, util, key, keys, depth) {\n return keys[depth];\n }\n async handle(parsingContext, util, key, keys, value, depth, testResult) {\n const keyOriginal = keys[depth];\n const context = await parsingContext.getContext(keys);\n const predicate = await util.predicateToTerm(context, key);\n if (predicate) {\n const objects = await util.valueToTerm(context, key, value, depth, keys);\n if (objects.length) {\n for (let object of objects) {\n // Based on parent key, check if reverse, embedded, and annotation.\n let parentKey = await util.unaliasKeywordParent(keys, depth);\n const reverse = Util_1.Util.isPropertyReverse(context, keyOriginal, parentKey);\n let parentDepthOffset = 0;\n while (parentKey === '@reverse' || typeof parentKey === 'number') {\n // Check parent of parent when checking while we're in an array or in @reverse\n if (typeof parentKey === 'number') {\n parentDepthOffset++;\n }\n else {\n depth--;\n }\n parentKey = await util.unaliasKeywordParent(keys, depth - parentDepthOffset);\n }\n const isEmbedded = Util_1.Util.isPropertyInEmbeddedNode(parentKey);\n util.validateReverseInEmbeddedNode(key, reverse, isEmbedded);\n const isAnnotation = Util_1.Util.isPropertyInAnnotationObject(parentKey);\n if (value) {\n // Special case if our term was defined as an @list, but does not occur in an array,\n // In that case we just emit it as an RDF list with a single element.\n const listValueContainer = '@list' in Util_1.Util.getContextValueContainer(context, key);\n if (listValueContainer || value['@list']) {\n if (((listValueContainer && !Array.isArray(value) && !value['@list'])\n || (value['@list'] && !Array.isArray(value['@list'])))\n && object !== util.rdfNil) {\n const listPointer = util.dataFactory.blankNode();\n parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer, util.rdfRest, util.rdfNil, util.getDefaultGraph()));\n parsingContext.emitQuad(depth, util.dataFactory.quad(listPointer, util.rdfFirst, object, util.getDefaultGraph()));\n object = listPointer;\n }\n // Lists are not allowed in @reverse'd properties\n if (reverse && !parsingContext.allowSubjectList) {\n throw new jsonld_context_parser_1.ErrorCoded(`Found illegal list value in subject position at ${key}`, jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_PROPERTY_VALUE);\n }\n }\n }\n await EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth, predicate, object, reverse, isEmbedded, isAnnotation);\n }\n }\n }\n }\n}\nexports.EntryHandlerPredicate = EntryHandlerPredicate;\n//# sourceMappingURL=EntryHandlerPredicate.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeyword = void 0;\n/**\n * An abstract keyword entry handler.\n */\nclass EntryHandlerKeyword {\n constructor(keyword) {\n this.keyword = keyword;\n }\n isPropertyHandler() {\n return false;\n }\n isStackProcessor() {\n return true;\n }\n async validate(parsingContext, util, keys, depth, inProperty) {\n return false;\n }\n async test(parsingContext, util, key, keys, depth) {\n return key === this.keyword;\n }\n}\nexports.EntryHandlerKeyword = EntryHandlerKeyword;\n//# sourceMappingURL=EntryHandlerKeyword.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordAnnotation = void 0;\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\n/**\n * Handles @annotation entries.\n */\nclass EntryHandlerKeywordAnnotation extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@annotation');\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n // Validate value\n if (typeof value === 'string' || (typeof value === 'object' && value['@value'])) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal annotation value: ${JSON.stringify(value)}`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION));\n }\n // Rest of the processing is done as regular nodes\n }\n}\nexports.EntryHandlerKeywordAnnotation = EntryHandlerKeywordAnnotation;\n//# sourceMappingURL=EntryHandlerKeywordAnnotation.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordContext = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\n/**\n * Handles @context entries.\n */\nclass EntryHandlerKeywordContext extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@context');\n }\n isStackProcessor() {\n return false;\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n // Error if an out-of-order context was found when support is not enabled.\n if (parsingContext.streamingProfile\n && (parsingContext.processingStack[depth]\n || parsingContext.processingType[depth]\n || parsingContext.idStack[depth] !== undefined)) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded('Found an out-of-order context, while streaming is enabled.' +\n '(disable `streamingProfile`)', jsonld_context_parser_1.ERROR_CODES.INVALID_STREAMING_KEY_ORDER));\n }\n // Find the parent context to inherit from.\n // We actually request a context for the current depth (with fallback to parent)\n // because we want to take into account any property-scoped contexts that are defined for this depth.\n const parentContext = parsingContext.getContext(keys);\n // Set the context for this scope\n const context = parsingContext.parseContext(value, (await parentContext).getContextRaw());\n parsingContext.contextTree.setContext(keys.slice(0, -1), context);\n parsingContext.emitContext(value);\n await parsingContext.validateContext(await context);\n }\n}\nexports.EntryHandlerKeywordContext = EntryHandlerKeywordContext;\n//# sourceMappingURL=EntryHandlerKeywordContext.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordGraph = void 0;\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\n/**\n * Handles @graph entries.\n */\nclass EntryHandlerKeywordGraph extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@graph');\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n // The current identifier identifies a graph for the deeper level.\n parsingContext.graphStack[depth + 1] = true;\n }\n}\nexports.EntryHandlerKeywordGraph = EntryHandlerKeywordGraph;\n//# sourceMappingURL=EntryHandlerKeywordGraph.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordId = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\n/**\n * Handles @id entries.\n */\nclass EntryHandlerKeywordId extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@id');\n }\n isStackProcessor() {\n return false;\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n if (typeof value !== 'string') {\n // JSON-LD-star allows @id object values\n if (parsingContext.rdfstar && typeof value === 'object') {\n const valueKeys = Object.keys(value);\n if (valueKeys.length === 1 && valueKeys[0] === '@id') {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Invalid embedded node without property with @id ${value['@id']}`, jsonld_context_parser_1.ERROR_CODES.INVALID_EMBEDDED_NODE));\n }\n }\n else {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal @id '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_ID_VALUE));\n }\n return;\n }\n // Determine the canonical place for this id.\n // For example, @nest parents should be ignored.\n const depthProperties = await util.getPropertiesDepth(keys, depth);\n // Error if an @id for this node already existed.\n if (parsingContext.idStack[depthProperties] !== undefined) {\n if (parsingContext.idStack[depthProperties][0].listHead) {\n // Error if an @list was already defined for this node\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal neighbouring entries next to @list for key: '${keys[depth - 1]}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_SET_OR_LIST_OBJECT));\n }\n else {\n // Otherwise, the previous id was just because of an @id entry.\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found duplicate @ids '${parsingContext\n .idStack[depthProperties][0].value}' and '${value}'`, jsonld_context_parser_1.ERROR_CODES.COLLIDING_KEYWORDS));\n }\n }\n // Error if an annotation was defined\n if (parsingContext.rdfstar && parsingContext.annotationsBuffer[depth]) {\n for (const annotation of parsingContext.annotationsBuffer[depth]) {\n if (annotation.depth === depth) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @id inside an annotation: ${value}`, jsonld_context_parser_1.ERROR_CODES.INVALID_ANNOTATION));\n }\n }\n }\n // Save our @id on the stack\n parsingContext.idStack[depthProperties] = util.nullableTermToArray(await util.resourceToTerm(await parsingContext.getContext(keys), value));\n }\n}\nexports.EntryHandlerKeywordId = EntryHandlerKeywordId;\n//# sourceMappingURL=EntryHandlerKeywordId.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordIncluded = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\n/**\n * Handles @included entries.\n */\nclass EntryHandlerKeywordIncluded extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@included');\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n if (typeof value !== 'object') {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal @included '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INCLUDED_VALUE));\n }\n const valueUnliased = await util.unaliasKeywords(value, keys, depth, await parsingContext.getContext(keys));\n if ('@value' in valueUnliased) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @included @value node '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INCLUDED_VALUE));\n }\n if ('@list' in valueUnliased) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an illegal @included @list node '${JSON.stringify(value)}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_INCLUDED_VALUE));\n }\n parsingContext.emittedStack[depth] = false;\n }\n}\nexports.EntryHandlerKeywordIncluded = EntryHandlerKeywordIncluded;\n//# sourceMappingURL=EntryHandlerKeywordIncluded.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordNest = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\n/**\n * Handles @nest entries.\n */\nclass EntryHandlerKeywordNest extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@nest');\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n if (typeof value !== 'object') {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found invalid @nest entry for '${key}': '${value}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_NEST_VALUE));\n }\n if ('@value' in await util.unaliasKeywords(value, keys, depth, await parsingContext.getContext(keys))) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found an invalid @value node for '${key}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_NEST_VALUE));\n }\n parsingContext.emittedStack[depth] = false;\n }\n}\nexports.EntryHandlerKeywordNest = EntryHandlerKeywordNest;\n//# sourceMappingURL=EntryHandlerKeywordNest.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordType = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\nconst Util_1 = require(\"../../Util\");\nconst EntryHandlerPredicate_1 = require(\"../EntryHandlerPredicate\");\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\n/**\n * Handles @graph entries.\n */\nclass EntryHandlerKeywordType extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@type');\n }\n isStackProcessor() {\n return false;\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n const keyOriginal = keys[depth];\n // The current identifier identifies an rdf:type predicate.\n // But we only emit it once the node closes,\n // as it's possible that the @type is used to identify the datatype of a literal, which we ignore here.\n const context = await parsingContext.getContext(keys);\n const predicate = util.rdfType;\n const parentKey = await util.unaliasKeywordParent(keys, depth);\n const reverse = Util_1.Util.isPropertyReverse(context, keyOriginal, parentKey);\n const isEmbedded = Util_1.Util.isPropertyInEmbeddedNode(parentKey);\n util.validateReverseInEmbeddedNode(key, reverse, isEmbedded);\n const isAnnotation = Util_1.Util.isPropertyInAnnotationObject(parentKey);\n // Handle multiple values if the value is an array\n const elements = Array.isArray(value) ? value : [value];\n for (const element of elements) {\n if (typeof element !== 'string') {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Found illegal @type '${element}'`, jsonld_context_parser_1.ERROR_CODES.INVALID_TYPE_VALUE));\n }\n const type = util.createVocabOrBaseTerm(context, element);\n if (type) {\n await EntryHandlerPredicate_1.EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth, predicate, type, reverse, isEmbedded, isAnnotation);\n }\n }\n // Collect type-scoped contexts if they exist\n let scopedContext = Promise.resolve(context);\n let hasTypedScopedContext = false;\n for (const element of elements.sort()) { // Spec requires lexicographical ordering\n const typeContext = Util_1.Util.getContextValue(context, '@context', element, null);\n if (typeContext) {\n hasTypedScopedContext = true;\n scopedContext = scopedContext.then((c) => parsingContext.parseContext(typeContext, c.getContextRaw()));\n }\n }\n // Error if an out-of-order type-scoped context was found when support is not enabled.\n if (parsingContext.streamingProfile\n && (hasTypedScopedContext || !parsingContext.streamingProfileAllowOutOfOrderPlainType)\n && (parsingContext.processingStack[depth] || parsingContext.idStack[depth])) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded('Found an out-of-order type-scoped context, while streaming is enabled.' +\n '(disable `streamingProfile`)', jsonld_context_parser_1.ERROR_CODES.INVALID_STREAMING_KEY_ORDER));\n }\n // If at least least one type-scoped context applies, set them in the tree.\n if (hasTypedScopedContext) {\n // Do not propagate by default\n scopedContext = scopedContext.then((c) => {\n // Set the original context at this depth as a fallback\n // This is needed when a context was already defined at the given depth,\n // and this context needs to remain accessible from child nodes when propagation is disabled.\n if (c.getContextRaw()['@propagate'] !== true) {\n return new jsonld_context_parser_1.JsonLdContextNormalized(Object.assign(Object.assign({}, c.getContextRaw()), { '@propagate': false, '@__propagateFallback': context.getContextRaw() }));\n }\n return c;\n });\n // Set the new context in the context tree\n parsingContext.contextTree.setContext(keys.slice(0, keys.length - 1), scopedContext);\n }\n // Flag that type has been processed at this depth\n parsingContext.processingType[depth] = true;\n }\n}\nexports.EntryHandlerKeywordType = EntryHandlerKeywordType;\n//# sourceMappingURL=EntryHandlerKeywordType.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordUnknownFallback = void 0;\nconst jsonld_context_parser_1 = require(\"jsonld-context-parser\");\n/**\n * A catch-all for keywords, that will either emit an error or ignore,\n * depending on whether or not the `strictValues` property is set.\n */\nclass EntryHandlerKeywordUnknownFallback {\n isPropertyHandler() {\n return false;\n }\n isStackProcessor() {\n return true;\n }\n async validate(parsingContext, util, keys, depth, inProperty) {\n const key = await util.unaliasKeyword(keys[depth], keys, depth);\n if (jsonld_context_parser_1.Util.isPotentialKeyword(key)) {\n // Don't emit anything inside free-floating lists\n if (!inProperty) {\n if (key === '@list') {\n return false;\n }\n }\n return true;\n }\n return false;\n }\n async test(parsingContext, util, key, keys, depth) {\n return jsonld_context_parser_1.Util.isPotentialKeyword(key);\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n const keywordType = EntryHandlerKeywordUnknownFallback.VALID_KEYWORDS_TYPES[key];\n if (keywordType !== undefined) {\n if (keywordType && typeof value !== keywordType.type) {\n parsingContext.emitError(new jsonld_context_parser_1.ErrorCoded(`Invalid value type for '${key}' with value '${value}'`, keywordType.errorCode));\n }\n }\n else if (parsingContext.strictValues) {\n parsingContext.emitError(new Error(`Unknown keyword '${key}' with value '${value}'`));\n }\n parsingContext.emittedStack[depth] = false;\n }\n}\nEntryHandlerKeywordUnknownFallback.VALID_KEYWORDS_TYPES = {\n '@index': { type: 'string', errorCode: jsonld_context_parser_1.ERROR_CODES.INVALID_INDEX_VALUE },\n '@list': null,\n '@reverse': { type: 'object', errorCode: jsonld_context_parser_1.ERROR_CODES.INVALID_REVERSE_VALUE },\n '@set': null,\n '@value': null,\n};\nexports.EntryHandlerKeywordUnknownFallback = EntryHandlerKeywordUnknownFallback;\n//# sourceMappingURL=EntryHandlerKeywordUnknownFallback.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EntryHandlerKeywordValue = void 0;\nconst EntryHandlerKeyword_1 = require(\"./EntryHandlerKeyword\");\n/**\n * Handles @value entries.\n */\nclass EntryHandlerKeywordValue extends EntryHandlerKeyword_1.EntryHandlerKeyword {\n constructor() {\n super('@value');\n }\n async validate(parsingContext, util, keys, depth, inProperty) {\n // If this is @value, mark it so in the stack so that no deeper handling of nodes occurs.\n const key = keys[depth];\n if (key && !parsingContext.literalStack[depth] && await this.test(parsingContext, util, key, keys, depth)) {\n parsingContext.literalStack[depth] = true;\n }\n return super.validate(parsingContext, util, keys, depth, inProperty);\n }\n async test(parsingContext, util, key, keys, depth) {\n return await util.unaliasKeyword(keys[depth], keys.slice(0, keys.length - 1), depth - 1, true) === '@value';\n }\n async handle(parsingContext, util, key, keys, value, depth) {\n // If the value is valid, indicate that we are processing a literal.\n // The actual value will be determined at the parent level when the @value is part of an object,\n // because we may want to take into account additional entries such as @language.\n // See {@link Util.valueToTerm}\n // Indicate that we are processing a literal, and that no later predicates should be parsed at this depth.\n parsingContext.literalStack[depth] = true;\n // Void any buffers that we may have accumulated up until now\n delete parsingContext.unidentifiedValuesBuffer[depth];\n delete parsingContext.unidentifiedGraphsBuffer[depth];\n // Indicate that we have not emitted at this depth\n parsingContext.emittedStack[depth] = false;\n }\n}\nexports.EntryHandlerKeywordValue = EntryHandlerKeywordValue;\n//# sourceMappingURL=EntryHandlerKeywordValue.js.map","'use strict'\n\nconst { SymbolDispose } = require('../../ours/primordials')\nconst { AbortError, codes } = require('../../ours/errors')\nconst { isNodeStream, isWebStream, kControllerErrorFunction } = require('./utils')\nconst eos = require('./end-of-stream')\nconst { ERR_INVALID_ARG_TYPE } = codes\nlet addAbortListener\n\n// This method is inlined here for readable-stream\n// It also does not allow for signal to not exist on the stream\n// https://github.com/nodejs/node/pull/36061#discussion_r533718029\nconst validateAbortSignal = (signal, name) => {\n if (typeof signal !== 'object' || !('aborted' in signal)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal)\n }\n}\nmodule.exports.addAbortSignal = function addAbortSignal(signal, stream) {\n validateAbortSignal(signal, 'signal')\n if (!isNodeStream(stream) && !isWebStream(stream)) {\n throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream)\n }\n return module.exports.addAbortSignalNoValidate(signal, stream)\n}\nmodule.exports.addAbortSignalNoValidate = function (signal, stream) {\n if (typeof signal !== 'object' || !('aborted' in signal)) {\n return stream\n }\n const onAbort = isNodeStream(stream)\n ? () => {\n stream.destroy(\n new AbortError(undefined, {\n cause: signal.reason\n })\n )\n }\n : () => {\n stream[kControllerErrorFunction](\n new AbortError(undefined, {\n cause: signal.reason\n })\n )\n }\n if (signal.aborted) {\n onAbort()\n } else {\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n const disposable = addAbortListener(signal, onAbort)\n eos(stream, disposable[SymbolDispose])\n }\n return stream\n}\n","'use strict'\n\nconst { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = require('../../ours/primordials')\nconst { Buffer } = require('buffer')\nconst { inspect } = require('../../ours/util')\nmodule.exports = class BufferList {\n constructor() {\n this.head = null\n this.tail = null\n this.length = 0\n }\n push(v) {\n const entry = {\n data: v,\n next: null\n }\n if (this.length > 0) this.tail.next = entry\n else this.head = entry\n this.tail = entry\n ++this.length\n }\n unshift(v) {\n const entry = {\n data: v,\n next: this.head\n }\n if (this.length === 0) this.tail = entry\n this.head = entry\n ++this.length\n }\n shift() {\n if (this.length === 0) return\n const ret = this.head.data\n if (this.length === 1) this.head = this.tail = null\n else this.head = this.head.next\n --this.length\n return ret\n }\n clear() {\n this.head = this.tail = null\n this.length = 0\n }\n join(s) {\n if (this.length === 0) return ''\n let p = this.head\n let ret = '' + p.data\n while ((p = p.next) !== null) ret += s + p.data\n return ret\n }\n concat(n) {\n if (this.length === 0) return Buffer.alloc(0)\n const ret = Buffer.allocUnsafe(n >>> 0)\n let p = this.head\n let i = 0\n while (p) {\n TypedArrayPrototypeSet(ret, p.data, i)\n i += p.data.length\n p = p.next\n }\n return ret\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n consume(n, hasStrings) {\n const data = this.head.data\n if (n < data.length) {\n // `slice` is the same for buffers and strings.\n const slice = data.slice(0, n)\n this.head.data = data.slice(n)\n return slice\n }\n if (n === data.length) {\n // First chunk is a perfect match.\n return this.shift()\n }\n // Result spans more than one buffer.\n return hasStrings ? this._getString(n) : this._getBuffer(n)\n }\n first() {\n return this.head.data\n }\n *[SymbolIterator]() {\n for (let p = this.head; p; p = p.next) {\n yield p.data\n }\n }\n\n // Consumes a specified amount of characters from the buffered data.\n _getString(n) {\n let ret = ''\n let p = this.head\n let c = 0\n do {\n const str = p.data\n if (n > str.length) {\n ret += str\n n -= str.length\n } else {\n if (n === str.length) {\n ret += str\n ++c\n if (p.next) this.head = p.next\n else this.head = this.tail = null\n } else {\n ret += StringPrototypeSlice(str, 0, n)\n this.head = p\n p.data = StringPrototypeSlice(str, n)\n }\n break\n }\n ++c\n } while ((p = p.next) !== null)\n this.length -= c\n return ret\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n _getBuffer(n) {\n const ret = Buffer.allocUnsafe(n)\n const retLen = n\n let p = this.head\n let c = 0\n do {\n const buf = p.data\n if (n > buf.length) {\n TypedArrayPrototypeSet(ret, buf, retLen - n)\n n -= buf.length\n } else {\n if (n === buf.length) {\n TypedArrayPrototypeSet(ret, buf, retLen - n)\n ++c\n if (p.next) this.head = p.next\n else this.head = this.tail = null\n } else {\n TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n)\n this.head = p\n p.data = buf.slice(n)\n }\n break\n }\n ++c\n } while ((p = p.next) !== null)\n this.length -= c\n return ret\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n [Symbol.for('nodejs.util.inspect.custom')](_, options) {\n return inspect(this, {\n ...options,\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n })\n }\n}\n","'use strict'\n\nconst { pipeline } = require('./pipeline')\nconst Duplex = require('./duplex')\nconst { destroyer } = require('./destroy')\nconst {\n isNodeStream,\n isReadable,\n isWritable,\n isWebStream,\n isTransformStream,\n isWritableStream,\n isReadableStream\n} = require('./utils')\nconst {\n AbortError,\n codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS }\n} = require('../../ours/errors')\nconst eos = require('./end-of-stream')\nmodule.exports = function compose(...streams) {\n if (streams.length === 0) {\n throw new ERR_MISSING_ARGS('streams')\n }\n if (streams.length === 1) {\n return Duplex.from(streams[0])\n }\n const orgStreams = [...streams]\n if (typeof streams[0] === 'function') {\n streams[0] = Duplex.from(streams[0])\n }\n if (typeof streams[streams.length - 1] === 'function') {\n const idx = streams.length - 1\n streams[idx] = Duplex.from(streams[idx])\n }\n for (let n = 0; n < streams.length; ++n) {\n if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) {\n // TODO(ronag): Add checks for non streams.\n continue\n }\n if (\n n < streams.length - 1 &&\n !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n]))\n ) {\n throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable')\n }\n if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) {\n throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable')\n }\n }\n let ondrain\n let onfinish\n let onreadable\n let onclose\n let d\n function onfinished(err) {\n const cb = onclose\n onclose = null\n if (cb) {\n cb(err)\n } else if (err) {\n d.destroy(err)\n } else if (!readable && !writable) {\n d.destroy()\n }\n }\n const head = streams[0]\n const tail = pipeline(streams, onfinished)\n const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head))\n const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail))\n\n // TODO(ronag): Avoid double buffering.\n // Implement Writable/Readable/Duplex traits.\n // See, https://github.com/nodejs/node/pull/33515.\n d = new Duplex({\n // TODO (ronag): highWaterMark?\n writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode),\n readableObjectMode: !!(tail !== null && tail !== undefined && tail.readableObjectMode),\n writable,\n readable\n })\n if (writable) {\n if (isNodeStream(head)) {\n d._write = function (chunk, encoding, callback) {\n if (head.write(chunk, encoding)) {\n callback()\n } else {\n ondrain = callback\n }\n }\n d._final = function (callback) {\n head.end()\n onfinish = callback\n }\n head.on('drain', function () {\n if (ondrain) {\n const cb = ondrain\n ondrain = null\n cb()\n }\n })\n } else if (isWebStream(head)) {\n const writable = isTransformStream(head) ? head.writable : head\n const writer = writable.getWriter()\n d._write = async function (chunk, encoding, callback) {\n try {\n await writer.ready\n writer.write(chunk).catch(() => {})\n callback()\n } catch (err) {\n callback(err)\n }\n }\n d._final = async function (callback) {\n try {\n await writer.ready\n writer.close().catch(() => {})\n onfinish = callback\n } catch (err) {\n callback(err)\n }\n }\n }\n const toRead = isTransformStream(tail) ? tail.readable : tail\n eos(toRead, () => {\n if (onfinish) {\n const cb = onfinish\n onfinish = null\n cb()\n }\n })\n }\n if (readable) {\n if (isNodeStream(tail)) {\n tail.on('readable', function () {\n if (onreadable) {\n const cb = onreadable\n onreadable = null\n cb()\n }\n })\n tail.on('end', function () {\n d.push(null)\n })\n d._read = function () {\n while (true) {\n const buf = tail.read()\n if (buf === null) {\n onreadable = d._read\n return\n }\n if (!d.push(buf)) {\n return\n }\n }\n }\n } else if (isWebStream(tail)) {\n const readable = isTransformStream(tail) ? tail.readable : tail\n const reader = readable.getReader()\n d._read = async function () {\n while (true) {\n try {\n const { value, done } = await reader.read()\n if (!d.push(value)) {\n return\n }\n if (done) {\n d.push(null)\n return\n }\n } catch {\n return\n }\n }\n }\n }\n }\n d._destroy = function (err, callback) {\n if (!err && onclose !== null) {\n err = new AbortError()\n }\n onreadable = null\n ondrain = null\n onfinish = null\n if (onclose === null) {\n callback(err)\n } else {\n onclose = callback\n if (isNodeStream(tail)) {\n destroyer(tail, err)\n }\n }\n }\n return d\n}\n","'use strict'\n\n/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n\nconst {\n aggregateTwoErrors,\n codes: { ERR_MULTIPLE_CALLBACK },\n AbortError\n} = require('../../ours/errors')\nconst { Symbol } = require('../../ours/primordials')\nconst { kIsDestroyed, isDestroyed, isFinished, isServerRequest } = require('./utils')\nconst kDestroy = Symbol('kDestroy')\nconst kConstruct = Symbol('kConstruct')\nfunction checkError(err, w, r) {\n if (err) {\n // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364\n err.stack // eslint-disable-line no-unused-expressions\n\n if (w && !w.errored) {\n w.errored = err\n }\n if (r && !r.errored) {\n r.errored = err\n }\n }\n}\n\n// Backwards compat. cb() is undocumented and unused in core but\n// unfortunately might be used by modules.\nfunction destroy(err, cb) {\n const r = this._readableState\n const w = this._writableState\n // With duplex streams we use the writable side for state.\n const s = w || r\n if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) {\n if (typeof cb === 'function') {\n cb()\n }\n return this\n }\n\n // We set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n checkError(err, w, r)\n if (w) {\n w.destroyed = true\n }\n if (r) {\n r.destroyed = true\n }\n\n // If still constructing then defer calling _destroy.\n if (!s.constructed) {\n this.once(kDestroy, function (er) {\n _destroy(this, aggregateTwoErrors(er, err), cb)\n })\n } else {\n _destroy(this, err, cb)\n }\n return this\n}\nfunction _destroy(self, err, cb) {\n let called = false\n function onDestroy(err) {\n if (called) {\n return\n }\n called = true\n const r = self._readableState\n const w = self._writableState\n checkError(err, w, r)\n if (w) {\n w.closed = true\n }\n if (r) {\n r.closed = true\n }\n if (typeof cb === 'function') {\n cb(err)\n }\n if (err) {\n process.nextTick(emitErrorCloseNT, self, err)\n } else {\n process.nextTick(emitCloseNT, self)\n }\n }\n try {\n self._destroy(err || null, onDestroy)\n } catch (err) {\n onDestroy(err)\n }\n}\nfunction emitErrorCloseNT(self, err) {\n emitErrorNT(self, err)\n emitCloseNT(self)\n}\nfunction emitCloseNT(self) {\n const r = self._readableState\n const w = self._writableState\n if (w) {\n w.closeEmitted = true\n }\n if (r) {\n r.closeEmitted = true\n }\n if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) {\n self.emit('close')\n }\n}\nfunction emitErrorNT(self, err) {\n const r = self._readableState\n const w = self._writableState\n if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) {\n return\n }\n if (w) {\n w.errorEmitted = true\n }\n if (r) {\n r.errorEmitted = true\n }\n self.emit('error', err)\n}\nfunction undestroy() {\n const r = this._readableState\n const w = this._writableState\n if (r) {\n r.constructed = true\n r.closed = false\n r.closeEmitted = false\n r.destroyed = false\n r.errored = null\n r.errorEmitted = false\n r.reading = false\n r.ended = r.readable === false\n r.endEmitted = r.readable === false\n }\n if (w) {\n w.constructed = true\n w.destroyed = false\n w.closed = false\n w.closeEmitted = false\n w.errored = null\n w.errorEmitted = false\n w.finalCalled = false\n w.prefinished = false\n w.ended = w.writable === false\n w.ending = w.writable === false\n w.finished = w.writable === false\n }\n}\nfunction errorOrDestroy(stream, err, sync) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n const r = stream._readableState\n const w = stream._writableState\n if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) {\n return this\n }\n if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy))\n stream.destroy(err)\n else if (err) {\n // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364\n err.stack // eslint-disable-line no-unused-expressions\n\n if (w && !w.errored) {\n w.errored = err\n }\n if (r && !r.errored) {\n r.errored = err\n }\n if (sync) {\n process.nextTick(emitErrorNT, stream, err)\n } else {\n emitErrorNT(stream, err)\n }\n }\n}\nfunction construct(stream, cb) {\n if (typeof stream._construct !== 'function') {\n return\n }\n const r = stream._readableState\n const w = stream._writableState\n if (r) {\n r.constructed = false\n }\n if (w) {\n w.constructed = false\n }\n stream.once(kConstruct, cb)\n if (stream.listenerCount(kConstruct) > 1) {\n // Duplex\n return\n }\n process.nextTick(constructNT, stream)\n}\nfunction constructNT(stream) {\n let called = false\n function onConstruct(err) {\n if (called) {\n errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK())\n return\n }\n called = true\n const r = stream._readableState\n const w = stream._writableState\n const s = w || r\n if (r) {\n r.constructed = true\n }\n if (w) {\n w.constructed = true\n }\n if (s.destroyed) {\n stream.emit(kDestroy, err)\n } else if (err) {\n errorOrDestroy(stream, err, true)\n } else {\n process.nextTick(emitConstructNT, stream)\n }\n }\n try {\n stream._construct((err) => {\n process.nextTick(onConstruct, err)\n })\n } catch (err) {\n process.nextTick(onConstruct, err)\n }\n}\nfunction emitConstructNT(stream) {\n stream.emit(kConstruct)\n}\nfunction isRequest(stream) {\n return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function'\n}\nfunction emitCloseLegacy(stream) {\n stream.emit('close')\n}\nfunction emitErrorCloseLegacy(stream, err) {\n stream.emit('error', err)\n process.nextTick(emitCloseLegacy, stream)\n}\n\n// Normalize destroy for legacy.\nfunction destroyer(stream, err) {\n if (!stream || isDestroyed(stream)) {\n return\n }\n if (!err && !isFinished(stream)) {\n err = new AbortError()\n }\n\n // TODO: Remove isRequest branches.\n if (isServerRequest(stream)) {\n stream.socket = null\n stream.destroy(err)\n } else if (isRequest(stream)) {\n stream.abort()\n } else if (isRequest(stream.req)) {\n stream.req.abort()\n } else if (typeof stream.destroy === 'function') {\n stream.destroy(err)\n } else if (typeof stream.close === 'function') {\n // TODO: Don't lose err?\n stream.close()\n } else if (err) {\n process.nextTick(emitErrorCloseLegacy, stream, err)\n } else {\n process.nextTick(emitCloseLegacy, stream)\n }\n if (!stream.destroyed) {\n stream[kIsDestroyed] = true\n }\n}\nmodule.exports = {\n construct,\n destroyer,\n destroy,\n undestroy,\n errorOrDestroy\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototype inheritance, this class\n// prototypically inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict'\n\nconst {\n ObjectDefineProperties,\n ObjectGetOwnPropertyDescriptor,\n ObjectKeys,\n ObjectSetPrototypeOf\n} = require('../../ours/primordials')\nmodule.exports = Duplex\nconst Readable = require('./readable')\nconst Writable = require('./writable')\nObjectSetPrototypeOf(Duplex.prototype, Readable.prototype)\nObjectSetPrototypeOf(Duplex, Readable)\n{\n const keys = ObjectKeys(Writable.prototype)\n // Allow the keys array to be GC'ed.\n for (let i = 0; i < keys.length; i++) {\n const method = keys[i]\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options)\n Readable.call(this, options)\n Writable.call(this, options)\n if (options) {\n this.allowHalfOpen = options.allowHalfOpen !== false\n if (options.readable === false) {\n this._readableState.readable = false\n this._readableState.ended = true\n this._readableState.endEmitted = true\n }\n if (options.writable === false) {\n this._writableState.writable = false\n this._writableState.ending = true\n this._writableState.ended = true\n this._writableState.finished = true\n }\n } else {\n this.allowHalfOpen = true\n }\n}\nObjectDefineProperties(Duplex.prototype, {\n writable: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable')\n },\n writableHighWaterMark: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark')\n },\n writableObjectMode: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode')\n },\n writableBuffer: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer')\n },\n writableLength: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength')\n },\n writableFinished: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished')\n },\n writableCorked: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked')\n },\n writableEnded: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded')\n },\n writableNeedDrain: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain')\n },\n destroyed: {\n __proto__: null,\n get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false\n }\n return this._readableState.destroyed && this._writableState.destroyed\n },\n set(value) {\n // Backward compatibility, the user is explicitly\n // managing destroyed.\n if (this._readableState && this._writableState) {\n this._readableState.destroyed = value\n this._writableState.destroyed = value\n }\n }\n }\n})\nlet webStreamsAdapters\n\n// Lazy to avoid circular references\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined) webStreamsAdapters = {}\n return webStreamsAdapters\n}\nDuplex.fromWeb = function (pair, options) {\n return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options)\n}\nDuplex.toWeb = function (duplex) {\n return lazyWebStreams().newReadableWritablePairFromDuplex(duplex)\n}\nlet duplexify\nDuplex.from = function (body) {\n if (!duplexify) {\n duplexify = require('./duplexify')\n }\n return duplexify(body, 'body')\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n\n;('use strict')\nconst bufferModule = require('buffer')\nconst {\n isReadable,\n isWritable,\n isIterable,\n isNodeStream,\n isReadableNodeStream,\n isWritableNodeStream,\n isDuplexNodeStream,\n isReadableStream,\n isWritableStream\n} = require('./utils')\nconst eos = require('./end-of-stream')\nconst {\n AbortError,\n codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE }\n} = require('../../ours/errors')\nconst { destroyer } = require('./destroy')\nconst Duplex = require('./duplex')\nconst Readable = require('./readable')\nconst Writable = require('./writable')\nconst { createDeferredPromise } = require('../../ours/util')\nconst from = require('./from')\nconst Blob = globalThis.Blob || bufferModule.Blob\nconst isBlob =\n typeof Blob !== 'undefined'\n ? function isBlob(b) {\n return b instanceof Blob\n }\n : function isBlob(b) {\n return false\n }\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nconst { FunctionPrototypeCall } = require('../../ours/primordials')\n\n// This is needed for pre node 17.\nclass Duplexify extends Duplex {\n constructor(options) {\n super(options)\n\n // https://github.com/nodejs/node/pull/34385\n\n if ((options === null || options === undefined ? undefined : options.readable) === false) {\n this._readableState.readable = false\n this._readableState.ended = true\n this._readableState.endEmitted = true\n }\n if ((options === null || options === undefined ? undefined : options.writable) === false) {\n this._writableState.writable = false\n this._writableState.ending = true\n this._writableState.ended = true\n this._writableState.finished = true\n }\n }\n}\nmodule.exports = function duplexify(body, name) {\n if (isDuplexNodeStream(body)) {\n return body\n }\n if (isReadableNodeStream(body)) {\n return _duplexify({\n readable: body\n })\n }\n if (isWritableNodeStream(body)) {\n return _duplexify({\n writable: body\n })\n }\n if (isNodeStream(body)) {\n return _duplexify({\n writable: false,\n readable: false\n })\n }\n if (isReadableStream(body)) {\n return _duplexify({\n readable: Readable.fromWeb(body)\n })\n }\n if (isWritableStream(body)) {\n return _duplexify({\n writable: Writable.fromWeb(body)\n })\n }\n if (typeof body === 'function') {\n const { value, write, final, destroy } = fromAsyncGen(body)\n if (isIterable(value)) {\n return from(Duplexify, value, {\n // TODO (ronag): highWaterMark?\n objectMode: true,\n write,\n final,\n destroy\n })\n }\n const then = value === null || value === undefined ? undefined : value.then\n if (typeof then === 'function') {\n let d\n const promise = FunctionPrototypeCall(\n then,\n value,\n (val) => {\n if (val != null) {\n throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val)\n }\n },\n (err) => {\n destroyer(d, err)\n }\n )\n return (d = new Duplexify({\n // TODO (ronag): highWaterMark?\n objectMode: true,\n readable: false,\n write,\n final(cb) {\n final(async () => {\n try {\n await promise\n process.nextTick(cb, null)\n } catch (err) {\n process.nextTick(cb, err)\n }\n })\n },\n destroy\n }))\n }\n throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value)\n }\n if (isBlob(body)) {\n return duplexify(body.arrayBuffer())\n }\n if (isIterable(body)) {\n return from(Duplexify, body, {\n // TODO (ronag): highWaterMark?\n objectMode: true,\n writable: false\n })\n }\n if (\n isReadableStream(body === null || body === undefined ? undefined : body.readable) &&\n isWritableStream(body === null || body === undefined ? undefined : body.writable)\n ) {\n return Duplexify.fromWeb(body)\n }\n if (\n typeof (body === null || body === undefined ? undefined : body.writable) === 'object' ||\n typeof (body === null || body === undefined ? undefined : body.readable) === 'object'\n ) {\n const readable =\n body !== null && body !== undefined && body.readable\n ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable)\n ? body === null || body === undefined\n ? undefined\n : body.readable\n : duplexify(body.readable)\n : undefined\n const writable =\n body !== null && body !== undefined && body.writable\n ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable)\n ? body === null || body === undefined\n ? undefined\n : body.writable\n : duplexify(body.writable)\n : undefined\n return _duplexify({\n readable,\n writable\n })\n }\n const then = body === null || body === undefined ? undefined : body.then\n if (typeof then === 'function') {\n let d\n FunctionPrototypeCall(\n then,\n body,\n (val) => {\n if (val != null) {\n d.push(val)\n }\n d.push(null)\n },\n (err) => {\n destroyer(d, err)\n }\n )\n return (d = new Duplexify({\n objectMode: true,\n writable: false,\n read() {}\n }))\n }\n throw new ERR_INVALID_ARG_TYPE(\n name,\n [\n 'Blob',\n 'ReadableStream',\n 'WritableStream',\n 'Stream',\n 'Iterable',\n 'AsyncIterable',\n 'Function',\n '{ readable, writable } pair',\n 'Promise'\n ],\n body\n )\n}\nfunction fromAsyncGen(fn) {\n let { promise, resolve } = createDeferredPromise()\n const ac = new AbortController()\n const signal = ac.signal\n const value = fn(\n (async function* () {\n while (true) {\n const _promise = promise\n promise = null\n const { chunk, done, cb } = await _promise\n process.nextTick(cb)\n if (done) return\n if (signal.aborted)\n throw new AbortError(undefined, {\n cause: signal.reason\n })\n ;({ promise, resolve } = createDeferredPromise())\n yield chunk\n }\n })(),\n {\n signal\n }\n )\n return {\n value,\n write(chunk, encoding, cb) {\n const _resolve = resolve\n resolve = null\n _resolve({\n chunk,\n done: false,\n cb\n })\n },\n final(cb) {\n const _resolve = resolve\n resolve = null\n _resolve({\n done: true,\n cb\n })\n },\n destroy(err, cb) {\n ac.abort()\n cb(err)\n }\n }\n}\nfunction _duplexify(pair) {\n const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable\n const w = pair.writable\n let readable = !!isReadable(r)\n let writable = !!isWritable(w)\n let ondrain\n let onfinish\n let onreadable\n let onclose\n let d\n function onfinished(err) {\n const cb = onclose\n onclose = null\n if (cb) {\n cb(err)\n } else if (err) {\n d.destroy(err)\n }\n }\n\n // TODO(ronag): Avoid double buffering.\n // Implement Writable/Readable/Duplex traits.\n // See, https://github.com/nodejs/node/pull/33515.\n d = new Duplexify({\n // TODO (ronag): highWaterMark?\n readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode),\n writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode),\n readable,\n writable\n })\n if (writable) {\n eos(w, (err) => {\n writable = false\n if (err) {\n destroyer(r, err)\n }\n onfinished(err)\n })\n d._write = function (chunk, encoding, callback) {\n if (w.write(chunk, encoding)) {\n callback()\n } else {\n ondrain = callback\n }\n }\n d._final = function (callback) {\n w.end()\n onfinish = callback\n }\n w.on('drain', function () {\n if (ondrain) {\n const cb = ondrain\n ondrain = null\n cb()\n }\n })\n w.on('finish', function () {\n if (onfinish) {\n const cb = onfinish\n onfinish = null\n cb()\n }\n })\n }\n if (readable) {\n eos(r, (err) => {\n readable = false\n if (err) {\n destroyer(r, err)\n }\n onfinished(err)\n })\n r.on('readable', function () {\n if (onreadable) {\n const cb = onreadable\n onreadable = null\n cb()\n }\n })\n r.on('end', function () {\n d.push(null)\n })\n d._read = function () {\n while (true) {\n const buf = r.read()\n if (buf === null) {\n onreadable = d._read\n return\n }\n if (!d.push(buf)) {\n return\n }\n }\n }\n }\n d._destroy = function (err, callback) {\n if (!err && onclose !== null) {\n err = new AbortError()\n }\n onreadable = null\n ondrain = null\n onfinish = null\n if (onclose === null) {\n callback(err)\n } else {\n onclose = callback\n destroyer(w, err)\n destroyer(r, err)\n }\n }\n return d\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n;('use strict')\nconst { AbortError, codes } = require('../../ours/errors')\nconst { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes\nconst { kEmptyObject, once } = require('../../ours/util')\nconst { validateAbortSignal, validateFunction, validateObject, validateBoolean } = require('../validators')\nconst { Promise, PromisePrototypeThen, SymbolDispose } = require('../../ours/primordials')\nconst {\n isClosed,\n isReadable,\n isReadableNodeStream,\n isReadableStream,\n isReadableFinished,\n isReadableErrored,\n isWritable,\n isWritableNodeStream,\n isWritableStream,\n isWritableFinished,\n isWritableErrored,\n isNodeStream,\n willEmitClose: _willEmitClose,\n kIsClosedPromise\n} = require('./utils')\nlet addAbortListener\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function'\n}\nconst nop = () => {}\nfunction eos(stream, options, callback) {\n var _options$readable, _options$writable\n if (arguments.length === 2) {\n callback = options\n options = kEmptyObject\n } else if (options == null) {\n options = kEmptyObject\n } else {\n validateObject(options, 'options')\n }\n validateFunction(callback, 'callback')\n validateAbortSignal(options.signal, 'options.signal')\n callback = once(callback)\n if (isReadableStream(stream) || isWritableStream(stream)) {\n return eosWeb(stream, options, callback)\n }\n if (!isNodeStream(stream)) {\n throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream)\n }\n const readable =\n (_options$readable = options.readable) !== null && _options$readable !== undefined\n ? _options$readable\n : isReadableNodeStream(stream)\n const writable =\n (_options$writable = options.writable) !== null && _options$writable !== undefined\n ? _options$writable\n : isWritableNodeStream(stream)\n const wState = stream._writableState\n const rState = stream._readableState\n const onlegacyfinish = () => {\n if (!stream.writable) {\n onfinish()\n }\n }\n\n // TODO (ronag): Improve soft detection to include core modules and\n // common ecosystem modules that do properly emit 'close' but fail\n // this generic check.\n let willEmitClose =\n _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable\n let writableFinished = isWritableFinished(stream, false)\n const onfinish = () => {\n writableFinished = true\n // Stream should not be destroyed here. If it is that\n // means that user space is doing something differently and\n // we cannot trust willEmitClose.\n if (stream.destroyed) {\n willEmitClose = false\n }\n if (willEmitClose && (!stream.readable || readable)) {\n return\n }\n if (!readable || readableFinished) {\n callback.call(stream)\n }\n }\n let readableFinished = isReadableFinished(stream, false)\n const onend = () => {\n readableFinished = true\n // Stream should not be destroyed here. If it is that\n // means that user space is doing something differently and\n // we cannot trust willEmitClose.\n if (stream.destroyed) {\n willEmitClose = false\n }\n if (willEmitClose && (!stream.writable || writable)) {\n return\n }\n if (!writable || writableFinished) {\n callback.call(stream)\n }\n }\n const onerror = (err) => {\n callback.call(stream, err)\n }\n let closed = isClosed(stream)\n const onclose = () => {\n closed = true\n const errored = isWritableErrored(stream) || isReadableErrored(stream)\n if (errored && typeof errored !== 'boolean') {\n return callback.call(stream, errored)\n }\n if (readable && !readableFinished && isReadableNodeStream(stream, true)) {\n if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE())\n }\n if (writable && !writableFinished) {\n if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE())\n }\n callback.call(stream)\n }\n const onclosed = () => {\n closed = true\n const errored = isWritableErrored(stream) || isReadableErrored(stream)\n if (errored && typeof errored !== 'boolean') {\n return callback.call(stream, errored)\n }\n callback.call(stream)\n }\n const onrequest = () => {\n stream.req.on('finish', onfinish)\n }\n if (isRequest(stream)) {\n stream.on('complete', onfinish)\n if (!willEmitClose) {\n stream.on('abort', onclose)\n }\n if (stream.req) {\n onrequest()\n } else {\n stream.on('request', onrequest)\n }\n } else if (writable && !wState) {\n // legacy streams\n stream.on('end', onlegacyfinish)\n stream.on('close', onlegacyfinish)\n }\n\n // Not all streams will emit 'close' after 'aborted'.\n if (!willEmitClose && typeof stream.aborted === 'boolean') {\n stream.on('aborted', onclose)\n }\n stream.on('end', onend)\n stream.on('finish', onfinish)\n if (options.error !== false) {\n stream.on('error', onerror)\n }\n stream.on('close', onclose)\n if (closed) {\n process.nextTick(onclose)\n } else if (\n (wState !== null && wState !== undefined && wState.errorEmitted) ||\n (rState !== null && rState !== undefined && rState.errorEmitted)\n ) {\n if (!willEmitClose) {\n process.nextTick(onclosed)\n }\n } else if (\n !readable &&\n (!willEmitClose || isReadable(stream)) &&\n (writableFinished || isWritable(stream) === false)\n ) {\n process.nextTick(onclosed)\n } else if (\n !writable &&\n (!willEmitClose || isWritable(stream)) &&\n (readableFinished || isReadable(stream) === false)\n ) {\n process.nextTick(onclosed)\n } else if (rState && stream.req && stream.aborted) {\n process.nextTick(onclosed)\n }\n const cleanup = () => {\n callback = nop\n stream.removeListener('aborted', onclose)\n stream.removeListener('complete', onfinish)\n stream.removeListener('abort', onclose)\n stream.removeListener('request', onrequest)\n if (stream.req) stream.req.removeListener('finish', onfinish)\n stream.removeListener('end', onlegacyfinish)\n stream.removeListener('close', onlegacyfinish)\n stream.removeListener('finish', onfinish)\n stream.removeListener('end', onend)\n stream.removeListener('error', onerror)\n stream.removeListener('close', onclose)\n }\n if (options.signal && !closed) {\n const abort = () => {\n // Keep it because cleanup removes it.\n const endCallback = callback\n cleanup()\n endCallback.call(\n stream,\n new AbortError(undefined, {\n cause: options.signal.reason\n })\n )\n }\n if (options.signal.aborted) {\n process.nextTick(abort)\n } else {\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n const disposable = addAbortListener(options.signal, abort)\n const originalCallback = callback\n callback = once((...args) => {\n disposable[SymbolDispose]()\n originalCallback.apply(stream, args)\n })\n }\n }\n return cleanup\n}\nfunction eosWeb(stream, options, callback) {\n let isAborted = false\n let abort = nop\n if (options.signal) {\n abort = () => {\n isAborted = true\n callback.call(\n stream,\n new AbortError(undefined, {\n cause: options.signal.reason\n })\n )\n }\n if (options.signal.aborted) {\n process.nextTick(abort)\n } else {\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n const disposable = addAbortListener(options.signal, abort)\n const originalCallback = callback\n callback = once((...args) => {\n disposable[SymbolDispose]()\n originalCallback.apply(stream, args)\n })\n }\n }\n const resolverFn = (...args) => {\n if (!isAborted) {\n process.nextTick(() => callback.apply(stream, args))\n }\n }\n PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn)\n return nop\n}\nfunction finished(stream, opts) {\n var _opts\n let autoCleanup = false\n if (opts === null) {\n opts = kEmptyObject\n }\n if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) {\n validateBoolean(opts.cleanup, 'cleanup')\n autoCleanup = opts.cleanup\n }\n return new Promise((resolve, reject) => {\n const cleanup = eos(stream, opts, (err) => {\n if (autoCleanup) {\n cleanup()\n }\n if (err) {\n reject(err)\n } else {\n resolve()\n }\n })\n })\n}\nmodule.exports = eos\nmodule.exports.finished = finished\n","'use strict'\n\n/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n\nconst { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require('../../ours/primordials')\nconst { Buffer } = require('buffer')\nconst { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require('../../ours/errors').codes\nfunction from(Readable, iterable, opts) {\n let iterator\n if (typeof iterable === 'string' || iterable instanceof Buffer) {\n return new Readable({\n objectMode: true,\n ...opts,\n read() {\n this.push(iterable)\n this.push(null)\n }\n })\n }\n let isAsync\n if (iterable && iterable[SymbolAsyncIterator]) {\n isAsync = true\n iterator = iterable[SymbolAsyncIterator]()\n } else if (iterable && iterable[SymbolIterator]) {\n isAsync = false\n iterator = iterable[SymbolIterator]()\n } else {\n throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable)\n }\n const readable = new Readable({\n objectMode: true,\n highWaterMark: 1,\n // TODO(ronag): What options should be allowed?\n ...opts\n })\n\n // Flag to protect against _read\n // being called before last iteration completion.\n let reading = false\n readable._read = function () {\n if (!reading) {\n reading = true\n next()\n }\n }\n readable._destroy = function (error, cb) {\n PromisePrototypeThen(\n close(error),\n () => process.nextTick(cb, error),\n // nextTick is here in case cb throws\n (e) => process.nextTick(cb, e || error)\n )\n }\n async function close(error) {\n const hadError = error !== undefined && error !== null\n const hasThrow = typeof iterator.throw === 'function'\n if (hadError && hasThrow) {\n const { value, done } = await iterator.throw(error)\n await value\n if (done) {\n return\n }\n }\n if (typeof iterator.return === 'function') {\n const { value } = await iterator.return()\n await value\n }\n }\n async function next() {\n for (;;) {\n try {\n const { value, done } = isAsync ? await iterator.next() : iterator.next()\n if (done) {\n readable.push(null)\n } else {\n const res = value && typeof value.then === 'function' ? await value : value\n if (res === null) {\n reading = false\n throw new ERR_STREAM_NULL_VALUES()\n } else if (readable.push(res)) {\n continue\n } else {\n reading = false\n }\n }\n } catch (err) {\n readable.destroy(err)\n }\n break\n }\n }\n return readable\n}\nmodule.exports = from\n","'use strict'\n\nconst { ArrayIsArray, ObjectSetPrototypeOf } = require('../../ours/primordials')\nconst { EventEmitter: EE } = require('events')\nfunction Stream(opts) {\n EE.call(this, opts)\n}\nObjectSetPrototypeOf(Stream.prototype, EE.prototype)\nObjectSetPrototypeOf(Stream, EE)\nStream.prototype.pipe = function (dest, options) {\n const source = this\n function ondata(chunk) {\n if (dest.writable && dest.write(chunk) === false && source.pause) {\n source.pause()\n }\n }\n source.on('data', ondata)\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume()\n }\n }\n dest.on('drain', ondrain)\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend)\n source.on('close', onclose)\n }\n let didOnEnd = false\n function onend() {\n if (didOnEnd) return\n didOnEnd = true\n dest.end()\n }\n function onclose() {\n if (didOnEnd) return\n didOnEnd = true\n if (typeof dest.destroy === 'function') dest.destroy()\n }\n\n // Don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup()\n if (EE.listenerCount(this, 'error') === 0) {\n this.emit('error', er)\n }\n }\n prependListener(source, 'error', onerror)\n prependListener(dest, 'error', onerror)\n\n // Remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata)\n dest.removeListener('drain', ondrain)\n source.removeListener('end', onend)\n source.removeListener('close', onclose)\n source.removeListener('error', onerror)\n dest.removeListener('error', onerror)\n source.removeListener('end', cleanup)\n source.removeListener('close', cleanup)\n dest.removeListener('close', cleanup)\n }\n source.on('end', cleanup)\n source.on('close', cleanup)\n dest.on('close', cleanup)\n dest.emit('pipe', source)\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest\n}\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn)\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn)\n else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn)\n else emitter._events[event] = [fn, emitter._events[event]]\n}\nmodule.exports = {\n Stream,\n prependListener\n}\n","'use strict'\n\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nconst {\n codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },\n AbortError\n} = require('../../ours/errors')\nconst { validateAbortSignal, validateInteger, validateObject } = require('../validators')\nconst kWeakHandler = require('../../ours/primordials').Symbol('kWeak')\nconst kResistStopPropagation = require('../../ours/primordials').Symbol('kResistStopPropagation')\nconst { finished } = require('./end-of-stream')\nconst staticCompose = require('./compose')\nconst { addAbortSignalNoValidate } = require('./add-abort-signal')\nconst { isWritable, isNodeStream } = require('./utils')\nconst { deprecate } = require('../../ours/util')\nconst {\n ArrayPrototypePush,\n Boolean,\n MathFloor,\n Number,\n NumberIsNaN,\n Promise,\n PromiseReject,\n PromiseResolve,\n PromisePrototypeThen,\n Symbol\n} = require('../../ours/primordials')\nconst kEmpty = Symbol('kEmpty')\nconst kEof = Symbol('kEof')\nfunction compose(stream, options) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n if (isNodeStream(stream) && !isWritable(stream)) {\n throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable')\n }\n const composedStream = staticCompose(this, stream)\n if (options !== null && options !== undefined && options.signal) {\n // Not validating as we already validated before\n addAbortSignalNoValidate(options.signal, composedStream)\n }\n return composedStream\n}\nfunction map(fn, options) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n let concurrency = 1\n if ((options === null || options === undefined ? undefined : options.concurrency) != null) {\n concurrency = MathFloor(options.concurrency)\n }\n let highWaterMark = concurrency - 1\n if ((options === null || options === undefined ? undefined : options.highWaterMark) != null) {\n highWaterMark = MathFloor(options.highWaterMark)\n }\n validateInteger(concurrency, 'options.concurrency', 1)\n validateInteger(highWaterMark, 'options.highWaterMark', 0)\n highWaterMark += concurrency\n return async function* map() {\n const signal = require('../../ours/util').AbortSignalAny(\n [options === null || options === undefined ? undefined : options.signal].filter(Boolean)\n )\n const stream = this\n const queue = []\n const signalOpt = {\n signal\n }\n let next\n let resume\n let done = false\n let cnt = 0\n function onCatch() {\n done = true\n afterItemProcessed()\n }\n function afterItemProcessed() {\n cnt -= 1\n maybeResume()\n }\n function maybeResume() {\n if (resume && !done && cnt < concurrency && queue.length < highWaterMark) {\n resume()\n resume = null\n }\n }\n async function pump() {\n try {\n for await (let val of stream) {\n if (done) {\n return\n }\n if (signal.aborted) {\n throw new AbortError()\n }\n try {\n val = fn(val, signalOpt)\n if (val === kEmpty) {\n continue\n }\n val = PromiseResolve(val)\n } catch (err) {\n val = PromiseReject(err)\n }\n cnt += 1\n PromisePrototypeThen(val, afterItemProcessed, onCatch)\n queue.push(val)\n if (next) {\n next()\n next = null\n }\n if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) {\n await new Promise((resolve) => {\n resume = resolve\n })\n }\n }\n queue.push(kEof)\n } catch (err) {\n const val = PromiseReject(err)\n PromisePrototypeThen(val, afterItemProcessed, onCatch)\n queue.push(val)\n } finally {\n done = true\n if (next) {\n next()\n next = null\n }\n }\n }\n pump()\n try {\n while (true) {\n while (queue.length > 0) {\n const val = await queue[0]\n if (val === kEof) {\n return\n }\n if (signal.aborted) {\n throw new AbortError()\n }\n if (val !== kEmpty) {\n yield val\n }\n queue.shift()\n maybeResume()\n }\n await new Promise((resolve) => {\n next = resolve\n })\n }\n } finally {\n done = true\n if (resume) {\n resume()\n resume = null\n }\n }\n }.call(this)\n}\nfunction asIndexedPairs(options = undefined) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n return async function* asIndexedPairs() {\n let index = 0\n for await (const val of this) {\n var _options$signal\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal = options.signal) !== null &&\n _options$signal !== undefined &&\n _options$signal.aborted\n ) {\n throw new AbortError({\n cause: options.signal.reason\n })\n }\n yield [index++, val]\n }\n }.call(this)\n}\nasync function some(fn, options = undefined) {\n for await (const unused of filter.call(this, fn, options)) {\n return true\n }\n return false\n}\nasync function every(fn, options = undefined) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n // https://en.wikipedia.org/wiki/De_Morgan%27s_laws\n return !(await some.call(\n this,\n async (...args) => {\n return !(await fn(...args))\n },\n options\n ))\n}\nasync function find(fn, options) {\n for await (const result of filter.call(this, fn, options)) {\n return result\n }\n return undefined\n}\nasync function forEach(fn, options) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n async function forEachFn(value, options) {\n await fn(value, options)\n return kEmpty\n }\n // eslint-disable-next-line no-unused-vars\n for await (const unused of map.call(this, forEachFn, options));\n}\nfunction filter(fn, options) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n async function filterFn(value, options) {\n if (await fn(value, options)) {\n return value\n }\n return kEmpty\n }\n return map.call(this, filterFn, options)\n}\n\n// Specific to provide better error to reduce since the argument is only\n// missing if the stream has no items in it - but the code is still appropriate\nclass ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS {\n constructor() {\n super('reduce')\n this.message = 'Reduce of an empty stream requires an initial value'\n }\n}\nasync function reduce(reducer, initialValue, options) {\n var _options$signal2\n if (typeof reducer !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer)\n }\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n let hasInitialValue = arguments.length > 1\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal2 = options.signal) !== null &&\n _options$signal2 !== undefined &&\n _options$signal2.aborted\n ) {\n const err = new AbortError(undefined, {\n cause: options.signal.reason\n })\n this.once('error', () => {}) // The error is already propagated\n await finished(this.destroy(err))\n throw err\n }\n const ac = new AbortController()\n const signal = ac.signal\n if (options !== null && options !== undefined && options.signal) {\n const opts = {\n once: true,\n [kWeakHandler]: this,\n [kResistStopPropagation]: true\n }\n options.signal.addEventListener('abort', () => ac.abort(), opts)\n }\n let gotAnyItemFromStream = false\n try {\n for await (const value of this) {\n var _options$signal3\n gotAnyItemFromStream = true\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal3 = options.signal) !== null &&\n _options$signal3 !== undefined &&\n _options$signal3.aborted\n ) {\n throw new AbortError()\n }\n if (!hasInitialValue) {\n initialValue = value\n hasInitialValue = true\n } else {\n initialValue = await reducer(initialValue, value, {\n signal\n })\n }\n }\n if (!gotAnyItemFromStream && !hasInitialValue) {\n throw new ReduceAwareErrMissingArgs()\n }\n } finally {\n ac.abort()\n }\n return initialValue\n}\nasync function toArray(options) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n const result = []\n for await (const val of this) {\n var _options$signal4\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal4 = options.signal) !== null &&\n _options$signal4 !== undefined &&\n _options$signal4.aborted\n ) {\n throw new AbortError(undefined, {\n cause: options.signal.reason\n })\n }\n ArrayPrototypePush(result, val)\n }\n return result\n}\nfunction flatMap(fn, options) {\n const values = map.call(this, fn, options)\n return async function* flatMap() {\n for await (const val of values) {\n yield* val\n }\n }.call(this)\n}\nfunction toIntegerOrInfinity(number) {\n // We coerce here to align with the spec\n // https://github.com/tc39/proposal-iterator-helpers/issues/169\n number = Number(number)\n if (NumberIsNaN(number)) {\n return 0\n }\n if (number < 0) {\n throw new ERR_OUT_OF_RANGE('number', '>= 0', number)\n }\n return number\n}\nfunction drop(number, options = undefined) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n number = toIntegerOrInfinity(number)\n return async function* drop() {\n var _options$signal5\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal5 = options.signal) !== null &&\n _options$signal5 !== undefined &&\n _options$signal5.aborted\n ) {\n throw new AbortError()\n }\n for await (const val of this) {\n var _options$signal6\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal6 = options.signal) !== null &&\n _options$signal6 !== undefined &&\n _options$signal6.aborted\n ) {\n throw new AbortError()\n }\n if (number-- <= 0) {\n yield val\n }\n }\n }.call(this)\n}\nfunction take(number, options = undefined) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n number = toIntegerOrInfinity(number)\n return async function* take() {\n var _options$signal7\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal7 = options.signal) !== null &&\n _options$signal7 !== undefined &&\n _options$signal7.aborted\n ) {\n throw new AbortError()\n }\n for await (const val of this) {\n var _options$signal8\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal8 = options.signal) !== null &&\n _options$signal8 !== undefined &&\n _options$signal8.aborted\n ) {\n throw new AbortError()\n }\n if (number-- > 0) {\n yield val\n }\n\n // Don't get another item from iterator in case we reached the end\n if (number <= 0) {\n return\n }\n }\n }.call(this)\n}\nmodule.exports.streamReturningOperators = {\n asIndexedPairs: deprecate(asIndexedPairs, 'readable.asIndexedPairs will be removed in a future version.'),\n drop,\n filter,\n flatMap,\n map,\n take,\n compose\n}\nmodule.exports.promiseReturningOperators = {\n every,\n forEach,\n reduce,\n toArray,\n some,\n find\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict'\n\nconst { ObjectSetPrototypeOf } = require('../../ours/primordials')\nmodule.exports = PassThrough\nconst Transform = require('./transform')\nObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype)\nObjectSetPrototypeOf(PassThrough, Transform)\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options)\n Transform.call(this, options)\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk)\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n;('use strict')\nconst { ArrayIsArray, Promise, SymbolAsyncIterator, SymbolDispose } = require('../../ours/primordials')\nconst eos = require('./end-of-stream')\nconst { once } = require('../../ours/util')\nconst destroyImpl = require('./destroy')\nconst Duplex = require('./duplex')\nconst {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_PREMATURE_CLOSE\n },\n AbortError\n} = require('../../ours/errors')\nconst { validateFunction, validateAbortSignal } = require('../validators')\nconst {\n isIterable,\n isReadable,\n isReadableNodeStream,\n isNodeStream,\n isTransformStream,\n isWebStream,\n isReadableStream,\n isReadableFinished\n} = require('./utils')\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nlet PassThrough\nlet Readable\nlet addAbortListener\nfunction destroyer(stream, reading, writing) {\n let finished = false\n stream.on('close', () => {\n finished = true\n })\n const cleanup = eos(\n stream,\n {\n readable: reading,\n writable: writing\n },\n (err) => {\n finished = !err\n }\n )\n return {\n destroy: (err) => {\n if (finished) return\n finished = true\n destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe'))\n },\n cleanup\n }\n}\nfunction popCallback(streams) {\n // Streams should never be an empty array. It should always contain at least\n // a single stream. Therefore optimize for the average case instead of\n // checking for length === 0 as well.\n validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]')\n return streams.pop()\n}\nfunction makeAsyncIterable(val) {\n if (isIterable(val)) {\n return val\n } else if (isReadableNodeStream(val)) {\n // Legacy streams are not Iterable.\n return fromReadable(val)\n }\n throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val)\n}\nasync function* fromReadable(val) {\n if (!Readable) {\n Readable = require('./readable')\n }\n yield* Readable.prototype[SymbolAsyncIterator].call(val)\n}\nasync function pumpToNode(iterable, writable, finish, { end }) {\n let error\n let onresolve = null\n const resume = (err) => {\n if (err) {\n error = err\n }\n if (onresolve) {\n const callback = onresolve\n onresolve = null\n callback()\n }\n }\n const wait = () =>\n new Promise((resolve, reject) => {\n if (error) {\n reject(error)\n } else {\n onresolve = () => {\n if (error) {\n reject(error)\n } else {\n resolve()\n }\n }\n }\n })\n writable.on('drain', resume)\n const cleanup = eos(\n writable,\n {\n readable: false\n },\n resume\n )\n try {\n if (writable.writableNeedDrain) {\n await wait()\n }\n for await (const chunk of iterable) {\n if (!writable.write(chunk)) {\n await wait()\n }\n }\n if (end) {\n writable.end()\n await wait()\n }\n finish()\n } catch (err) {\n finish(error !== err ? aggregateTwoErrors(error, err) : err)\n } finally {\n cleanup()\n writable.off('drain', resume)\n }\n}\nasync function pumpToWeb(readable, writable, finish, { end }) {\n if (isTransformStream(writable)) {\n writable = writable.writable\n }\n // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure\n const writer = writable.getWriter()\n try {\n for await (const chunk of readable) {\n await writer.ready\n writer.write(chunk).catch(() => {})\n }\n await writer.ready\n if (end) {\n await writer.close()\n }\n finish()\n } catch (err) {\n try {\n await writer.abort(err)\n finish(err)\n } catch (err) {\n finish(err)\n }\n }\n}\nfunction pipeline(...streams) {\n return pipelineImpl(streams, once(popCallback(streams)))\n}\nfunction pipelineImpl(streams, callback, opts) {\n if (streams.length === 1 && ArrayIsArray(streams[0])) {\n streams = streams[0]\n }\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams')\n }\n const ac = new AbortController()\n const signal = ac.signal\n const outerSignal = opts === null || opts === undefined ? undefined : opts.signal\n\n // Need to cleanup event listeners if last stream is readable\n // https://github.com/nodejs/node/issues/35452\n const lastStreamCleanup = []\n validateAbortSignal(outerSignal, 'options.signal')\n function abort() {\n finishImpl(new AbortError())\n }\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n let disposable\n if (outerSignal) {\n disposable = addAbortListener(outerSignal, abort)\n }\n let error\n let value\n const destroys = []\n let finishCount = 0\n function finish(err) {\n finishImpl(err, --finishCount === 0)\n }\n function finishImpl(err, final) {\n var _disposable\n if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) {\n error = err\n }\n if (!error && !final) {\n return\n }\n while (destroys.length) {\n destroys.shift()(error)\n }\n ;(_disposable = disposable) === null || _disposable === undefined ? undefined : _disposable[SymbolDispose]()\n ac.abort()\n if (final) {\n if (!error) {\n lastStreamCleanup.forEach((fn) => fn())\n }\n process.nextTick(callback, error, value)\n }\n }\n let ret\n for (let i = 0; i < streams.length; i++) {\n const stream = streams[i]\n const reading = i < streams.length - 1\n const writing = i > 0\n const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false\n const isLastStream = i === streams.length - 1\n if (isNodeStream(stream)) {\n if (end) {\n const { destroy, cleanup } = destroyer(stream, reading, writing)\n destroys.push(destroy)\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(cleanup)\n }\n }\n\n // Catch stream errors that occur after pipe/pump has completed.\n function onError(err) {\n if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n finish(err)\n }\n }\n stream.on('error', onError)\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(() => {\n stream.removeListener('error', onError)\n })\n }\n }\n if (i === 0) {\n if (typeof stream === 'function') {\n ret = stream({\n signal\n })\n if (!isIterable(ret)) {\n throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret)\n }\n } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) {\n ret = stream\n } else {\n ret = Duplex.from(stream)\n }\n } else if (typeof stream === 'function') {\n if (isTransformStream(ret)) {\n var _ret\n ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable)\n } else {\n ret = makeAsyncIterable(ret)\n }\n ret = stream(ret, {\n signal\n })\n if (reading) {\n if (!isIterable(ret, true)) {\n throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret)\n }\n } else {\n var _ret2\n if (!PassThrough) {\n PassThrough = require('./passthrough')\n }\n\n // If the last argument to pipeline is not a stream\n // we must create a proxy stream so that pipeline(...)\n // always returns a stream which can be further\n // composed through `.pipe(stream)`.\n\n const pt = new PassThrough({\n objectMode: true\n })\n\n // Handle Promises/A+ spec, `then` could be a getter that throws on\n // second use.\n const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then\n if (typeof then === 'function') {\n finishCount++\n then.call(\n ret,\n (val) => {\n value = val\n if (val != null) {\n pt.write(val)\n }\n if (end) {\n pt.end()\n }\n process.nextTick(finish)\n },\n (err) => {\n pt.destroy(err)\n process.nextTick(finish, err)\n }\n )\n } else if (isIterable(ret, true)) {\n finishCount++\n pumpToNode(ret, pt, finish, {\n end\n })\n } else if (isReadableStream(ret) || isTransformStream(ret)) {\n const toRead = ret.readable || ret\n finishCount++\n pumpToNode(toRead, pt, finish, {\n end\n })\n } else {\n throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret)\n }\n ret = pt\n const { destroy, cleanup } = destroyer(ret, false, true)\n destroys.push(destroy)\n if (isLastStream) {\n lastStreamCleanup.push(cleanup)\n }\n }\n } else if (isNodeStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount += 2\n const cleanup = pipe(ret, stream, finish, {\n end\n })\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(cleanup)\n }\n } else if (isTransformStream(ret) || isReadableStream(ret)) {\n const toRead = ret.readable || ret\n finishCount++\n pumpToNode(toRead, stream, finish, {\n end\n })\n } else if (isIterable(ret)) {\n finishCount++\n pumpToNode(ret, stream, finish, {\n end\n })\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'val',\n ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'],\n ret\n )\n }\n ret = stream\n } else if (isWebStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount++\n pumpToWeb(makeAsyncIterable(ret), stream, finish, {\n end\n })\n } else if (isReadableStream(ret) || isIterable(ret)) {\n finishCount++\n pumpToWeb(ret, stream, finish, {\n end\n })\n } else if (isTransformStream(ret)) {\n finishCount++\n pumpToWeb(ret.readable, stream, finish, {\n end\n })\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'val',\n ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'],\n ret\n )\n }\n ret = stream\n } else {\n ret = Duplex.from(stream)\n }\n }\n if (\n (signal !== null && signal !== undefined && signal.aborted) ||\n (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted)\n ) {\n process.nextTick(abort)\n }\n return ret\n}\nfunction pipe(src, dst, finish, { end }) {\n let ended = false\n dst.on('close', () => {\n if (!ended) {\n // Finish if the destination closes before the source has completed.\n finish(new ERR_STREAM_PREMATURE_CLOSE())\n }\n })\n src.pipe(dst, {\n end: false\n }) // If end is true we already will have a listener to end dst.\n\n if (end) {\n // Compat. Before node v10.12.0 stdio used to throw an error so\n // pipe() did/does not end() stdio destinations.\n // Now they allow it but \"secretly\" don't close the underlying fd.\n\n function endFn() {\n ended = true\n dst.end()\n }\n if (isReadableFinished(src)) {\n // End the destination if the source has already ended.\n process.nextTick(endFn)\n } else {\n src.once('end', endFn)\n }\n } else {\n finish()\n }\n eos(\n src,\n {\n readable: true,\n writable: false\n },\n (err) => {\n const rState = src._readableState\n if (\n err &&\n err.code === 'ERR_STREAM_PREMATURE_CLOSE' &&\n rState &&\n rState.ended &&\n !rState.errored &&\n !rState.errorEmitted\n ) {\n // Some readable streams will emit 'close' before 'end'. However, since\n // this is on the readable side 'end' should still be emitted if the\n // stream has been ended and no error emitted. This should be allowed in\n // favor of backwards compatibility. Since the stream is piped to a\n // destination this should not result in any observable difference.\n // We don't need to check if this is a writable premature close since\n // eos will only fail with premature close on the reading side for\n // duplex streams.\n src.once('end', finish).once('error', finish)\n } else {\n finish(err)\n }\n }\n )\n return eos(\n dst,\n {\n readable: false,\n writable: true\n },\n finish\n )\n}\nmodule.exports = {\n pipelineImpl,\n pipeline\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n;('use strict')\nconst {\n ArrayPrototypeIndexOf,\n NumberIsInteger,\n NumberIsNaN,\n NumberParseInt,\n ObjectDefineProperties,\n ObjectKeys,\n ObjectSetPrototypeOf,\n Promise,\n SafeSet,\n SymbolAsyncDispose,\n SymbolAsyncIterator,\n Symbol\n} = require('../../ours/primordials')\nmodule.exports = Readable\nReadable.ReadableState = ReadableState\nconst { EventEmitter: EE } = require('events')\nconst { Stream, prependListener } = require('./legacy')\nconst { Buffer } = require('buffer')\nconst { addAbortSignal } = require('./add-abort-signal')\nconst eos = require('./end-of-stream')\nlet debug = require('../../ours/util').debuglog('stream', (fn) => {\n debug = fn\n})\nconst BufferList = require('./buffer_list')\nconst destroyImpl = require('./destroy')\nconst { getHighWaterMark, getDefaultHighWaterMark } = require('./state')\nconst {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_OUT_OF_RANGE,\n ERR_STREAM_PUSH_AFTER_EOF,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT\n },\n AbortError\n} = require('../../ours/errors')\nconst { validateObject } = require('../validators')\nconst kPaused = Symbol('kPaused')\nconst { StringDecoder } = require('string_decoder')\nconst from = require('./from')\nObjectSetPrototypeOf(Readable.prototype, Stream.prototype)\nObjectSetPrototypeOf(Readable, Stream)\nconst nop = () => {}\nconst { errorOrDestroy } = destroyImpl\nconst kObjectMode = 1 << 0\nconst kEnded = 1 << 1\nconst kEndEmitted = 1 << 2\nconst kReading = 1 << 3\nconst kConstructed = 1 << 4\nconst kSync = 1 << 5\nconst kNeedReadable = 1 << 6\nconst kEmittedReadable = 1 << 7\nconst kReadableListening = 1 << 8\nconst kResumeScheduled = 1 << 9\nconst kErrorEmitted = 1 << 10\nconst kEmitClose = 1 << 11\nconst kAutoDestroy = 1 << 12\nconst kDestroyed = 1 << 13\nconst kClosed = 1 << 14\nconst kCloseEmitted = 1 << 15\nconst kMultiAwaitDrain = 1 << 16\nconst kReadingMore = 1 << 17\nconst kDataEmitted = 1 << 18\n\n// TODO(benjamingr) it is likely slower to do it this way than with free functions\nfunction makeBitMapDescriptor(bit) {\n return {\n enumerable: false,\n get() {\n return (this.state & bit) !== 0\n },\n set(value) {\n if (value) this.state |= bit\n else this.state &= ~bit\n }\n }\n}\nObjectDefineProperties(ReadableState.prototype, {\n objectMode: makeBitMapDescriptor(kObjectMode),\n ended: makeBitMapDescriptor(kEnded),\n endEmitted: makeBitMapDescriptor(kEndEmitted),\n reading: makeBitMapDescriptor(kReading),\n // Stream is still being constructed and cannot be\n // destroyed until construction finished or failed.\n // Async construction is opt in, therefore we start as\n // constructed.\n constructed: makeBitMapDescriptor(kConstructed),\n // A flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n sync: makeBitMapDescriptor(kSync),\n // Whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n needReadable: makeBitMapDescriptor(kNeedReadable),\n emittedReadable: makeBitMapDescriptor(kEmittedReadable),\n readableListening: makeBitMapDescriptor(kReadableListening),\n resumeScheduled: makeBitMapDescriptor(kResumeScheduled),\n // True if the error was already emitted and should not be thrown again.\n errorEmitted: makeBitMapDescriptor(kErrorEmitted),\n emitClose: makeBitMapDescriptor(kEmitClose),\n autoDestroy: makeBitMapDescriptor(kAutoDestroy),\n // Has it been destroyed.\n destroyed: makeBitMapDescriptor(kDestroyed),\n // Indicates whether the stream has finished destroying.\n closed: makeBitMapDescriptor(kClosed),\n // True if close has been emitted or would have been emitted\n // depending on emitClose.\n closeEmitted: makeBitMapDescriptor(kCloseEmitted),\n multiAwaitDrain: makeBitMapDescriptor(kMultiAwaitDrain),\n // If true, a maybeReadMore has been scheduled.\n readingMore: makeBitMapDescriptor(kReadingMore),\n dataEmitted: makeBitMapDescriptor(kDataEmitted)\n})\nfunction ReadableState(options, stream, isDuplex) {\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof require('./duplex')\n\n // Bit map field to store ReadableState more effciently with 1 bit per field\n // instead of a V8 slot per field.\n this.state = kEmitClose | kAutoDestroy | kConstructed | kSync\n // Object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away.\n if (options && options.objectMode) this.state |= kObjectMode\n if (isDuplex && options && options.readableObjectMode) this.state |= kObjectMode\n\n // The point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = options\n ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex)\n : getDefaultHighWaterMark(false)\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift().\n this.buffer = new BufferList()\n this.length = 0\n this.pipes = []\n this.flowing = null\n this[kPaused] = null\n\n // Should close be emitted on destroy. Defaults to true.\n if (options && options.emitClose === false) this.state &= ~kEmitClose\n\n // Should .destroy() be called after 'end' (and potentially 'finish').\n if (options && options.autoDestroy === false) this.state &= ~kAutoDestroy\n\n // Indicates whether the stream has errored. When true no further\n // _read calls, 'data' or 'readable' events should occur. This is needed\n // since when autoDestroy is disabled we need a way to tell whether the\n // stream has failed.\n this.errored = null\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = (options && options.defaultEncoding) || 'utf8'\n\n // Ref the piped dest which we need a drain event on it\n // type: null | Writable | Set.\n this.awaitDrainWriters = null\n this.decoder = null\n this.encoding = null\n if (options && options.encoding) {\n this.decoder = new StringDecoder(options.encoding)\n this.encoding = options.encoding\n }\n}\nfunction Readable(options) {\n if (!(this instanceof Readable)) return new Readable(options)\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5.\n const isDuplex = this instanceof require('./duplex')\n this._readableState = new ReadableState(options, this, isDuplex)\n if (options) {\n if (typeof options.read === 'function') this._read = options.read\n if (typeof options.destroy === 'function') this._destroy = options.destroy\n if (typeof options.construct === 'function') this._construct = options.construct\n if (options.signal && !isDuplex) addAbortSignal(options.signal, this)\n }\n Stream.call(this, options)\n destroyImpl.construct(this, () => {\n if (this._readableState.needReadable) {\n maybeReadMore(this, this._readableState)\n }\n })\n}\nReadable.prototype.destroy = destroyImpl.destroy\nReadable.prototype._undestroy = destroyImpl.undestroy\nReadable.prototype._destroy = function (err, cb) {\n cb(err)\n}\nReadable.prototype[EE.captureRejectionSymbol] = function (err) {\n this.destroy(err)\n}\nReadable.prototype[SymbolAsyncDispose] = function () {\n let error\n if (!this.destroyed) {\n error = this.readableEnded ? null : new AbortError()\n this.destroy(error)\n }\n return new Promise((resolve, reject) => eos(this, (err) => (err && err !== error ? reject(err) : resolve(null))))\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, false)\n}\n\n// Unshift should *always* be something directly out of read().\nReadable.prototype.unshift = function (chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, true)\n}\nfunction readableAddChunk(stream, chunk, encoding, addToFront) {\n debug('readableAddChunk', chunk)\n const state = stream._readableState\n let err\n if ((state.state & kObjectMode) === 0) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding\n if (state.encoding !== encoding) {\n if (addToFront && state.encoding) {\n // When unshifting, if state.encoding is set, we have to save\n // the string in the BufferList with the state encoding.\n chunk = Buffer.from(chunk, encoding).toString(state.encoding)\n } else {\n chunk = Buffer.from(chunk, encoding)\n encoding = ''\n }\n }\n } else if (chunk instanceof Buffer) {\n encoding = ''\n } else if (Stream._isUint8Array(chunk)) {\n chunk = Stream._uint8ArrayToBuffer(chunk)\n encoding = ''\n } else if (chunk != null) {\n err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk)\n }\n }\n if (err) {\n errorOrDestroy(stream, err)\n } else if (chunk === null) {\n state.state &= ~kReading\n onEofChunk(stream, state)\n } else if ((state.state & kObjectMode) !== 0 || (chunk && chunk.length > 0)) {\n if (addToFront) {\n if ((state.state & kEndEmitted) !== 0) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT())\n else if (state.destroyed || state.errored) return false\n else addChunk(stream, state, chunk, true)\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF())\n } else if (state.destroyed || state.errored) {\n return false\n } else {\n state.state &= ~kReading\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk)\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false)\n else maybeReadMore(stream, state)\n } else {\n addChunk(stream, state, chunk, false)\n }\n }\n } else if (!addToFront) {\n state.state &= ~kReading\n maybeReadMore(stream, state)\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0)\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) {\n // Use the guard to avoid creating `Set()` repeatedly\n // when we have multiple pipes.\n if ((state.state & kMultiAwaitDrain) !== 0) {\n state.awaitDrainWriters.clear()\n } else {\n state.awaitDrainWriters = null\n }\n state.dataEmitted = true\n stream.emit('data', chunk)\n } else {\n // Update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length\n if (addToFront) state.buffer.unshift(chunk)\n else state.buffer.push(chunk)\n if ((state.state & kNeedReadable) !== 0) emitReadable(stream)\n }\n maybeReadMore(stream, state)\n}\nReadable.prototype.isPaused = function () {\n const state = this._readableState\n return state[kPaused] === true || state.flowing === false\n}\n\n// Backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n const decoder = new StringDecoder(enc)\n this._readableState.decoder = decoder\n // If setEncoding(null), decoder.encoding equals utf8.\n this._readableState.encoding = this._readableState.decoder.encoding\n const buffer = this._readableState.buffer\n // Iterate over current buffer to convert already stored Buffers:\n let content = ''\n for (const data of buffer) {\n content += decoder.write(data)\n }\n buffer.clear()\n if (content !== '') buffer.push(content)\n this._readableState.length = content.length\n return this\n}\n\n// Don't raise the hwm > 1GB.\nconst MAX_HWM = 0x40000000\nfunction computeNewHighWaterMark(n) {\n if (n > MAX_HWM) {\n throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n)\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts.\n n--\n n |= n >>> 1\n n |= n >>> 2\n n |= n >>> 4\n n |= n >>> 8\n n |= n >>> 16\n n++\n }\n return n\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || (state.length === 0 && state.ended)) return 0\n if ((state.state & kObjectMode) !== 0) return 1\n if (NumberIsNaN(n)) {\n // Only flow one buffer at a time.\n if (state.flowing && state.length) return state.buffer.first().length\n return state.length\n }\n if (n <= state.length) return n\n return state.ended ? state.length : 0\n}\n\n// You can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n)\n // Same as parseInt(undefined, 10), however V8 7.3 performance regressed\n // in this scenario, so we are doing it manually.\n if (n === undefined) {\n n = NaN\n } else if (!NumberIsInteger(n)) {\n n = NumberParseInt(n, 10)\n }\n const state = this._readableState\n const nOrig = n\n\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n)\n if (n !== 0) state.state &= ~kEmittedReadable\n\n // If we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (\n n === 0 &&\n state.needReadable &&\n ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)\n ) {\n debug('read: emitReadable', state.length, state.ended)\n if (state.length === 0 && state.ended) endReadable(this)\n else emitReadable(this)\n return null\n }\n n = howMuchToRead(n, state)\n\n // If we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this)\n return null\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n let doRead = (state.state & kNeedReadable) !== 0\n debug('need readable', doRead)\n\n // If we currently have less than the highWaterMark, then also read some.\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true\n debug('length less than watermark', doRead)\n }\n\n // However, if we've ended, then there's no point, if we're already\n // reading, then it's unnecessary, if we're constructing we have to wait,\n // and if we're destroyed or errored, then it's not allowed,\n if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) {\n doRead = false\n debug('reading, ended or constructing', doRead)\n } else if (doRead) {\n debug('do read')\n state.state |= kReading | kSync\n // If the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.state |= kNeedReadable\n\n // Call internal read method\n try {\n this._read(state.highWaterMark)\n } catch (err) {\n errorOrDestroy(this, err)\n }\n state.state &= ~kSync\n\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state)\n }\n let ret\n if (n > 0) ret = fromList(n, state)\n else ret = null\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark\n n = 0\n } else {\n state.length -= n\n if (state.multiAwaitDrain) {\n state.awaitDrainWriters.clear()\n } else {\n state.awaitDrainWriters = null\n }\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this)\n }\n if (ret !== null && !state.errorEmitted && !state.closeEmitted) {\n state.dataEmitted = true\n this.emit('data', ret)\n }\n return ret\n}\nfunction onEofChunk(stream, state) {\n debug('onEofChunk')\n if (state.ended) return\n if (state.decoder) {\n const chunk = state.decoder.end()\n if (chunk && chunk.length) {\n state.buffer.push(chunk)\n state.length += state.objectMode ? 1 : chunk.length\n }\n }\n state.ended = true\n if (state.sync) {\n // If we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call.\n emitReadable(stream)\n } else {\n // Emit 'readable' now to make sure it gets picked up.\n state.needReadable = false\n state.emittedReadable = true\n // We have to emit readable now that we are EOF. Modules\n // in the ecosystem (e.g. dicer) rely on this event being sync.\n emitReadable_(stream)\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n const state = stream._readableState\n debug('emitReadable', state.needReadable, state.emittedReadable)\n state.needReadable = false\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing)\n state.emittedReadable = true\n process.nextTick(emitReadable_, stream)\n }\n}\nfunction emitReadable_(stream) {\n const state = stream._readableState\n debug('emitReadable_', state.destroyed, state.length, state.ended)\n if (!state.destroyed && !state.errored && (state.length || state.ended)) {\n stream.emit('readable')\n state.emittedReadable = false\n }\n\n // The stream needs another readable event if:\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark\n flow(stream)\n}\n\n// At this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore && state.constructed) {\n state.readingMore = true\n process.nextTick(maybeReadMore_, stream, state)\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (\n !state.reading &&\n !state.ended &&\n (state.length < state.highWaterMark || (state.flowing && state.length === 0))\n ) {\n const len = state.length\n debug('maybeReadMore read 0')\n stream.read(0)\n if (len === state.length)\n // Didn't get any data, stop spinning.\n break\n }\n state.readingMore = false\n}\n\n// Abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_read()')\n}\nReadable.prototype.pipe = function (dest, pipeOpts) {\n const src = this\n const state = this._readableState\n if (state.pipes.length === 1) {\n if (!state.multiAwaitDrain) {\n state.multiAwaitDrain = true\n state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : [])\n }\n }\n state.pipes.push(dest)\n debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts)\n const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr\n const endFn = doEnd ? onend : unpipe\n if (state.endEmitted) process.nextTick(endFn)\n else src.once('end', endFn)\n dest.on('unpipe', onunpipe)\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe')\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true\n cleanup()\n }\n }\n }\n function onend() {\n debug('onend')\n dest.end()\n }\n let ondrain\n let cleanedUp = false\n function cleanup() {\n debug('cleanup')\n // Cleanup event handlers once the pipe is broken.\n dest.removeListener('close', onclose)\n dest.removeListener('finish', onfinish)\n if (ondrain) {\n dest.removeListener('drain', ondrain)\n }\n dest.removeListener('error', onerror)\n dest.removeListener('unpipe', onunpipe)\n src.removeListener('end', onend)\n src.removeListener('end', unpipe)\n src.removeListener('data', ondata)\n cleanedUp = true\n\n // If the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain()\n }\n function pause() {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if (!cleanedUp) {\n if (state.pipes.length === 1 && state.pipes[0] === dest) {\n debug('false write response, pause', 0)\n state.awaitDrainWriters = dest\n state.multiAwaitDrain = false\n } else if (state.pipes.length > 1 && state.pipes.includes(dest)) {\n debug('false write response, pause', state.awaitDrainWriters.size)\n state.awaitDrainWriters.add(dest)\n }\n src.pause()\n }\n if (!ondrain) {\n // When the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n ondrain = pipeOnDrain(src, dest)\n dest.on('drain', ondrain)\n }\n }\n src.on('data', ondata)\n function ondata(chunk) {\n debug('ondata')\n const ret = dest.write(chunk)\n debug('dest.write', ret)\n if (ret === false) {\n pause()\n }\n }\n\n // If the dest has an error, then stop piping into it.\n // However, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er)\n unpipe()\n dest.removeListener('error', onerror)\n if (dest.listenerCount('error') === 0) {\n const s = dest._writableState || dest._readableState\n if (s && !s.errorEmitted) {\n // User incorrectly emitted 'error' directly on the stream.\n errorOrDestroy(dest, er)\n } else {\n dest.emit('error', er)\n }\n }\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror)\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish)\n unpipe()\n }\n dest.once('close', onclose)\n function onfinish() {\n debug('onfinish')\n dest.removeListener('close', onclose)\n unpipe()\n }\n dest.once('finish', onfinish)\n function unpipe() {\n debug('unpipe')\n src.unpipe(dest)\n }\n\n // Tell the dest that it's being piped to.\n dest.emit('pipe', src)\n\n // Start the flow if it hasn't been started already.\n\n if (dest.writableNeedDrain === true) {\n pause()\n } else if (!state.flowing) {\n debug('pipe resume')\n src.resume()\n }\n return dest\n}\nfunction pipeOnDrain(src, dest) {\n return function pipeOnDrainFunctionResult() {\n const state = src._readableState\n\n // `ondrain` will call directly,\n // `this` maybe not a reference to dest,\n // so we use the real dest here.\n if (state.awaitDrainWriters === dest) {\n debug('pipeOnDrain', 1)\n state.awaitDrainWriters = null\n } else if (state.multiAwaitDrain) {\n debug('pipeOnDrain', state.awaitDrainWriters.size)\n state.awaitDrainWriters.delete(dest)\n }\n if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) {\n src.resume()\n }\n }\n}\nReadable.prototype.unpipe = function (dest) {\n const state = this._readableState\n const unpipeInfo = {\n hasUnpiped: false\n }\n\n // If we're not piping anywhere, then do nothing.\n if (state.pipes.length === 0) return this\n if (!dest) {\n // remove all.\n const dests = state.pipes\n state.pipes = []\n this.pause()\n for (let i = 0; i < dests.length; i++)\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n })\n return this\n }\n\n // Try to find the right one.\n const index = ArrayPrototypeIndexOf(state.pipes, dest)\n if (index === -1) return this\n state.pipes.splice(index, 1)\n if (state.pipes.length === 0) this.pause()\n dest.emit('unpipe', this, unpipeInfo)\n return this\n}\n\n// Set up data events if they are asked for\n// Ensure readable listeners eventually get something.\nReadable.prototype.on = function (ev, fn) {\n const res = Stream.prototype.on.call(this, ev, fn)\n const state = this._readableState\n if (ev === 'data') {\n // Update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0\n\n // Try start flowing on next tick if stream isn't explicitly paused.\n if (state.flowing !== false) this.resume()\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true\n state.flowing = false\n state.emittedReadable = false\n debug('on readable', state.length, state.reading)\n if (state.length) {\n emitReadable(this)\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this)\n }\n }\n }\n return res\n}\nReadable.prototype.addListener = Readable.prototype.on\nReadable.prototype.removeListener = function (ev, fn) {\n const res = Stream.prototype.removeListener.call(this, ev, fn)\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this)\n }\n return res\n}\nReadable.prototype.off = Readable.prototype.removeListener\nReadable.prototype.removeAllListeners = function (ev) {\n const res = Stream.prototype.removeAllListeners.apply(this, arguments)\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this)\n }\n return res\n}\nfunction updateReadableListening(self) {\n const state = self._readableState\n state.readableListening = self.listenerCount('readable') > 0\n if (state.resumeScheduled && state[kPaused] === false) {\n // Flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true\n\n // Crude way to check if we should resume.\n } else if (self.listenerCount('data') > 0) {\n self.resume()\n } else if (!state.readableListening) {\n state.flowing = null\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0')\n self.read(0)\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n const state = this._readableState\n if (!state.flowing) {\n debug('resume')\n // We flow only if there is no one listening\n // for readable, but we still have to call\n // resume().\n state.flowing = !state.readableListening\n resume(this, state)\n }\n state[kPaused] = false\n return this\n}\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true\n process.nextTick(resume_, stream, state)\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading)\n if (!state.reading) {\n stream.read(0)\n }\n state.resumeScheduled = false\n stream.emit('resume')\n flow(stream)\n if (state.flowing && !state.reading) stream.read(0)\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing)\n if (this._readableState.flowing !== false) {\n debug('pause')\n this._readableState.flowing = false\n this.emit('pause')\n }\n this._readableState[kPaused] = true\n return this\n}\nfunction flow(stream) {\n const state = stream._readableState\n debug('flow', state.flowing)\n while (state.flowing && stream.read() !== null);\n}\n\n// Wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n let paused = false\n\n // TODO (ronag): Should this.destroy(err) emit\n // 'error' on the wrapped stream? Would require\n // a static factory method, e.g. Readable.wrap(stream).\n\n stream.on('data', (chunk) => {\n if (!this.push(chunk) && stream.pause) {\n paused = true\n stream.pause()\n }\n })\n stream.on('end', () => {\n this.push(null)\n })\n stream.on('error', (err) => {\n errorOrDestroy(this, err)\n })\n stream.on('close', () => {\n this.destroy()\n })\n stream.on('destroy', () => {\n this.destroy()\n })\n this._read = () => {\n if (paused && stream.resume) {\n paused = false\n stream.resume()\n }\n }\n\n // Proxy all the other methods. Important when wrapping filters and duplexes.\n const streamKeys = ObjectKeys(stream)\n for (let j = 1; j < streamKeys.length; j++) {\n const i = streamKeys[j]\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = stream[i].bind(stream)\n }\n }\n return this\n}\nReadable.prototype[SymbolAsyncIterator] = function () {\n return streamToAsyncIterator(this)\n}\nReadable.prototype.iterator = function (options) {\n if (options !== undefined) {\n validateObject(options, 'options')\n }\n return streamToAsyncIterator(this, options)\n}\nfunction streamToAsyncIterator(stream, options) {\n if (typeof stream.read !== 'function') {\n stream = Readable.wrap(stream, {\n objectMode: true\n })\n }\n const iter = createAsyncIterator(stream, options)\n iter.stream = stream\n return iter\n}\nasync function* createAsyncIterator(stream, options) {\n let callback = nop\n function next(resolve) {\n if (this === stream) {\n callback()\n callback = nop\n } else {\n callback = resolve\n }\n }\n stream.on('readable', next)\n let error\n const cleanup = eos(\n stream,\n {\n writable: false\n },\n (err) => {\n error = err ? aggregateTwoErrors(error, err) : null\n callback()\n callback = nop\n }\n )\n try {\n while (true) {\n const chunk = stream.destroyed ? null : stream.read()\n if (chunk !== null) {\n yield chunk\n } else if (error) {\n throw error\n } else if (error === null) {\n return\n } else {\n await new Promise(next)\n }\n }\n } catch (err) {\n error = aggregateTwoErrors(error, err)\n throw error\n } finally {\n if (\n (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) &&\n (error === undefined || stream._readableState.autoDestroy)\n ) {\n destroyImpl.destroyer(stream, null)\n } else {\n stream.off('readable', next)\n cleanup()\n }\n }\n}\n\n// Making it explicit these properties are not enumerable\n// because otherwise some prototype manipulation in\n// userland will fail.\nObjectDefineProperties(Readable.prototype, {\n readable: {\n __proto__: null,\n get() {\n const r = this._readableState\n // r.readable === false means that this is part of a Duplex stream\n // where the readable side was disabled upon construction.\n // Compat. The user might manually disable readable side through\n // deprecated setter.\n return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted\n },\n set(val) {\n // Backwards compat.\n if (this._readableState) {\n this._readableState.readable = !!val\n }\n }\n },\n readableDidRead: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState.dataEmitted\n }\n },\n readableAborted: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return !!(\n this._readableState.readable !== false &&\n (this._readableState.destroyed || this._readableState.errored) &&\n !this._readableState.endEmitted\n )\n }\n },\n readableHighWaterMark: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState.highWaterMark\n }\n },\n readableBuffer: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState && this._readableState.buffer\n }\n },\n readableFlowing: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState.flowing\n },\n set: function (state) {\n if (this._readableState) {\n this._readableState.flowing = state\n }\n }\n },\n readableLength: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState.length\n }\n },\n readableObjectMode: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.objectMode : false\n }\n },\n readableEncoding: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.encoding : null\n }\n },\n errored: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.errored : null\n }\n },\n closed: {\n __proto__: null,\n get() {\n return this._readableState ? this._readableState.closed : false\n }\n },\n destroyed: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.destroyed : false\n },\n set(value) {\n // We ignore the value if the stream\n // has not been initialized yet.\n if (!this._readableState) {\n return\n }\n\n // Backward compatibility, the user is explicitly\n // managing destroyed.\n this._readableState.destroyed = value\n }\n },\n readableEnded: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.endEmitted : false\n }\n }\n})\nObjectDefineProperties(ReadableState.prototype, {\n // Legacy getter for `pipesCount`.\n pipesCount: {\n __proto__: null,\n get() {\n return this.pipes.length\n }\n },\n // Legacy property for `paused`.\n paused: {\n __proto__: null,\n get() {\n return this[kPaused] !== false\n },\n set(value) {\n this[kPaused] = !!value\n }\n }\n})\n\n// Exposed for testing purposes only.\nReadable._fromList = fromList\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered.\n if (state.length === 0) return null\n let ret\n if (state.objectMode) ret = state.buffer.shift()\n else if (!n || n >= state.length) {\n // Read it all, truncate the list.\n if (state.decoder) ret = state.buffer.join('')\n else if (state.buffer.length === 1) ret = state.buffer.first()\n else ret = state.buffer.concat(state.length)\n state.buffer.clear()\n } else {\n // read part of list.\n ret = state.buffer.consume(n, state.decoder)\n }\n return ret\n}\nfunction endReadable(stream) {\n const state = stream._readableState\n debug('endReadable', state.endEmitted)\n if (!state.endEmitted) {\n state.ended = true\n process.nextTick(endReadableNT, state, stream)\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length)\n\n // Check that we didn't get one last unshift.\n if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) {\n state.endEmitted = true\n stream.emit('end')\n if (stream.writable && stream.allowHalfOpen === false) {\n process.nextTick(endWritableNT, stream)\n } else if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well.\n const wState = stream._writableState\n const autoDestroy =\n !wState ||\n (wState.autoDestroy &&\n // We don't expect the writable to ever 'finish'\n // if writable is explicitly set to false.\n (wState.finished || wState.writable === false))\n if (autoDestroy) {\n stream.destroy()\n }\n }\n }\n}\nfunction endWritableNT(stream) {\n const writable = stream.writable && !stream.writableEnded && !stream.destroyed\n if (writable) {\n stream.end()\n }\n}\nReadable.from = function (iterable, opts) {\n return from(Readable, iterable, opts)\n}\nlet webStreamsAdapters\n\n// Lazy to avoid circular references\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined) webStreamsAdapters = {}\n return webStreamsAdapters\n}\nReadable.fromWeb = function (readableStream, options) {\n return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options)\n}\nReadable.toWeb = function (streamReadable, options) {\n return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options)\n}\nReadable.wrap = function (src, options) {\n var _ref, _src$readableObjectMo\n return new Readable({\n objectMode:\n (_ref =\n (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined\n ? _src$readableObjectMo\n : src.objectMode) !== null && _ref !== undefined\n ? _ref\n : true,\n ...options,\n destroy(err, callback) {\n destroyImpl.destroyer(src, err)\n callback(err)\n }\n }).wrap(src)\n}\n","'use strict'\n\nconst { MathFloor, NumberIsInteger } = require('../../ours/primordials')\nconst { validateInteger } = require('../validators')\nconst { ERR_INVALID_ARG_VALUE } = require('../../ours/errors').codes\nlet defaultHighWaterMarkBytes = 16 * 1024\nlet defaultHighWaterMarkObjectMode = 16\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null\n}\nfunction getDefaultHighWaterMark(objectMode) {\n return objectMode ? defaultHighWaterMarkObjectMode : defaultHighWaterMarkBytes\n}\nfunction setDefaultHighWaterMark(objectMode, value) {\n validateInteger(value, 'value', 0)\n if (objectMode) {\n defaultHighWaterMarkObjectMode = value\n } else {\n defaultHighWaterMarkBytes = value\n }\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n const hwm = highWaterMarkFrom(options, isDuplex, duplexKey)\n if (hwm != null) {\n if (!NumberIsInteger(hwm) || hwm < 0) {\n const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark'\n throw new ERR_INVALID_ARG_VALUE(name, hwm)\n }\n return MathFloor(hwm)\n }\n\n // Default value\n return getDefaultHighWaterMark(state.objectMode)\n}\nmodule.exports = {\n getHighWaterMark,\n getDefaultHighWaterMark,\n setDefaultHighWaterMark\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict'\n\nconst { ObjectSetPrototypeOf, Symbol } = require('../../ours/primordials')\nmodule.exports = Transform\nconst { ERR_METHOD_NOT_IMPLEMENTED } = require('../../ours/errors').codes\nconst Duplex = require('./duplex')\nconst { getHighWaterMark } = require('./state')\nObjectSetPrototypeOf(Transform.prototype, Duplex.prototype)\nObjectSetPrototypeOf(Transform, Duplex)\nconst kCallback = Symbol('kCallback')\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options)\n\n // TODO (ronag): This should preferably always be\n // applied but would be semver-major. Or even better;\n // make Transform a Readable with the Writable interface.\n const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null\n if (readableHighWaterMark === 0) {\n // A Duplex will buffer both on the writable and readable side while\n // a Transform just wants to buffer hwm number of elements. To avoid\n // buffering twice we disable buffering on the writable side.\n options = {\n ...options,\n highWaterMark: null,\n readableHighWaterMark,\n // TODO (ronag): 0 is not optimal since we have\n // a \"bug\" where we check needDrain before calling _write and not after.\n // Refs: https://github.com/nodejs/node/pull/32887\n // Refs: https://github.com/nodejs/node/pull/35941\n writableHighWaterMark: options.writableHighWaterMark || 0\n }\n }\n Duplex.call(this, options)\n\n // We have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false\n this[kCallback] = null\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform\n if (typeof options.flush === 'function') this._flush = options.flush\n }\n\n // When the writable side finishes, then flush out anything remaining.\n // Backwards compat. Some Transform streams incorrectly implement _final\n // instead of or in addition to _flush. By using 'prefinish' instead of\n // implementing _final we continue supporting this unfortunate use case.\n this.on('prefinish', prefinish)\n}\nfunction final(cb) {\n if (typeof this._flush === 'function' && !this.destroyed) {\n this._flush((er, data) => {\n if (er) {\n if (cb) {\n cb(er)\n } else {\n this.destroy(er)\n }\n return\n }\n if (data != null) {\n this.push(data)\n }\n this.push(null)\n if (cb) {\n cb()\n }\n })\n } else {\n this.push(null)\n if (cb) {\n cb()\n }\n }\n}\nfunction prefinish() {\n if (this._final !== final) {\n final.call(this)\n }\n}\nTransform.prototype._final = final\nTransform.prototype._transform = function (chunk, encoding, callback) {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()')\n}\nTransform.prototype._write = function (chunk, encoding, callback) {\n const rState = this._readableState\n const wState = this._writableState\n const length = rState.length\n this._transform(chunk, encoding, (err, val) => {\n if (err) {\n callback(err)\n return\n }\n if (val != null) {\n this.push(val)\n }\n if (\n wState.ended ||\n // Backwards compat.\n length === rState.length ||\n // Backwards compat.\n rState.length < rState.highWaterMark\n ) {\n callback()\n } else {\n this[kCallback] = callback\n }\n })\n}\nTransform.prototype._read = function () {\n if (this[kCallback]) {\n const callback = this[kCallback]\n this[kCallback] = null\n callback()\n }\n}\n","'use strict'\n\nconst { SymbolAsyncIterator, SymbolIterator, SymbolFor } = require('../../ours/primordials')\n\n// We need to use SymbolFor to make these globally available\n// for interopt with readable-stream, i.e. readable-stream\n// and node core needs to be able to read/write private state\n// from each other for proper interoperability.\nconst kIsDestroyed = SymbolFor('nodejs.stream.destroyed')\nconst kIsErrored = SymbolFor('nodejs.stream.errored')\nconst kIsReadable = SymbolFor('nodejs.stream.readable')\nconst kIsWritable = SymbolFor('nodejs.stream.writable')\nconst kIsDisturbed = SymbolFor('nodejs.stream.disturbed')\nconst kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise')\nconst kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction')\nfunction isReadableNodeStream(obj, strict = false) {\n var _obj$_readableState\n return !!(\n (\n obj &&\n typeof obj.pipe === 'function' &&\n typeof obj.on === 'function' &&\n (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) &&\n (!obj._writableState ||\n ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined\n ? undefined\n : _obj$_readableState.readable) !== false) &&\n // Duplex\n (!obj._writableState || obj._readableState)\n ) // Writable has .pipe.\n )\n}\n\nfunction isWritableNodeStream(obj) {\n var _obj$_writableState\n return !!(\n (\n obj &&\n typeof obj.write === 'function' &&\n typeof obj.on === 'function' &&\n (!obj._readableState ||\n ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined\n ? undefined\n : _obj$_writableState.writable) !== false)\n ) // Duplex\n )\n}\n\nfunction isDuplexNodeStream(obj) {\n return !!(\n obj &&\n typeof obj.pipe === 'function' &&\n obj._readableState &&\n typeof obj.on === 'function' &&\n typeof obj.write === 'function'\n )\n}\nfunction isNodeStream(obj) {\n return (\n obj &&\n (obj._readableState ||\n obj._writableState ||\n (typeof obj.write === 'function' && typeof obj.on === 'function') ||\n (typeof obj.pipe === 'function' && typeof obj.on === 'function'))\n )\n}\nfunction isReadableStream(obj) {\n return !!(\n obj &&\n !isNodeStream(obj) &&\n typeof obj.pipeThrough === 'function' &&\n typeof obj.getReader === 'function' &&\n typeof obj.cancel === 'function'\n )\n}\nfunction isWritableStream(obj) {\n return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function')\n}\nfunction isTransformStream(obj) {\n return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object')\n}\nfunction isWebStream(obj) {\n return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj)\n}\nfunction isIterable(obj, isAsync) {\n if (obj == null) return false\n if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function'\n if (isAsync === false) return typeof obj[SymbolIterator] === 'function'\n return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function'\n}\nfunction isDestroyed(stream) {\n if (!isNodeStream(stream)) return null\n const wState = stream._writableState\n const rState = stream._readableState\n const state = wState || rState\n return !!(stream.destroyed || stream[kIsDestroyed] || (state !== null && state !== undefined && state.destroyed))\n}\n\n// Have been end():d.\nfunction isWritableEnded(stream) {\n if (!isWritableNodeStream(stream)) return null\n if (stream.writableEnded === true) return true\n const wState = stream._writableState\n if (wState !== null && wState !== undefined && wState.errored) return false\n if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null\n return wState.ended\n}\n\n// Have emitted 'finish'.\nfunction isWritableFinished(stream, strict) {\n if (!isWritableNodeStream(stream)) return null\n if (stream.writableFinished === true) return true\n const wState = stream._writableState\n if (wState !== null && wState !== undefined && wState.errored) return false\n if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null\n return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0))\n}\n\n// Have been push(null):d.\nfunction isReadableEnded(stream) {\n if (!isReadableNodeStream(stream)) return null\n if (stream.readableEnded === true) return true\n const rState = stream._readableState\n if (!rState || rState.errored) return false\n if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null\n return rState.ended\n}\n\n// Have emitted 'end'.\nfunction isReadableFinished(stream, strict) {\n if (!isReadableNodeStream(stream)) return null\n const rState = stream._readableState\n if (rState !== null && rState !== undefined && rState.errored) return false\n if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null\n return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0))\n}\nfunction isReadable(stream) {\n if (stream && stream[kIsReadable] != null) return stream[kIsReadable]\n if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null\n if (isDestroyed(stream)) return false\n return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream)\n}\nfunction isWritable(stream) {\n if (stream && stream[kIsWritable] != null) return stream[kIsWritable]\n if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null\n if (isDestroyed(stream)) return false\n return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream)\n}\nfunction isFinished(stream, opts) {\n if (!isNodeStream(stream)) {\n return null\n }\n if (isDestroyed(stream)) {\n return true\n }\n if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) {\n return false\n }\n if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) {\n return false\n }\n return true\n}\nfunction isWritableErrored(stream) {\n var _stream$_writableStat, _stream$_writableStat2\n if (!isNodeStream(stream)) {\n return null\n }\n if (stream.writableErrored) {\n return stream.writableErrored\n }\n return (_stream$_writableStat =\n (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined\n ? undefined\n : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined\n ? _stream$_writableStat\n : null\n}\nfunction isReadableErrored(stream) {\n var _stream$_readableStat, _stream$_readableStat2\n if (!isNodeStream(stream)) {\n return null\n }\n if (stream.readableErrored) {\n return stream.readableErrored\n }\n return (_stream$_readableStat =\n (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined\n ? undefined\n : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined\n ? _stream$_readableStat\n : null\n}\nfunction isClosed(stream) {\n if (!isNodeStream(stream)) {\n return null\n }\n if (typeof stream.closed === 'boolean') {\n return stream.closed\n }\n const wState = stream._writableState\n const rState = stream._readableState\n if (\n typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' ||\n typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean'\n ) {\n return (\n (wState === null || wState === undefined ? undefined : wState.closed) ||\n (rState === null || rState === undefined ? undefined : rState.closed)\n )\n }\n if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) {\n return stream._closed\n }\n return null\n}\nfunction isOutgoingMessage(stream) {\n return (\n typeof stream._closed === 'boolean' &&\n typeof stream._defaultKeepAlive === 'boolean' &&\n typeof stream._removedConnection === 'boolean' &&\n typeof stream._removedContLen === 'boolean'\n )\n}\nfunction isServerResponse(stream) {\n return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream)\n}\nfunction isServerRequest(stream) {\n var _stream$req\n return (\n typeof stream._consuming === 'boolean' &&\n typeof stream._dumped === 'boolean' &&\n ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) ===\n undefined\n )\n}\nfunction willEmitClose(stream) {\n if (!isNodeStream(stream)) return null\n const wState = stream._writableState\n const rState = stream._readableState\n const state = wState || rState\n return (\n (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false)\n )\n}\nfunction isDisturbed(stream) {\n var _stream$kIsDisturbed\n return !!(\n stream &&\n ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined\n ? _stream$kIsDisturbed\n : stream.readableDidRead || stream.readableAborted)\n )\n}\nfunction isErrored(stream) {\n var _ref,\n _ref2,\n _ref3,\n _ref4,\n _ref5,\n _stream$kIsErrored,\n _stream$_readableStat3,\n _stream$_writableStat3,\n _stream$_readableStat4,\n _stream$_writableStat4\n return !!(\n stream &&\n ((_ref =\n (_ref2 =\n (_ref3 =\n (_ref4 =\n (_ref5 =\n (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined\n ? _stream$kIsErrored\n : stream.readableErrored) !== null && _ref5 !== undefined\n ? _ref5\n : stream.writableErrored) !== null && _ref4 !== undefined\n ? _ref4\n : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined\n ? undefined\n : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined\n ? _ref3\n : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined\n ? undefined\n : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined\n ? _ref2\n : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined\n ? undefined\n : _stream$_readableStat4.errored) !== null && _ref !== undefined\n ? _ref\n : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined\n ? undefined\n : _stream$_writableStat4.errored)\n )\n}\nmodule.exports = {\n isDestroyed,\n kIsDestroyed,\n isDisturbed,\n kIsDisturbed,\n isErrored,\n kIsErrored,\n isReadable,\n kIsReadable,\n kIsClosedPromise,\n kControllerErrorFunction,\n kIsWritable,\n isClosed,\n isDuplexNodeStream,\n isFinished,\n isIterable,\n isReadableNodeStream,\n isReadableStream,\n isReadableEnded,\n isReadableFinished,\n isReadableErrored,\n isNodeStream,\n isWebStream,\n isWritable,\n isWritableNodeStream,\n isWritableStream,\n isWritableEnded,\n isWritableFinished,\n isWritableErrored,\n isServerRequest,\n isServerResponse,\n willEmitClose,\n isTransformStream\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n;('use strict')\nconst {\n ArrayPrototypeSlice,\n Error,\n FunctionPrototypeSymbolHasInstance,\n ObjectDefineProperty,\n ObjectDefineProperties,\n ObjectSetPrototypeOf,\n StringPrototypeToLowerCase,\n Symbol,\n SymbolHasInstance\n} = require('../../ours/primordials')\nmodule.exports = Writable\nWritable.WritableState = WritableState\nconst { EventEmitter: EE } = require('events')\nconst Stream = require('./legacy').Stream\nconst { Buffer } = require('buffer')\nconst destroyImpl = require('./destroy')\nconst { addAbortSignal } = require('./add-abort-signal')\nconst { getHighWaterMark, getDefaultHighWaterMark } = require('./state')\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_ALREADY_FINISHED,\n ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING\n} = require('../../ours/errors').codes\nconst { errorOrDestroy } = destroyImpl\nObjectSetPrototypeOf(Writable.prototype, Stream.prototype)\nObjectSetPrototypeOf(Writable, Stream)\nfunction nop() {}\nconst kOnFinished = Symbol('kOnFinished')\nfunction WritableState(options, stream, isDuplex) {\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof require('./duplex')\n\n // Object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!(options && options.objectMode)\n if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode)\n\n // The point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write().\n this.highWaterMark = options\n ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex)\n : getDefaultHighWaterMark(false)\n\n // if _final has been called.\n this.finalCalled = false\n\n // drain event flag.\n this.needDrain = false\n // At the start of calling end()\n this.ending = false\n // When end() has been called, and returned.\n this.ended = false\n // When 'finish' is emitted.\n this.finished = false\n\n // Has it been destroyed\n this.destroyed = false\n\n // Should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n const noDecode = !!(options && options.decodeStrings === false)\n this.decodeStrings = !noDecode\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = (options && options.defaultEncoding) || 'utf8'\n\n // Not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0\n\n // A flag to see when we're in the middle of a write.\n this.writing = false\n\n // When true all writes will be buffered until .uncork() call.\n this.corked = 0\n\n // A flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true\n\n // A flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false\n\n // The callback that's passed to _write(chunk, cb).\n this.onwrite = onwrite.bind(undefined, stream)\n\n // The callback that the user supplies to write(chunk, encoding, cb).\n this.writecb = null\n\n // The amount that is being written when _write is called.\n this.writelen = 0\n\n // Storage for data passed to the afterWrite() callback in case of\n // synchronous _write() completion.\n this.afterWriteTickInfo = null\n resetBuffer(this)\n\n // Number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted.\n this.pendingcb = 0\n\n // Stream is still being constructed and cannot be\n // destroyed until construction finished or failed.\n // Async construction is opt in, therefore we start as\n // constructed.\n this.constructed = true\n\n // Emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams.\n this.prefinished = false\n\n // True if the error was already emitted and should not be thrown again.\n this.errorEmitted = false\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = !options || options.emitClose !== false\n\n // Should .destroy() be called after 'finish' (and potentially 'end').\n this.autoDestroy = !options || options.autoDestroy !== false\n\n // Indicates whether the stream has errored. When true all write() calls\n // should return false. This is needed since when autoDestroy\n // is disabled we need a way to tell whether the stream has failed.\n this.errored = null\n\n // Indicates whether the stream has finished destroying.\n this.closed = false\n\n // True if close has been emitted or would have been emitted\n // depending on emitClose.\n this.closeEmitted = false\n this[kOnFinished] = []\n}\nfunction resetBuffer(state) {\n state.buffered = []\n state.bufferedIndex = 0\n state.allBuffers = true\n state.allNoop = true\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n return ArrayPrototypeSlice(this.buffered, this.bufferedIndex)\n}\nObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', {\n __proto__: null,\n get() {\n return this.buffered.length - this.bufferedIndex\n }\n})\nfunction Writable(options) {\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5.\n const isDuplex = this instanceof require('./duplex')\n if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options)\n this._writableState = new WritableState(options, this, isDuplex)\n if (options) {\n if (typeof options.write === 'function') this._write = options.write\n if (typeof options.writev === 'function') this._writev = options.writev\n if (typeof options.destroy === 'function') this._destroy = options.destroy\n if (typeof options.final === 'function') this._final = options.final\n if (typeof options.construct === 'function') this._construct = options.construct\n if (options.signal) addAbortSignal(options.signal, this)\n }\n Stream.call(this, options)\n destroyImpl.construct(this, () => {\n const state = this._writableState\n if (!state.writing) {\n clearBuffer(this, state)\n }\n finishMaybe(this, state)\n })\n}\nObjectDefineProperty(Writable, SymbolHasInstance, {\n __proto__: null,\n value: function (object) {\n if (FunctionPrototypeSymbolHasInstance(this, object)) return true\n if (this !== Writable) return false\n return object && object._writableState instanceof WritableState\n }\n})\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE())\n}\nfunction _write(stream, chunk, encoding, cb) {\n const state = stream._writableState\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = state.defaultEncoding\n } else {\n if (!encoding) encoding = state.defaultEncoding\n else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding)\n if (typeof cb !== 'function') cb = nop\n }\n if (chunk === null) {\n throw new ERR_STREAM_NULL_VALUES()\n } else if (!state.objectMode) {\n if (typeof chunk === 'string') {\n if (state.decodeStrings !== false) {\n chunk = Buffer.from(chunk, encoding)\n encoding = 'buffer'\n }\n } else if (chunk instanceof Buffer) {\n encoding = 'buffer'\n } else if (Stream._isUint8Array(chunk)) {\n chunk = Stream._uint8ArrayToBuffer(chunk)\n encoding = 'buffer'\n } else {\n throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk)\n }\n }\n let err\n if (state.ending) {\n err = new ERR_STREAM_WRITE_AFTER_END()\n } else if (state.destroyed) {\n err = new ERR_STREAM_DESTROYED('write')\n }\n if (err) {\n process.nextTick(cb, err)\n errorOrDestroy(stream, err, true)\n return err\n }\n state.pendingcb++\n return writeOrBuffer(stream, state, chunk, encoding, cb)\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n return _write(this, chunk, encoding, cb) === true\n}\nWritable.prototype.cork = function () {\n this._writableState.corked++\n}\nWritable.prototype.uncork = function () {\n const state = this._writableState\n if (state.corked) {\n state.corked--\n if (!state.writing) clearBuffer(this, state)\n }\n}\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding)\n if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding)\n this._writableState.defaultEncoding = encoding\n return this\n}\n\n// If we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, callback) {\n const len = state.objectMode ? 1 : chunk.length\n state.length += len\n\n // stream._write resets state.length\n const ret = state.length < state.highWaterMark\n // We must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true\n if (state.writing || state.corked || state.errored || !state.constructed) {\n state.buffered.push({\n chunk,\n encoding,\n callback\n })\n if (state.allBuffers && encoding !== 'buffer') {\n state.allBuffers = false\n }\n if (state.allNoop && callback !== nop) {\n state.allNoop = false\n }\n } else {\n state.writelen = len\n state.writecb = callback\n state.writing = true\n state.sync = true\n stream._write(chunk, encoding, state.onwrite)\n state.sync = false\n }\n\n // Return false if errored or destroyed in order to break\n // any synchronous while(stream.write(data)) loops.\n return ret && !state.errored && !state.destroyed\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len\n state.writecb = cb\n state.writing = true\n state.sync = true\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'))\n else if (writev) stream._writev(chunk, state.onwrite)\n else stream._write(chunk, encoding, state.onwrite)\n state.sync = false\n}\nfunction onwriteError(stream, state, er, cb) {\n --state.pendingcb\n cb(er)\n // Ensure callbacks are invoked even when autoDestroy is\n // not enabled. Passing `er` here doesn't make sense since\n // it's related to one specific write, not to the buffered\n // writes.\n errorBuffer(state)\n // This can emit error, but error must always follow cb.\n errorOrDestroy(stream, er)\n}\nfunction onwrite(stream, er) {\n const state = stream._writableState\n const sync = state.sync\n const cb = state.writecb\n if (typeof cb !== 'function') {\n errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK())\n return\n }\n state.writing = false\n state.writecb = null\n state.length -= state.writelen\n state.writelen = 0\n if (er) {\n // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364\n er.stack // eslint-disable-line no-unused-expressions\n\n if (!state.errored) {\n state.errored = er\n }\n\n // In case of duplex streams we need to notify the readable side of the\n // error.\n if (stream._readableState && !stream._readableState.errored) {\n stream._readableState.errored = er\n }\n if (sync) {\n process.nextTick(onwriteError, stream, state, er, cb)\n } else {\n onwriteError(stream, state, er, cb)\n }\n } else {\n if (state.buffered.length > state.bufferedIndex) {\n clearBuffer(stream, state)\n }\n if (sync) {\n // It is a common case that the callback passed to .write() is always\n // the same. In that case, we do not schedule a new nextTick(), but\n // rather just increase a counter, to improve performance and avoid\n // memory allocations.\n if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) {\n state.afterWriteTickInfo.count++\n } else {\n state.afterWriteTickInfo = {\n count: 1,\n cb,\n stream,\n state\n }\n process.nextTick(afterWriteTick, state.afterWriteTickInfo)\n }\n } else {\n afterWrite(stream, state, 1, cb)\n }\n }\n}\nfunction afterWriteTick({ stream, state, count, cb }) {\n state.afterWriteTickInfo = null\n return afterWrite(stream, state, count, cb)\n}\nfunction afterWrite(stream, state, count, cb) {\n const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain\n if (needDrain) {\n state.needDrain = false\n stream.emit('drain')\n }\n while (count-- > 0) {\n state.pendingcb--\n cb()\n }\n if (state.destroyed) {\n errorBuffer(state)\n }\n finishMaybe(stream, state)\n}\n\n// If there's something in the buffer waiting, then invoke callbacks.\nfunction errorBuffer(state) {\n if (state.writing) {\n return\n }\n for (let n = state.bufferedIndex; n < state.buffered.length; ++n) {\n var _state$errored\n const { chunk, callback } = state.buffered[n]\n const len = state.objectMode ? 1 : chunk.length\n state.length -= len\n callback(\n (_state$errored = state.errored) !== null && _state$errored !== undefined\n ? _state$errored\n : new ERR_STREAM_DESTROYED('write')\n )\n }\n const onfinishCallbacks = state[kOnFinished].splice(0)\n for (let i = 0; i < onfinishCallbacks.length; i++) {\n var _state$errored2\n onfinishCallbacks[i](\n (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined\n ? _state$errored2\n : new ERR_STREAM_DESTROYED('end')\n )\n }\n resetBuffer(state)\n}\n\n// If there's something in the buffer waiting, then process it.\nfunction clearBuffer(stream, state) {\n if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) {\n return\n }\n const { buffered, bufferedIndex, objectMode } = state\n const bufferedLength = buffered.length - bufferedIndex\n if (!bufferedLength) {\n return\n }\n let i = bufferedIndex\n state.bufferProcessing = true\n if (bufferedLength > 1 && stream._writev) {\n state.pendingcb -= bufferedLength - 1\n const callback = state.allNoop\n ? nop\n : (err) => {\n for (let n = i; n < buffered.length; ++n) {\n buffered[n].callback(err)\n }\n }\n // Make a copy of `buffered` if it's going to be used by `callback` above,\n // since `doWrite` will mutate the array.\n const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i)\n chunks.allBuffers = state.allBuffers\n doWrite(stream, state, true, state.length, chunks, '', callback)\n resetBuffer(state)\n } else {\n do {\n const { chunk, encoding, callback } = buffered[i]\n buffered[i++] = null\n const len = objectMode ? 1 : chunk.length\n doWrite(stream, state, false, len, chunk, encoding, callback)\n } while (i < buffered.length && !state.writing)\n if (i === buffered.length) {\n resetBuffer(state)\n } else if (i > 256) {\n buffered.splice(0, i)\n state.bufferedIndex = 0\n } else {\n state.bufferedIndex = i\n }\n }\n state.bufferProcessing = false\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n if (this._writev) {\n this._writev(\n [\n {\n chunk,\n encoding\n }\n ],\n cb\n )\n } else {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_write()')\n }\n}\nWritable.prototype._writev = null\nWritable.prototype.end = function (chunk, encoding, cb) {\n const state = this._writableState\n if (typeof chunk === 'function') {\n cb = chunk\n chunk = null\n encoding = null\n } else if (typeof encoding === 'function') {\n cb = encoding\n encoding = null\n }\n let err\n if (chunk !== null && chunk !== undefined) {\n const ret = _write(this, chunk, encoding)\n if (ret instanceof Error) {\n err = ret\n }\n }\n\n // .end() fully uncorks.\n if (state.corked) {\n state.corked = 1\n this.uncork()\n }\n if (err) {\n // Do nothing...\n } else if (!state.errored && !state.ending) {\n // This is forgiving in terms of unnecessary calls to end() and can hide\n // logic errors. However, usually such errors are harmless and causing a\n // hard error can be disproportionately destructive. It is not always\n // trivial for the user to determine whether end() needs to be called\n // or not.\n\n state.ending = true\n finishMaybe(this, state, true)\n state.ended = true\n } else if (state.finished) {\n err = new ERR_STREAM_ALREADY_FINISHED('end')\n } else if (state.destroyed) {\n err = new ERR_STREAM_DESTROYED('end')\n }\n if (typeof cb === 'function') {\n if (err || state.finished) {\n process.nextTick(cb, err)\n } else {\n state[kOnFinished].push(cb)\n }\n }\n return this\n}\nfunction needFinish(state) {\n return (\n state.ending &&\n !state.destroyed &&\n state.constructed &&\n state.length === 0 &&\n !state.errored &&\n state.buffered.length === 0 &&\n !state.finished &&\n !state.writing &&\n !state.errorEmitted &&\n !state.closeEmitted\n )\n}\nfunction callFinal(stream, state) {\n let called = false\n function onFinish(err) {\n if (called) {\n errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK())\n return\n }\n called = true\n state.pendingcb--\n if (err) {\n const onfinishCallbacks = state[kOnFinished].splice(0)\n for (let i = 0; i < onfinishCallbacks.length; i++) {\n onfinishCallbacks[i](err)\n }\n errorOrDestroy(stream, err, state.sync)\n } else if (needFinish(state)) {\n state.prefinished = true\n stream.emit('prefinish')\n // Backwards compat. Don't check state.sync here.\n // Some streams assume 'finish' will be emitted\n // asynchronously relative to _final callback.\n state.pendingcb++\n process.nextTick(finish, stream, state)\n }\n }\n state.sync = true\n state.pendingcb++\n try {\n stream._final(onFinish)\n } catch (err) {\n onFinish(err)\n }\n state.sync = false\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.finalCalled = true\n callFinal(stream, state)\n } else {\n state.prefinished = true\n stream.emit('prefinish')\n }\n }\n}\nfunction finishMaybe(stream, state, sync) {\n if (needFinish(state)) {\n prefinish(stream, state)\n if (state.pendingcb === 0) {\n if (sync) {\n state.pendingcb++\n process.nextTick(\n (stream, state) => {\n if (needFinish(state)) {\n finish(stream, state)\n } else {\n state.pendingcb--\n }\n },\n stream,\n state\n )\n } else if (needFinish(state)) {\n state.pendingcb++\n finish(stream, state)\n }\n }\n }\n}\nfunction finish(stream, state) {\n state.pendingcb--\n state.finished = true\n const onfinishCallbacks = state[kOnFinished].splice(0)\n for (let i = 0; i < onfinishCallbacks.length; i++) {\n onfinishCallbacks[i]()\n }\n stream.emit('finish')\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well.\n const rState = stream._readableState\n const autoDestroy =\n !rState ||\n (rState.autoDestroy &&\n // We don't expect the readable to ever 'end'\n // if readable is explicitly set to false.\n (rState.endEmitted || rState.readable === false))\n if (autoDestroy) {\n stream.destroy()\n }\n }\n}\nObjectDefineProperties(Writable.prototype, {\n closed: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.closed : false\n }\n },\n destroyed: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.destroyed : false\n },\n set(value) {\n // Backward compatibility, the user is explicitly managing destroyed.\n if (this._writableState) {\n this._writableState.destroyed = value\n }\n }\n },\n writable: {\n __proto__: null,\n get() {\n const w = this._writableState\n // w.writable === false means that this is part of a Duplex stream\n // where the writable side was disabled upon construction.\n // Compat. The user might manually disable writable side through\n // deprecated setter.\n return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended\n },\n set(val) {\n // Backwards compatible.\n if (this._writableState) {\n this._writableState.writable = !!val\n }\n }\n },\n writableFinished: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.finished : false\n }\n },\n writableObjectMode: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.objectMode : false\n }\n },\n writableBuffer: {\n __proto__: null,\n get() {\n return this._writableState && this._writableState.getBuffer()\n }\n },\n writableEnded: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.ending : false\n }\n },\n writableNeedDrain: {\n __proto__: null,\n get() {\n const wState = this._writableState\n if (!wState) return false\n return !wState.destroyed && !wState.ending && wState.needDrain\n }\n },\n writableHighWaterMark: {\n __proto__: null,\n get() {\n return this._writableState && this._writableState.highWaterMark\n }\n },\n writableCorked: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.corked : 0\n }\n },\n writableLength: {\n __proto__: null,\n get() {\n return this._writableState && this._writableState.length\n }\n },\n errored: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._writableState ? this._writableState.errored : null\n }\n },\n writableAborted: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return !!(\n this._writableState.writable !== false &&\n (this._writableState.destroyed || this._writableState.errored) &&\n !this._writableState.finished\n )\n }\n }\n})\nconst destroy = destroyImpl.destroy\nWritable.prototype.destroy = function (err, cb) {\n const state = this._writableState\n\n // Invoke pending callbacks.\n if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) {\n process.nextTick(errorBuffer, state)\n }\n destroy.call(this, err, cb)\n return this\n}\nWritable.prototype._undestroy = destroyImpl.undestroy\nWritable.prototype._destroy = function (err, cb) {\n cb(err)\n}\nWritable.prototype[EE.captureRejectionSymbol] = function (err) {\n this.destroy(err)\n}\nlet webStreamsAdapters\n\n// Lazy to avoid circular references\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined) webStreamsAdapters = {}\n return webStreamsAdapters\n}\nWritable.fromWeb = function (writableStream, options) {\n return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options)\n}\nWritable.toWeb = function (streamWritable) {\n return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable)\n}\n","/* eslint jsdoc/require-jsdoc: \"error\" */\n\n'use strict'\n\nconst {\n ArrayIsArray,\n ArrayPrototypeIncludes,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n NumberIsInteger,\n NumberIsNaN,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n NumberParseInt,\n ObjectPrototypeHasOwnProperty,\n RegExpPrototypeExec,\n String,\n StringPrototypeToUpperCase,\n StringPrototypeTrim\n} = require('../ours/primordials')\nconst {\n hideStackFrames,\n codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL }\n} = require('../ours/errors')\nconst { normalizeEncoding } = require('../ours/util')\nconst { isAsyncFunction, isArrayBufferView } = require('../ours/util').types\nconst signals = {}\n\n/**\n * @param {*} value\n * @returns {boolean}\n */\nfunction isInt32(value) {\n return value === (value | 0)\n}\n\n/**\n * @param {*} value\n * @returns {boolean}\n */\nfunction isUint32(value) {\n return value === value >>> 0\n}\nconst octalReg = /^[0-7]+$/\nconst modeDesc = 'must be a 32-bit unsigned integer or an octal string'\n\n/**\n * Parse and validate values that will be converted into mode_t (the S_*\n * constants). Only valid numbers and octal strings are allowed. They could be\n * converted to 32-bit unsigned integers or non-negative signed integers in the\n * C++ land, but any value higher than 0o777 will result in platform-specific\n * behaviors.\n * @param {*} value Values to be validated\n * @param {string} name Name of the argument\n * @param {number} [def] If specified, will be returned for invalid values\n * @returns {number}\n */\nfunction parseFileMode(value, name, def) {\n if (typeof value === 'undefined') {\n value = def\n }\n if (typeof value === 'string') {\n if (RegExpPrototypeExec(octalReg, value) === null) {\n throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc)\n }\n value = NumberParseInt(value, 8)\n }\n validateUint32(value, name)\n return value\n}\n\n/**\n * @callback validateInteger\n * @param {*} value\n * @param {string} name\n * @param {number} [min]\n * @param {number} [max]\n * @returns {asserts value is number}\n */\n\n/** @type {validateInteger} */\nconst validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {\n if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value)\n if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value)\n})\n\n/**\n * @callback validateInt32\n * @param {*} value\n * @param {string} name\n * @param {number} [min]\n * @param {number} [max]\n * @returns {asserts value is number}\n */\n\n/** @type {validateInt32} */\nconst validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {\n // The defaults for min and max correspond to the limits of 32-bit integers.\n if (typeof value !== 'number') {\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n if (!NumberIsInteger(value)) {\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value)\n }\n if (value < min || value > max) {\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value)\n }\n})\n\n/**\n * @callback validateUint32\n * @param {*} value\n * @param {string} name\n * @param {number|boolean} [positive=false]\n * @returns {asserts value is number}\n */\n\n/** @type {validateUint32} */\nconst validateUint32 = hideStackFrames((value, name, positive = false) => {\n if (typeof value !== 'number') {\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n if (!NumberIsInteger(value)) {\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value)\n }\n const min = positive ? 1 : 0\n // 2 ** 32 === 4294967296\n const max = 4294967295\n if (value < min || value > max) {\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value)\n }\n})\n\n/**\n * @callback validateString\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is string}\n */\n\n/** @type {validateString} */\nfunction validateString(value, name) {\n if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value)\n}\n\n/**\n * @callback validateNumber\n * @param {*} value\n * @param {string} name\n * @param {number} [min]\n * @param {number} [max]\n * @returns {asserts value is number}\n */\n\n/** @type {validateNumber} */\nfunction validateNumber(value, name, min = undefined, max) {\n if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n if (\n (min != null && value < min) ||\n (max != null && value > max) ||\n ((min != null || max != null) && NumberIsNaN(value))\n ) {\n throw new ERR_OUT_OF_RANGE(\n name,\n `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`,\n value\n )\n }\n}\n\n/**\n * @callback validateOneOf\n * @template T\n * @param {T} value\n * @param {string} name\n * @param {T[]} oneOf\n */\n\n/** @type {validateOneOf} */\nconst validateOneOf = hideStackFrames((value, name, oneOf) => {\n if (!ArrayPrototypeIncludes(oneOf, value)) {\n const allowed = ArrayPrototypeJoin(\n ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))),\n ', '\n )\n const reason = 'must be one of: ' + allowed\n throw new ERR_INVALID_ARG_VALUE(name, value, reason)\n }\n})\n\n/**\n * @callback validateBoolean\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is boolean}\n */\n\n/** @type {validateBoolean} */\nfunction validateBoolean(value, name) {\n if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value)\n}\n\n/**\n * @param {any} options\n * @param {string} key\n * @param {boolean} defaultValue\n * @returns {boolean}\n */\nfunction getOwnPropertyValueOrDefault(options, key, defaultValue) {\n return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key]\n}\n\n/**\n * @callback validateObject\n * @param {*} value\n * @param {string} name\n * @param {{\n * allowArray?: boolean,\n * allowFunction?: boolean,\n * nullable?: boolean\n * }} [options]\n */\n\n/** @type {validateObject} */\nconst validateObject = hideStackFrames((value, name, options = null) => {\n const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false)\n const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false)\n const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false)\n if (\n (!nullable && value === null) ||\n (!allowArray && ArrayIsArray(value)) ||\n (typeof value !== 'object' && (!allowFunction || typeof value !== 'function'))\n ) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Object', value)\n }\n})\n\n/**\n * @callback validateDictionary - We are using the Web IDL Standard definition\n * of \"dictionary\" here, which means any value\n * whose Type is either Undefined, Null, or\n * Object (which includes functions).\n * @param {*} value\n * @param {string} name\n * @see https://webidl.spec.whatwg.org/#es-dictionary\n * @see https://tc39.es/ecma262/#table-typeof-operator-results\n */\n\n/** @type {validateDictionary} */\nconst validateDictionary = hideStackFrames((value, name) => {\n if (value != null && typeof value !== 'object' && typeof value !== 'function') {\n throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value)\n }\n})\n\n/**\n * @callback validateArray\n * @param {*} value\n * @param {string} name\n * @param {number} [minLength]\n * @returns {asserts value is any[]}\n */\n\n/** @type {validateArray} */\nconst validateArray = hideStackFrames((value, name, minLength = 0) => {\n if (!ArrayIsArray(value)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Array', value)\n }\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`\n throw new ERR_INVALID_ARG_VALUE(name, value, reason)\n }\n})\n\n/**\n * @callback validateStringArray\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is string[]}\n */\n\n/** @type {validateStringArray} */\nfunction validateStringArray(value, name) {\n validateArray(value, name)\n for (let i = 0; i < value.length; i++) {\n validateString(value[i], `${name}[${i}]`)\n }\n}\n\n/**\n * @callback validateBooleanArray\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is boolean[]}\n */\n\n/** @type {validateBooleanArray} */\nfunction validateBooleanArray(value, name) {\n validateArray(value, name)\n for (let i = 0; i < value.length; i++) {\n validateBoolean(value[i], `${name}[${i}]`)\n }\n}\n\n/**\n * @callback validateAbortSignalArray\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is AbortSignal[]}\n */\n\n/** @type {validateAbortSignalArray} */\nfunction validateAbortSignalArray(value, name) {\n validateArray(value, name)\n for (let i = 0; i < value.length; i++) {\n const signal = value[i]\n const indexedName = `${name}[${i}]`\n if (signal == null) {\n throw new ERR_INVALID_ARG_TYPE(indexedName, 'AbortSignal', signal)\n }\n validateAbortSignal(signal, indexedName)\n }\n}\n\n/**\n * @param {*} signal\n * @param {string} [name='signal']\n * @returns {asserts signal is keyof signals}\n */\nfunction validateSignalName(signal, name = 'signal') {\n validateString(signal, name)\n if (signals[signal] === undefined) {\n if (signals[StringPrototypeToUpperCase(signal)] !== undefined) {\n throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)')\n }\n throw new ERR_UNKNOWN_SIGNAL(signal)\n }\n}\n\n/**\n * @callback validateBuffer\n * @param {*} buffer\n * @param {string} [name='buffer']\n * @returns {asserts buffer is ArrayBufferView}\n */\n\n/** @type {validateBuffer} */\nconst validateBuffer = hideStackFrames((buffer, name = 'buffer') => {\n if (!isArrayBufferView(buffer)) {\n throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer)\n }\n})\n\n/**\n * @param {string} data\n * @param {string} encoding\n */\nfunction validateEncoding(data, encoding) {\n const normalizedEncoding = normalizeEncoding(encoding)\n const length = data.length\n if (normalizedEncoding === 'hex' && length % 2 !== 0) {\n throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`)\n }\n}\n\n/**\n * Check that the port number is not NaN when coerced to a number,\n * is an integer and that it falls within the legal range of port numbers.\n * @param {*} port\n * @param {string} [name='Port']\n * @param {boolean} [allowZero=true]\n * @returns {number}\n */\nfunction validatePort(port, name = 'Port', allowZero = true) {\n if (\n (typeof port !== 'number' && typeof port !== 'string') ||\n (typeof port === 'string' && StringPrototypeTrim(port).length === 0) ||\n +port !== +port >>> 0 ||\n port > 0xffff ||\n (port === 0 && !allowZero)\n ) {\n throw new ERR_SOCKET_BAD_PORT(name, port, allowZero)\n }\n return port | 0\n}\n\n/**\n * @callback validateAbortSignal\n * @param {*} signal\n * @param {string} name\n */\n\n/** @type {validateAbortSignal} */\nconst validateAbortSignal = hideStackFrames((signal, name) => {\n if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal)\n }\n})\n\n/**\n * @callback validateFunction\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is Function}\n */\n\n/** @type {validateFunction} */\nconst validateFunction = hideStackFrames((value, name) => {\n if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value)\n})\n\n/**\n * @callback validatePlainFunction\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is Function}\n */\n\n/** @type {validatePlainFunction} */\nconst validatePlainFunction = hideStackFrames((value, name) => {\n if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value)\n})\n\n/**\n * @callback validateUndefined\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is undefined}\n */\n\n/** @type {validateUndefined} */\nconst validateUndefined = hideStackFrames((value, name) => {\n if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value)\n})\n\n/**\n * @template T\n * @param {T} value\n * @param {string} name\n * @param {T[]} union\n */\nfunction validateUnion(value, name, union) {\n if (!ArrayPrototypeIncludes(union, value)) {\n throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value)\n }\n}\n\n/*\n The rules for the Link header field are described here:\n https://www.rfc-editor.org/rfc/rfc8288.html#section-3\n\n This regex validates any string surrounded by angle brackets\n (not necessarily a valid URI reference) followed by zero or more\n link-params separated by semicolons.\n*/\nconst linkValueRegExp = /^(?:<[^>]*>)(?:\\s*;\\s*[^;\"\\s]+(?:=(\")?[^;\"\\s]*\\1)?)*$/\n\n/**\n * @param {any} value\n * @param {string} name\n */\nfunction validateLinkHeaderFormat(value, name) {\n if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) {\n throw new ERR_INVALID_ARG_VALUE(\n name,\n value,\n 'must be an array or string of format \"; rel=preload; as=style\"'\n )\n }\n}\n\n/**\n * @param {any} hints\n * @return {string}\n */\nfunction validateLinkHeaderValue(hints) {\n if (typeof hints === 'string') {\n validateLinkHeaderFormat(hints, 'hints')\n return hints\n } else if (ArrayIsArray(hints)) {\n const hintsLength = hints.length\n let result = ''\n if (hintsLength === 0) {\n return result\n }\n for (let i = 0; i < hintsLength; i++) {\n const link = hints[i]\n validateLinkHeaderFormat(link, 'hints')\n result += link\n if (i !== hintsLength - 1) {\n result += ', '\n }\n }\n return result\n }\n throw new ERR_INVALID_ARG_VALUE(\n 'hints',\n hints,\n 'must be an array or string of format \"; rel=preload; as=style\"'\n )\n}\nmodule.exports = {\n isInt32,\n isUint32,\n parseFileMode,\n validateArray,\n validateStringArray,\n validateBooleanArray,\n validateAbortSignalArray,\n validateBoolean,\n validateBuffer,\n validateDictionary,\n validateEncoding,\n validateFunction,\n validateInt32,\n validateInteger,\n validateNumber,\n validateObject,\n validateOneOf,\n validatePlainFunction,\n validatePort,\n validateSignalName,\n validateString,\n validateUint32,\n validateUndefined,\n validateUnion,\n validateAbortSignal,\n validateLinkHeaderValue\n}\n","'use strict'\n\nconst CustomStream = require('../stream')\nconst promises = require('../stream/promises')\nconst originalDestroy = CustomStream.Readable.destroy\nmodule.exports = CustomStream.Readable\n\n// Explicit export naming is needed for ESM\nmodule.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer\nmodule.exports._isUint8Array = CustomStream._isUint8Array\nmodule.exports.isDisturbed = CustomStream.isDisturbed\nmodule.exports.isErrored = CustomStream.isErrored\nmodule.exports.isReadable = CustomStream.isReadable\nmodule.exports.Readable = CustomStream.Readable\nmodule.exports.Writable = CustomStream.Writable\nmodule.exports.Duplex = CustomStream.Duplex\nmodule.exports.Transform = CustomStream.Transform\nmodule.exports.PassThrough = CustomStream.PassThrough\nmodule.exports.addAbortSignal = CustomStream.addAbortSignal\nmodule.exports.finished = CustomStream.finished\nmodule.exports.destroy = CustomStream.destroy\nmodule.exports.destroy = originalDestroy\nmodule.exports.pipeline = CustomStream.pipeline\nmodule.exports.compose = CustomStream.compose\nObject.defineProperty(CustomStream, 'promises', {\n configurable: true,\n enumerable: true,\n get() {\n return promises\n }\n})\nmodule.exports.Stream = CustomStream.Stream\n\n// Allow default importing\nmodule.exports.default = module.exports\n","'use strict'\n\nconst { format, inspect, AggregateError: CustomAggregateError } = require('./util')\n\n/*\n This file is a reduced and adapted version of the main lib/internal/errors.js file defined at\n\n https://github.com/nodejs/node/blob/master/lib/internal/errors.js\n\n Don't try to replace with the original file and keep it up to date (starting from E(...) definitions)\n with the upstream file.\n*/\n\nconst AggregateError = globalThis.AggregateError || CustomAggregateError\nconst kIsNodeError = Symbol('kIsNodeError')\nconst kTypes = [\n 'string',\n 'function',\n 'number',\n 'object',\n // Accept 'Function' and 'Object' as alternative to the lower cased version.\n 'Function',\n 'Object',\n 'boolean',\n 'bigint',\n 'symbol'\n]\nconst classRegExp = /^([A-Z][a-z0-9]*)+$/\nconst nodeInternalPrefix = '__node_internal_'\nconst codes = {}\nfunction assert(value, message) {\n if (!value) {\n throw new codes.ERR_INTERNAL_ASSERTION(message)\n }\n}\n\n// Only use this for integers! Decimal numbers do not work with this function.\nfunction addNumericalSeparator(val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\nfunction getMessage(key, msg, args) {\n if (typeof msg === 'function') {\n assert(\n msg.length <= args.length,\n // Default options do not count.\n `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`\n )\n return msg(...args)\n }\n const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length\n assert(\n expectedLength === args.length,\n `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`\n )\n if (args.length === 0) {\n return msg\n }\n return format(msg, ...args)\n}\nfunction E(code, message, Base) {\n if (!Base) {\n Base = Error\n }\n class NodeError extends Base {\n constructor(...args) {\n super(getMessage(code, message, args))\n }\n toString() {\n return `${this.name} [${code}]: ${this.message}`\n }\n }\n Object.defineProperties(NodeError.prototype, {\n name: {\n value: Base.name,\n writable: true,\n enumerable: false,\n configurable: true\n },\n toString: {\n value() {\n return `${this.name} [${code}]: ${this.message}`\n },\n writable: true,\n enumerable: false,\n configurable: true\n }\n })\n NodeError.prototype.code = code\n NodeError.prototype[kIsNodeError] = true\n codes[code] = NodeError\n}\nfunction hideStackFrames(fn) {\n // We rename the functions that will be hidden to cut off the stacktrace\n // at the outermost one\n const hidden = nodeInternalPrefix + fn.name\n Object.defineProperty(fn, 'name', {\n value: hidden\n })\n return fn\n}\nfunction aggregateTwoErrors(innerError, outerError) {\n if (innerError && outerError && innerError !== outerError) {\n if (Array.isArray(outerError.errors)) {\n // If `outerError` is already an `AggregateError`.\n outerError.errors.push(innerError)\n return outerError\n }\n const err = new AggregateError([outerError, innerError], outerError.message)\n err.code = outerError.code\n return err\n }\n return innerError || outerError\n}\nclass AbortError extends Error {\n constructor(message = 'The operation was aborted', options = undefined) {\n if (options !== undefined && typeof options !== 'object') {\n throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options)\n }\n super(message, options)\n this.code = 'ABORT_ERR'\n this.name = 'AbortError'\n }\n}\nE('ERR_ASSERTION', '%s', Error)\nE(\n 'ERR_INVALID_ARG_TYPE',\n (name, expected, actual) => {\n assert(typeof name === 'string', \"'name' must be a string\")\n if (!Array.isArray(expected)) {\n expected = [expected]\n }\n let msg = 'The '\n if (name.endsWith(' argument')) {\n // For cases like 'first argument'\n msg += `${name} `\n } else {\n msg += `\"${name}\" ${name.includes('.') ? 'property' : 'argument'} `\n }\n msg += 'must be '\n const types = []\n const instances = []\n const other = []\n for (const value of expected) {\n assert(typeof value === 'string', 'All expected entries have to be of type string')\n if (kTypes.includes(value)) {\n types.push(value.toLowerCase())\n } else if (classRegExp.test(value)) {\n instances.push(value)\n } else {\n assert(value !== 'object', 'The value \"object\" should be written as \"Object\"')\n other.push(value)\n }\n }\n\n // Special handle `object` in case other instances are allowed to outline\n // the differences between each other.\n if (instances.length > 0) {\n const pos = types.indexOf('object')\n if (pos !== -1) {\n types.splice(types, pos, 1)\n instances.push('Object')\n }\n }\n if (types.length > 0) {\n switch (types.length) {\n case 1:\n msg += `of type ${types[0]}`\n break\n case 2:\n msg += `one of type ${types[0]} or ${types[1]}`\n break\n default: {\n const last = types.pop()\n msg += `one of type ${types.join(', ')}, or ${last}`\n }\n }\n if (instances.length > 0 || other.length > 0) {\n msg += ' or '\n }\n }\n if (instances.length > 0) {\n switch (instances.length) {\n case 1:\n msg += `an instance of ${instances[0]}`\n break\n case 2:\n msg += `an instance of ${instances[0]} or ${instances[1]}`\n break\n default: {\n const last = instances.pop()\n msg += `an instance of ${instances.join(', ')}, or ${last}`\n }\n }\n if (other.length > 0) {\n msg += ' or '\n }\n }\n switch (other.length) {\n case 0:\n break\n case 1:\n if (other[0].toLowerCase() !== other[0]) {\n msg += 'an '\n }\n msg += `${other[0]}`\n break\n case 2:\n msg += `one of ${other[0]} or ${other[1]}`\n break\n default: {\n const last = other.pop()\n msg += `one of ${other.join(', ')}, or ${last}`\n }\n }\n if (actual == null) {\n msg += `. Received ${actual}`\n } else if (typeof actual === 'function' && actual.name) {\n msg += `. Received function ${actual.name}`\n } else if (typeof actual === 'object') {\n var _actual$constructor\n if (\n (_actual$constructor = actual.constructor) !== null &&\n _actual$constructor !== undefined &&\n _actual$constructor.name\n ) {\n msg += `. Received an instance of ${actual.constructor.name}`\n } else {\n const inspected = inspect(actual, {\n depth: -1\n })\n msg += `. Received ${inspected}`\n }\n } else {\n let inspected = inspect(actual, {\n colors: false\n })\n if (inspected.length > 25) {\n inspected = `${inspected.slice(0, 25)}...`\n }\n msg += `. Received type ${typeof actual} (${inspected})`\n }\n return msg\n },\n TypeError\n)\nE(\n 'ERR_INVALID_ARG_VALUE',\n (name, value, reason = 'is invalid') => {\n let inspected = inspect(value)\n if (inspected.length > 128) {\n inspected = inspected.slice(0, 128) + '...'\n }\n const type = name.includes('.') ? 'property' : 'argument'\n return `The ${type} '${name}' ${reason}. Received ${inspected}`\n },\n TypeError\n)\nE(\n 'ERR_INVALID_RETURN_VALUE',\n (input, name, value) => {\n var _value$constructor\n const type =\n value !== null &&\n value !== undefined &&\n (_value$constructor = value.constructor) !== null &&\n _value$constructor !== undefined &&\n _value$constructor.name\n ? `instance of ${value.constructor.name}`\n : `type ${typeof value}`\n return `Expected ${input} to be returned from the \"${name}\"` + ` function but got ${type}.`\n },\n TypeError\n)\nE(\n 'ERR_MISSING_ARGS',\n (...args) => {\n assert(args.length > 0, 'At least one arg needs to be specified')\n let msg\n const len = args.length\n args = (Array.isArray(args) ? args : [args]).map((a) => `\"${a}\"`).join(' or ')\n switch (len) {\n case 1:\n msg += `The ${args[0]} argument`\n break\n case 2:\n msg += `The ${args[0]} and ${args[1]} arguments`\n break\n default:\n {\n const last = args.pop()\n msg += `The ${args.join(', ')}, and ${last} arguments`\n }\n break\n }\n return `${msg} must be specified`\n },\n TypeError\n)\nE(\n 'ERR_OUT_OF_RANGE',\n (str, range, input) => {\n assert(range, 'Missing \"range\" argument')\n let received\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > 2n ** 32n || input < -(2n ** 32n)) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n } else {\n received = inspect(input)\n }\n return `The value of \"${str}\" is out of range. It must be ${range}. Received ${received}`\n },\n RangeError\n)\nE('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error)\nE('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error)\nE('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error)\nE('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error)\nE('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error)\nE('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError)\nE('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error)\nE('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error)\nE('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error)\nE('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error)\nE('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError)\nmodule.exports = {\n AbortError,\n aggregateTwoErrors: hideStackFrames(aggregateTwoErrors),\n hideStackFrames,\n codes\n}\n","'use strict'\n\n/*\n This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at\n\n https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js\n\n Don't try to replace with the original file and keep it up to date with the upstream file.\n*/\nmodule.exports = {\n ArrayIsArray(self) {\n return Array.isArray(self)\n },\n ArrayPrototypeIncludes(self, el) {\n return self.includes(el)\n },\n ArrayPrototypeIndexOf(self, el) {\n return self.indexOf(el)\n },\n ArrayPrototypeJoin(self, sep) {\n return self.join(sep)\n },\n ArrayPrototypeMap(self, fn) {\n return self.map(fn)\n },\n ArrayPrototypePop(self, el) {\n return self.pop(el)\n },\n ArrayPrototypePush(self, el) {\n return self.push(el)\n },\n ArrayPrototypeSlice(self, start, end) {\n return self.slice(start, end)\n },\n Error,\n FunctionPrototypeCall(fn, thisArgs, ...args) {\n return fn.call(thisArgs, ...args)\n },\n FunctionPrototypeSymbolHasInstance(self, instance) {\n return Function.prototype[Symbol.hasInstance].call(self, instance)\n },\n MathFloor: Math.floor,\n Number,\n NumberIsInteger: Number.isInteger,\n NumberIsNaN: Number.isNaN,\n NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,\n NumberParseInt: Number.parseInt,\n ObjectDefineProperties(self, props) {\n return Object.defineProperties(self, props)\n },\n ObjectDefineProperty(self, name, prop) {\n return Object.defineProperty(self, name, prop)\n },\n ObjectGetOwnPropertyDescriptor(self, name) {\n return Object.getOwnPropertyDescriptor(self, name)\n },\n ObjectKeys(obj) {\n return Object.keys(obj)\n },\n ObjectSetPrototypeOf(target, proto) {\n return Object.setPrototypeOf(target, proto)\n },\n Promise,\n PromisePrototypeCatch(self, fn) {\n return self.catch(fn)\n },\n PromisePrototypeThen(self, thenFn, catchFn) {\n return self.then(thenFn, catchFn)\n },\n PromiseReject(err) {\n return Promise.reject(err)\n },\n PromiseResolve(val) {\n return Promise.resolve(val)\n },\n ReflectApply: Reflect.apply,\n RegExpPrototypeTest(self, value) {\n return self.test(value)\n },\n SafeSet: Set,\n String,\n StringPrototypeSlice(self, start, end) {\n return self.slice(start, end)\n },\n StringPrototypeToLowerCase(self) {\n return self.toLowerCase()\n },\n StringPrototypeToUpperCase(self) {\n return self.toUpperCase()\n },\n StringPrototypeTrim(self) {\n return self.trim()\n },\n Symbol,\n SymbolFor: Symbol.for,\n SymbolAsyncIterator: Symbol.asyncIterator,\n SymbolHasInstance: Symbol.hasInstance,\n SymbolIterator: Symbol.iterator,\n SymbolDispose: Symbol.dispose || Symbol('Symbol.dispose'),\n SymbolAsyncDispose: Symbol.asyncDispose || Symbol('Symbol.asyncDispose'),\n TypedArrayPrototypeSet(self, buf, len) {\n return self.set(buf, len)\n },\n Boolean: Boolean,\n Uint8Array\n}\n","'use strict'\n\nconst bufferModule = require('buffer')\nconst { kResistStopPropagation, SymbolDispose } = require('./primordials')\nconst AbortSignal = globalThis.AbortSignal || require('abort-controller').AbortSignal\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nconst AsyncFunction = Object.getPrototypeOf(async function () {}).constructor\nconst Blob = globalThis.Blob || bufferModule.Blob\n/* eslint-disable indent */\nconst isBlob =\n typeof Blob !== 'undefined'\n ? function isBlob(b) {\n // eslint-disable-next-line indent\n return b instanceof Blob\n }\n : function isBlob(b) {\n return false\n }\n/* eslint-enable indent */\n\nconst validateAbortSignal = (signal, name) => {\n if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal)\n }\n}\nconst validateFunction = (value, name) => {\n if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value)\n}\n\n// This is a simplified version of AggregateError\nclass AggregateError extends Error {\n constructor(errors) {\n if (!Array.isArray(errors)) {\n throw new TypeError(`Expected input to be an Array, got ${typeof errors}`)\n }\n let message = ''\n for (let i = 0; i < errors.length; i++) {\n message += ` ${errors[i].stack}\\n`\n }\n super(message)\n this.name = 'AggregateError'\n this.errors = errors\n }\n}\nmodule.exports = {\n AggregateError,\n kEmptyObject: Object.freeze({}),\n once(callback) {\n let called = false\n return function (...args) {\n if (called) {\n return\n }\n called = true\n callback.apply(this, args)\n }\n },\n createDeferredPromise: function () {\n let resolve\n let reject\n\n // eslint-disable-next-line promise/param-names\n const promise = new Promise((res, rej) => {\n resolve = res\n reject = rej\n })\n return {\n promise,\n resolve,\n reject\n }\n },\n promisify(fn) {\n return new Promise((resolve, reject) => {\n fn((err, ...args) => {\n if (err) {\n return reject(err)\n }\n return resolve(...args)\n })\n })\n },\n debuglog() {\n return function () {}\n },\n format(format, ...args) {\n // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args\n return format.replace(/%([sdifj])/g, function (...[_unused, type]) {\n const replacement = args.shift()\n if (type === 'f') {\n return replacement.toFixed(6)\n } else if (type === 'j') {\n return JSON.stringify(replacement)\n } else if (type === 's' && typeof replacement === 'object') {\n const ctor = replacement.constructor !== Object ? replacement.constructor.name : ''\n return `${ctor} {}`.trim()\n } else {\n return replacement.toString()\n }\n })\n },\n inspect(value) {\n // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options\n switch (typeof value) {\n case 'string':\n if (value.includes(\"'\")) {\n if (!value.includes('\"')) {\n return `\"${value}\"`\n } else if (!value.includes('`') && !value.includes('${')) {\n return `\\`${value}\\``\n }\n }\n return `'${value}'`\n case 'number':\n if (isNaN(value)) {\n return 'NaN'\n } else if (Object.is(value, -0)) {\n return String(value)\n }\n return value\n case 'bigint':\n return `${String(value)}n`\n case 'boolean':\n case 'undefined':\n return String(value)\n case 'object':\n return '{}'\n }\n },\n types: {\n isAsyncFunction(fn) {\n return fn instanceof AsyncFunction\n },\n isArrayBufferView(arr) {\n return ArrayBuffer.isView(arr)\n }\n },\n isBlob,\n deprecate(fn, message) {\n return fn\n },\n addAbortListener:\n require('events').addAbortListener ||\n function addAbortListener(signal, listener) {\n if (signal === undefined) {\n throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal)\n }\n validateAbortSignal(signal, 'signal')\n validateFunction(listener, 'listener')\n let removeEventListener\n if (signal.aborted) {\n queueMicrotask(() => listener())\n } else {\n signal.addEventListener('abort', listener, {\n __proto__: null,\n once: true,\n [kResistStopPropagation]: true\n })\n removeEventListener = () => {\n signal.removeEventListener('abort', listener)\n }\n }\n return {\n __proto__: null,\n [SymbolDispose]() {\n var _removeEventListener\n ;(_removeEventListener = removeEventListener) === null || _removeEventListener === undefined\n ? undefined\n : _removeEventListener()\n }\n }\n },\n AbortSignalAny:\n AbortSignal.any ||\n function AbortSignalAny(signals) {\n // Fast path if there is only one signal.\n if (signals.length === 1) {\n return signals[0]\n }\n const ac = new AbortController()\n const abort = () => ac.abort()\n signals.forEach((signal) => {\n validateAbortSignal(signal, 'signals')\n signal.addEventListener('abort', abort, {\n once: true\n })\n })\n ac.signal.addEventListener(\n 'abort',\n () => {\n signals.forEach((signal) => signal.removeEventListener('abort', abort))\n },\n {\n once: true\n }\n )\n return ac.signal\n }\n}\nmodule.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom')\n","/* replacement start */\n\nconst { Buffer } = require('buffer')\n\n/* replacement end */\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n;('use strict')\nconst { ObjectDefineProperty, ObjectKeys, ReflectApply } = require('./ours/primordials')\nconst {\n promisify: { custom: customPromisify }\n} = require('./ours/util')\nconst { streamReturningOperators, promiseReturningOperators } = require('./internal/streams/operators')\nconst {\n codes: { ERR_ILLEGAL_CONSTRUCTOR }\n} = require('./ours/errors')\nconst compose = require('./internal/streams/compose')\nconst { setDefaultHighWaterMark, getDefaultHighWaterMark } = require('./internal/streams/state')\nconst { pipeline } = require('./internal/streams/pipeline')\nconst { destroyer } = require('./internal/streams/destroy')\nconst eos = require('./internal/streams/end-of-stream')\nconst internalBuffer = {}\nconst promises = require('./stream/promises')\nconst utils = require('./internal/streams/utils')\nconst Stream = (module.exports = require('./internal/streams/legacy').Stream)\nStream.isDestroyed = utils.isDestroyed\nStream.isDisturbed = utils.isDisturbed\nStream.isErrored = utils.isErrored\nStream.isReadable = utils.isReadable\nStream.isWritable = utils.isWritable\nStream.Readable = require('./internal/streams/readable')\nfor (const key of ObjectKeys(streamReturningOperators)) {\n const op = streamReturningOperators[key]\n function fn(...args) {\n if (new.target) {\n throw ERR_ILLEGAL_CONSTRUCTOR()\n }\n return Stream.Readable.from(ReflectApply(op, this, args))\n }\n ObjectDefineProperty(fn, 'name', {\n __proto__: null,\n value: op.name\n })\n ObjectDefineProperty(fn, 'length', {\n __proto__: null,\n value: op.length\n })\n ObjectDefineProperty(Stream.Readable.prototype, key, {\n __proto__: null,\n value: fn,\n enumerable: false,\n configurable: true,\n writable: true\n })\n}\nfor (const key of ObjectKeys(promiseReturningOperators)) {\n const op = promiseReturningOperators[key]\n function fn(...args) {\n if (new.target) {\n throw ERR_ILLEGAL_CONSTRUCTOR()\n }\n return ReflectApply(op, this, args)\n }\n ObjectDefineProperty(fn, 'name', {\n __proto__: null,\n value: op.name\n })\n ObjectDefineProperty(fn, 'length', {\n __proto__: null,\n value: op.length\n })\n ObjectDefineProperty(Stream.Readable.prototype, key, {\n __proto__: null,\n value: fn,\n enumerable: false,\n configurable: true,\n writable: true\n })\n}\nStream.Writable = require('./internal/streams/writable')\nStream.Duplex = require('./internal/streams/duplex')\nStream.Transform = require('./internal/streams/transform')\nStream.PassThrough = require('./internal/streams/passthrough')\nStream.pipeline = pipeline\nconst { addAbortSignal } = require('./internal/streams/add-abort-signal')\nStream.addAbortSignal = addAbortSignal\nStream.finished = eos\nStream.destroy = destroyer\nStream.compose = compose\nStream.setDefaultHighWaterMark = setDefaultHighWaterMark\nStream.getDefaultHighWaterMark = getDefaultHighWaterMark\nObjectDefineProperty(Stream, 'promises', {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() {\n return promises\n }\n})\nObjectDefineProperty(pipeline, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n return promises.pipeline\n }\n})\nObjectDefineProperty(eos, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n return promises.finished\n }\n})\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream\nStream._isUint8Array = function isUint8Array(value) {\n return value instanceof Uint8Array\n}\nStream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)\n}\n","'use strict'\n\nconst { ArrayPrototypePop, Promise } = require('../ours/primordials')\nconst { isIterable, isNodeStream, isWebStream } = require('../internal/streams/utils')\nconst { pipelineImpl: pl } = require('../internal/streams/pipeline')\nconst { finished } = require('../internal/streams/end-of-stream')\nrequire('../../lib/stream.js')\nfunction pipeline(...streams) {\n return new Promise((resolve, reject) => {\n let signal\n let end\n const lastArg = streams[streams.length - 1]\n if (\n lastArg &&\n typeof lastArg === 'object' &&\n !isNodeStream(lastArg) &&\n !isIterable(lastArg) &&\n !isWebStream(lastArg)\n ) {\n const options = ArrayPrototypePop(streams)\n signal = options.signal\n end = options.end\n }\n pl(\n streams,\n (err, value) => {\n if (err) {\n reject(err)\n } else {\n resolve(value)\n }\n },\n {\n signal,\n end\n }\n )\n })\n}\nmodule.exports = {\n finished,\n pipeline\n}\n","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","'use strict'\n\nconst { SymbolDispose } = require('../../ours/primordials')\nconst { AbortError, codes } = require('../../ours/errors')\nconst { isNodeStream, isWebStream, kControllerErrorFunction } = require('./utils')\nconst eos = require('./end-of-stream')\nconst { ERR_INVALID_ARG_TYPE } = codes\nlet addAbortListener\n\n// This method is inlined here for readable-stream\n// It also does not allow for signal to not exist on the stream\n// https://github.com/nodejs/node/pull/36061#discussion_r533718029\nconst validateAbortSignal = (signal, name) => {\n if (typeof signal !== 'object' || !('aborted' in signal)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal)\n }\n}\nmodule.exports.addAbortSignal = function addAbortSignal(signal, stream) {\n validateAbortSignal(signal, 'signal')\n if (!isNodeStream(stream) && !isWebStream(stream)) {\n throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream)\n }\n return module.exports.addAbortSignalNoValidate(signal, stream)\n}\nmodule.exports.addAbortSignalNoValidate = function (signal, stream) {\n if (typeof signal !== 'object' || !('aborted' in signal)) {\n return stream\n }\n const onAbort = isNodeStream(stream)\n ? () => {\n stream.destroy(\n new AbortError(undefined, {\n cause: signal.reason\n })\n )\n }\n : () => {\n stream[kControllerErrorFunction](\n new AbortError(undefined, {\n cause: signal.reason\n })\n )\n }\n if (signal.aborted) {\n onAbort()\n } else {\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n const disposable = addAbortListener(signal, onAbort)\n eos(stream, disposable[SymbolDispose])\n }\n return stream\n}\n","'use strict'\n\nconst { StringPrototypeSlice, SymbolIterator, TypedArrayPrototypeSet, Uint8Array } = require('../../ours/primordials')\nconst { Buffer } = require('buffer')\nconst { inspect } = require('../../ours/util')\nmodule.exports = class BufferList {\n constructor() {\n this.head = null\n this.tail = null\n this.length = 0\n }\n push(v) {\n const entry = {\n data: v,\n next: null\n }\n if (this.length > 0) this.tail.next = entry\n else this.head = entry\n this.tail = entry\n ++this.length\n }\n unshift(v) {\n const entry = {\n data: v,\n next: this.head\n }\n if (this.length === 0) this.tail = entry\n this.head = entry\n ++this.length\n }\n shift() {\n if (this.length === 0) return\n const ret = this.head.data\n if (this.length === 1) this.head = this.tail = null\n else this.head = this.head.next\n --this.length\n return ret\n }\n clear() {\n this.head = this.tail = null\n this.length = 0\n }\n join(s) {\n if (this.length === 0) return ''\n let p = this.head\n let ret = '' + p.data\n while ((p = p.next) !== null) ret += s + p.data\n return ret\n }\n concat(n) {\n if (this.length === 0) return Buffer.alloc(0)\n const ret = Buffer.allocUnsafe(n >>> 0)\n let p = this.head\n let i = 0\n while (p) {\n TypedArrayPrototypeSet(ret, p.data, i)\n i += p.data.length\n p = p.next\n }\n return ret\n }\n\n // Consumes a specified amount of bytes or characters from the buffered data.\n consume(n, hasStrings) {\n const data = this.head.data\n if (n < data.length) {\n // `slice` is the same for buffers and strings.\n const slice = data.slice(0, n)\n this.head.data = data.slice(n)\n return slice\n }\n if (n === data.length) {\n // First chunk is a perfect match.\n return this.shift()\n }\n // Result spans more than one buffer.\n return hasStrings ? this._getString(n) : this._getBuffer(n)\n }\n first() {\n return this.head.data\n }\n *[SymbolIterator]() {\n for (let p = this.head; p; p = p.next) {\n yield p.data\n }\n }\n\n // Consumes a specified amount of characters from the buffered data.\n _getString(n) {\n let ret = ''\n let p = this.head\n let c = 0\n do {\n const str = p.data\n if (n > str.length) {\n ret += str\n n -= str.length\n } else {\n if (n === str.length) {\n ret += str\n ++c\n if (p.next) this.head = p.next\n else this.head = this.tail = null\n } else {\n ret += StringPrototypeSlice(str, 0, n)\n this.head = p\n p.data = StringPrototypeSlice(str, n)\n }\n break\n }\n ++c\n } while ((p = p.next) !== null)\n this.length -= c\n return ret\n }\n\n // Consumes a specified amount of bytes from the buffered data.\n _getBuffer(n) {\n const ret = Buffer.allocUnsafe(n)\n const retLen = n\n let p = this.head\n let c = 0\n do {\n const buf = p.data\n if (n > buf.length) {\n TypedArrayPrototypeSet(ret, buf, retLen - n)\n n -= buf.length\n } else {\n if (n === buf.length) {\n TypedArrayPrototypeSet(ret, buf, retLen - n)\n ++c\n if (p.next) this.head = p.next\n else this.head = this.tail = null\n } else {\n TypedArrayPrototypeSet(ret, new Uint8Array(buf.buffer, buf.byteOffset, n), retLen - n)\n this.head = p\n p.data = buf.slice(n)\n }\n break\n }\n ++c\n } while ((p = p.next) !== null)\n this.length -= c\n return ret\n }\n\n // Make sure the linked list only shows the minimal necessary information.\n [Symbol.for('nodejs.util.inspect.custom')](_, options) {\n return inspect(this, {\n ...options,\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n })\n }\n}\n","'use strict'\n\nconst { pipeline } = require('./pipeline')\nconst Duplex = require('./duplex')\nconst { destroyer } = require('./destroy')\nconst {\n isNodeStream,\n isReadable,\n isWritable,\n isWebStream,\n isTransformStream,\n isWritableStream,\n isReadableStream\n} = require('./utils')\nconst {\n AbortError,\n codes: { ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS }\n} = require('../../ours/errors')\nconst eos = require('./end-of-stream')\nmodule.exports = function compose(...streams) {\n if (streams.length === 0) {\n throw new ERR_MISSING_ARGS('streams')\n }\n if (streams.length === 1) {\n return Duplex.from(streams[0])\n }\n const orgStreams = [...streams]\n if (typeof streams[0] === 'function') {\n streams[0] = Duplex.from(streams[0])\n }\n if (typeof streams[streams.length - 1] === 'function') {\n const idx = streams.length - 1\n streams[idx] = Duplex.from(streams[idx])\n }\n for (let n = 0; n < streams.length; ++n) {\n if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) {\n // TODO(ronag): Add checks for non streams.\n continue\n }\n if (\n n < streams.length - 1 &&\n !(isReadable(streams[n]) || isReadableStream(streams[n]) || isTransformStream(streams[n]))\n ) {\n throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be readable')\n }\n if (n > 0 && !(isWritable(streams[n]) || isWritableStream(streams[n]) || isTransformStream(streams[n]))) {\n throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], 'must be writable')\n }\n }\n let ondrain\n let onfinish\n let onreadable\n let onclose\n let d\n function onfinished(err) {\n const cb = onclose\n onclose = null\n if (cb) {\n cb(err)\n } else if (err) {\n d.destroy(err)\n } else if (!readable && !writable) {\n d.destroy()\n }\n }\n const head = streams[0]\n const tail = pipeline(streams, onfinished)\n const writable = !!(isWritable(head) || isWritableStream(head) || isTransformStream(head))\n const readable = !!(isReadable(tail) || isReadableStream(tail) || isTransformStream(tail))\n\n // TODO(ronag): Avoid double buffering.\n // Implement Writable/Readable/Duplex traits.\n // See, https://github.com/nodejs/node/pull/33515.\n d = new Duplex({\n // TODO (ronag): highWaterMark?\n writableObjectMode: !!(head !== null && head !== undefined && head.writableObjectMode),\n readableObjectMode: !!(tail !== null && tail !== undefined && tail.readableObjectMode),\n writable,\n readable\n })\n if (writable) {\n if (isNodeStream(head)) {\n d._write = function (chunk, encoding, callback) {\n if (head.write(chunk, encoding)) {\n callback()\n } else {\n ondrain = callback\n }\n }\n d._final = function (callback) {\n head.end()\n onfinish = callback\n }\n head.on('drain', function () {\n if (ondrain) {\n const cb = ondrain\n ondrain = null\n cb()\n }\n })\n } else if (isWebStream(head)) {\n const writable = isTransformStream(head) ? head.writable : head\n const writer = writable.getWriter()\n d._write = async function (chunk, encoding, callback) {\n try {\n await writer.ready\n writer.write(chunk).catch(() => {})\n callback()\n } catch (err) {\n callback(err)\n }\n }\n d._final = async function (callback) {\n try {\n await writer.ready\n writer.close().catch(() => {})\n onfinish = callback\n } catch (err) {\n callback(err)\n }\n }\n }\n const toRead = isTransformStream(tail) ? tail.readable : tail\n eos(toRead, () => {\n if (onfinish) {\n const cb = onfinish\n onfinish = null\n cb()\n }\n })\n }\n if (readable) {\n if (isNodeStream(tail)) {\n tail.on('readable', function () {\n if (onreadable) {\n const cb = onreadable\n onreadable = null\n cb()\n }\n })\n tail.on('end', function () {\n d.push(null)\n })\n d._read = function () {\n while (true) {\n const buf = tail.read()\n if (buf === null) {\n onreadable = d._read\n return\n }\n if (!d.push(buf)) {\n return\n }\n }\n }\n } else if (isWebStream(tail)) {\n const readable = isTransformStream(tail) ? tail.readable : tail\n const reader = readable.getReader()\n d._read = async function () {\n while (true) {\n try {\n const { value, done } = await reader.read()\n if (!d.push(value)) {\n return\n }\n if (done) {\n d.push(null)\n return\n }\n } catch {\n return\n }\n }\n }\n }\n }\n d._destroy = function (err, callback) {\n if (!err && onclose !== null) {\n err = new AbortError()\n }\n onreadable = null\n ondrain = null\n onfinish = null\n if (onclose === null) {\n callback(err)\n } else {\n onclose = callback\n if (isNodeStream(tail)) {\n destroyer(tail, err)\n }\n }\n }\n return d\n}\n","'use strict'\n\n/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n\nconst {\n aggregateTwoErrors,\n codes: { ERR_MULTIPLE_CALLBACK },\n AbortError\n} = require('../../ours/errors')\nconst { Symbol } = require('../../ours/primordials')\nconst { kIsDestroyed, isDestroyed, isFinished, isServerRequest } = require('./utils')\nconst kDestroy = Symbol('kDestroy')\nconst kConstruct = Symbol('kConstruct')\nfunction checkError(err, w, r) {\n if (err) {\n // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364\n err.stack // eslint-disable-line no-unused-expressions\n\n if (w && !w.errored) {\n w.errored = err\n }\n if (r && !r.errored) {\n r.errored = err\n }\n }\n}\n\n// Backwards compat. cb() is undocumented and unused in core but\n// unfortunately might be used by modules.\nfunction destroy(err, cb) {\n const r = this._readableState\n const w = this._writableState\n // With duplex streams we use the writable side for state.\n const s = w || r\n if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) {\n if (typeof cb === 'function') {\n cb()\n }\n return this\n }\n\n // We set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n checkError(err, w, r)\n if (w) {\n w.destroyed = true\n }\n if (r) {\n r.destroyed = true\n }\n\n // If still constructing then defer calling _destroy.\n if (!s.constructed) {\n this.once(kDestroy, function (er) {\n _destroy(this, aggregateTwoErrors(er, err), cb)\n })\n } else {\n _destroy(this, err, cb)\n }\n return this\n}\nfunction _destroy(self, err, cb) {\n let called = false\n function onDestroy(err) {\n if (called) {\n return\n }\n called = true\n const r = self._readableState\n const w = self._writableState\n checkError(err, w, r)\n if (w) {\n w.closed = true\n }\n if (r) {\n r.closed = true\n }\n if (typeof cb === 'function') {\n cb(err)\n }\n if (err) {\n process.nextTick(emitErrorCloseNT, self, err)\n } else {\n process.nextTick(emitCloseNT, self)\n }\n }\n try {\n self._destroy(err || null, onDestroy)\n } catch (err) {\n onDestroy(err)\n }\n}\nfunction emitErrorCloseNT(self, err) {\n emitErrorNT(self, err)\n emitCloseNT(self)\n}\nfunction emitCloseNT(self) {\n const r = self._readableState\n const w = self._writableState\n if (w) {\n w.closeEmitted = true\n }\n if (r) {\n r.closeEmitted = true\n }\n if ((w !== null && w !== undefined && w.emitClose) || (r !== null && r !== undefined && r.emitClose)) {\n self.emit('close')\n }\n}\nfunction emitErrorNT(self, err) {\n const r = self._readableState\n const w = self._writableState\n if ((w !== null && w !== undefined && w.errorEmitted) || (r !== null && r !== undefined && r.errorEmitted)) {\n return\n }\n if (w) {\n w.errorEmitted = true\n }\n if (r) {\n r.errorEmitted = true\n }\n self.emit('error', err)\n}\nfunction undestroy() {\n const r = this._readableState\n const w = this._writableState\n if (r) {\n r.constructed = true\n r.closed = false\n r.closeEmitted = false\n r.destroyed = false\n r.errored = null\n r.errorEmitted = false\n r.reading = false\n r.ended = r.readable === false\n r.endEmitted = r.readable === false\n }\n if (w) {\n w.constructed = true\n w.destroyed = false\n w.closed = false\n w.closeEmitted = false\n w.errored = null\n w.errorEmitted = false\n w.finalCalled = false\n w.prefinished = false\n w.ended = w.writable === false\n w.ending = w.writable === false\n w.finished = w.writable === false\n }\n}\nfunction errorOrDestroy(stream, err, sync) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n\n const r = stream._readableState\n const w = stream._writableState\n if ((w !== null && w !== undefined && w.destroyed) || (r !== null && r !== undefined && r.destroyed)) {\n return this\n }\n if ((r !== null && r !== undefined && r.autoDestroy) || (w !== null && w !== undefined && w.autoDestroy))\n stream.destroy(err)\n else if (err) {\n // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364\n err.stack // eslint-disable-line no-unused-expressions\n\n if (w && !w.errored) {\n w.errored = err\n }\n if (r && !r.errored) {\n r.errored = err\n }\n if (sync) {\n process.nextTick(emitErrorNT, stream, err)\n } else {\n emitErrorNT(stream, err)\n }\n }\n}\nfunction construct(stream, cb) {\n if (typeof stream._construct !== 'function') {\n return\n }\n const r = stream._readableState\n const w = stream._writableState\n if (r) {\n r.constructed = false\n }\n if (w) {\n w.constructed = false\n }\n stream.once(kConstruct, cb)\n if (stream.listenerCount(kConstruct) > 1) {\n // Duplex\n return\n }\n process.nextTick(constructNT, stream)\n}\nfunction constructNT(stream) {\n let called = false\n function onConstruct(err) {\n if (called) {\n errorOrDestroy(stream, err !== null && err !== undefined ? err : new ERR_MULTIPLE_CALLBACK())\n return\n }\n called = true\n const r = stream._readableState\n const w = stream._writableState\n const s = w || r\n if (r) {\n r.constructed = true\n }\n if (w) {\n w.constructed = true\n }\n if (s.destroyed) {\n stream.emit(kDestroy, err)\n } else if (err) {\n errorOrDestroy(stream, err, true)\n } else {\n process.nextTick(emitConstructNT, stream)\n }\n }\n try {\n stream._construct((err) => {\n process.nextTick(onConstruct, err)\n })\n } catch (err) {\n process.nextTick(onConstruct, err)\n }\n}\nfunction emitConstructNT(stream) {\n stream.emit(kConstruct)\n}\nfunction isRequest(stream) {\n return (stream === null || stream === undefined ? undefined : stream.setHeader) && typeof stream.abort === 'function'\n}\nfunction emitCloseLegacy(stream) {\n stream.emit('close')\n}\nfunction emitErrorCloseLegacy(stream, err) {\n stream.emit('error', err)\n process.nextTick(emitCloseLegacy, stream)\n}\n\n// Normalize destroy for legacy.\nfunction destroyer(stream, err) {\n if (!stream || isDestroyed(stream)) {\n return\n }\n if (!err && !isFinished(stream)) {\n err = new AbortError()\n }\n\n // TODO: Remove isRequest branches.\n if (isServerRequest(stream)) {\n stream.socket = null\n stream.destroy(err)\n } else if (isRequest(stream)) {\n stream.abort()\n } else if (isRequest(stream.req)) {\n stream.req.abort()\n } else if (typeof stream.destroy === 'function') {\n stream.destroy(err)\n } else if (typeof stream.close === 'function') {\n // TODO: Don't lose err?\n stream.close()\n } else if (err) {\n process.nextTick(emitErrorCloseLegacy, stream, err)\n } else {\n process.nextTick(emitCloseLegacy, stream)\n }\n if (!stream.destroyed) {\n stream[kIsDestroyed] = true\n }\n}\nmodule.exports = {\n construct,\n destroyer,\n destroy,\n undestroy,\n errorOrDestroy\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototype inheritance, this class\n// prototypically inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict'\n\nconst {\n ObjectDefineProperties,\n ObjectGetOwnPropertyDescriptor,\n ObjectKeys,\n ObjectSetPrototypeOf\n} = require('../../ours/primordials')\nmodule.exports = Duplex\nconst Readable = require('./readable')\nconst Writable = require('./writable')\nObjectSetPrototypeOf(Duplex.prototype, Readable.prototype)\nObjectSetPrototypeOf(Duplex, Readable)\n{\n const keys = ObjectKeys(Writable.prototype)\n // Allow the keys array to be GC'ed.\n for (let i = 0; i < keys.length; i++) {\n const method = keys[i]\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]\n }\n}\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options)\n Readable.call(this, options)\n Writable.call(this, options)\n if (options) {\n this.allowHalfOpen = options.allowHalfOpen !== false\n if (options.readable === false) {\n this._readableState.readable = false\n this._readableState.ended = true\n this._readableState.endEmitted = true\n }\n if (options.writable === false) {\n this._writableState.writable = false\n this._writableState.ending = true\n this._writableState.ended = true\n this._writableState.finished = true\n }\n } else {\n this.allowHalfOpen = true\n }\n}\nObjectDefineProperties(Duplex.prototype, {\n writable: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writable')\n },\n writableHighWaterMark: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableHighWaterMark')\n },\n writableObjectMode: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableObjectMode')\n },\n writableBuffer: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableBuffer')\n },\n writableLength: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableLength')\n },\n writableFinished: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableFinished')\n },\n writableCorked: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableCorked')\n },\n writableEnded: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableEnded')\n },\n writableNeedDrain: {\n __proto__: null,\n ...ObjectGetOwnPropertyDescriptor(Writable.prototype, 'writableNeedDrain')\n },\n destroyed: {\n __proto__: null,\n get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false\n }\n return this._readableState.destroyed && this._writableState.destroyed\n },\n set(value) {\n // Backward compatibility, the user is explicitly\n // managing destroyed.\n if (this._readableState && this._writableState) {\n this._readableState.destroyed = value\n this._writableState.destroyed = value\n }\n }\n }\n})\nlet webStreamsAdapters\n\n// Lazy to avoid circular references\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined) webStreamsAdapters = {}\n return webStreamsAdapters\n}\nDuplex.fromWeb = function (pair, options) {\n return lazyWebStreams().newStreamDuplexFromReadableWritablePair(pair, options)\n}\nDuplex.toWeb = function (duplex) {\n return lazyWebStreams().newReadableWritablePairFromDuplex(duplex)\n}\nlet duplexify\nDuplex.from = function (body) {\n if (!duplexify) {\n duplexify = require('./duplexify')\n }\n return duplexify(body, 'body')\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n\n;('use strict')\nconst bufferModule = require('buffer')\nconst {\n isReadable,\n isWritable,\n isIterable,\n isNodeStream,\n isReadableNodeStream,\n isWritableNodeStream,\n isDuplexNodeStream,\n isReadableStream,\n isWritableStream\n} = require('./utils')\nconst eos = require('./end-of-stream')\nconst {\n AbortError,\n codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE }\n} = require('../../ours/errors')\nconst { destroyer } = require('./destroy')\nconst Duplex = require('./duplex')\nconst Readable = require('./readable')\nconst Writable = require('./writable')\nconst { createDeferredPromise } = require('../../ours/util')\nconst from = require('./from')\nconst Blob = globalThis.Blob || bufferModule.Blob\nconst isBlob =\n typeof Blob !== 'undefined'\n ? function isBlob(b) {\n return b instanceof Blob\n }\n : function isBlob(b) {\n return false\n }\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nconst { FunctionPrototypeCall } = require('../../ours/primordials')\n\n// This is needed for pre node 17.\nclass Duplexify extends Duplex {\n constructor(options) {\n super(options)\n\n // https://github.com/nodejs/node/pull/34385\n\n if ((options === null || options === undefined ? undefined : options.readable) === false) {\n this._readableState.readable = false\n this._readableState.ended = true\n this._readableState.endEmitted = true\n }\n if ((options === null || options === undefined ? undefined : options.writable) === false) {\n this._writableState.writable = false\n this._writableState.ending = true\n this._writableState.ended = true\n this._writableState.finished = true\n }\n }\n}\nmodule.exports = function duplexify(body, name) {\n if (isDuplexNodeStream(body)) {\n return body\n }\n if (isReadableNodeStream(body)) {\n return _duplexify({\n readable: body\n })\n }\n if (isWritableNodeStream(body)) {\n return _duplexify({\n writable: body\n })\n }\n if (isNodeStream(body)) {\n return _duplexify({\n writable: false,\n readable: false\n })\n }\n if (isReadableStream(body)) {\n return _duplexify({\n readable: Readable.fromWeb(body)\n })\n }\n if (isWritableStream(body)) {\n return _duplexify({\n writable: Writable.fromWeb(body)\n })\n }\n if (typeof body === 'function') {\n const { value, write, final, destroy } = fromAsyncGen(body)\n if (isIterable(value)) {\n return from(Duplexify, value, {\n // TODO (ronag): highWaterMark?\n objectMode: true,\n write,\n final,\n destroy\n })\n }\n const then = value === null || value === undefined ? undefined : value.then\n if (typeof then === 'function') {\n let d\n const promise = FunctionPrototypeCall(\n then,\n value,\n (val) => {\n if (val != null) {\n throw new ERR_INVALID_RETURN_VALUE('nully', 'body', val)\n }\n },\n (err) => {\n destroyer(d, err)\n }\n )\n return (d = new Duplexify({\n // TODO (ronag): highWaterMark?\n objectMode: true,\n readable: false,\n write,\n final(cb) {\n final(async () => {\n try {\n await promise\n process.nextTick(cb, null)\n } catch (err) {\n process.nextTick(cb, err)\n }\n })\n },\n destroy\n }))\n }\n throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or AsyncFunction', name, value)\n }\n if (isBlob(body)) {\n return duplexify(body.arrayBuffer())\n }\n if (isIterable(body)) {\n return from(Duplexify, body, {\n // TODO (ronag): highWaterMark?\n objectMode: true,\n writable: false\n })\n }\n if (\n isReadableStream(body === null || body === undefined ? undefined : body.readable) &&\n isWritableStream(body === null || body === undefined ? undefined : body.writable)\n ) {\n return Duplexify.fromWeb(body)\n }\n if (\n typeof (body === null || body === undefined ? undefined : body.writable) === 'object' ||\n typeof (body === null || body === undefined ? undefined : body.readable) === 'object'\n ) {\n const readable =\n body !== null && body !== undefined && body.readable\n ? isReadableNodeStream(body === null || body === undefined ? undefined : body.readable)\n ? body === null || body === undefined\n ? undefined\n : body.readable\n : duplexify(body.readable)\n : undefined\n const writable =\n body !== null && body !== undefined && body.writable\n ? isWritableNodeStream(body === null || body === undefined ? undefined : body.writable)\n ? body === null || body === undefined\n ? undefined\n : body.writable\n : duplexify(body.writable)\n : undefined\n return _duplexify({\n readable,\n writable\n })\n }\n const then = body === null || body === undefined ? undefined : body.then\n if (typeof then === 'function') {\n let d\n FunctionPrototypeCall(\n then,\n body,\n (val) => {\n if (val != null) {\n d.push(val)\n }\n d.push(null)\n },\n (err) => {\n destroyer(d, err)\n }\n )\n return (d = new Duplexify({\n objectMode: true,\n writable: false,\n read() {}\n }))\n }\n throw new ERR_INVALID_ARG_TYPE(\n name,\n [\n 'Blob',\n 'ReadableStream',\n 'WritableStream',\n 'Stream',\n 'Iterable',\n 'AsyncIterable',\n 'Function',\n '{ readable, writable } pair',\n 'Promise'\n ],\n body\n )\n}\nfunction fromAsyncGen(fn) {\n let { promise, resolve } = createDeferredPromise()\n const ac = new AbortController()\n const signal = ac.signal\n const value = fn(\n (async function* () {\n while (true) {\n const _promise = promise\n promise = null\n const { chunk, done, cb } = await _promise\n process.nextTick(cb)\n if (done) return\n if (signal.aborted)\n throw new AbortError(undefined, {\n cause: signal.reason\n })\n ;({ promise, resolve } = createDeferredPromise())\n yield chunk\n }\n })(),\n {\n signal\n }\n )\n return {\n value,\n write(chunk, encoding, cb) {\n const _resolve = resolve\n resolve = null\n _resolve({\n chunk,\n done: false,\n cb\n })\n },\n final(cb) {\n const _resolve = resolve\n resolve = null\n _resolve({\n done: true,\n cb\n })\n },\n destroy(err, cb) {\n ac.abort()\n cb(err)\n }\n }\n}\nfunction _duplexify(pair) {\n const r = pair.readable && typeof pair.readable.read !== 'function' ? Readable.wrap(pair.readable) : pair.readable\n const w = pair.writable\n let readable = !!isReadable(r)\n let writable = !!isWritable(w)\n let ondrain\n let onfinish\n let onreadable\n let onclose\n let d\n function onfinished(err) {\n const cb = onclose\n onclose = null\n if (cb) {\n cb(err)\n } else if (err) {\n d.destroy(err)\n }\n }\n\n // TODO(ronag): Avoid double buffering.\n // Implement Writable/Readable/Duplex traits.\n // See, https://github.com/nodejs/node/pull/33515.\n d = new Duplexify({\n // TODO (ronag): highWaterMark?\n readableObjectMode: !!(r !== null && r !== undefined && r.readableObjectMode),\n writableObjectMode: !!(w !== null && w !== undefined && w.writableObjectMode),\n readable,\n writable\n })\n if (writable) {\n eos(w, (err) => {\n writable = false\n if (err) {\n destroyer(r, err)\n }\n onfinished(err)\n })\n d._write = function (chunk, encoding, callback) {\n if (w.write(chunk, encoding)) {\n callback()\n } else {\n ondrain = callback\n }\n }\n d._final = function (callback) {\n w.end()\n onfinish = callback\n }\n w.on('drain', function () {\n if (ondrain) {\n const cb = ondrain\n ondrain = null\n cb()\n }\n })\n w.on('finish', function () {\n if (onfinish) {\n const cb = onfinish\n onfinish = null\n cb()\n }\n })\n }\n if (readable) {\n eos(r, (err) => {\n readable = false\n if (err) {\n destroyer(r, err)\n }\n onfinished(err)\n })\n r.on('readable', function () {\n if (onreadable) {\n const cb = onreadable\n onreadable = null\n cb()\n }\n })\n r.on('end', function () {\n d.push(null)\n })\n d._read = function () {\n while (true) {\n const buf = r.read()\n if (buf === null) {\n onreadable = d._read\n return\n }\n if (!d.push(buf)) {\n return\n }\n }\n }\n }\n d._destroy = function (err, callback) {\n if (!err && onclose !== null) {\n err = new AbortError()\n }\n onreadable = null\n ondrain = null\n onfinish = null\n if (onclose === null) {\n callback(err)\n } else {\n onclose = callback\n destroyer(w, err)\n destroyer(r, err)\n }\n }\n return d\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n\n;('use strict')\nconst { AbortError, codes } = require('../../ours/errors')\nconst { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes\nconst { kEmptyObject, once } = require('../../ours/util')\nconst { validateAbortSignal, validateFunction, validateObject, validateBoolean } = require('../validators')\nconst { Promise, PromisePrototypeThen, SymbolDispose } = require('../../ours/primordials')\nconst {\n isClosed,\n isReadable,\n isReadableNodeStream,\n isReadableStream,\n isReadableFinished,\n isReadableErrored,\n isWritable,\n isWritableNodeStream,\n isWritableStream,\n isWritableFinished,\n isWritableErrored,\n isNodeStream,\n willEmitClose: _willEmitClose,\n kIsClosedPromise\n} = require('./utils')\nlet addAbortListener\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function'\n}\nconst nop = () => {}\nfunction eos(stream, options, callback) {\n var _options$readable, _options$writable\n if (arguments.length === 2) {\n callback = options\n options = kEmptyObject\n } else if (options == null) {\n options = kEmptyObject\n } else {\n validateObject(options, 'options')\n }\n validateFunction(callback, 'callback')\n validateAbortSignal(options.signal, 'options.signal')\n callback = once(callback)\n if (isReadableStream(stream) || isWritableStream(stream)) {\n return eosWeb(stream, options, callback)\n }\n if (!isNodeStream(stream)) {\n throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream)\n }\n const readable =\n (_options$readable = options.readable) !== null && _options$readable !== undefined\n ? _options$readable\n : isReadableNodeStream(stream)\n const writable =\n (_options$writable = options.writable) !== null && _options$writable !== undefined\n ? _options$writable\n : isWritableNodeStream(stream)\n const wState = stream._writableState\n const rState = stream._readableState\n const onlegacyfinish = () => {\n if (!stream.writable) {\n onfinish()\n }\n }\n\n // TODO (ronag): Improve soft detection to include core modules and\n // common ecosystem modules that do properly emit 'close' but fail\n // this generic check.\n let willEmitClose =\n _willEmitClose(stream) && isReadableNodeStream(stream) === readable && isWritableNodeStream(stream) === writable\n let writableFinished = isWritableFinished(stream, false)\n const onfinish = () => {\n writableFinished = true\n // Stream should not be destroyed here. If it is that\n // means that user space is doing something differently and\n // we cannot trust willEmitClose.\n if (stream.destroyed) {\n willEmitClose = false\n }\n if (willEmitClose && (!stream.readable || readable)) {\n return\n }\n if (!readable || readableFinished) {\n callback.call(stream)\n }\n }\n let readableFinished = isReadableFinished(stream, false)\n const onend = () => {\n readableFinished = true\n // Stream should not be destroyed here. If it is that\n // means that user space is doing something differently and\n // we cannot trust willEmitClose.\n if (stream.destroyed) {\n willEmitClose = false\n }\n if (willEmitClose && (!stream.writable || writable)) {\n return\n }\n if (!writable || writableFinished) {\n callback.call(stream)\n }\n }\n const onerror = (err) => {\n callback.call(stream, err)\n }\n let closed = isClosed(stream)\n const onclose = () => {\n closed = true\n const errored = isWritableErrored(stream) || isReadableErrored(stream)\n if (errored && typeof errored !== 'boolean') {\n return callback.call(stream, errored)\n }\n if (readable && !readableFinished && isReadableNodeStream(stream, true)) {\n if (!isReadableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE())\n }\n if (writable && !writableFinished) {\n if (!isWritableFinished(stream, false)) return callback.call(stream, new ERR_STREAM_PREMATURE_CLOSE())\n }\n callback.call(stream)\n }\n const onclosed = () => {\n closed = true\n const errored = isWritableErrored(stream) || isReadableErrored(stream)\n if (errored && typeof errored !== 'boolean') {\n return callback.call(stream, errored)\n }\n callback.call(stream)\n }\n const onrequest = () => {\n stream.req.on('finish', onfinish)\n }\n if (isRequest(stream)) {\n stream.on('complete', onfinish)\n if (!willEmitClose) {\n stream.on('abort', onclose)\n }\n if (stream.req) {\n onrequest()\n } else {\n stream.on('request', onrequest)\n }\n } else if (writable && !wState) {\n // legacy streams\n stream.on('end', onlegacyfinish)\n stream.on('close', onlegacyfinish)\n }\n\n // Not all streams will emit 'close' after 'aborted'.\n if (!willEmitClose && typeof stream.aborted === 'boolean') {\n stream.on('aborted', onclose)\n }\n stream.on('end', onend)\n stream.on('finish', onfinish)\n if (options.error !== false) {\n stream.on('error', onerror)\n }\n stream.on('close', onclose)\n if (closed) {\n process.nextTick(onclose)\n } else if (\n (wState !== null && wState !== undefined && wState.errorEmitted) ||\n (rState !== null && rState !== undefined && rState.errorEmitted)\n ) {\n if (!willEmitClose) {\n process.nextTick(onclosed)\n }\n } else if (\n !readable &&\n (!willEmitClose || isReadable(stream)) &&\n (writableFinished || isWritable(stream) === false)\n ) {\n process.nextTick(onclosed)\n } else if (\n !writable &&\n (!willEmitClose || isWritable(stream)) &&\n (readableFinished || isReadable(stream) === false)\n ) {\n process.nextTick(onclosed)\n } else if (rState && stream.req && stream.aborted) {\n process.nextTick(onclosed)\n }\n const cleanup = () => {\n callback = nop\n stream.removeListener('aborted', onclose)\n stream.removeListener('complete', onfinish)\n stream.removeListener('abort', onclose)\n stream.removeListener('request', onrequest)\n if (stream.req) stream.req.removeListener('finish', onfinish)\n stream.removeListener('end', onlegacyfinish)\n stream.removeListener('close', onlegacyfinish)\n stream.removeListener('finish', onfinish)\n stream.removeListener('end', onend)\n stream.removeListener('error', onerror)\n stream.removeListener('close', onclose)\n }\n if (options.signal && !closed) {\n const abort = () => {\n // Keep it because cleanup removes it.\n const endCallback = callback\n cleanup()\n endCallback.call(\n stream,\n new AbortError(undefined, {\n cause: options.signal.reason\n })\n )\n }\n if (options.signal.aborted) {\n process.nextTick(abort)\n } else {\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n const disposable = addAbortListener(options.signal, abort)\n const originalCallback = callback\n callback = once((...args) => {\n disposable[SymbolDispose]()\n originalCallback.apply(stream, args)\n })\n }\n }\n return cleanup\n}\nfunction eosWeb(stream, options, callback) {\n let isAborted = false\n let abort = nop\n if (options.signal) {\n abort = () => {\n isAborted = true\n callback.call(\n stream,\n new AbortError(undefined, {\n cause: options.signal.reason\n })\n )\n }\n if (options.signal.aborted) {\n process.nextTick(abort)\n } else {\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n const disposable = addAbortListener(options.signal, abort)\n const originalCallback = callback\n callback = once((...args) => {\n disposable[SymbolDispose]()\n originalCallback.apply(stream, args)\n })\n }\n }\n const resolverFn = (...args) => {\n if (!isAborted) {\n process.nextTick(() => callback.apply(stream, args))\n }\n }\n PromisePrototypeThen(stream[kIsClosedPromise].promise, resolverFn, resolverFn)\n return nop\n}\nfunction finished(stream, opts) {\n var _opts\n let autoCleanup = false\n if (opts === null) {\n opts = kEmptyObject\n }\n if ((_opts = opts) !== null && _opts !== undefined && _opts.cleanup) {\n validateBoolean(opts.cleanup, 'cleanup')\n autoCleanup = opts.cleanup\n }\n return new Promise((resolve, reject) => {\n const cleanup = eos(stream, opts, (err) => {\n if (autoCleanup) {\n cleanup()\n }\n if (err) {\n reject(err)\n } else {\n resolve()\n }\n })\n })\n}\nmodule.exports = eos\nmodule.exports.finished = finished\n","'use strict'\n\n/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n\nconst { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require('../../ours/primordials')\nconst { Buffer } = require('buffer')\nconst { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require('../../ours/errors').codes\nfunction from(Readable, iterable, opts) {\n let iterator\n if (typeof iterable === 'string' || iterable instanceof Buffer) {\n return new Readable({\n objectMode: true,\n ...opts,\n read() {\n this.push(iterable)\n this.push(null)\n }\n })\n }\n let isAsync\n if (iterable && iterable[SymbolAsyncIterator]) {\n isAsync = true\n iterator = iterable[SymbolAsyncIterator]()\n } else if (iterable && iterable[SymbolIterator]) {\n isAsync = false\n iterator = iterable[SymbolIterator]()\n } else {\n throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable)\n }\n const readable = new Readable({\n objectMode: true,\n highWaterMark: 1,\n // TODO(ronag): What options should be allowed?\n ...opts\n })\n\n // Flag to protect against _read\n // being called before last iteration completion.\n let reading = false\n readable._read = function () {\n if (!reading) {\n reading = true\n next()\n }\n }\n readable._destroy = function (error, cb) {\n PromisePrototypeThen(\n close(error),\n () => process.nextTick(cb, error),\n // nextTick is here in case cb throws\n (e) => process.nextTick(cb, e || error)\n )\n }\n async function close(error) {\n const hadError = error !== undefined && error !== null\n const hasThrow = typeof iterator.throw === 'function'\n if (hadError && hasThrow) {\n const { value, done } = await iterator.throw(error)\n await value\n if (done) {\n return\n }\n }\n if (typeof iterator.return === 'function') {\n const { value } = await iterator.return()\n await value\n }\n }\n async function next() {\n for (;;) {\n try {\n const { value, done } = isAsync ? await iterator.next() : iterator.next()\n if (done) {\n readable.push(null)\n } else {\n const res = value && typeof value.then === 'function' ? await value : value\n if (res === null) {\n reading = false\n throw new ERR_STREAM_NULL_VALUES()\n } else if (readable.push(res)) {\n continue\n } else {\n reading = false\n }\n }\n } catch (err) {\n readable.destroy(err)\n }\n break\n }\n }\n return readable\n}\nmodule.exports = from\n","'use strict'\n\nconst { ArrayIsArray, ObjectSetPrototypeOf } = require('../../ours/primordials')\nconst { EventEmitter: EE } = require('events')\nfunction Stream(opts) {\n EE.call(this, opts)\n}\nObjectSetPrototypeOf(Stream.prototype, EE.prototype)\nObjectSetPrototypeOf(Stream, EE)\nStream.prototype.pipe = function (dest, options) {\n const source = this\n function ondata(chunk) {\n if (dest.writable && dest.write(chunk) === false && source.pause) {\n source.pause()\n }\n }\n source.on('data', ondata)\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume()\n }\n }\n dest.on('drain', ondrain)\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend)\n source.on('close', onclose)\n }\n let didOnEnd = false\n function onend() {\n if (didOnEnd) return\n didOnEnd = true\n dest.end()\n }\n function onclose() {\n if (didOnEnd) return\n didOnEnd = true\n if (typeof dest.destroy === 'function') dest.destroy()\n }\n\n // Don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup()\n if (EE.listenerCount(this, 'error') === 0) {\n this.emit('error', er)\n }\n }\n prependListener(source, 'error', onerror)\n prependListener(dest, 'error', onerror)\n\n // Remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata)\n dest.removeListener('drain', ondrain)\n source.removeListener('end', onend)\n source.removeListener('close', onclose)\n source.removeListener('error', onerror)\n dest.removeListener('error', onerror)\n source.removeListener('end', cleanup)\n source.removeListener('close', cleanup)\n dest.removeListener('close', cleanup)\n }\n source.on('end', cleanup)\n source.on('close', cleanup)\n dest.on('close', cleanup)\n dest.emit('pipe', source)\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest\n}\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn)\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn)\n else if (ArrayIsArray(emitter._events[event])) emitter._events[event].unshift(fn)\n else emitter._events[event] = [fn, emitter._events[event]]\n}\nmodule.exports = {\n Stream,\n prependListener\n}\n","'use strict'\n\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nconst {\n codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_TYPE, ERR_MISSING_ARGS, ERR_OUT_OF_RANGE },\n AbortError\n} = require('../../ours/errors')\nconst { validateAbortSignal, validateInteger, validateObject } = require('../validators')\nconst kWeakHandler = require('../../ours/primordials').Symbol('kWeak')\nconst kResistStopPropagation = require('../../ours/primordials').Symbol('kResistStopPropagation')\nconst { finished } = require('./end-of-stream')\nconst staticCompose = require('./compose')\nconst { addAbortSignalNoValidate } = require('./add-abort-signal')\nconst { isWritable, isNodeStream } = require('./utils')\nconst { deprecate } = require('../../ours/util')\nconst {\n ArrayPrototypePush,\n Boolean,\n MathFloor,\n Number,\n NumberIsNaN,\n Promise,\n PromiseReject,\n PromiseResolve,\n PromisePrototypeThen,\n Symbol\n} = require('../../ours/primordials')\nconst kEmpty = Symbol('kEmpty')\nconst kEof = Symbol('kEof')\nfunction compose(stream, options) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n if (isNodeStream(stream) && !isWritable(stream)) {\n throw new ERR_INVALID_ARG_VALUE('stream', stream, 'must be writable')\n }\n const composedStream = staticCompose(this, stream)\n if (options !== null && options !== undefined && options.signal) {\n // Not validating as we already validated before\n addAbortSignalNoValidate(options.signal, composedStream)\n }\n return composedStream\n}\nfunction map(fn, options) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n let concurrency = 1\n if ((options === null || options === undefined ? undefined : options.concurrency) != null) {\n concurrency = MathFloor(options.concurrency)\n }\n let highWaterMark = concurrency - 1\n if ((options === null || options === undefined ? undefined : options.highWaterMark) != null) {\n highWaterMark = MathFloor(options.highWaterMark)\n }\n validateInteger(concurrency, 'options.concurrency', 1)\n validateInteger(highWaterMark, 'options.highWaterMark', 0)\n highWaterMark += concurrency\n return async function* map() {\n const signal = require('../../ours/util').AbortSignalAny(\n [options === null || options === undefined ? undefined : options.signal].filter(Boolean)\n )\n const stream = this\n const queue = []\n const signalOpt = {\n signal\n }\n let next\n let resume\n let done = false\n let cnt = 0\n function onCatch() {\n done = true\n afterItemProcessed()\n }\n function afterItemProcessed() {\n cnt -= 1\n maybeResume()\n }\n function maybeResume() {\n if (resume && !done && cnt < concurrency && queue.length < highWaterMark) {\n resume()\n resume = null\n }\n }\n async function pump() {\n try {\n for await (let val of stream) {\n if (done) {\n return\n }\n if (signal.aborted) {\n throw new AbortError()\n }\n try {\n val = fn(val, signalOpt)\n if (val === kEmpty) {\n continue\n }\n val = PromiseResolve(val)\n } catch (err) {\n val = PromiseReject(err)\n }\n cnt += 1\n PromisePrototypeThen(val, afterItemProcessed, onCatch)\n queue.push(val)\n if (next) {\n next()\n next = null\n }\n if (!done && (queue.length >= highWaterMark || cnt >= concurrency)) {\n await new Promise((resolve) => {\n resume = resolve\n })\n }\n }\n queue.push(kEof)\n } catch (err) {\n const val = PromiseReject(err)\n PromisePrototypeThen(val, afterItemProcessed, onCatch)\n queue.push(val)\n } finally {\n done = true\n if (next) {\n next()\n next = null\n }\n }\n }\n pump()\n try {\n while (true) {\n while (queue.length > 0) {\n const val = await queue[0]\n if (val === kEof) {\n return\n }\n if (signal.aborted) {\n throw new AbortError()\n }\n if (val !== kEmpty) {\n yield val\n }\n queue.shift()\n maybeResume()\n }\n await new Promise((resolve) => {\n next = resolve\n })\n }\n } finally {\n done = true\n if (resume) {\n resume()\n resume = null\n }\n }\n }.call(this)\n}\nfunction asIndexedPairs(options = undefined) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n return async function* asIndexedPairs() {\n let index = 0\n for await (const val of this) {\n var _options$signal\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal = options.signal) !== null &&\n _options$signal !== undefined &&\n _options$signal.aborted\n ) {\n throw new AbortError({\n cause: options.signal.reason\n })\n }\n yield [index++, val]\n }\n }.call(this)\n}\nasync function some(fn, options = undefined) {\n for await (const unused of filter.call(this, fn, options)) {\n return true\n }\n return false\n}\nasync function every(fn, options = undefined) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n // https://en.wikipedia.org/wiki/De_Morgan%27s_laws\n return !(await some.call(\n this,\n async (...args) => {\n return !(await fn(...args))\n },\n options\n ))\n}\nasync function find(fn, options) {\n for await (const result of filter.call(this, fn, options)) {\n return result\n }\n return undefined\n}\nasync function forEach(fn, options) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n async function forEachFn(value, options) {\n await fn(value, options)\n return kEmpty\n }\n // eslint-disable-next-line no-unused-vars\n for await (const unused of map.call(this, forEachFn, options));\n}\nfunction filter(fn, options) {\n if (typeof fn !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('fn', ['Function', 'AsyncFunction'], fn)\n }\n async function filterFn(value, options) {\n if (await fn(value, options)) {\n return value\n }\n return kEmpty\n }\n return map.call(this, filterFn, options)\n}\n\n// Specific to provide better error to reduce since the argument is only\n// missing if the stream has no items in it - but the code is still appropriate\nclass ReduceAwareErrMissingArgs extends ERR_MISSING_ARGS {\n constructor() {\n super('reduce')\n this.message = 'Reduce of an empty stream requires an initial value'\n }\n}\nasync function reduce(reducer, initialValue, options) {\n var _options$signal2\n if (typeof reducer !== 'function') {\n throw new ERR_INVALID_ARG_TYPE('reducer', ['Function', 'AsyncFunction'], reducer)\n }\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n let hasInitialValue = arguments.length > 1\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal2 = options.signal) !== null &&\n _options$signal2 !== undefined &&\n _options$signal2.aborted\n ) {\n const err = new AbortError(undefined, {\n cause: options.signal.reason\n })\n this.once('error', () => {}) // The error is already propagated\n await finished(this.destroy(err))\n throw err\n }\n const ac = new AbortController()\n const signal = ac.signal\n if (options !== null && options !== undefined && options.signal) {\n const opts = {\n once: true,\n [kWeakHandler]: this,\n [kResistStopPropagation]: true\n }\n options.signal.addEventListener('abort', () => ac.abort(), opts)\n }\n let gotAnyItemFromStream = false\n try {\n for await (const value of this) {\n var _options$signal3\n gotAnyItemFromStream = true\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal3 = options.signal) !== null &&\n _options$signal3 !== undefined &&\n _options$signal3.aborted\n ) {\n throw new AbortError()\n }\n if (!hasInitialValue) {\n initialValue = value\n hasInitialValue = true\n } else {\n initialValue = await reducer(initialValue, value, {\n signal\n })\n }\n }\n if (!gotAnyItemFromStream && !hasInitialValue) {\n throw new ReduceAwareErrMissingArgs()\n }\n } finally {\n ac.abort()\n }\n return initialValue\n}\nasync function toArray(options) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n const result = []\n for await (const val of this) {\n var _options$signal4\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal4 = options.signal) !== null &&\n _options$signal4 !== undefined &&\n _options$signal4.aborted\n ) {\n throw new AbortError(undefined, {\n cause: options.signal.reason\n })\n }\n ArrayPrototypePush(result, val)\n }\n return result\n}\nfunction flatMap(fn, options) {\n const values = map.call(this, fn, options)\n return async function* flatMap() {\n for await (const val of values) {\n yield* val\n }\n }.call(this)\n}\nfunction toIntegerOrInfinity(number) {\n // We coerce here to align with the spec\n // https://github.com/tc39/proposal-iterator-helpers/issues/169\n number = Number(number)\n if (NumberIsNaN(number)) {\n return 0\n }\n if (number < 0) {\n throw new ERR_OUT_OF_RANGE('number', '>= 0', number)\n }\n return number\n}\nfunction drop(number, options = undefined) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n number = toIntegerOrInfinity(number)\n return async function* drop() {\n var _options$signal5\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal5 = options.signal) !== null &&\n _options$signal5 !== undefined &&\n _options$signal5.aborted\n ) {\n throw new AbortError()\n }\n for await (const val of this) {\n var _options$signal6\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal6 = options.signal) !== null &&\n _options$signal6 !== undefined &&\n _options$signal6.aborted\n ) {\n throw new AbortError()\n }\n if (number-- <= 0) {\n yield val\n }\n }\n }.call(this)\n}\nfunction take(number, options = undefined) {\n if (options != null) {\n validateObject(options, 'options')\n }\n if ((options === null || options === undefined ? undefined : options.signal) != null) {\n validateAbortSignal(options.signal, 'options.signal')\n }\n number = toIntegerOrInfinity(number)\n return async function* take() {\n var _options$signal7\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal7 = options.signal) !== null &&\n _options$signal7 !== undefined &&\n _options$signal7.aborted\n ) {\n throw new AbortError()\n }\n for await (const val of this) {\n var _options$signal8\n if (\n options !== null &&\n options !== undefined &&\n (_options$signal8 = options.signal) !== null &&\n _options$signal8 !== undefined &&\n _options$signal8.aborted\n ) {\n throw new AbortError()\n }\n if (number-- > 0) {\n yield val\n }\n\n // Don't get another item from iterator in case we reached the end\n if (number <= 0) {\n return\n }\n }\n }.call(this)\n}\nmodule.exports.streamReturningOperators = {\n asIndexedPairs: deprecate(asIndexedPairs, 'readable.asIndexedPairs will be removed in a future version.'),\n drop,\n filter,\n flatMap,\n map,\n take,\n compose\n}\nmodule.exports.promiseReturningOperators = {\n every,\n forEach,\n reduce,\n toArray,\n some,\n find\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n'use strict'\n\nconst { ObjectSetPrototypeOf } = require('../../ours/primordials')\nmodule.exports = PassThrough\nconst Transform = require('./transform')\nObjectSetPrototypeOf(PassThrough.prototype, Transform.prototype)\nObjectSetPrototypeOf(PassThrough, Transform)\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options)\n Transform.call(this, options)\n}\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk)\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n\n;('use strict')\nconst { ArrayIsArray, Promise, SymbolAsyncIterator, SymbolDispose } = require('../../ours/primordials')\nconst eos = require('./end-of-stream')\nconst { once } = require('../../ours/util')\nconst destroyImpl = require('./destroy')\nconst Duplex = require('./duplex')\nconst {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_INVALID_RETURN_VALUE,\n ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_PREMATURE_CLOSE\n },\n AbortError\n} = require('../../ours/errors')\nconst { validateFunction, validateAbortSignal } = require('../validators')\nconst {\n isIterable,\n isReadable,\n isReadableNodeStream,\n isNodeStream,\n isTransformStream,\n isWebStream,\n isReadableStream,\n isReadableFinished\n} = require('./utils')\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nlet PassThrough\nlet Readable\nlet addAbortListener\nfunction destroyer(stream, reading, writing) {\n let finished = false\n stream.on('close', () => {\n finished = true\n })\n const cleanup = eos(\n stream,\n {\n readable: reading,\n writable: writing\n },\n (err) => {\n finished = !err\n }\n )\n return {\n destroy: (err) => {\n if (finished) return\n finished = true\n destroyImpl.destroyer(stream, err || new ERR_STREAM_DESTROYED('pipe'))\n },\n cleanup\n }\n}\nfunction popCallback(streams) {\n // Streams should never be an empty array. It should always contain at least\n // a single stream. Therefore optimize for the average case instead of\n // checking for length === 0 as well.\n validateFunction(streams[streams.length - 1], 'streams[stream.length - 1]')\n return streams.pop()\n}\nfunction makeAsyncIterable(val) {\n if (isIterable(val)) {\n return val\n } else if (isReadableNodeStream(val)) {\n // Legacy streams are not Iterable.\n return fromReadable(val)\n }\n throw new ERR_INVALID_ARG_TYPE('val', ['Readable', 'Iterable', 'AsyncIterable'], val)\n}\nasync function* fromReadable(val) {\n if (!Readable) {\n Readable = require('./readable')\n }\n yield* Readable.prototype[SymbolAsyncIterator].call(val)\n}\nasync function pumpToNode(iterable, writable, finish, { end }) {\n let error\n let onresolve = null\n const resume = (err) => {\n if (err) {\n error = err\n }\n if (onresolve) {\n const callback = onresolve\n onresolve = null\n callback()\n }\n }\n const wait = () =>\n new Promise((resolve, reject) => {\n if (error) {\n reject(error)\n } else {\n onresolve = () => {\n if (error) {\n reject(error)\n } else {\n resolve()\n }\n }\n }\n })\n writable.on('drain', resume)\n const cleanup = eos(\n writable,\n {\n readable: false\n },\n resume\n )\n try {\n if (writable.writableNeedDrain) {\n await wait()\n }\n for await (const chunk of iterable) {\n if (!writable.write(chunk)) {\n await wait()\n }\n }\n if (end) {\n writable.end()\n await wait()\n }\n finish()\n } catch (err) {\n finish(error !== err ? aggregateTwoErrors(error, err) : err)\n } finally {\n cleanup()\n writable.off('drain', resume)\n }\n}\nasync function pumpToWeb(readable, writable, finish, { end }) {\n if (isTransformStream(writable)) {\n writable = writable.writable\n }\n // https://streams.spec.whatwg.org/#example-manual-write-with-backpressure\n const writer = writable.getWriter()\n try {\n for await (const chunk of readable) {\n await writer.ready\n writer.write(chunk).catch(() => {})\n }\n await writer.ready\n if (end) {\n await writer.close()\n }\n finish()\n } catch (err) {\n try {\n await writer.abort(err)\n finish(err)\n } catch (err) {\n finish(err)\n }\n }\n}\nfunction pipeline(...streams) {\n return pipelineImpl(streams, once(popCallback(streams)))\n}\nfunction pipelineImpl(streams, callback, opts) {\n if (streams.length === 1 && ArrayIsArray(streams[0])) {\n streams = streams[0]\n }\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams')\n }\n const ac = new AbortController()\n const signal = ac.signal\n const outerSignal = opts === null || opts === undefined ? undefined : opts.signal\n\n // Need to cleanup event listeners if last stream is readable\n // https://github.com/nodejs/node/issues/35452\n const lastStreamCleanup = []\n validateAbortSignal(outerSignal, 'options.signal')\n function abort() {\n finishImpl(new AbortError())\n }\n addAbortListener = addAbortListener || require('../../ours/util').addAbortListener\n let disposable\n if (outerSignal) {\n disposable = addAbortListener(outerSignal, abort)\n }\n let error\n let value\n const destroys = []\n let finishCount = 0\n function finish(err) {\n finishImpl(err, --finishCount === 0)\n }\n function finishImpl(err, final) {\n var _disposable\n if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) {\n error = err\n }\n if (!error && !final) {\n return\n }\n while (destroys.length) {\n destroys.shift()(error)\n }\n ;(_disposable = disposable) === null || _disposable === undefined ? undefined : _disposable[SymbolDispose]()\n ac.abort()\n if (final) {\n if (!error) {\n lastStreamCleanup.forEach((fn) => fn())\n }\n process.nextTick(callback, error, value)\n }\n }\n let ret\n for (let i = 0; i < streams.length; i++) {\n const stream = streams[i]\n const reading = i < streams.length - 1\n const writing = i > 0\n const end = reading || (opts === null || opts === undefined ? undefined : opts.end) !== false\n const isLastStream = i === streams.length - 1\n if (isNodeStream(stream)) {\n if (end) {\n const { destroy, cleanup } = destroyer(stream, reading, writing)\n destroys.push(destroy)\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(cleanup)\n }\n }\n\n // Catch stream errors that occur after pipe/pump has completed.\n function onError(err) {\n if (err && err.name !== 'AbortError' && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n finish(err)\n }\n }\n stream.on('error', onError)\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(() => {\n stream.removeListener('error', onError)\n })\n }\n }\n if (i === 0) {\n if (typeof stream === 'function') {\n ret = stream({\n signal\n })\n if (!isIterable(ret)) {\n throw new ERR_INVALID_RETURN_VALUE('Iterable, AsyncIterable or Stream', 'source', ret)\n }\n } else if (isIterable(stream) || isReadableNodeStream(stream) || isTransformStream(stream)) {\n ret = stream\n } else {\n ret = Duplex.from(stream)\n }\n } else if (typeof stream === 'function') {\n if (isTransformStream(ret)) {\n var _ret\n ret = makeAsyncIterable((_ret = ret) === null || _ret === undefined ? undefined : _ret.readable)\n } else {\n ret = makeAsyncIterable(ret)\n }\n ret = stream(ret, {\n signal\n })\n if (reading) {\n if (!isIterable(ret, true)) {\n throw new ERR_INVALID_RETURN_VALUE('AsyncIterable', `transform[${i - 1}]`, ret)\n }\n } else {\n var _ret2\n if (!PassThrough) {\n PassThrough = require('./passthrough')\n }\n\n // If the last argument to pipeline is not a stream\n // we must create a proxy stream so that pipeline(...)\n // always returns a stream which can be further\n // composed through `.pipe(stream)`.\n\n const pt = new PassThrough({\n objectMode: true\n })\n\n // Handle Promises/A+ spec, `then` could be a getter that throws on\n // second use.\n const then = (_ret2 = ret) === null || _ret2 === undefined ? undefined : _ret2.then\n if (typeof then === 'function') {\n finishCount++\n then.call(\n ret,\n (val) => {\n value = val\n if (val != null) {\n pt.write(val)\n }\n if (end) {\n pt.end()\n }\n process.nextTick(finish)\n },\n (err) => {\n pt.destroy(err)\n process.nextTick(finish, err)\n }\n )\n } else if (isIterable(ret, true)) {\n finishCount++\n pumpToNode(ret, pt, finish, {\n end\n })\n } else if (isReadableStream(ret) || isTransformStream(ret)) {\n const toRead = ret.readable || ret\n finishCount++\n pumpToNode(toRead, pt, finish, {\n end\n })\n } else {\n throw new ERR_INVALID_RETURN_VALUE('AsyncIterable or Promise', 'destination', ret)\n }\n ret = pt\n const { destroy, cleanup } = destroyer(ret, false, true)\n destroys.push(destroy)\n if (isLastStream) {\n lastStreamCleanup.push(cleanup)\n }\n }\n } else if (isNodeStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount += 2\n const cleanup = pipe(ret, stream, finish, {\n end\n })\n if (isReadable(stream) && isLastStream) {\n lastStreamCleanup.push(cleanup)\n }\n } else if (isTransformStream(ret) || isReadableStream(ret)) {\n const toRead = ret.readable || ret\n finishCount++\n pumpToNode(toRead, stream, finish, {\n end\n })\n } else if (isIterable(ret)) {\n finishCount++\n pumpToNode(ret, stream, finish, {\n end\n })\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'val',\n ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'],\n ret\n )\n }\n ret = stream\n } else if (isWebStream(stream)) {\n if (isReadableNodeStream(ret)) {\n finishCount++\n pumpToWeb(makeAsyncIterable(ret), stream, finish, {\n end\n })\n } else if (isReadableStream(ret) || isIterable(ret)) {\n finishCount++\n pumpToWeb(ret, stream, finish, {\n end\n })\n } else if (isTransformStream(ret)) {\n finishCount++\n pumpToWeb(ret.readable, stream, finish, {\n end\n })\n } else {\n throw new ERR_INVALID_ARG_TYPE(\n 'val',\n ['Readable', 'Iterable', 'AsyncIterable', 'ReadableStream', 'TransformStream'],\n ret\n )\n }\n ret = stream\n } else {\n ret = Duplex.from(stream)\n }\n }\n if (\n (signal !== null && signal !== undefined && signal.aborted) ||\n (outerSignal !== null && outerSignal !== undefined && outerSignal.aborted)\n ) {\n process.nextTick(abort)\n }\n return ret\n}\nfunction pipe(src, dst, finish, { end }) {\n let ended = false\n dst.on('close', () => {\n if (!ended) {\n // Finish if the destination closes before the source has completed.\n finish(new ERR_STREAM_PREMATURE_CLOSE())\n }\n })\n src.pipe(dst, {\n end: false\n }) // If end is true we already will have a listener to end dst.\n\n if (end) {\n // Compat. Before node v10.12.0 stdio used to throw an error so\n // pipe() did/does not end() stdio destinations.\n // Now they allow it but \"secretly\" don't close the underlying fd.\n\n function endFn() {\n ended = true\n dst.end()\n }\n if (isReadableFinished(src)) {\n // End the destination if the source has already ended.\n process.nextTick(endFn)\n } else {\n src.once('end', endFn)\n }\n } else {\n finish()\n }\n eos(\n src,\n {\n readable: true,\n writable: false\n },\n (err) => {\n const rState = src._readableState\n if (\n err &&\n err.code === 'ERR_STREAM_PREMATURE_CLOSE' &&\n rState &&\n rState.ended &&\n !rState.errored &&\n !rState.errorEmitted\n ) {\n // Some readable streams will emit 'close' before 'end'. However, since\n // this is on the readable side 'end' should still be emitted if the\n // stream has been ended and no error emitted. This should be allowed in\n // favor of backwards compatibility. Since the stream is piped to a\n // destination this should not result in any observable difference.\n // We don't need to check if this is a writable premature close since\n // eos will only fail with premature close on the reading side for\n // duplex streams.\n src.once('end', finish).once('error', finish)\n } else {\n finish(err)\n }\n }\n )\n return eos(\n dst,\n {\n readable: false,\n writable: true\n },\n finish\n )\n}\nmodule.exports = {\n pipelineImpl,\n pipeline\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n;('use strict')\nconst {\n ArrayPrototypeIndexOf,\n NumberIsInteger,\n NumberIsNaN,\n NumberParseInt,\n ObjectDefineProperties,\n ObjectKeys,\n ObjectSetPrototypeOf,\n Promise,\n SafeSet,\n SymbolAsyncDispose,\n SymbolAsyncIterator,\n Symbol\n} = require('../../ours/primordials')\nmodule.exports = Readable\nReadable.ReadableState = ReadableState\nconst { EventEmitter: EE } = require('events')\nconst { Stream, prependListener } = require('./legacy')\nconst { Buffer } = require('buffer')\nconst { addAbortSignal } = require('./add-abort-signal')\nconst eos = require('./end-of-stream')\nlet debug = require('../../ours/util').debuglog('stream', (fn) => {\n debug = fn\n})\nconst BufferList = require('./buffer_list')\nconst destroyImpl = require('./destroy')\nconst { getHighWaterMark, getDefaultHighWaterMark } = require('./state')\nconst {\n aggregateTwoErrors,\n codes: {\n ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_OUT_OF_RANGE,\n ERR_STREAM_PUSH_AFTER_EOF,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT\n },\n AbortError\n} = require('../../ours/errors')\nconst { validateObject } = require('../validators')\nconst kPaused = Symbol('kPaused')\nconst { StringDecoder } = require('string_decoder')\nconst from = require('./from')\nObjectSetPrototypeOf(Readable.prototype, Stream.prototype)\nObjectSetPrototypeOf(Readable, Stream)\nconst nop = () => {}\nconst { errorOrDestroy } = destroyImpl\nconst kObjectMode = 1 << 0\nconst kEnded = 1 << 1\nconst kEndEmitted = 1 << 2\nconst kReading = 1 << 3\nconst kConstructed = 1 << 4\nconst kSync = 1 << 5\nconst kNeedReadable = 1 << 6\nconst kEmittedReadable = 1 << 7\nconst kReadableListening = 1 << 8\nconst kResumeScheduled = 1 << 9\nconst kErrorEmitted = 1 << 10\nconst kEmitClose = 1 << 11\nconst kAutoDestroy = 1 << 12\nconst kDestroyed = 1 << 13\nconst kClosed = 1 << 14\nconst kCloseEmitted = 1 << 15\nconst kMultiAwaitDrain = 1 << 16\nconst kReadingMore = 1 << 17\nconst kDataEmitted = 1 << 18\n\n// TODO(benjamingr) it is likely slower to do it this way than with free functions\nfunction makeBitMapDescriptor(bit) {\n return {\n enumerable: false,\n get() {\n return (this.state & bit) !== 0\n },\n set(value) {\n if (value) this.state |= bit\n else this.state &= ~bit\n }\n }\n}\nObjectDefineProperties(ReadableState.prototype, {\n objectMode: makeBitMapDescriptor(kObjectMode),\n ended: makeBitMapDescriptor(kEnded),\n endEmitted: makeBitMapDescriptor(kEndEmitted),\n reading: makeBitMapDescriptor(kReading),\n // Stream is still being constructed and cannot be\n // destroyed until construction finished or failed.\n // Async construction is opt in, therefore we start as\n // constructed.\n constructed: makeBitMapDescriptor(kConstructed),\n // A flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n sync: makeBitMapDescriptor(kSync),\n // Whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n needReadable: makeBitMapDescriptor(kNeedReadable),\n emittedReadable: makeBitMapDescriptor(kEmittedReadable),\n readableListening: makeBitMapDescriptor(kReadableListening),\n resumeScheduled: makeBitMapDescriptor(kResumeScheduled),\n // True if the error was already emitted and should not be thrown again.\n errorEmitted: makeBitMapDescriptor(kErrorEmitted),\n emitClose: makeBitMapDescriptor(kEmitClose),\n autoDestroy: makeBitMapDescriptor(kAutoDestroy),\n // Has it been destroyed.\n destroyed: makeBitMapDescriptor(kDestroyed),\n // Indicates whether the stream has finished destroying.\n closed: makeBitMapDescriptor(kClosed),\n // True if close has been emitted or would have been emitted\n // depending on emitClose.\n closeEmitted: makeBitMapDescriptor(kCloseEmitted),\n multiAwaitDrain: makeBitMapDescriptor(kMultiAwaitDrain),\n // If true, a maybeReadMore has been scheduled.\n readingMore: makeBitMapDescriptor(kReadingMore),\n dataEmitted: makeBitMapDescriptor(kDataEmitted)\n})\nfunction ReadableState(options, stream, isDuplex) {\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof require('./duplex')\n\n // Bit map field to store ReadableState more effciently with 1 bit per field\n // instead of a V8 slot per field.\n this.state = kEmitClose | kAutoDestroy | kConstructed | kSync\n // Object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away.\n if (options && options.objectMode) this.state |= kObjectMode\n if (isDuplex && options && options.readableObjectMode) this.state |= kObjectMode\n\n // The point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n this.highWaterMark = options\n ? getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex)\n : getDefaultHighWaterMark(false)\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift().\n this.buffer = new BufferList()\n this.length = 0\n this.pipes = []\n this.flowing = null\n this[kPaused] = null\n\n // Should close be emitted on destroy. Defaults to true.\n if (options && options.emitClose === false) this.state &= ~kEmitClose\n\n // Should .destroy() be called after 'end' (and potentially 'finish').\n if (options && options.autoDestroy === false) this.state &= ~kAutoDestroy\n\n // Indicates whether the stream has errored. When true no further\n // _read calls, 'data' or 'readable' events should occur. This is needed\n // since when autoDestroy is disabled we need a way to tell whether the\n // stream has failed.\n this.errored = null\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = (options && options.defaultEncoding) || 'utf8'\n\n // Ref the piped dest which we need a drain event on it\n // type: null | Writable | Set.\n this.awaitDrainWriters = null\n this.decoder = null\n this.encoding = null\n if (options && options.encoding) {\n this.decoder = new StringDecoder(options.encoding)\n this.encoding = options.encoding\n }\n}\nfunction Readable(options) {\n if (!(this instanceof Readable)) return new Readable(options)\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5.\n const isDuplex = this instanceof require('./duplex')\n this._readableState = new ReadableState(options, this, isDuplex)\n if (options) {\n if (typeof options.read === 'function') this._read = options.read\n if (typeof options.destroy === 'function') this._destroy = options.destroy\n if (typeof options.construct === 'function') this._construct = options.construct\n if (options.signal && !isDuplex) addAbortSignal(options.signal, this)\n }\n Stream.call(this, options)\n destroyImpl.construct(this, () => {\n if (this._readableState.needReadable) {\n maybeReadMore(this, this._readableState)\n }\n })\n}\nReadable.prototype.destroy = destroyImpl.destroy\nReadable.prototype._undestroy = destroyImpl.undestroy\nReadable.prototype._destroy = function (err, cb) {\n cb(err)\n}\nReadable.prototype[EE.captureRejectionSymbol] = function (err) {\n this.destroy(err)\n}\nReadable.prototype[SymbolAsyncDispose] = function () {\n let error\n if (!this.destroyed) {\n error = this.readableEnded ? null : new AbortError()\n this.destroy(error)\n }\n return new Promise((resolve, reject) => eos(this, (err) => (err && err !== error ? reject(err) : resolve(null))))\n}\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, false)\n}\n\n// Unshift should *always* be something directly out of read().\nReadable.prototype.unshift = function (chunk, encoding) {\n return readableAddChunk(this, chunk, encoding, true)\n}\nfunction readableAddChunk(stream, chunk, encoding, addToFront) {\n debug('readableAddChunk', chunk)\n const state = stream._readableState\n let err\n if ((state.state & kObjectMode) === 0) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding\n if (state.encoding !== encoding) {\n if (addToFront && state.encoding) {\n // When unshifting, if state.encoding is set, we have to save\n // the string in the BufferList with the state encoding.\n chunk = Buffer.from(chunk, encoding).toString(state.encoding)\n } else {\n chunk = Buffer.from(chunk, encoding)\n encoding = ''\n }\n }\n } else if (chunk instanceof Buffer) {\n encoding = ''\n } else if (Stream._isUint8Array(chunk)) {\n chunk = Stream._uint8ArrayToBuffer(chunk)\n encoding = ''\n } else if (chunk != null) {\n err = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk)\n }\n }\n if (err) {\n errorOrDestroy(stream, err)\n } else if (chunk === null) {\n state.state &= ~kReading\n onEofChunk(stream, state)\n } else if ((state.state & kObjectMode) !== 0 || (chunk && chunk.length > 0)) {\n if (addToFront) {\n if ((state.state & kEndEmitted) !== 0) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT())\n else if (state.destroyed || state.errored) return false\n else addChunk(stream, state, chunk, true)\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF())\n } else if (state.destroyed || state.errored) {\n return false\n } else {\n state.state &= ~kReading\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk)\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false)\n else maybeReadMore(stream, state)\n } else {\n addChunk(stream, state, chunk, false)\n }\n }\n } else if (!addToFront) {\n state.state &= ~kReading\n maybeReadMore(stream, state)\n }\n\n // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n return !state.ended && (state.length < state.highWaterMark || state.length === 0)\n}\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync && stream.listenerCount('data') > 0) {\n // Use the guard to avoid creating `Set()` repeatedly\n // when we have multiple pipes.\n if ((state.state & kMultiAwaitDrain) !== 0) {\n state.awaitDrainWriters.clear()\n } else {\n state.awaitDrainWriters = null\n }\n state.dataEmitted = true\n stream.emit('data', chunk)\n } else {\n // Update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length\n if (addToFront) state.buffer.unshift(chunk)\n else state.buffer.push(chunk)\n if ((state.state & kNeedReadable) !== 0) emitReadable(stream)\n }\n maybeReadMore(stream, state)\n}\nReadable.prototype.isPaused = function () {\n const state = this._readableState\n return state[kPaused] === true || state.flowing === false\n}\n\n// Backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n const decoder = new StringDecoder(enc)\n this._readableState.decoder = decoder\n // If setEncoding(null), decoder.encoding equals utf8.\n this._readableState.encoding = this._readableState.decoder.encoding\n const buffer = this._readableState.buffer\n // Iterate over current buffer to convert already stored Buffers:\n let content = ''\n for (const data of buffer) {\n content += decoder.write(data)\n }\n buffer.clear()\n if (content !== '') buffer.push(content)\n this._readableState.length = content.length\n return this\n}\n\n// Don't raise the hwm > 1GB.\nconst MAX_HWM = 0x40000000\nfunction computeNewHighWaterMark(n) {\n if (n > MAX_HWM) {\n throw new ERR_OUT_OF_RANGE('size', '<= 1GiB', n)\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts.\n n--\n n |= n >>> 1\n n |= n >>> 2\n n |= n >>> 4\n n |= n >>> 8\n n |= n >>> 16\n n++\n }\n return n\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || (state.length === 0 && state.ended)) return 0\n if ((state.state & kObjectMode) !== 0) return 1\n if (NumberIsNaN(n)) {\n // Only flow one buffer at a time.\n if (state.flowing && state.length) return state.buffer.first().length\n return state.length\n }\n if (n <= state.length) return n\n return state.ended ? state.length : 0\n}\n\n// You can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n)\n // Same as parseInt(undefined, 10), however V8 7.3 performance regressed\n // in this scenario, so we are doing it manually.\n if (n === undefined) {\n n = NaN\n } else if (!NumberIsInteger(n)) {\n n = NumberParseInt(n, 10)\n }\n const state = this._readableState\n const nOrig = n\n\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n)\n if (n !== 0) state.state &= ~kEmittedReadable\n\n // If we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (\n n === 0 &&\n state.needReadable &&\n ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)\n ) {\n debug('read: emitReadable', state.length, state.ended)\n if (state.length === 0 && state.ended) endReadable(this)\n else emitReadable(this)\n return null\n }\n n = howMuchToRead(n, state)\n\n // If we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this)\n return null\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n let doRead = (state.state & kNeedReadable) !== 0\n debug('need readable', doRead)\n\n // If we currently have less than the highWaterMark, then also read some.\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true\n debug('length less than watermark', doRead)\n }\n\n // However, if we've ended, then there's no point, if we're already\n // reading, then it's unnecessary, if we're constructing we have to wait,\n // and if we're destroyed or errored, then it's not allowed,\n if (state.ended || state.reading || state.destroyed || state.errored || !state.constructed) {\n doRead = false\n debug('reading, ended or constructing', doRead)\n } else if (doRead) {\n debug('do read')\n state.state |= kReading | kSync\n // If the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.state |= kNeedReadable\n\n // Call internal read method\n try {\n this._read(state.highWaterMark)\n } catch (err) {\n errorOrDestroy(this, err)\n }\n state.state &= ~kSync\n\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state)\n }\n let ret\n if (n > 0) ret = fromList(n, state)\n else ret = null\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark\n n = 0\n } else {\n state.length -= n\n if (state.multiAwaitDrain) {\n state.awaitDrainWriters.clear()\n } else {\n state.awaitDrainWriters = null\n }\n }\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this)\n }\n if (ret !== null && !state.errorEmitted && !state.closeEmitted) {\n state.dataEmitted = true\n this.emit('data', ret)\n }\n return ret\n}\nfunction onEofChunk(stream, state) {\n debug('onEofChunk')\n if (state.ended) return\n if (state.decoder) {\n const chunk = state.decoder.end()\n if (chunk && chunk.length) {\n state.buffer.push(chunk)\n state.length += state.objectMode ? 1 : chunk.length\n }\n }\n state.ended = true\n if (state.sync) {\n // If we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call.\n emitReadable(stream)\n } else {\n // Emit 'readable' now to make sure it gets picked up.\n state.needReadable = false\n state.emittedReadable = true\n // We have to emit readable now that we are EOF. Modules\n // in the ecosystem (e.g. dicer) rely on this event being sync.\n emitReadable_(stream)\n }\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n const state = stream._readableState\n debug('emitReadable', state.needReadable, state.emittedReadable)\n state.needReadable = false\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing)\n state.emittedReadable = true\n process.nextTick(emitReadable_, stream)\n }\n}\nfunction emitReadable_(stream) {\n const state = stream._readableState\n debug('emitReadable_', state.destroyed, state.length, state.ended)\n if (!state.destroyed && !state.errored && (state.length || state.ended)) {\n stream.emit('readable')\n state.emittedReadable = false\n }\n\n // The stream needs another readable event if:\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark\n flow(stream)\n}\n\n// At this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore && state.constructed) {\n state.readingMore = true\n process.nextTick(maybeReadMore_, stream, state)\n }\n}\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (\n !state.reading &&\n !state.ended &&\n (state.length < state.highWaterMark || (state.flowing && state.length === 0))\n ) {\n const len = state.length\n debug('maybeReadMore read 0')\n stream.read(0)\n if (len === state.length)\n // Didn't get any data, stop spinning.\n break\n }\n state.readingMore = false\n}\n\n// Abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_read()')\n}\nReadable.prototype.pipe = function (dest, pipeOpts) {\n const src = this\n const state = this._readableState\n if (state.pipes.length === 1) {\n if (!state.multiAwaitDrain) {\n state.multiAwaitDrain = true\n state.awaitDrainWriters = new SafeSet(state.awaitDrainWriters ? [state.awaitDrainWriters] : [])\n }\n }\n state.pipes.push(dest)\n debug('pipe count=%d opts=%j', state.pipes.length, pipeOpts)\n const doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr\n const endFn = doEnd ? onend : unpipe\n if (state.endEmitted) process.nextTick(endFn)\n else src.once('end', endFn)\n dest.on('unpipe', onunpipe)\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe')\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true\n cleanup()\n }\n }\n }\n function onend() {\n debug('onend')\n dest.end()\n }\n let ondrain\n let cleanedUp = false\n function cleanup() {\n debug('cleanup')\n // Cleanup event handlers once the pipe is broken.\n dest.removeListener('close', onclose)\n dest.removeListener('finish', onfinish)\n if (ondrain) {\n dest.removeListener('drain', ondrain)\n }\n dest.removeListener('error', onerror)\n dest.removeListener('unpipe', onunpipe)\n src.removeListener('end', onend)\n src.removeListener('end', unpipe)\n src.removeListener('data', ondata)\n cleanedUp = true\n\n // If the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (ondrain && state.awaitDrainWriters && (!dest._writableState || dest._writableState.needDrain)) ondrain()\n }\n function pause() {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if (!cleanedUp) {\n if (state.pipes.length === 1 && state.pipes[0] === dest) {\n debug('false write response, pause', 0)\n state.awaitDrainWriters = dest\n state.multiAwaitDrain = false\n } else if (state.pipes.length > 1 && state.pipes.includes(dest)) {\n debug('false write response, pause', state.awaitDrainWriters.size)\n state.awaitDrainWriters.add(dest)\n }\n src.pause()\n }\n if (!ondrain) {\n // When the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n ondrain = pipeOnDrain(src, dest)\n dest.on('drain', ondrain)\n }\n }\n src.on('data', ondata)\n function ondata(chunk) {\n debug('ondata')\n const ret = dest.write(chunk)\n debug('dest.write', ret)\n if (ret === false) {\n pause()\n }\n }\n\n // If the dest has an error, then stop piping into it.\n // However, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er)\n unpipe()\n dest.removeListener('error', onerror)\n if (dest.listenerCount('error') === 0) {\n const s = dest._writableState || dest._readableState\n if (s && !s.errorEmitted) {\n // User incorrectly emitted 'error' directly on the stream.\n errorOrDestroy(dest, er)\n } else {\n dest.emit('error', er)\n }\n }\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror)\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish)\n unpipe()\n }\n dest.once('close', onclose)\n function onfinish() {\n debug('onfinish')\n dest.removeListener('close', onclose)\n unpipe()\n }\n dest.once('finish', onfinish)\n function unpipe() {\n debug('unpipe')\n src.unpipe(dest)\n }\n\n // Tell the dest that it's being piped to.\n dest.emit('pipe', src)\n\n // Start the flow if it hasn't been started already.\n\n if (dest.writableNeedDrain === true) {\n pause()\n } else if (!state.flowing) {\n debug('pipe resume')\n src.resume()\n }\n return dest\n}\nfunction pipeOnDrain(src, dest) {\n return function pipeOnDrainFunctionResult() {\n const state = src._readableState\n\n // `ondrain` will call directly,\n // `this` maybe not a reference to dest,\n // so we use the real dest here.\n if (state.awaitDrainWriters === dest) {\n debug('pipeOnDrain', 1)\n state.awaitDrainWriters = null\n } else if (state.multiAwaitDrain) {\n debug('pipeOnDrain', state.awaitDrainWriters.size)\n state.awaitDrainWriters.delete(dest)\n }\n if ((!state.awaitDrainWriters || state.awaitDrainWriters.size === 0) && src.listenerCount('data')) {\n src.resume()\n }\n }\n}\nReadable.prototype.unpipe = function (dest) {\n const state = this._readableState\n const unpipeInfo = {\n hasUnpiped: false\n }\n\n // If we're not piping anywhere, then do nothing.\n if (state.pipes.length === 0) return this\n if (!dest) {\n // remove all.\n const dests = state.pipes\n state.pipes = []\n this.pause()\n for (let i = 0; i < dests.length; i++)\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n })\n return this\n }\n\n // Try to find the right one.\n const index = ArrayPrototypeIndexOf(state.pipes, dest)\n if (index === -1) return this\n state.pipes.splice(index, 1)\n if (state.pipes.length === 0) this.pause()\n dest.emit('unpipe', this, unpipeInfo)\n return this\n}\n\n// Set up data events if they are asked for\n// Ensure readable listeners eventually get something.\nReadable.prototype.on = function (ev, fn) {\n const res = Stream.prototype.on.call(this, ev, fn)\n const state = this._readableState\n if (ev === 'data') {\n // Update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0\n\n // Try start flowing on next tick if stream isn't explicitly paused.\n if (state.flowing !== false) this.resume()\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true\n state.flowing = false\n state.emittedReadable = false\n debug('on readable', state.length, state.reading)\n if (state.length) {\n emitReadable(this)\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this)\n }\n }\n }\n return res\n}\nReadable.prototype.addListener = Readable.prototype.on\nReadable.prototype.removeListener = function (ev, fn) {\n const res = Stream.prototype.removeListener.call(this, ev, fn)\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this)\n }\n return res\n}\nReadable.prototype.off = Readable.prototype.removeListener\nReadable.prototype.removeAllListeners = function (ev) {\n const res = Stream.prototype.removeAllListeners.apply(this, arguments)\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this)\n }\n return res\n}\nfunction updateReadableListening(self) {\n const state = self._readableState\n state.readableListening = self.listenerCount('readable') > 0\n if (state.resumeScheduled && state[kPaused] === false) {\n // Flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true\n\n // Crude way to check if we should resume.\n } else if (self.listenerCount('data') > 0) {\n self.resume()\n } else if (!state.readableListening) {\n state.flowing = null\n }\n}\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0')\n self.read(0)\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n const state = this._readableState\n if (!state.flowing) {\n debug('resume')\n // We flow only if there is no one listening\n // for readable, but we still have to call\n // resume().\n state.flowing = !state.readableListening\n resume(this, state)\n }\n state[kPaused] = false\n return this\n}\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true\n process.nextTick(resume_, stream, state)\n }\n}\nfunction resume_(stream, state) {\n debug('resume', state.reading)\n if (!state.reading) {\n stream.read(0)\n }\n state.resumeScheduled = false\n stream.emit('resume')\n flow(stream)\n if (state.flowing && !state.reading) stream.read(0)\n}\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing)\n if (this._readableState.flowing !== false) {\n debug('pause')\n this._readableState.flowing = false\n this.emit('pause')\n }\n this._readableState[kPaused] = true\n return this\n}\nfunction flow(stream) {\n const state = stream._readableState\n debug('flow', state.flowing)\n while (state.flowing && stream.read() !== null);\n}\n\n// Wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n let paused = false\n\n // TODO (ronag): Should this.destroy(err) emit\n // 'error' on the wrapped stream? Would require\n // a static factory method, e.g. Readable.wrap(stream).\n\n stream.on('data', (chunk) => {\n if (!this.push(chunk) && stream.pause) {\n paused = true\n stream.pause()\n }\n })\n stream.on('end', () => {\n this.push(null)\n })\n stream.on('error', (err) => {\n errorOrDestroy(this, err)\n })\n stream.on('close', () => {\n this.destroy()\n })\n stream.on('destroy', () => {\n this.destroy()\n })\n this._read = () => {\n if (paused && stream.resume) {\n paused = false\n stream.resume()\n }\n }\n\n // Proxy all the other methods. Important when wrapping filters and duplexes.\n const streamKeys = ObjectKeys(stream)\n for (let j = 1; j < streamKeys.length; j++) {\n const i = streamKeys[j]\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = stream[i].bind(stream)\n }\n }\n return this\n}\nReadable.prototype[SymbolAsyncIterator] = function () {\n return streamToAsyncIterator(this)\n}\nReadable.prototype.iterator = function (options) {\n if (options !== undefined) {\n validateObject(options, 'options')\n }\n return streamToAsyncIterator(this, options)\n}\nfunction streamToAsyncIterator(stream, options) {\n if (typeof stream.read !== 'function') {\n stream = Readable.wrap(stream, {\n objectMode: true\n })\n }\n const iter = createAsyncIterator(stream, options)\n iter.stream = stream\n return iter\n}\nasync function* createAsyncIterator(stream, options) {\n let callback = nop\n function next(resolve) {\n if (this === stream) {\n callback()\n callback = nop\n } else {\n callback = resolve\n }\n }\n stream.on('readable', next)\n let error\n const cleanup = eos(\n stream,\n {\n writable: false\n },\n (err) => {\n error = err ? aggregateTwoErrors(error, err) : null\n callback()\n callback = nop\n }\n )\n try {\n while (true) {\n const chunk = stream.destroyed ? null : stream.read()\n if (chunk !== null) {\n yield chunk\n } else if (error) {\n throw error\n } else if (error === null) {\n return\n } else {\n await new Promise(next)\n }\n }\n } catch (err) {\n error = aggregateTwoErrors(error, err)\n throw error\n } finally {\n if (\n (error || (options === null || options === undefined ? undefined : options.destroyOnReturn) !== false) &&\n (error === undefined || stream._readableState.autoDestroy)\n ) {\n destroyImpl.destroyer(stream, null)\n } else {\n stream.off('readable', next)\n cleanup()\n }\n }\n}\n\n// Making it explicit these properties are not enumerable\n// because otherwise some prototype manipulation in\n// userland will fail.\nObjectDefineProperties(Readable.prototype, {\n readable: {\n __proto__: null,\n get() {\n const r = this._readableState\n // r.readable === false means that this is part of a Duplex stream\n // where the readable side was disabled upon construction.\n // Compat. The user might manually disable readable side through\n // deprecated setter.\n return !!r && r.readable !== false && !r.destroyed && !r.errorEmitted && !r.endEmitted\n },\n set(val) {\n // Backwards compat.\n if (this._readableState) {\n this._readableState.readable = !!val\n }\n }\n },\n readableDidRead: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState.dataEmitted\n }\n },\n readableAborted: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return !!(\n this._readableState.readable !== false &&\n (this._readableState.destroyed || this._readableState.errored) &&\n !this._readableState.endEmitted\n )\n }\n },\n readableHighWaterMark: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState.highWaterMark\n }\n },\n readableBuffer: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState && this._readableState.buffer\n }\n },\n readableFlowing: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return this._readableState.flowing\n },\n set: function (state) {\n if (this._readableState) {\n this._readableState.flowing = state\n }\n }\n },\n readableLength: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState.length\n }\n },\n readableObjectMode: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.objectMode : false\n }\n },\n readableEncoding: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.encoding : null\n }\n },\n errored: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.errored : null\n }\n },\n closed: {\n __proto__: null,\n get() {\n return this._readableState ? this._readableState.closed : false\n }\n },\n destroyed: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.destroyed : false\n },\n set(value) {\n // We ignore the value if the stream\n // has not been initialized yet.\n if (!this._readableState) {\n return\n }\n\n // Backward compatibility, the user is explicitly\n // managing destroyed.\n this._readableState.destroyed = value\n }\n },\n readableEnded: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._readableState ? this._readableState.endEmitted : false\n }\n }\n})\nObjectDefineProperties(ReadableState.prototype, {\n // Legacy getter for `pipesCount`.\n pipesCount: {\n __proto__: null,\n get() {\n return this.pipes.length\n }\n },\n // Legacy property for `paused`.\n paused: {\n __proto__: null,\n get() {\n return this[kPaused] !== false\n },\n set(value) {\n this[kPaused] = !!value\n }\n }\n})\n\n// Exposed for testing purposes only.\nReadable._fromList = fromList\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered.\n if (state.length === 0) return null\n let ret\n if (state.objectMode) ret = state.buffer.shift()\n else if (!n || n >= state.length) {\n // Read it all, truncate the list.\n if (state.decoder) ret = state.buffer.join('')\n else if (state.buffer.length === 1) ret = state.buffer.first()\n else ret = state.buffer.concat(state.length)\n state.buffer.clear()\n } else {\n // read part of list.\n ret = state.buffer.consume(n, state.decoder)\n }\n return ret\n}\nfunction endReadable(stream) {\n const state = stream._readableState\n debug('endReadable', state.endEmitted)\n if (!state.endEmitted) {\n state.ended = true\n process.nextTick(endReadableNT, state, stream)\n }\n}\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length)\n\n // Check that we didn't get one last unshift.\n if (!state.errored && !state.closeEmitted && !state.endEmitted && state.length === 0) {\n state.endEmitted = true\n stream.emit('end')\n if (stream.writable && stream.allowHalfOpen === false) {\n process.nextTick(endWritableNT, stream)\n } else if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well.\n const wState = stream._writableState\n const autoDestroy =\n !wState ||\n (wState.autoDestroy &&\n // We don't expect the writable to ever 'finish'\n // if writable is explicitly set to false.\n (wState.finished || wState.writable === false))\n if (autoDestroy) {\n stream.destroy()\n }\n }\n }\n}\nfunction endWritableNT(stream) {\n const writable = stream.writable && !stream.writableEnded && !stream.destroyed\n if (writable) {\n stream.end()\n }\n}\nReadable.from = function (iterable, opts) {\n return from(Readable, iterable, opts)\n}\nlet webStreamsAdapters\n\n// Lazy to avoid circular references\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined) webStreamsAdapters = {}\n return webStreamsAdapters\n}\nReadable.fromWeb = function (readableStream, options) {\n return lazyWebStreams().newStreamReadableFromReadableStream(readableStream, options)\n}\nReadable.toWeb = function (streamReadable, options) {\n return lazyWebStreams().newReadableStreamFromStreamReadable(streamReadable, options)\n}\nReadable.wrap = function (src, options) {\n var _ref, _src$readableObjectMo\n return new Readable({\n objectMode:\n (_ref =\n (_src$readableObjectMo = src.readableObjectMode) !== null && _src$readableObjectMo !== undefined\n ? _src$readableObjectMo\n : src.objectMode) !== null && _ref !== undefined\n ? _ref\n : true,\n ...options,\n destroy(err, callback) {\n destroyImpl.destroyer(src, err)\n callback(err)\n }\n }).wrap(src)\n}\n","'use strict'\n\nconst { MathFloor, NumberIsInteger } = require('../../ours/primordials')\nconst { validateInteger } = require('../validators')\nconst { ERR_INVALID_ARG_VALUE } = require('../../ours/errors').codes\nlet defaultHighWaterMarkBytes = 16 * 1024\nlet defaultHighWaterMarkObjectMode = 16\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null\n}\nfunction getDefaultHighWaterMark(objectMode) {\n return objectMode ? defaultHighWaterMarkObjectMode : defaultHighWaterMarkBytes\n}\nfunction setDefaultHighWaterMark(objectMode, value) {\n validateInteger(value, 'value', 0)\n if (objectMode) {\n defaultHighWaterMarkObjectMode = value\n } else {\n defaultHighWaterMarkBytes = value\n }\n}\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n const hwm = highWaterMarkFrom(options, isDuplex, duplexKey)\n if (hwm != null) {\n if (!NumberIsInteger(hwm) || hwm < 0) {\n const name = isDuplex ? `options.${duplexKey}` : 'options.highWaterMark'\n throw new ERR_INVALID_ARG_VALUE(name, hwm)\n }\n return MathFloor(hwm)\n }\n\n // Default value\n return getDefaultHighWaterMark(state.objectMode)\n}\nmodule.exports = {\n getHighWaterMark,\n getDefaultHighWaterMark,\n setDefaultHighWaterMark\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict'\n\nconst { ObjectSetPrototypeOf, Symbol } = require('../../ours/primordials')\nmodule.exports = Transform\nconst { ERR_METHOD_NOT_IMPLEMENTED } = require('../../ours/errors').codes\nconst Duplex = require('./duplex')\nconst { getHighWaterMark } = require('./state')\nObjectSetPrototypeOf(Transform.prototype, Duplex.prototype)\nObjectSetPrototypeOf(Transform, Duplex)\nconst kCallback = Symbol('kCallback')\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options)\n\n // TODO (ronag): This should preferably always be\n // applied but would be semver-major. Or even better;\n // make Transform a Readable with the Writable interface.\n const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null\n if (readableHighWaterMark === 0) {\n // A Duplex will buffer both on the writable and readable side while\n // a Transform just wants to buffer hwm number of elements. To avoid\n // buffering twice we disable buffering on the writable side.\n options = {\n ...options,\n highWaterMark: null,\n readableHighWaterMark,\n // TODO (ronag): 0 is not optimal since we have\n // a \"bug\" where we check needDrain before calling _write and not after.\n // Refs: https://github.com/nodejs/node/pull/32887\n // Refs: https://github.com/nodejs/node/pull/35941\n writableHighWaterMark: options.writableHighWaterMark || 0\n }\n }\n Duplex.call(this, options)\n\n // We have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false\n this[kCallback] = null\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform\n if (typeof options.flush === 'function') this._flush = options.flush\n }\n\n // When the writable side finishes, then flush out anything remaining.\n // Backwards compat. Some Transform streams incorrectly implement _final\n // instead of or in addition to _flush. By using 'prefinish' instead of\n // implementing _final we continue supporting this unfortunate use case.\n this.on('prefinish', prefinish)\n}\nfunction final(cb) {\n if (typeof this._flush === 'function' && !this.destroyed) {\n this._flush((er, data) => {\n if (er) {\n if (cb) {\n cb(er)\n } else {\n this.destroy(er)\n }\n return\n }\n if (data != null) {\n this.push(data)\n }\n this.push(null)\n if (cb) {\n cb()\n }\n })\n } else {\n this.push(null)\n if (cb) {\n cb()\n }\n }\n}\nfunction prefinish() {\n if (this._final !== final) {\n final.call(this)\n }\n}\nTransform.prototype._final = final\nTransform.prototype._transform = function (chunk, encoding, callback) {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_transform()')\n}\nTransform.prototype._write = function (chunk, encoding, callback) {\n const rState = this._readableState\n const wState = this._writableState\n const length = rState.length\n this._transform(chunk, encoding, (err, val) => {\n if (err) {\n callback(err)\n return\n }\n if (val != null) {\n this.push(val)\n }\n if (\n wState.ended ||\n // Backwards compat.\n length === rState.length ||\n // Backwards compat.\n rState.length < rState.highWaterMark\n ) {\n callback()\n } else {\n this[kCallback] = callback\n }\n })\n}\nTransform.prototype._read = function () {\n if (this[kCallback]) {\n const callback = this[kCallback]\n this[kCallback] = null\n callback()\n }\n}\n","'use strict'\n\nconst { SymbolAsyncIterator, SymbolIterator, SymbolFor } = require('../../ours/primordials')\n\n// We need to use SymbolFor to make these globally available\n// for interopt with readable-stream, i.e. readable-stream\n// and node core needs to be able to read/write private state\n// from each other for proper interoperability.\nconst kIsDestroyed = SymbolFor('nodejs.stream.destroyed')\nconst kIsErrored = SymbolFor('nodejs.stream.errored')\nconst kIsReadable = SymbolFor('nodejs.stream.readable')\nconst kIsWritable = SymbolFor('nodejs.stream.writable')\nconst kIsDisturbed = SymbolFor('nodejs.stream.disturbed')\nconst kIsClosedPromise = SymbolFor('nodejs.webstream.isClosedPromise')\nconst kControllerErrorFunction = SymbolFor('nodejs.webstream.controllerErrorFunction')\nfunction isReadableNodeStream(obj, strict = false) {\n var _obj$_readableState\n return !!(\n (\n obj &&\n typeof obj.pipe === 'function' &&\n typeof obj.on === 'function' &&\n (!strict || (typeof obj.pause === 'function' && typeof obj.resume === 'function')) &&\n (!obj._writableState ||\n ((_obj$_readableState = obj._readableState) === null || _obj$_readableState === undefined\n ? undefined\n : _obj$_readableState.readable) !== false) &&\n // Duplex\n (!obj._writableState || obj._readableState)\n ) // Writable has .pipe.\n )\n}\n\nfunction isWritableNodeStream(obj) {\n var _obj$_writableState\n return !!(\n (\n obj &&\n typeof obj.write === 'function' &&\n typeof obj.on === 'function' &&\n (!obj._readableState ||\n ((_obj$_writableState = obj._writableState) === null || _obj$_writableState === undefined\n ? undefined\n : _obj$_writableState.writable) !== false)\n ) // Duplex\n )\n}\n\nfunction isDuplexNodeStream(obj) {\n return !!(\n obj &&\n typeof obj.pipe === 'function' &&\n obj._readableState &&\n typeof obj.on === 'function' &&\n typeof obj.write === 'function'\n )\n}\nfunction isNodeStream(obj) {\n return (\n obj &&\n (obj._readableState ||\n obj._writableState ||\n (typeof obj.write === 'function' && typeof obj.on === 'function') ||\n (typeof obj.pipe === 'function' && typeof obj.on === 'function'))\n )\n}\nfunction isReadableStream(obj) {\n return !!(\n obj &&\n !isNodeStream(obj) &&\n typeof obj.pipeThrough === 'function' &&\n typeof obj.getReader === 'function' &&\n typeof obj.cancel === 'function'\n )\n}\nfunction isWritableStream(obj) {\n return !!(obj && !isNodeStream(obj) && typeof obj.getWriter === 'function' && typeof obj.abort === 'function')\n}\nfunction isTransformStream(obj) {\n return !!(obj && !isNodeStream(obj) && typeof obj.readable === 'object' && typeof obj.writable === 'object')\n}\nfunction isWebStream(obj) {\n return isReadableStream(obj) || isWritableStream(obj) || isTransformStream(obj)\n}\nfunction isIterable(obj, isAsync) {\n if (obj == null) return false\n if (isAsync === true) return typeof obj[SymbolAsyncIterator] === 'function'\n if (isAsync === false) return typeof obj[SymbolIterator] === 'function'\n return typeof obj[SymbolAsyncIterator] === 'function' || typeof obj[SymbolIterator] === 'function'\n}\nfunction isDestroyed(stream) {\n if (!isNodeStream(stream)) return null\n const wState = stream._writableState\n const rState = stream._readableState\n const state = wState || rState\n return !!(stream.destroyed || stream[kIsDestroyed] || (state !== null && state !== undefined && state.destroyed))\n}\n\n// Have been end():d.\nfunction isWritableEnded(stream) {\n if (!isWritableNodeStream(stream)) return null\n if (stream.writableEnded === true) return true\n const wState = stream._writableState\n if (wState !== null && wState !== undefined && wState.errored) return false\n if (typeof (wState === null || wState === undefined ? undefined : wState.ended) !== 'boolean') return null\n return wState.ended\n}\n\n// Have emitted 'finish'.\nfunction isWritableFinished(stream, strict) {\n if (!isWritableNodeStream(stream)) return null\n if (stream.writableFinished === true) return true\n const wState = stream._writableState\n if (wState !== null && wState !== undefined && wState.errored) return false\n if (typeof (wState === null || wState === undefined ? undefined : wState.finished) !== 'boolean') return null\n return !!(wState.finished || (strict === false && wState.ended === true && wState.length === 0))\n}\n\n// Have been push(null):d.\nfunction isReadableEnded(stream) {\n if (!isReadableNodeStream(stream)) return null\n if (stream.readableEnded === true) return true\n const rState = stream._readableState\n if (!rState || rState.errored) return false\n if (typeof (rState === null || rState === undefined ? undefined : rState.ended) !== 'boolean') return null\n return rState.ended\n}\n\n// Have emitted 'end'.\nfunction isReadableFinished(stream, strict) {\n if (!isReadableNodeStream(stream)) return null\n const rState = stream._readableState\n if (rState !== null && rState !== undefined && rState.errored) return false\n if (typeof (rState === null || rState === undefined ? undefined : rState.endEmitted) !== 'boolean') return null\n return !!(rState.endEmitted || (strict === false && rState.ended === true && rState.length === 0))\n}\nfunction isReadable(stream) {\n if (stream && stream[kIsReadable] != null) return stream[kIsReadable]\n if (typeof (stream === null || stream === undefined ? undefined : stream.readable) !== 'boolean') return null\n if (isDestroyed(stream)) return false\n return isReadableNodeStream(stream) && stream.readable && !isReadableFinished(stream)\n}\nfunction isWritable(stream) {\n if (stream && stream[kIsWritable] != null) return stream[kIsWritable]\n if (typeof (stream === null || stream === undefined ? undefined : stream.writable) !== 'boolean') return null\n if (isDestroyed(stream)) return false\n return isWritableNodeStream(stream) && stream.writable && !isWritableEnded(stream)\n}\nfunction isFinished(stream, opts) {\n if (!isNodeStream(stream)) {\n return null\n }\n if (isDestroyed(stream)) {\n return true\n }\n if ((opts === null || opts === undefined ? undefined : opts.readable) !== false && isReadable(stream)) {\n return false\n }\n if ((opts === null || opts === undefined ? undefined : opts.writable) !== false && isWritable(stream)) {\n return false\n }\n return true\n}\nfunction isWritableErrored(stream) {\n var _stream$_writableStat, _stream$_writableStat2\n if (!isNodeStream(stream)) {\n return null\n }\n if (stream.writableErrored) {\n return stream.writableErrored\n }\n return (_stream$_writableStat =\n (_stream$_writableStat2 = stream._writableState) === null || _stream$_writableStat2 === undefined\n ? undefined\n : _stream$_writableStat2.errored) !== null && _stream$_writableStat !== undefined\n ? _stream$_writableStat\n : null\n}\nfunction isReadableErrored(stream) {\n var _stream$_readableStat, _stream$_readableStat2\n if (!isNodeStream(stream)) {\n return null\n }\n if (stream.readableErrored) {\n return stream.readableErrored\n }\n return (_stream$_readableStat =\n (_stream$_readableStat2 = stream._readableState) === null || _stream$_readableStat2 === undefined\n ? undefined\n : _stream$_readableStat2.errored) !== null && _stream$_readableStat !== undefined\n ? _stream$_readableStat\n : null\n}\nfunction isClosed(stream) {\n if (!isNodeStream(stream)) {\n return null\n }\n if (typeof stream.closed === 'boolean') {\n return stream.closed\n }\n const wState = stream._writableState\n const rState = stream._readableState\n if (\n typeof (wState === null || wState === undefined ? undefined : wState.closed) === 'boolean' ||\n typeof (rState === null || rState === undefined ? undefined : rState.closed) === 'boolean'\n ) {\n return (\n (wState === null || wState === undefined ? undefined : wState.closed) ||\n (rState === null || rState === undefined ? undefined : rState.closed)\n )\n }\n if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) {\n return stream._closed\n }\n return null\n}\nfunction isOutgoingMessage(stream) {\n return (\n typeof stream._closed === 'boolean' &&\n typeof stream._defaultKeepAlive === 'boolean' &&\n typeof stream._removedConnection === 'boolean' &&\n typeof stream._removedContLen === 'boolean'\n )\n}\nfunction isServerResponse(stream) {\n return typeof stream._sent100 === 'boolean' && isOutgoingMessage(stream)\n}\nfunction isServerRequest(stream) {\n var _stream$req\n return (\n typeof stream._consuming === 'boolean' &&\n typeof stream._dumped === 'boolean' &&\n ((_stream$req = stream.req) === null || _stream$req === undefined ? undefined : _stream$req.upgradeOrConnect) ===\n undefined\n )\n}\nfunction willEmitClose(stream) {\n if (!isNodeStream(stream)) return null\n const wState = stream._writableState\n const rState = stream._readableState\n const state = wState || rState\n return (\n (!state && isServerResponse(stream)) || !!(state && state.autoDestroy && state.emitClose && state.closed === false)\n )\n}\nfunction isDisturbed(stream) {\n var _stream$kIsDisturbed\n return !!(\n stream &&\n ((_stream$kIsDisturbed = stream[kIsDisturbed]) !== null && _stream$kIsDisturbed !== undefined\n ? _stream$kIsDisturbed\n : stream.readableDidRead || stream.readableAborted)\n )\n}\nfunction isErrored(stream) {\n var _ref,\n _ref2,\n _ref3,\n _ref4,\n _ref5,\n _stream$kIsErrored,\n _stream$_readableStat3,\n _stream$_writableStat3,\n _stream$_readableStat4,\n _stream$_writableStat4\n return !!(\n stream &&\n ((_ref =\n (_ref2 =\n (_ref3 =\n (_ref4 =\n (_ref5 =\n (_stream$kIsErrored = stream[kIsErrored]) !== null && _stream$kIsErrored !== undefined\n ? _stream$kIsErrored\n : stream.readableErrored) !== null && _ref5 !== undefined\n ? _ref5\n : stream.writableErrored) !== null && _ref4 !== undefined\n ? _ref4\n : (_stream$_readableStat3 = stream._readableState) === null || _stream$_readableStat3 === undefined\n ? undefined\n : _stream$_readableStat3.errorEmitted) !== null && _ref3 !== undefined\n ? _ref3\n : (_stream$_writableStat3 = stream._writableState) === null || _stream$_writableStat3 === undefined\n ? undefined\n : _stream$_writableStat3.errorEmitted) !== null && _ref2 !== undefined\n ? _ref2\n : (_stream$_readableStat4 = stream._readableState) === null || _stream$_readableStat4 === undefined\n ? undefined\n : _stream$_readableStat4.errored) !== null && _ref !== undefined\n ? _ref\n : (_stream$_writableStat4 = stream._writableState) === null || _stream$_writableStat4 === undefined\n ? undefined\n : _stream$_writableStat4.errored)\n )\n}\nmodule.exports = {\n isDestroyed,\n kIsDestroyed,\n isDisturbed,\n kIsDisturbed,\n isErrored,\n kIsErrored,\n isReadable,\n kIsReadable,\n kIsClosedPromise,\n kControllerErrorFunction,\n kIsWritable,\n isClosed,\n isDuplexNodeStream,\n isFinished,\n isIterable,\n isReadableNodeStream,\n isReadableStream,\n isReadableEnded,\n isReadableFinished,\n isReadableErrored,\n isNodeStream,\n isWebStream,\n isWritable,\n isWritableNodeStream,\n isWritableStream,\n isWritableEnded,\n isWritableFinished,\n isWritableErrored,\n isServerRequest,\n isServerResponse,\n willEmitClose,\n isTransformStream\n}\n","/* replacement start */\n\nconst process = require('process/')\n\n/* replacement end */\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n;('use strict')\nconst {\n ArrayPrototypeSlice,\n Error,\n FunctionPrototypeSymbolHasInstance,\n ObjectDefineProperty,\n ObjectDefineProperties,\n ObjectSetPrototypeOf,\n StringPrototypeToLowerCase,\n Symbol,\n SymbolHasInstance\n} = require('../../ours/primordials')\nmodule.exports = Writable\nWritable.WritableState = WritableState\nconst { EventEmitter: EE } = require('events')\nconst Stream = require('./legacy').Stream\nconst { Buffer } = require('buffer')\nconst destroyImpl = require('./destroy')\nconst { addAbortSignal } = require('./add-abort-signal')\nconst { getHighWaterMark, getDefaultHighWaterMark } = require('./state')\nconst {\n ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED,\n ERR_STREAM_ALREADY_FINISHED,\n ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING\n} = require('../../ours/errors').codes\nconst { errorOrDestroy } = destroyImpl\nObjectSetPrototypeOf(Writable.prototype, Stream.prototype)\nObjectSetPrototypeOf(Writable, Stream)\nfunction nop() {}\nconst kOnFinished = Symbol('kOnFinished')\nfunction WritableState(options, stream, isDuplex) {\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof require('./duplex')\n\n // Object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!(options && options.objectMode)\n if (isDuplex) this.objectMode = this.objectMode || !!(options && options.writableObjectMode)\n\n // The point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write().\n this.highWaterMark = options\n ? getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex)\n : getDefaultHighWaterMark(false)\n\n // if _final has been called.\n this.finalCalled = false\n\n // drain event flag.\n this.needDrain = false\n // At the start of calling end()\n this.ending = false\n // When end() has been called, and returned.\n this.ended = false\n // When 'finish' is emitted.\n this.finished = false\n\n // Has it been destroyed\n this.destroyed = false\n\n // Should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n const noDecode = !!(options && options.decodeStrings === false)\n this.decodeStrings = !noDecode\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = (options && options.defaultEncoding) || 'utf8'\n\n // Not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0\n\n // A flag to see when we're in the middle of a write.\n this.writing = false\n\n // When true all writes will be buffered until .uncork() call.\n this.corked = 0\n\n // A flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true\n\n // A flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false\n\n // The callback that's passed to _write(chunk, cb).\n this.onwrite = onwrite.bind(undefined, stream)\n\n // The callback that the user supplies to write(chunk, encoding, cb).\n this.writecb = null\n\n // The amount that is being written when _write is called.\n this.writelen = 0\n\n // Storage for data passed to the afterWrite() callback in case of\n // synchronous _write() completion.\n this.afterWriteTickInfo = null\n resetBuffer(this)\n\n // Number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted.\n this.pendingcb = 0\n\n // Stream is still being constructed and cannot be\n // destroyed until construction finished or failed.\n // Async construction is opt in, therefore we start as\n // constructed.\n this.constructed = true\n\n // Emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams.\n this.prefinished = false\n\n // True if the error was already emitted and should not be thrown again.\n this.errorEmitted = false\n\n // Should close be emitted on destroy. Defaults to true.\n this.emitClose = !options || options.emitClose !== false\n\n // Should .destroy() be called after 'finish' (and potentially 'end').\n this.autoDestroy = !options || options.autoDestroy !== false\n\n // Indicates whether the stream has errored. When true all write() calls\n // should return false. This is needed since when autoDestroy\n // is disabled we need a way to tell whether the stream has failed.\n this.errored = null\n\n // Indicates whether the stream has finished destroying.\n this.closed = false\n\n // True if close has been emitted or would have been emitted\n // depending on emitClose.\n this.closeEmitted = false\n this[kOnFinished] = []\n}\nfunction resetBuffer(state) {\n state.buffered = []\n state.bufferedIndex = 0\n state.allBuffers = true\n state.allNoop = true\n}\nWritableState.prototype.getBuffer = function getBuffer() {\n return ArrayPrototypeSlice(this.buffered, this.bufferedIndex)\n}\nObjectDefineProperty(WritableState.prototype, 'bufferedRequestCount', {\n __proto__: null,\n get() {\n return this.buffered.length - this.bufferedIndex\n }\n})\nfunction Writable(options) {\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5.\n const isDuplex = this instanceof require('./duplex')\n if (!isDuplex && !FunctionPrototypeSymbolHasInstance(Writable, this)) return new Writable(options)\n this._writableState = new WritableState(options, this, isDuplex)\n if (options) {\n if (typeof options.write === 'function') this._write = options.write\n if (typeof options.writev === 'function') this._writev = options.writev\n if (typeof options.destroy === 'function') this._destroy = options.destroy\n if (typeof options.final === 'function') this._final = options.final\n if (typeof options.construct === 'function') this._construct = options.construct\n if (options.signal) addAbortSignal(options.signal, this)\n }\n Stream.call(this, options)\n destroyImpl.construct(this, () => {\n const state = this._writableState\n if (!state.writing) {\n clearBuffer(this, state)\n }\n finishMaybe(this, state)\n })\n}\nObjectDefineProperty(Writable, SymbolHasInstance, {\n __proto__: null,\n value: function (object) {\n if (FunctionPrototypeSymbolHasInstance(this, object)) return true\n if (this !== Writable) return false\n return object && object._writableState instanceof WritableState\n }\n})\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE())\n}\nfunction _write(stream, chunk, encoding, cb) {\n const state = stream._writableState\n if (typeof encoding === 'function') {\n cb = encoding\n encoding = state.defaultEncoding\n } else {\n if (!encoding) encoding = state.defaultEncoding\n else if (encoding !== 'buffer' && !Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding)\n if (typeof cb !== 'function') cb = nop\n }\n if (chunk === null) {\n throw new ERR_STREAM_NULL_VALUES()\n } else if (!state.objectMode) {\n if (typeof chunk === 'string') {\n if (state.decodeStrings !== false) {\n chunk = Buffer.from(chunk, encoding)\n encoding = 'buffer'\n }\n } else if (chunk instanceof Buffer) {\n encoding = 'buffer'\n } else if (Stream._isUint8Array(chunk)) {\n chunk = Stream._uint8ArrayToBuffer(chunk)\n encoding = 'buffer'\n } else {\n throw new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk)\n }\n }\n let err\n if (state.ending) {\n err = new ERR_STREAM_WRITE_AFTER_END()\n } else if (state.destroyed) {\n err = new ERR_STREAM_DESTROYED('write')\n }\n if (err) {\n process.nextTick(cb, err)\n errorOrDestroy(stream, err, true)\n return err\n }\n state.pendingcb++\n return writeOrBuffer(stream, state, chunk, encoding, cb)\n}\nWritable.prototype.write = function (chunk, encoding, cb) {\n return _write(this, chunk, encoding, cb) === true\n}\nWritable.prototype.cork = function () {\n this._writableState.corked++\n}\nWritable.prototype.uncork = function () {\n const state = this._writableState\n if (state.corked) {\n state.corked--\n if (!state.writing) clearBuffer(this, state)\n }\n}\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = StringPrototypeToLowerCase(encoding)\n if (!Buffer.isEncoding(encoding)) throw new ERR_UNKNOWN_ENCODING(encoding)\n this._writableState.defaultEncoding = encoding\n return this\n}\n\n// If we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, chunk, encoding, callback) {\n const len = state.objectMode ? 1 : chunk.length\n state.length += len\n\n // stream._write resets state.length\n const ret = state.length < state.highWaterMark\n // We must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true\n if (state.writing || state.corked || state.errored || !state.constructed) {\n state.buffered.push({\n chunk,\n encoding,\n callback\n })\n if (state.allBuffers && encoding !== 'buffer') {\n state.allBuffers = false\n }\n if (state.allNoop && callback !== nop) {\n state.allNoop = false\n }\n } else {\n state.writelen = len\n state.writecb = callback\n state.writing = true\n state.sync = true\n stream._write(chunk, encoding, state.onwrite)\n state.sync = false\n }\n\n // Return false if errored or destroyed in order to break\n // any synchronous while(stream.write(data)) loops.\n return ret && !state.errored && !state.destroyed\n}\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len\n state.writecb = cb\n state.writing = true\n state.sync = true\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'))\n else if (writev) stream._writev(chunk, state.onwrite)\n else stream._write(chunk, encoding, state.onwrite)\n state.sync = false\n}\nfunction onwriteError(stream, state, er, cb) {\n --state.pendingcb\n cb(er)\n // Ensure callbacks are invoked even when autoDestroy is\n // not enabled. Passing `er` here doesn't make sense since\n // it's related to one specific write, not to the buffered\n // writes.\n errorBuffer(state)\n // This can emit error, but error must always follow cb.\n errorOrDestroy(stream, er)\n}\nfunction onwrite(stream, er) {\n const state = stream._writableState\n const sync = state.sync\n const cb = state.writecb\n if (typeof cb !== 'function') {\n errorOrDestroy(stream, new ERR_MULTIPLE_CALLBACK())\n return\n }\n state.writing = false\n state.writecb = null\n state.length -= state.writelen\n state.writelen = 0\n if (er) {\n // Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364\n er.stack // eslint-disable-line no-unused-expressions\n\n if (!state.errored) {\n state.errored = er\n }\n\n // In case of duplex streams we need to notify the readable side of the\n // error.\n if (stream._readableState && !stream._readableState.errored) {\n stream._readableState.errored = er\n }\n if (sync) {\n process.nextTick(onwriteError, stream, state, er, cb)\n } else {\n onwriteError(stream, state, er, cb)\n }\n } else {\n if (state.buffered.length > state.bufferedIndex) {\n clearBuffer(stream, state)\n }\n if (sync) {\n // It is a common case that the callback passed to .write() is always\n // the same. In that case, we do not schedule a new nextTick(), but\n // rather just increase a counter, to improve performance and avoid\n // memory allocations.\n if (state.afterWriteTickInfo !== null && state.afterWriteTickInfo.cb === cb) {\n state.afterWriteTickInfo.count++\n } else {\n state.afterWriteTickInfo = {\n count: 1,\n cb,\n stream,\n state\n }\n process.nextTick(afterWriteTick, state.afterWriteTickInfo)\n }\n } else {\n afterWrite(stream, state, 1, cb)\n }\n }\n}\nfunction afterWriteTick({ stream, state, count, cb }) {\n state.afterWriteTickInfo = null\n return afterWrite(stream, state, count, cb)\n}\nfunction afterWrite(stream, state, count, cb) {\n const needDrain = !state.ending && !stream.destroyed && state.length === 0 && state.needDrain\n if (needDrain) {\n state.needDrain = false\n stream.emit('drain')\n }\n while (count-- > 0) {\n state.pendingcb--\n cb()\n }\n if (state.destroyed) {\n errorBuffer(state)\n }\n finishMaybe(stream, state)\n}\n\n// If there's something in the buffer waiting, then invoke callbacks.\nfunction errorBuffer(state) {\n if (state.writing) {\n return\n }\n for (let n = state.bufferedIndex; n < state.buffered.length; ++n) {\n var _state$errored\n const { chunk, callback } = state.buffered[n]\n const len = state.objectMode ? 1 : chunk.length\n state.length -= len\n callback(\n (_state$errored = state.errored) !== null && _state$errored !== undefined\n ? _state$errored\n : new ERR_STREAM_DESTROYED('write')\n )\n }\n const onfinishCallbacks = state[kOnFinished].splice(0)\n for (let i = 0; i < onfinishCallbacks.length; i++) {\n var _state$errored2\n onfinishCallbacks[i](\n (_state$errored2 = state.errored) !== null && _state$errored2 !== undefined\n ? _state$errored2\n : new ERR_STREAM_DESTROYED('end')\n )\n }\n resetBuffer(state)\n}\n\n// If there's something in the buffer waiting, then process it.\nfunction clearBuffer(stream, state) {\n if (state.corked || state.bufferProcessing || state.destroyed || !state.constructed) {\n return\n }\n const { buffered, bufferedIndex, objectMode } = state\n const bufferedLength = buffered.length - bufferedIndex\n if (!bufferedLength) {\n return\n }\n let i = bufferedIndex\n state.bufferProcessing = true\n if (bufferedLength > 1 && stream._writev) {\n state.pendingcb -= bufferedLength - 1\n const callback = state.allNoop\n ? nop\n : (err) => {\n for (let n = i; n < buffered.length; ++n) {\n buffered[n].callback(err)\n }\n }\n // Make a copy of `buffered` if it's going to be used by `callback` above,\n // since `doWrite` will mutate the array.\n const chunks = state.allNoop && i === 0 ? buffered : ArrayPrototypeSlice(buffered, i)\n chunks.allBuffers = state.allBuffers\n doWrite(stream, state, true, state.length, chunks, '', callback)\n resetBuffer(state)\n } else {\n do {\n const { chunk, encoding, callback } = buffered[i]\n buffered[i++] = null\n const len = objectMode ? 1 : chunk.length\n doWrite(stream, state, false, len, chunk, encoding, callback)\n } while (i < buffered.length && !state.writing)\n if (i === buffered.length) {\n resetBuffer(state)\n } else if (i > 256) {\n buffered.splice(0, i)\n state.bufferedIndex = 0\n } else {\n state.bufferedIndex = i\n }\n }\n state.bufferProcessing = false\n}\nWritable.prototype._write = function (chunk, encoding, cb) {\n if (this._writev) {\n this._writev(\n [\n {\n chunk,\n encoding\n }\n ],\n cb\n )\n } else {\n throw new ERR_METHOD_NOT_IMPLEMENTED('_write()')\n }\n}\nWritable.prototype._writev = null\nWritable.prototype.end = function (chunk, encoding, cb) {\n const state = this._writableState\n if (typeof chunk === 'function') {\n cb = chunk\n chunk = null\n encoding = null\n } else if (typeof encoding === 'function') {\n cb = encoding\n encoding = null\n }\n let err\n if (chunk !== null && chunk !== undefined) {\n const ret = _write(this, chunk, encoding)\n if (ret instanceof Error) {\n err = ret\n }\n }\n\n // .end() fully uncorks.\n if (state.corked) {\n state.corked = 1\n this.uncork()\n }\n if (err) {\n // Do nothing...\n } else if (!state.errored && !state.ending) {\n // This is forgiving in terms of unnecessary calls to end() and can hide\n // logic errors. However, usually such errors are harmless and causing a\n // hard error can be disproportionately destructive. It is not always\n // trivial for the user to determine whether end() needs to be called\n // or not.\n\n state.ending = true\n finishMaybe(this, state, true)\n state.ended = true\n } else if (state.finished) {\n err = new ERR_STREAM_ALREADY_FINISHED('end')\n } else if (state.destroyed) {\n err = new ERR_STREAM_DESTROYED('end')\n }\n if (typeof cb === 'function') {\n if (err || state.finished) {\n process.nextTick(cb, err)\n } else {\n state[kOnFinished].push(cb)\n }\n }\n return this\n}\nfunction needFinish(state) {\n return (\n state.ending &&\n !state.destroyed &&\n state.constructed &&\n state.length === 0 &&\n !state.errored &&\n state.buffered.length === 0 &&\n !state.finished &&\n !state.writing &&\n !state.errorEmitted &&\n !state.closeEmitted\n )\n}\nfunction callFinal(stream, state) {\n let called = false\n function onFinish(err) {\n if (called) {\n errorOrDestroy(stream, err !== null && err !== undefined ? err : ERR_MULTIPLE_CALLBACK())\n return\n }\n called = true\n state.pendingcb--\n if (err) {\n const onfinishCallbacks = state[kOnFinished].splice(0)\n for (let i = 0; i < onfinishCallbacks.length; i++) {\n onfinishCallbacks[i](err)\n }\n errorOrDestroy(stream, err, state.sync)\n } else if (needFinish(state)) {\n state.prefinished = true\n stream.emit('prefinish')\n // Backwards compat. Don't check state.sync here.\n // Some streams assume 'finish' will be emitted\n // asynchronously relative to _final callback.\n state.pendingcb++\n process.nextTick(finish, stream, state)\n }\n }\n state.sync = true\n state.pendingcb++\n try {\n stream._final(onFinish)\n } catch (err) {\n onFinish(err)\n }\n state.sync = false\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.finalCalled = true\n callFinal(stream, state)\n } else {\n state.prefinished = true\n stream.emit('prefinish')\n }\n }\n}\nfunction finishMaybe(stream, state, sync) {\n if (needFinish(state)) {\n prefinish(stream, state)\n if (state.pendingcb === 0) {\n if (sync) {\n state.pendingcb++\n process.nextTick(\n (stream, state) => {\n if (needFinish(state)) {\n finish(stream, state)\n } else {\n state.pendingcb--\n }\n },\n stream,\n state\n )\n } else if (needFinish(state)) {\n state.pendingcb++\n finish(stream, state)\n }\n }\n }\n}\nfunction finish(stream, state) {\n state.pendingcb--\n state.finished = true\n const onfinishCallbacks = state[kOnFinished].splice(0)\n for (let i = 0; i < onfinishCallbacks.length; i++) {\n onfinishCallbacks[i]()\n }\n stream.emit('finish')\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well.\n const rState = stream._readableState\n const autoDestroy =\n !rState ||\n (rState.autoDestroy &&\n // We don't expect the readable to ever 'end'\n // if readable is explicitly set to false.\n (rState.endEmitted || rState.readable === false))\n if (autoDestroy) {\n stream.destroy()\n }\n }\n}\nObjectDefineProperties(Writable.prototype, {\n closed: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.closed : false\n }\n },\n destroyed: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.destroyed : false\n },\n set(value) {\n // Backward compatibility, the user is explicitly managing destroyed.\n if (this._writableState) {\n this._writableState.destroyed = value\n }\n }\n },\n writable: {\n __proto__: null,\n get() {\n const w = this._writableState\n // w.writable === false means that this is part of a Duplex stream\n // where the writable side was disabled upon construction.\n // Compat. The user might manually disable writable side through\n // deprecated setter.\n return !!w && w.writable !== false && !w.destroyed && !w.errored && !w.ending && !w.ended\n },\n set(val) {\n // Backwards compatible.\n if (this._writableState) {\n this._writableState.writable = !!val\n }\n }\n },\n writableFinished: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.finished : false\n }\n },\n writableObjectMode: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.objectMode : false\n }\n },\n writableBuffer: {\n __proto__: null,\n get() {\n return this._writableState && this._writableState.getBuffer()\n }\n },\n writableEnded: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.ending : false\n }\n },\n writableNeedDrain: {\n __proto__: null,\n get() {\n const wState = this._writableState\n if (!wState) return false\n return !wState.destroyed && !wState.ending && wState.needDrain\n }\n },\n writableHighWaterMark: {\n __proto__: null,\n get() {\n return this._writableState && this._writableState.highWaterMark\n }\n },\n writableCorked: {\n __proto__: null,\n get() {\n return this._writableState ? this._writableState.corked : 0\n }\n },\n writableLength: {\n __proto__: null,\n get() {\n return this._writableState && this._writableState.length\n }\n },\n errored: {\n __proto__: null,\n enumerable: false,\n get() {\n return this._writableState ? this._writableState.errored : null\n }\n },\n writableAborted: {\n __proto__: null,\n enumerable: false,\n get: function () {\n return !!(\n this._writableState.writable !== false &&\n (this._writableState.destroyed || this._writableState.errored) &&\n !this._writableState.finished\n )\n }\n }\n})\nconst destroy = destroyImpl.destroy\nWritable.prototype.destroy = function (err, cb) {\n const state = this._writableState\n\n // Invoke pending callbacks.\n if (!state.destroyed && (state.bufferedIndex < state.buffered.length || state[kOnFinished].length)) {\n process.nextTick(errorBuffer, state)\n }\n destroy.call(this, err, cb)\n return this\n}\nWritable.prototype._undestroy = destroyImpl.undestroy\nWritable.prototype._destroy = function (err, cb) {\n cb(err)\n}\nWritable.prototype[EE.captureRejectionSymbol] = function (err) {\n this.destroy(err)\n}\nlet webStreamsAdapters\n\n// Lazy to avoid circular references\nfunction lazyWebStreams() {\n if (webStreamsAdapters === undefined) webStreamsAdapters = {}\n return webStreamsAdapters\n}\nWritable.fromWeb = function (writableStream, options) {\n return lazyWebStreams().newStreamWritableFromWritableStream(writableStream, options)\n}\nWritable.toWeb = function (streamWritable) {\n return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable)\n}\n","/* eslint jsdoc/require-jsdoc: \"error\" */\n\n'use strict'\n\nconst {\n ArrayIsArray,\n ArrayPrototypeIncludes,\n ArrayPrototypeJoin,\n ArrayPrototypeMap,\n NumberIsInteger,\n NumberIsNaN,\n NumberMAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER,\n NumberParseInt,\n ObjectPrototypeHasOwnProperty,\n RegExpPrototypeExec,\n String,\n StringPrototypeToUpperCase,\n StringPrototypeTrim\n} = require('../ours/primordials')\nconst {\n hideStackFrames,\n codes: { ERR_SOCKET_BAD_PORT, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, ERR_OUT_OF_RANGE, ERR_UNKNOWN_SIGNAL }\n} = require('../ours/errors')\nconst { normalizeEncoding } = require('../ours/util')\nconst { isAsyncFunction, isArrayBufferView } = require('../ours/util').types\nconst signals = {}\n\n/**\n * @param {*} value\n * @returns {boolean}\n */\nfunction isInt32(value) {\n return value === (value | 0)\n}\n\n/**\n * @param {*} value\n * @returns {boolean}\n */\nfunction isUint32(value) {\n return value === value >>> 0\n}\nconst octalReg = /^[0-7]+$/\nconst modeDesc = 'must be a 32-bit unsigned integer or an octal string'\n\n/**\n * Parse and validate values that will be converted into mode_t (the S_*\n * constants). Only valid numbers and octal strings are allowed. They could be\n * converted to 32-bit unsigned integers or non-negative signed integers in the\n * C++ land, but any value higher than 0o777 will result in platform-specific\n * behaviors.\n * @param {*} value Values to be validated\n * @param {string} name Name of the argument\n * @param {number} [def] If specified, will be returned for invalid values\n * @returns {number}\n */\nfunction parseFileMode(value, name, def) {\n if (typeof value === 'undefined') {\n value = def\n }\n if (typeof value === 'string') {\n if (RegExpPrototypeExec(octalReg, value) === null) {\n throw new ERR_INVALID_ARG_VALUE(name, value, modeDesc)\n }\n value = NumberParseInt(value, 8)\n }\n validateUint32(value, name)\n return value\n}\n\n/**\n * @callback validateInteger\n * @param {*} value\n * @param {string} name\n * @param {number} [min]\n * @param {number} [max]\n * @returns {asserts value is number}\n */\n\n/** @type {validateInteger} */\nconst validateInteger = hideStackFrames((value, name, min = NumberMIN_SAFE_INTEGER, max = NumberMAX_SAFE_INTEGER) => {\n if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n if (!NumberIsInteger(value)) throw new ERR_OUT_OF_RANGE(name, 'an integer', value)\n if (value < min || value > max) throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value)\n})\n\n/**\n * @callback validateInt32\n * @param {*} value\n * @param {string} name\n * @param {number} [min]\n * @param {number} [max]\n * @returns {asserts value is number}\n */\n\n/** @type {validateInt32} */\nconst validateInt32 = hideStackFrames((value, name, min = -2147483648, max = 2147483647) => {\n // The defaults for min and max correspond to the limits of 32-bit integers.\n if (typeof value !== 'number') {\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n if (!NumberIsInteger(value)) {\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value)\n }\n if (value < min || value > max) {\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value)\n }\n})\n\n/**\n * @callback validateUint32\n * @param {*} value\n * @param {string} name\n * @param {number|boolean} [positive=false]\n * @returns {asserts value is number}\n */\n\n/** @type {validateUint32} */\nconst validateUint32 = hideStackFrames((value, name, positive = false) => {\n if (typeof value !== 'number') {\n throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n if (!NumberIsInteger(value)) {\n throw new ERR_OUT_OF_RANGE(name, 'an integer', value)\n }\n const min = positive ? 1 : 0\n // 2 ** 32 === 4294967296\n const max = 4294967295\n if (value < min || value > max) {\n throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value)\n }\n})\n\n/**\n * @callback validateString\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is string}\n */\n\n/** @type {validateString} */\nfunction validateString(value, name) {\n if (typeof value !== 'string') throw new ERR_INVALID_ARG_TYPE(name, 'string', value)\n}\n\n/**\n * @callback validateNumber\n * @param {*} value\n * @param {string} name\n * @param {number} [min]\n * @param {number} [max]\n * @returns {asserts value is number}\n */\n\n/** @type {validateNumber} */\nfunction validateNumber(value, name, min = undefined, max) {\n if (typeof value !== 'number') throw new ERR_INVALID_ARG_TYPE(name, 'number', value)\n if (\n (min != null && value < min) ||\n (max != null && value > max) ||\n ((min != null || max != null) && NumberIsNaN(value))\n ) {\n throw new ERR_OUT_OF_RANGE(\n name,\n `${min != null ? `>= ${min}` : ''}${min != null && max != null ? ' && ' : ''}${max != null ? `<= ${max}` : ''}`,\n value\n )\n }\n}\n\n/**\n * @callback validateOneOf\n * @template T\n * @param {T} value\n * @param {string} name\n * @param {T[]} oneOf\n */\n\n/** @type {validateOneOf} */\nconst validateOneOf = hideStackFrames((value, name, oneOf) => {\n if (!ArrayPrototypeIncludes(oneOf, value)) {\n const allowed = ArrayPrototypeJoin(\n ArrayPrototypeMap(oneOf, (v) => (typeof v === 'string' ? `'${v}'` : String(v))),\n ', '\n )\n const reason = 'must be one of: ' + allowed\n throw new ERR_INVALID_ARG_VALUE(name, value, reason)\n }\n})\n\n/**\n * @callback validateBoolean\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is boolean}\n */\n\n/** @type {validateBoolean} */\nfunction validateBoolean(value, name) {\n if (typeof value !== 'boolean') throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value)\n}\n\n/**\n * @param {any} options\n * @param {string} key\n * @param {boolean} defaultValue\n * @returns {boolean}\n */\nfunction getOwnPropertyValueOrDefault(options, key, defaultValue) {\n return options == null || !ObjectPrototypeHasOwnProperty(options, key) ? defaultValue : options[key]\n}\n\n/**\n * @callback validateObject\n * @param {*} value\n * @param {string} name\n * @param {{\n * allowArray?: boolean,\n * allowFunction?: boolean,\n * nullable?: boolean\n * }} [options]\n */\n\n/** @type {validateObject} */\nconst validateObject = hideStackFrames((value, name, options = null) => {\n const allowArray = getOwnPropertyValueOrDefault(options, 'allowArray', false)\n const allowFunction = getOwnPropertyValueOrDefault(options, 'allowFunction', false)\n const nullable = getOwnPropertyValueOrDefault(options, 'nullable', false)\n if (\n (!nullable && value === null) ||\n (!allowArray && ArrayIsArray(value)) ||\n (typeof value !== 'object' && (!allowFunction || typeof value !== 'function'))\n ) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Object', value)\n }\n})\n\n/**\n * @callback validateDictionary - We are using the Web IDL Standard definition\n * of \"dictionary\" here, which means any value\n * whose Type is either Undefined, Null, or\n * Object (which includes functions).\n * @param {*} value\n * @param {string} name\n * @see https://webidl.spec.whatwg.org/#es-dictionary\n * @see https://tc39.es/ecma262/#table-typeof-operator-results\n */\n\n/** @type {validateDictionary} */\nconst validateDictionary = hideStackFrames((value, name) => {\n if (value != null && typeof value !== 'object' && typeof value !== 'function') {\n throw new ERR_INVALID_ARG_TYPE(name, 'a dictionary', value)\n }\n})\n\n/**\n * @callback validateArray\n * @param {*} value\n * @param {string} name\n * @param {number} [minLength]\n * @returns {asserts value is any[]}\n */\n\n/** @type {validateArray} */\nconst validateArray = hideStackFrames((value, name, minLength = 0) => {\n if (!ArrayIsArray(value)) {\n throw new ERR_INVALID_ARG_TYPE(name, 'Array', value)\n }\n if (value.length < minLength) {\n const reason = `must be longer than ${minLength}`\n throw new ERR_INVALID_ARG_VALUE(name, value, reason)\n }\n})\n\n/**\n * @callback validateStringArray\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is string[]}\n */\n\n/** @type {validateStringArray} */\nfunction validateStringArray(value, name) {\n validateArray(value, name)\n for (let i = 0; i < value.length; i++) {\n validateString(value[i], `${name}[${i}]`)\n }\n}\n\n/**\n * @callback validateBooleanArray\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is boolean[]}\n */\n\n/** @type {validateBooleanArray} */\nfunction validateBooleanArray(value, name) {\n validateArray(value, name)\n for (let i = 0; i < value.length; i++) {\n validateBoolean(value[i], `${name}[${i}]`)\n }\n}\n\n/**\n * @callback validateAbortSignalArray\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is AbortSignal[]}\n */\n\n/** @type {validateAbortSignalArray} */\nfunction validateAbortSignalArray(value, name) {\n validateArray(value, name)\n for (let i = 0; i < value.length; i++) {\n const signal = value[i]\n const indexedName = `${name}[${i}]`\n if (signal == null) {\n throw new ERR_INVALID_ARG_TYPE(indexedName, 'AbortSignal', signal)\n }\n validateAbortSignal(signal, indexedName)\n }\n}\n\n/**\n * @param {*} signal\n * @param {string} [name='signal']\n * @returns {asserts signal is keyof signals}\n */\nfunction validateSignalName(signal, name = 'signal') {\n validateString(signal, name)\n if (signals[signal] === undefined) {\n if (signals[StringPrototypeToUpperCase(signal)] !== undefined) {\n throw new ERR_UNKNOWN_SIGNAL(signal + ' (signals must use all capital letters)')\n }\n throw new ERR_UNKNOWN_SIGNAL(signal)\n }\n}\n\n/**\n * @callback validateBuffer\n * @param {*} buffer\n * @param {string} [name='buffer']\n * @returns {asserts buffer is ArrayBufferView}\n */\n\n/** @type {validateBuffer} */\nconst validateBuffer = hideStackFrames((buffer, name = 'buffer') => {\n if (!isArrayBufferView(buffer)) {\n throw new ERR_INVALID_ARG_TYPE(name, ['Buffer', 'TypedArray', 'DataView'], buffer)\n }\n})\n\n/**\n * @param {string} data\n * @param {string} encoding\n */\nfunction validateEncoding(data, encoding) {\n const normalizedEncoding = normalizeEncoding(encoding)\n const length = data.length\n if (normalizedEncoding === 'hex' && length % 2 !== 0) {\n throw new ERR_INVALID_ARG_VALUE('encoding', encoding, `is invalid for data of length ${length}`)\n }\n}\n\n/**\n * Check that the port number is not NaN when coerced to a number,\n * is an integer and that it falls within the legal range of port numbers.\n * @param {*} port\n * @param {string} [name='Port']\n * @param {boolean} [allowZero=true]\n * @returns {number}\n */\nfunction validatePort(port, name = 'Port', allowZero = true) {\n if (\n (typeof port !== 'number' && typeof port !== 'string') ||\n (typeof port === 'string' && StringPrototypeTrim(port).length === 0) ||\n +port !== +port >>> 0 ||\n port > 0xffff ||\n (port === 0 && !allowZero)\n ) {\n throw new ERR_SOCKET_BAD_PORT(name, port, allowZero)\n }\n return port | 0\n}\n\n/**\n * @callback validateAbortSignal\n * @param {*} signal\n * @param {string} name\n */\n\n/** @type {validateAbortSignal} */\nconst validateAbortSignal = hideStackFrames((signal, name) => {\n if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal)\n }\n})\n\n/**\n * @callback validateFunction\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is Function}\n */\n\n/** @type {validateFunction} */\nconst validateFunction = hideStackFrames((value, name) => {\n if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value)\n})\n\n/**\n * @callback validatePlainFunction\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is Function}\n */\n\n/** @type {validatePlainFunction} */\nconst validatePlainFunction = hideStackFrames((value, name) => {\n if (typeof value !== 'function' || isAsyncFunction(value)) throw new ERR_INVALID_ARG_TYPE(name, 'Function', value)\n})\n\n/**\n * @callback validateUndefined\n * @param {*} value\n * @param {string} name\n * @returns {asserts value is undefined}\n */\n\n/** @type {validateUndefined} */\nconst validateUndefined = hideStackFrames((value, name) => {\n if (value !== undefined) throw new ERR_INVALID_ARG_TYPE(name, 'undefined', value)\n})\n\n/**\n * @template T\n * @param {T} value\n * @param {string} name\n * @param {T[]} union\n */\nfunction validateUnion(value, name, union) {\n if (!ArrayPrototypeIncludes(union, value)) {\n throw new ERR_INVALID_ARG_TYPE(name, `('${ArrayPrototypeJoin(union, '|')}')`, value)\n }\n}\n\n/*\n The rules for the Link header field are described here:\n https://www.rfc-editor.org/rfc/rfc8288.html#section-3\n\n This regex validates any string surrounded by angle brackets\n (not necessarily a valid URI reference) followed by zero or more\n link-params separated by semicolons.\n*/\nconst linkValueRegExp = /^(?:<[^>]*>)(?:\\s*;\\s*[^;\"\\s]+(?:=(\")?[^;\"\\s]*\\1)?)*$/\n\n/**\n * @param {any} value\n * @param {string} name\n */\nfunction validateLinkHeaderFormat(value, name) {\n if (typeof value === 'undefined' || !RegExpPrototypeExec(linkValueRegExp, value)) {\n throw new ERR_INVALID_ARG_VALUE(\n name,\n value,\n 'must be an array or string of format \"; rel=preload; as=style\"'\n )\n }\n}\n\n/**\n * @param {any} hints\n * @return {string}\n */\nfunction validateLinkHeaderValue(hints) {\n if (typeof hints === 'string') {\n validateLinkHeaderFormat(hints, 'hints')\n return hints\n } else if (ArrayIsArray(hints)) {\n const hintsLength = hints.length\n let result = ''\n if (hintsLength === 0) {\n return result\n }\n for (let i = 0; i < hintsLength; i++) {\n const link = hints[i]\n validateLinkHeaderFormat(link, 'hints')\n result += link\n if (i !== hintsLength - 1) {\n result += ', '\n }\n }\n return result\n }\n throw new ERR_INVALID_ARG_VALUE(\n 'hints',\n hints,\n 'must be an array or string of format \"; rel=preload; as=style\"'\n )\n}\nmodule.exports = {\n isInt32,\n isUint32,\n parseFileMode,\n validateArray,\n validateStringArray,\n validateBooleanArray,\n validateAbortSignalArray,\n validateBoolean,\n validateBuffer,\n validateDictionary,\n validateEncoding,\n validateFunction,\n validateInt32,\n validateInteger,\n validateNumber,\n validateObject,\n validateOneOf,\n validatePlainFunction,\n validatePort,\n validateSignalName,\n validateString,\n validateUint32,\n validateUndefined,\n validateUnion,\n validateAbortSignal,\n validateLinkHeaderValue\n}\n","'use strict'\n\nconst CustomStream = require('../stream')\nconst promises = require('../stream/promises')\nconst originalDestroy = CustomStream.Readable.destroy\nmodule.exports = CustomStream.Readable\n\n// Explicit export naming is needed for ESM\nmodule.exports._uint8ArrayToBuffer = CustomStream._uint8ArrayToBuffer\nmodule.exports._isUint8Array = CustomStream._isUint8Array\nmodule.exports.isDisturbed = CustomStream.isDisturbed\nmodule.exports.isErrored = CustomStream.isErrored\nmodule.exports.isReadable = CustomStream.isReadable\nmodule.exports.Readable = CustomStream.Readable\nmodule.exports.Writable = CustomStream.Writable\nmodule.exports.Duplex = CustomStream.Duplex\nmodule.exports.Transform = CustomStream.Transform\nmodule.exports.PassThrough = CustomStream.PassThrough\nmodule.exports.addAbortSignal = CustomStream.addAbortSignal\nmodule.exports.finished = CustomStream.finished\nmodule.exports.destroy = CustomStream.destroy\nmodule.exports.destroy = originalDestroy\nmodule.exports.pipeline = CustomStream.pipeline\nmodule.exports.compose = CustomStream.compose\nObject.defineProperty(CustomStream, 'promises', {\n configurable: true,\n enumerable: true,\n get() {\n return promises\n }\n})\nmodule.exports.Stream = CustomStream.Stream\n\n// Allow default importing\nmodule.exports.default = module.exports\n","'use strict'\n\nconst { format, inspect, AggregateError: CustomAggregateError } = require('./util')\n\n/*\n This file is a reduced and adapted version of the main lib/internal/errors.js file defined at\n\n https://github.com/nodejs/node/blob/master/lib/internal/errors.js\n\n Don't try to replace with the original file and keep it up to date (starting from E(...) definitions)\n with the upstream file.\n*/\n\nconst AggregateError = globalThis.AggregateError || CustomAggregateError\nconst kIsNodeError = Symbol('kIsNodeError')\nconst kTypes = [\n 'string',\n 'function',\n 'number',\n 'object',\n // Accept 'Function' and 'Object' as alternative to the lower cased version.\n 'Function',\n 'Object',\n 'boolean',\n 'bigint',\n 'symbol'\n]\nconst classRegExp = /^([A-Z][a-z0-9]*)+$/\nconst nodeInternalPrefix = '__node_internal_'\nconst codes = {}\nfunction assert(value, message) {\n if (!value) {\n throw new codes.ERR_INTERNAL_ASSERTION(message)\n }\n}\n\n// Only use this for integers! Decimal numbers do not work with this function.\nfunction addNumericalSeparator(val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\nfunction getMessage(key, msg, args) {\n if (typeof msg === 'function') {\n assert(\n msg.length <= args.length,\n // Default options do not count.\n `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${msg.length}).`\n )\n return msg(...args)\n }\n const expectedLength = (msg.match(/%[dfijoOs]/g) || []).length\n assert(\n expectedLength === args.length,\n `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`\n )\n if (args.length === 0) {\n return msg\n }\n return format(msg, ...args)\n}\nfunction E(code, message, Base) {\n if (!Base) {\n Base = Error\n }\n class NodeError extends Base {\n constructor(...args) {\n super(getMessage(code, message, args))\n }\n toString() {\n return `${this.name} [${code}]: ${this.message}`\n }\n }\n Object.defineProperties(NodeError.prototype, {\n name: {\n value: Base.name,\n writable: true,\n enumerable: false,\n configurable: true\n },\n toString: {\n value() {\n return `${this.name} [${code}]: ${this.message}`\n },\n writable: true,\n enumerable: false,\n configurable: true\n }\n })\n NodeError.prototype.code = code\n NodeError.prototype[kIsNodeError] = true\n codes[code] = NodeError\n}\nfunction hideStackFrames(fn) {\n // We rename the functions that will be hidden to cut off the stacktrace\n // at the outermost one\n const hidden = nodeInternalPrefix + fn.name\n Object.defineProperty(fn, 'name', {\n value: hidden\n })\n return fn\n}\nfunction aggregateTwoErrors(innerError, outerError) {\n if (innerError && outerError && innerError !== outerError) {\n if (Array.isArray(outerError.errors)) {\n // If `outerError` is already an `AggregateError`.\n outerError.errors.push(innerError)\n return outerError\n }\n const err = new AggregateError([outerError, innerError], outerError.message)\n err.code = outerError.code\n return err\n }\n return innerError || outerError\n}\nclass AbortError extends Error {\n constructor(message = 'The operation was aborted', options = undefined) {\n if (options !== undefined && typeof options !== 'object') {\n throw new codes.ERR_INVALID_ARG_TYPE('options', 'Object', options)\n }\n super(message, options)\n this.code = 'ABORT_ERR'\n this.name = 'AbortError'\n }\n}\nE('ERR_ASSERTION', '%s', Error)\nE(\n 'ERR_INVALID_ARG_TYPE',\n (name, expected, actual) => {\n assert(typeof name === 'string', \"'name' must be a string\")\n if (!Array.isArray(expected)) {\n expected = [expected]\n }\n let msg = 'The '\n if (name.endsWith(' argument')) {\n // For cases like 'first argument'\n msg += `${name} `\n } else {\n msg += `\"${name}\" ${name.includes('.') ? 'property' : 'argument'} `\n }\n msg += 'must be '\n const types = []\n const instances = []\n const other = []\n for (const value of expected) {\n assert(typeof value === 'string', 'All expected entries have to be of type string')\n if (kTypes.includes(value)) {\n types.push(value.toLowerCase())\n } else if (classRegExp.test(value)) {\n instances.push(value)\n } else {\n assert(value !== 'object', 'The value \"object\" should be written as \"Object\"')\n other.push(value)\n }\n }\n\n // Special handle `object` in case other instances are allowed to outline\n // the differences between each other.\n if (instances.length > 0) {\n const pos = types.indexOf('object')\n if (pos !== -1) {\n types.splice(types, pos, 1)\n instances.push('Object')\n }\n }\n if (types.length > 0) {\n switch (types.length) {\n case 1:\n msg += `of type ${types[0]}`\n break\n case 2:\n msg += `one of type ${types[0]} or ${types[1]}`\n break\n default: {\n const last = types.pop()\n msg += `one of type ${types.join(', ')}, or ${last}`\n }\n }\n if (instances.length > 0 || other.length > 0) {\n msg += ' or '\n }\n }\n if (instances.length > 0) {\n switch (instances.length) {\n case 1:\n msg += `an instance of ${instances[0]}`\n break\n case 2:\n msg += `an instance of ${instances[0]} or ${instances[1]}`\n break\n default: {\n const last = instances.pop()\n msg += `an instance of ${instances.join(', ')}, or ${last}`\n }\n }\n if (other.length > 0) {\n msg += ' or '\n }\n }\n switch (other.length) {\n case 0:\n break\n case 1:\n if (other[0].toLowerCase() !== other[0]) {\n msg += 'an '\n }\n msg += `${other[0]}`\n break\n case 2:\n msg += `one of ${other[0]} or ${other[1]}`\n break\n default: {\n const last = other.pop()\n msg += `one of ${other.join(', ')}, or ${last}`\n }\n }\n if (actual == null) {\n msg += `. Received ${actual}`\n } else if (typeof actual === 'function' && actual.name) {\n msg += `. Received function ${actual.name}`\n } else if (typeof actual === 'object') {\n var _actual$constructor\n if (\n (_actual$constructor = actual.constructor) !== null &&\n _actual$constructor !== undefined &&\n _actual$constructor.name\n ) {\n msg += `. Received an instance of ${actual.constructor.name}`\n } else {\n const inspected = inspect(actual, {\n depth: -1\n })\n msg += `. Received ${inspected}`\n }\n } else {\n let inspected = inspect(actual, {\n colors: false\n })\n if (inspected.length > 25) {\n inspected = `${inspected.slice(0, 25)}...`\n }\n msg += `. Received type ${typeof actual} (${inspected})`\n }\n return msg\n },\n TypeError\n)\nE(\n 'ERR_INVALID_ARG_VALUE',\n (name, value, reason = 'is invalid') => {\n let inspected = inspect(value)\n if (inspected.length > 128) {\n inspected = inspected.slice(0, 128) + '...'\n }\n const type = name.includes('.') ? 'property' : 'argument'\n return `The ${type} '${name}' ${reason}. Received ${inspected}`\n },\n TypeError\n)\nE(\n 'ERR_INVALID_RETURN_VALUE',\n (input, name, value) => {\n var _value$constructor\n const type =\n value !== null &&\n value !== undefined &&\n (_value$constructor = value.constructor) !== null &&\n _value$constructor !== undefined &&\n _value$constructor.name\n ? `instance of ${value.constructor.name}`\n : `type ${typeof value}`\n return `Expected ${input} to be returned from the \"${name}\"` + ` function but got ${type}.`\n },\n TypeError\n)\nE(\n 'ERR_MISSING_ARGS',\n (...args) => {\n assert(args.length > 0, 'At least one arg needs to be specified')\n let msg\n const len = args.length\n args = (Array.isArray(args) ? args : [args]).map((a) => `\"${a}\"`).join(' or ')\n switch (len) {\n case 1:\n msg += `The ${args[0]} argument`\n break\n case 2:\n msg += `The ${args[0]} and ${args[1]} arguments`\n break\n default:\n {\n const last = args.pop()\n msg += `The ${args.join(', ')}, and ${last} arguments`\n }\n break\n }\n return `${msg} must be specified`\n },\n TypeError\n)\nE(\n 'ERR_OUT_OF_RANGE',\n (str, range, input) => {\n assert(range, 'Missing \"range\" argument')\n let received\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > 2n ** 32n || input < -(2n ** 32n)) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n } else {\n received = inspect(input)\n }\n return `The value of \"${str}\" is out of range. It must be ${range}. Received ${received}`\n },\n RangeError\n)\nE('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times', Error)\nE('ERR_METHOD_NOT_IMPLEMENTED', 'The %s method is not implemented', Error)\nE('ERR_STREAM_ALREADY_FINISHED', 'Cannot call %s after a stream was finished', Error)\nE('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable', Error)\nE('ERR_STREAM_DESTROYED', 'Cannot call %s after a stream was destroyed', Error)\nE('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError)\nE('ERR_STREAM_PREMATURE_CLOSE', 'Premature close', Error)\nE('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF', Error)\nE('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event', Error)\nE('ERR_STREAM_WRITE_AFTER_END', 'write after end', Error)\nE('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError)\nmodule.exports = {\n AbortError,\n aggregateTwoErrors: hideStackFrames(aggregateTwoErrors),\n hideStackFrames,\n codes\n}\n","'use strict'\n\n/*\n This file is a reduced and adapted version of the main lib/internal/per_context/primordials.js file defined at\n\n https://github.com/nodejs/node/blob/master/lib/internal/per_context/primordials.js\n\n Don't try to replace with the original file and keep it up to date with the upstream file.\n*/\nmodule.exports = {\n ArrayIsArray(self) {\n return Array.isArray(self)\n },\n ArrayPrototypeIncludes(self, el) {\n return self.includes(el)\n },\n ArrayPrototypeIndexOf(self, el) {\n return self.indexOf(el)\n },\n ArrayPrototypeJoin(self, sep) {\n return self.join(sep)\n },\n ArrayPrototypeMap(self, fn) {\n return self.map(fn)\n },\n ArrayPrototypePop(self, el) {\n return self.pop(el)\n },\n ArrayPrototypePush(self, el) {\n return self.push(el)\n },\n ArrayPrototypeSlice(self, start, end) {\n return self.slice(start, end)\n },\n Error,\n FunctionPrototypeCall(fn, thisArgs, ...args) {\n return fn.call(thisArgs, ...args)\n },\n FunctionPrototypeSymbolHasInstance(self, instance) {\n return Function.prototype[Symbol.hasInstance].call(self, instance)\n },\n MathFloor: Math.floor,\n Number,\n NumberIsInteger: Number.isInteger,\n NumberIsNaN: Number.isNaN,\n NumberMAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER,\n NumberMIN_SAFE_INTEGER: Number.MIN_SAFE_INTEGER,\n NumberParseInt: Number.parseInt,\n ObjectDefineProperties(self, props) {\n return Object.defineProperties(self, props)\n },\n ObjectDefineProperty(self, name, prop) {\n return Object.defineProperty(self, name, prop)\n },\n ObjectGetOwnPropertyDescriptor(self, name) {\n return Object.getOwnPropertyDescriptor(self, name)\n },\n ObjectKeys(obj) {\n return Object.keys(obj)\n },\n ObjectSetPrototypeOf(target, proto) {\n return Object.setPrototypeOf(target, proto)\n },\n Promise,\n PromisePrototypeCatch(self, fn) {\n return self.catch(fn)\n },\n PromisePrototypeThen(self, thenFn, catchFn) {\n return self.then(thenFn, catchFn)\n },\n PromiseReject(err) {\n return Promise.reject(err)\n },\n PromiseResolve(val) {\n return Promise.resolve(val)\n },\n ReflectApply: Reflect.apply,\n RegExpPrototypeTest(self, value) {\n return self.test(value)\n },\n SafeSet: Set,\n String,\n StringPrototypeSlice(self, start, end) {\n return self.slice(start, end)\n },\n StringPrototypeToLowerCase(self) {\n return self.toLowerCase()\n },\n StringPrototypeToUpperCase(self) {\n return self.toUpperCase()\n },\n StringPrototypeTrim(self) {\n return self.trim()\n },\n Symbol,\n SymbolFor: Symbol.for,\n SymbolAsyncIterator: Symbol.asyncIterator,\n SymbolHasInstance: Symbol.hasInstance,\n SymbolIterator: Symbol.iterator,\n SymbolDispose: Symbol.dispose || Symbol('Symbol.dispose'),\n SymbolAsyncDispose: Symbol.asyncDispose || Symbol('Symbol.asyncDispose'),\n TypedArrayPrototypeSet(self, buf, len) {\n return self.set(buf, len)\n },\n Boolean: Boolean,\n Uint8Array\n}\n","'use strict'\n\nconst bufferModule = require('buffer')\nconst { kResistStopPropagation, SymbolDispose } = require('./primordials')\nconst AbortSignal = globalThis.AbortSignal || require('abort-controller').AbortSignal\nconst AbortController = globalThis.AbortController || require('abort-controller').AbortController\nconst AsyncFunction = Object.getPrototypeOf(async function () {}).constructor\nconst Blob = globalThis.Blob || bufferModule.Blob\n/* eslint-disable indent */\nconst isBlob =\n typeof Blob !== 'undefined'\n ? function isBlob(b) {\n // eslint-disable-next-line indent\n return b instanceof Blob\n }\n : function isBlob(b) {\n return false\n }\n/* eslint-enable indent */\n\nconst validateAbortSignal = (signal, name) => {\n if (signal !== undefined && (signal === null || typeof signal !== 'object' || !('aborted' in signal))) {\n throw new ERR_INVALID_ARG_TYPE(name, 'AbortSignal', signal)\n }\n}\nconst validateFunction = (value, name) => {\n if (typeof value !== 'function') throw new ERR_INVALID_ARG_TYPE(name, 'Function', value)\n}\n\n// This is a simplified version of AggregateError\nclass AggregateError extends Error {\n constructor(errors) {\n if (!Array.isArray(errors)) {\n throw new TypeError(`Expected input to be an Array, got ${typeof errors}`)\n }\n let message = ''\n for (let i = 0; i < errors.length; i++) {\n message += ` ${errors[i].stack}\\n`\n }\n super(message)\n this.name = 'AggregateError'\n this.errors = errors\n }\n}\nmodule.exports = {\n AggregateError,\n kEmptyObject: Object.freeze({}),\n once(callback) {\n let called = false\n return function (...args) {\n if (called) {\n return\n }\n called = true\n callback.apply(this, args)\n }\n },\n createDeferredPromise: function () {\n let resolve\n let reject\n\n // eslint-disable-next-line promise/param-names\n const promise = new Promise((res, rej) => {\n resolve = res\n reject = rej\n })\n return {\n promise,\n resolve,\n reject\n }\n },\n promisify(fn) {\n return new Promise((resolve, reject) => {\n fn((err, ...args) => {\n if (err) {\n return reject(err)\n }\n return resolve(...args)\n })\n })\n },\n debuglog() {\n return function () {}\n },\n format(format, ...args) {\n // Simplified version of https://nodejs.org/api/util.html#utilformatformat-args\n return format.replace(/%([sdifj])/g, function (...[_unused, type]) {\n const replacement = args.shift()\n if (type === 'f') {\n return replacement.toFixed(6)\n } else if (type === 'j') {\n return JSON.stringify(replacement)\n } else if (type === 's' && typeof replacement === 'object') {\n const ctor = replacement.constructor !== Object ? replacement.constructor.name : ''\n return `${ctor} {}`.trim()\n } else {\n return replacement.toString()\n }\n })\n },\n inspect(value) {\n // Vastly simplified version of https://nodejs.org/api/util.html#utilinspectobject-options\n switch (typeof value) {\n case 'string':\n if (value.includes(\"'\")) {\n if (!value.includes('\"')) {\n return `\"${value}\"`\n } else if (!value.includes('`') && !value.includes('${')) {\n return `\\`${value}\\``\n }\n }\n return `'${value}'`\n case 'number':\n if (isNaN(value)) {\n return 'NaN'\n } else if (Object.is(value, -0)) {\n return String(value)\n }\n return value\n case 'bigint':\n return `${String(value)}n`\n case 'boolean':\n case 'undefined':\n return String(value)\n case 'object':\n return '{}'\n }\n },\n types: {\n isAsyncFunction(fn) {\n return fn instanceof AsyncFunction\n },\n isArrayBufferView(arr) {\n return ArrayBuffer.isView(arr)\n }\n },\n isBlob,\n deprecate(fn, message) {\n return fn\n },\n addAbortListener:\n require('events').addAbortListener ||\n function addAbortListener(signal, listener) {\n if (signal === undefined) {\n throw new ERR_INVALID_ARG_TYPE('signal', 'AbortSignal', signal)\n }\n validateAbortSignal(signal, 'signal')\n validateFunction(listener, 'listener')\n let removeEventListener\n if (signal.aborted) {\n queueMicrotask(() => listener())\n } else {\n signal.addEventListener('abort', listener, {\n __proto__: null,\n once: true,\n [kResistStopPropagation]: true\n })\n removeEventListener = () => {\n signal.removeEventListener('abort', listener)\n }\n }\n return {\n __proto__: null,\n [SymbolDispose]() {\n var _removeEventListener\n ;(_removeEventListener = removeEventListener) === null || _removeEventListener === undefined\n ? undefined\n : _removeEventListener()\n }\n }\n },\n AbortSignalAny:\n AbortSignal.any ||\n function AbortSignalAny(signals) {\n // Fast path if there is only one signal.\n if (signals.length === 1) {\n return signals[0]\n }\n const ac = new AbortController()\n const abort = () => ac.abort()\n signals.forEach((signal) => {\n validateAbortSignal(signal, 'signals')\n signal.addEventListener('abort', abort, {\n once: true\n })\n })\n ac.signal.addEventListener(\n 'abort',\n () => {\n signals.forEach((signal) => signal.removeEventListener('abort', abort))\n },\n {\n once: true\n }\n )\n return ac.signal\n }\n}\nmodule.exports.promisify.custom = Symbol.for('nodejs.util.promisify.custom')\n","/* replacement start */\n\nconst { Buffer } = require('buffer')\n\n/* replacement end */\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n;('use strict')\nconst { ObjectDefineProperty, ObjectKeys, ReflectApply } = require('./ours/primordials')\nconst {\n promisify: { custom: customPromisify }\n} = require('./ours/util')\nconst { streamReturningOperators, promiseReturningOperators } = require('./internal/streams/operators')\nconst {\n codes: { ERR_ILLEGAL_CONSTRUCTOR }\n} = require('./ours/errors')\nconst compose = require('./internal/streams/compose')\nconst { setDefaultHighWaterMark, getDefaultHighWaterMark } = require('./internal/streams/state')\nconst { pipeline } = require('./internal/streams/pipeline')\nconst { destroyer } = require('./internal/streams/destroy')\nconst eos = require('./internal/streams/end-of-stream')\nconst internalBuffer = {}\nconst promises = require('./stream/promises')\nconst utils = require('./internal/streams/utils')\nconst Stream = (module.exports = require('./internal/streams/legacy').Stream)\nStream.isDestroyed = utils.isDestroyed\nStream.isDisturbed = utils.isDisturbed\nStream.isErrored = utils.isErrored\nStream.isReadable = utils.isReadable\nStream.isWritable = utils.isWritable\nStream.Readable = require('./internal/streams/readable')\nfor (const key of ObjectKeys(streamReturningOperators)) {\n const op = streamReturningOperators[key]\n function fn(...args) {\n if (new.target) {\n throw ERR_ILLEGAL_CONSTRUCTOR()\n }\n return Stream.Readable.from(ReflectApply(op, this, args))\n }\n ObjectDefineProperty(fn, 'name', {\n __proto__: null,\n value: op.name\n })\n ObjectDefineProperty(fn, 'length', {\n __proto__: null,\n value: op.length\n })\n ObjectDefineProperty(Stream.Readable.prototype, key, {\n __proto__: null,\n value: fn,\n enumerable: false,\n configurable: true,\n writable: true\n })\n}\nfor (const key of ObjectKeys(promiseReturningOperators)) {\n const op = promiseReturningOperators[key]\n function fn(...args) {\n if (new.target) {\n throw ERR_ILLEGAL_CONSTRUCTOR()\n }\n return ReflectApply(op, this, args)\n }\n ObjectDefineProperty(fn, 'name', {\n __proto__: null,\n value: op.name\n })\n ObjectDefineProperty(fn, 'length', {\n __proto__: null,\n value: op.length\n })\n ObjectDefineProperty(Stream.Readable.prototype, key, {\n __proto__: null,\n value: fn,\n enumerable: false,\n configurable: true,\n writable: true\n })\n}\nStream.Writable = require('./internal/streams/writable')\nStream.Duplex = require('./internal/streams/duplex')\nStream.Transform = require('./internal/streams/transform')\nStream.PassThrough = require('./internal/streams/passthrough')\nStream.pipeline = pipeline\nconst { addAbortSignal } = require('./internal/streams/add-abort-signal')\nStream.addAbortSignal = addAbortSignal\nStream.finished = eos\nStream.destroy = destroyer\nStream.compose = compose\nStream.setDefaultHighWaterMark = setDefaultHighWaterMark\nStream.getDefaultHighWaterMark = getDefaultHighWaterMark\nObjectDefineProperty(Stream, 'promises', {\n __proto__: null,\n configurable: true,\n enumerable: true,\n get() {\n return promises\n }\n})\nObjectDefineProperty(pipeline, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n return promises.pipeline\n }\n})\nObjectDefineProperty(eos, customPromisify, {\n __proto__: null,\n enumerable: true,\n get() {\n return promises.finished\n }\n})\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream\nStream._isUint8Array = function isUint8Array(value) {\n return value instanceof Uint8Array\n}\nStream._uint8ArrayToBuffer = function _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)\n}\n","'use strict'\n\nconst { ArrayPrototypePop, Promise } = require('../ours/primordials')\nconst { isIterable, isNodeStream, isWebStream } = require('../internal/streams/utils')\nconst { pipelineImpl: pl } = require('../internal/streams/pipeline')\nconst { finished } = require('../internal/streams/end-of-stream')\nrequire('../../lib/stream.js')\nfunction pipeline(...streams) {\n return new Promise((resolve, reject) => {\n let signal\n let end\n const lastArg = streams[streams.length - 1]\n if (\n lastArg &&\n typeof lastArg === 'object' &&\n !isNodeStream(lastArg) &&\n !isIterable(lastArg) &&\n !isWebStream(lastArg)\n ) {\n const options = ArrayPrototypePop(streams)\n signal = options.signal\n end = options.end\n }\n pl(\n streams,\n (err, value) => {\n if (err) {\n reject(err)\n } else {\n resolve(value)\n }\n },\n {\n signal,\n end\n }\n )\n })\n}\nmodule.exports = {\n finished,\n pipeline\n}\n","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","const RDF = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n XSD = 'http://www.w3.org/2001/XMLSchema#',\n SWAP = 'http://www.w3.org/2000/10/swap/';\n\nexport default {\n xsd: {\n decimal: `${XSD}decimal`,\n boolean: `${XSD}boolean`,\n double: `${XSD}double`,\n integer: `${XSD}integer`,\n string: `${XSD}string`,\n },\n rdf: {\n type: `${RDF}type`,\n nil: `${RDF}nil`,\n first: `${RDF}first`,\n rest: `${RDF}rest`,\n langString: `${RDF}langString`,\n },\n owl: {\n sameAs: 'http://www.w3.org/2002/07/owl#sameAs',\n },\n r: {\n forSome: `${SWAP}reify#forSome`,\n forAll: `${SWAP}reify#forAll`,\n },\n log: {\n implies: `${SWAP}log#implies`,\n },\n};\n","// N3.js implementations of the RDF/JS core data types\n// See https://github.com/rdfjs/representation-task-force/blob/master/interface-spec.md\n\nimport namespaces from './IRIs';\nimport { isDefaultGraph } from './N3Util';\nconst { rdf, xsd } = namespaces;\n\n// eslint-disable-next-line prefer-const\nlet DEFAULTGRAPH;\nlet _blankNodeCounter = 0;\n\nconst escapedLiteral = /^\"(.*\".*)(?=\"[^\"]*$)/;\n\n// ## DataFactory singleton\nconst DataFactory = {\n namedNode,\n blankNode,\n variable,\n literal,\n defaultGraph,\n quad,\n triple: quad,\n};\nexport default DataFactory;\n\n// ## Term constructor\nexport class Term {\n constructor(id) {\n this.id = id;\n }\n\n // ### The value of this term\n get value() {\n return this.id;\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through ids\n if (other instanceof Term)\n return this.id === other.id;\n // Otherwise, compare term type and value\n return !!other && this.termType === other.termType &&\n this.value === other.value;\n }\n\n // ### Implement hashCode for Immutable.js, since we implement `equals`\n // https://immutable-js.com/docs/v4.0.0/ValueObject/#hashCode()\n hashCode() {\n return 0;\n }\n\n // ### Returns a plain object representation of this term\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n };\n }\n}\n\n\n// ## NamedNode constructor\nexport class NamedNode extends Term {\n // ### The term type of this term\n get termType() {\n return 'NamedNode';\n }\n}\n\n// ## Literal constructor\nexport class Literal extends Term {\n // ### The term type of this term\n get termType() {\n return 'Literal';\n }\n\n // ### The text value of this literal\n get value() {\n return this.id.substring(1, this.id.lastIndexOf('\"'));\n }\n\n // ### The language of this literal\n get language() {\n // Find the last quotation mark (e.g., '\"abc\"@en-us')\n const id = this.id;\n let atPos = id.lastIndexOf('\"') + 1;\n // If \"@\" it follows, return the remaining substring; empty otherwise\n return atPos < id.length && id[atPos++] === '@' ? id.substr(atPos).toLowerCase() : '';\n }\n\n // ### The datatype IRI of this literal\n get datatype() {\n return new NamedNode(this.datatypeString);\n }\n\n // ### The datatype string of this literal\n get datatypeString() {\n // Find the last quotation mark (e.g., '\"abc\"^^http://ex.org/types#t')\n const id = this.id, dtPos = id.lastIndexOf('\"') + 1;\n const char = dtPos < id.length ? id[dtPos] : '';\n // If \"^\" it follows, return the remaining substring\n return char === '^' ? id.substr(dtPos + 2) :\n // If \"@\" follows, return rdf:langString; xsd:string otherwise\n (char !== '@' ? xsd.string : rdf.langString);\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both literals were created by this library,\n // equality can be computed through ids\n if (other instanceof Literal)\n return this.id === other.id;\n // Otherwise, compare term type, value, language, and datatype\n return !!other && !!other.datatype &&\n this.termType === other.termType &&\n this.value === other.value &&\n this.language === other.language &&\n this.datatype.value === other.datatype.value;\n }\n\n toJSON() {\n return {\n termType: this.termType,\n value: this.value,\n language: this.language,\n datatype: { termType: 'NamedNode', value: this.datatypeString },\n };\n }\n}\n\n// ## BlankNode constructor\nexport class BlankNode extends Term {\n constructor(name) {\n super(`_:${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'BlankNode';\n }\n\n // ### The name of this blank node\n get value() {\n return this.id.substr(2);\n }\n}\n\nexport class Variable extends Term {\n constructor(name) {\n super(`?${name}`);\n }\n\n // ### The term type of this term\n get termType() {\n return 'Variable';\n }\n\n // ### The name of this variable\n get value() {\n return this.id.substr(1);\n }\n}\n\n// ## DefaultGraph constructor\nexport class DefaultGraph extends Term {\n constructor() {\n super('');\n return DEFAULTGRAPH || this;\n }\n\n // ### The term type of this term\n get termType() {\n return 'DefaultGraph';\n }\n\n // ### Returns whether this object represents the same term as the other\n equals(other) {\n // If both terms were created by this library,\n // equality can be computed through strict equality;\n // otherwise, compare term types.\n return (this === other) || (!!other && (this.termType === other.termType));\n }\n}\n\n// ## DefaultGraph singleton\nDEFAULTGRAPH = new DefaultGraph();\n\n// ### Constructs a term from the given internal string ID\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termFromId(id, factory, nested) {\n factory = factory || DataFactory;\n\n // Falsy value or empty string indicate the default graph\n if (!id)\n return factory.defaultGraph();\n\n // Identify the term type based on the first character\n switch (id[0]) {\n case '?':\n return factory.variable(id.substr(1));\n case '_':\n return factory.blankNode(id.substr(2));\n case '\"':\n // Shortcut for internal literals\n if (factory === DataFactory)\n return new Literal(id);\n // Literal without datatype or language\n if (id[id.length - 1] === '\"')\n return factory.literal(id.substr(1, id.length - 2));\n // Literal with datatype or language\n const endPos = id.lastIndexOf('\"', id.length - 1);\n return factory.literal(id.substr(1, endPos - 1),\n id[endPos + 1] === '@' ? id.substr(endPos + 2)\n : factory.namedNode(id.substr(endPos + 3)));\n case '[':\n id = JSON.parse(id);\n break;\n default:\n if (!nested || !Array.isArray(id)) {\n return factory.namedNode(id);\n }\n }\n return factory.quad(\n termFromId(id[0], factory, true),\n termFromId(id[1], factory, true),\n termFromId(id[2], factory, true),\n id[3] && termFromId(id[3], factory, true)\n );\n}\n\n// ### Constructs an internal string ID from the given term or ID string\n// The third 'nested' parameter of this function is to aid\n// with recursion over nested terms. It should not be used\n// by consumers of this library.\n// See https://github.com/rdfjs/N3.js/pull/311#discussion_r1061042725\nexport function termToId(term, nested) {\n if (typeof term === 'string')\n return term;\n if (term instanceof Term && term.termType !== 'Quad')\n return term.id;\n if (!term)\n return DEFAULTGRAPH.id;\n\n // Term instantiated with another library\n switch (term.termType) {\n case 'NamedNode': return term.value;\n case 'BlankNode': return `_:${term.value}`;\n case 'Variable': return `?${term.value}`;\n case 'DefaultGraph': return '';\n case 'Literal': return `\"${term.value}\"${\n term.language ? `@${term.language}` :\n (term.datatype && term.datatype.value !== xsd.string ? `^^${term.datatype.value}` : '')}`;\n case 'Quad':\n const res = [\n termToId(term.subject, true),\n termToId(term.predicate, true),\n termToId(term.object, true),\n ];\n if (!isDefaultGraph(term.graph)) {\n res.push(termToId(term.graph, true));\n }\n return nested ? res : JSON.stringify(res);\n default: throw new Error(`Unexpected termType: ${term.termType}`);\n }\n}\n\n\n// ## Quad constructor\nexport class Quad extends Term {\n constructor(subject, predicate, object, graph) {\n super('');\n this._subject = subject;\n this._predicate = predicate;\n this._object = object;\n this._graph = graph || DEFAULTGRAPH;\n }\n\n // ### The term type of this term\n get termType() {\n return 'Quad';\n }\n\n get subject() {\n return this._subject;\n }\n\n get predicate() {\n return this._predicate;\n }\n\n get object() {\n return this._object;\n }\n\n get graph() {\n return this._graph;\n }\n\n // ### Returns a plain object representation of this quad\n toJSON() {\n return {\n termType: this.termType,\n subject: this._subject.toJSON(),\n predicate: this._predicate.toJSON(),\n object: this._object.toJSON(),\n graph: this._graph.toJSON(),\n };\n }\n\n // ### Returns whether this object represents the same quad as the other\n equals(other) {\n return !!other && this._subject.equals(other.subject) &&\n this._predicate.equals(other.predicate) &&\n this._object.equals(other.object) &&\n this._graph.equals(other.graph);\n }\n}\nexport { Quad as Triple };\n\n// ### Escapes the quotes within the given literal\nexport function escapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"/g, '\"\"')}`);\n}\n\n// ### Unescapes the quotes within the given literal\nexport function unescapeQuotes(id) {\n return id.replace(escapedLiteral, (_, quoted) => `\"${quoted.replace(/\"\"/g, '\"')}`);\n}\n\n// ### Creates an IRI\nfunction namedNode(iri) {\n return new NamedNode(iri);\n}\n\n// ### Creates a blank node\nfunction blankNode(name) {\n return new BlankNode(name || `n3-${_blankNodeCounter++}`);\n}\n\n// ### Creates a literal\nfunction literal(value, languageOrDataType) {\n // Create a language-tagged string\n if (typeof languageOrDataType === 'string')\n return new Literal(`\"${value}\"@${languageOrDataType.toLowerCase()}`);\n\n // Automatically determine datatype for booleans and numbers\n let datatype = languageOrDataType ? languageOrDataType.value : '';\n if (datatype === '') {\n // Convert a boolean\n if (typeof value === 'boolean')\n datatype = xsd.boolean;\n // Convert an integer or double\n else if (typeof value === 'number') {\n if (Number.isFinite(value))\n datatype = Number.isInteger(value) ? xsd.integer : xsd.double;\n else {\n datatype = xsd.double;\n if (!Number.isNaN(value))\n value = value > 0 ? 'INF' : '-INF';\n }\n }\n }\n\n // Create a datatyped literal\n return (datatype === '' || datatype === xsd.string) ?\n new Literal(`\"${value}\"`) :\n new Literal(`\"${value}\"^^${datatype}`);\n}\n\n// ### Creates a variable\nfunction variable(name) {\n return new Variable(name);\n}\n\n// ### Returns the default graph\nfunction defaultGraph() {\n return DEFAULTGRAPH;\n}\n\n// ### Creates a quad\nfunction quad(subject, predicate, object, graph) {\n return new Quad(subject, predicate, object, graph);\n}\n","// **N3Lexer** tokenizes N3 documents.\nimport namespaces from './IRIs';\nimport queueMicrotask from 'queue-microtask';\n\nconst { xsd } = namespaces;\n\n// Regular expression and replacement string to escape N3 strings\nconst escapeSequence = /\\\\u([a-fA-F0-9]{4})|\\\\U([a-fA-F0-9]{8})|\\\\([^])/g;\nconst escapeReplacements = {\n '\\\\': '\\\\', \"'\": \"'\", '\"': '\"',\n 'n': '\\n', 'r': '\\r', 't': '\\t', 'f': '\\f', 'b': '\\b',\n '_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',\n '(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',\n '/': '/', '?': '?', '#': '#', '@': '@', '%': '%',\n};\nconst illegalIriChars = /[\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]/;\n\nconst lineModeRegExps = {\n _iri: true,\n _unescapedIri: true,\n _simpleQuotedString: true,\n _langcode: true,\n _blank: true,\n _newline: true,\n _comment: true,\n _whitespace: true,\n _endOfFile: true,\n};\nconst invalidRegExp = /$0^/;\n\n// ## Constructor\nexport default class N3Lexer {\n constructor(options) {\n // ## Regular expressions\n // It's slightly faster to have these as properties than as in-scope variables\n this._iri = /^<((?:[^ <>{}\\\\]|\\\\[uU])+)>[ \\t]*/; // IRI with escape sequences; needs sanity check after unescaping\n this._unescapedIri = /^<([^\\x00-\\x20<>\\\\\"\\{\\}\\|\\^\\`]*)>[ \\t]*/; // IRI without escape sequences; no unescaping\n this._simpleQuotedString = /^\"([^\"\\\\\\r\\n]*)\"(?=[^\"])/; // string without escape sequences\n this._simpleApostropheString = /^'([^'\\\\\\r\\n]*)'(?=[^'])/;\n this._langcode = /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\\-])/i;\n this._prefix = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:(?=[#\\s<])/;\n this._prefixed = /^((?:[A-Za-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)?:((?:(?:[0-:A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])(?:(?:[\\.\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~])*(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff]|%[0-9a-fA-F]{2}|\\\\[!#-\\/;=?\\-@_~]))?)?)(?:[ \\t]+|(?=\\.?[,;!\\^\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._variable = /^\\?(?:(?:[A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:[\\-0-:A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?=[.,;!\\^\\s#()\\[\\]\\{\\}\"'<>])/;\n this._blank = /^_:((?:[0-9A-Z_a-z\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02ff\\u0370-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])(?:\\.?[\\-0-9A-Z_a-z\\xb7\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u037d\\u037f-\\u1fff\\u200c\\u200d\\u203f\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]|[\\ud800-\\udb7f][\\udc00-\\udfff])*)(?:[ \\t]+|(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>]))/;\n this._number = /^[\\-+]?(?:(\\d+\\.\\d*|\\.?\\d+)[eE][\\-+]?|\\d*(\\.)?)\\d+(?=\\.?[,;:\\s#()\\[\\]\\{\\}\"'<>])/;\n this._boolean = /^(?:true|false)(?=[.,;\\s#()\\[\\]\\{\\}\"'<>])/;\n this._keyword = /^@[a-z]+(?=[\\s#<:])/i;\n this._sparqlKeyword = /^(?:PREFIX|BASE|GRAPH)(?=[\\s#<])/i;\n this._shortPredicates = /^a(?=[\\s#()\\[\\]\\{\\}\"'<>])/;\n this._newline = /^[ \\t]*(?:#[^\\n\\r]*)?(?:\\r\\n|\\n|\\r)[ \\t]*/;\n this._comment = /#([^\\n\\r]*)/;\n this._whitespace = /^[ \\t]+/;\n this._endOfFile = /^(?:#[^\\n\\r]*)?$/;\n options = options || {};\n\n // In line mode (N-Triples or N-Quads), only simple features may be parsed\n if (this._lineMode = !!options.lineMode) {\n this._n3Mode = false;\n // Don't tokenize special literals\n for (const key in this) {\n if (!(key in lineModeRegExps) && this[key] instanceof RegExp)\n this[key] = invalidRegExp;\n }\n }\n // When not in line mode, enable N3 functionality by default\n else {\n this._n3Mode = options.n3 !== false;\n }\n // Don't output comment tokens by default\n this._comments = !!options.comments;\n // Cache the last tested closing position of long literals\n this._literalClosingPos = 0;\n }\n\n // ## Private methods\n\n // ### `_tokenizeToEnd` tokenizes as for as possible, emitting tokens through the callback\n _tokenizeToEnd(callback, inputFinished) {\n // Continue parsing as far as possible; the loop will return eventually\n let input = this._input;\n let currentLineLength = input.length;\n while (true) {\n // Count and skip whitespace lines\n let whiteSpaceMatch, comment;\n while (whiteSpaceMatch = this._newline.exec(input)) {\n // Try to find a comment\n if (this._comments && (comment = this._comment.exec(whiteSpaceMatch[0])))\n emitToken('comment', comment[1], '', this._line, whiteSpaceMatch[0].length);\n // Advance the input\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n currentLineLength = input.length;\n this._line++;\n }\n // Skip whitespace on current line\n if (!whiteSpaceMatch && (whiteSpaceMatch = this._whitespace.exec(input)))\n input = input.substr(whiteSpaceMatch[0].length, input.length);\n\n // Stop for now if we're at the end\n if (this._endOfFile.test(input)) {\n // If the input is finished, emit EOF\n if (inputFinished) {\n // Try to find a final comment\n if (this._comments && (comment = this._comment.exec(input)))\n emitToken('comment', comment[1], '', this._line, input.length);\n input = null;\n emitToken('eof', '', '', this._line, 0);\n }\n return this._input = input;\n }\n\n // Look for specific token types based on the first character\n const line = this._line, firstChar = input[0];\n let type = '', value = '', prefix = '',\n match = null, matchLength = 0, inconclusive = false;\n switch (firstChar) {\n case '^':\n // We need at least 3 tokens lookahead to distinguish ^^ and ^^pre:fixed\n if (input.length < 3)\n break;\n // Try to match a type\n else if (input[1] === '^') {\n this._previousMarker = '^^';\n // Move to type IRI or prefixed name\n input = input.substr(2);\n if (input[0] !== '<') {\n inconclusive = true;\n break;\n }\n }\n // If no type, it must be a path expression\n else {\n if (this._n3Mode) {\n matchLength = 1;\n type = '^';\n }\n break;\n }\n // Fall through in case the type is an IRI\n case '<':\n // Try to find a full IRI without escape sequences\n if (match = this._unescapedIri.exec(input))\n type = 'IRI', value = match[1];\n // Try to find a full IRI with escape sequences\n else if (match = this._iri.exec(input)) {\n value = this._unescape(match[1]);\n if (value === null || illegalIriChars.test(value))\n return reportSyntaxError(this);\n type = 'IRI';\n }\n // Try to find a nested triple\n else if (input.length > 1 && input[1] === '<')\n type = '<<', matchLength = 2;\n // Try to find a backwards implication arrow\n else if (this._n3Mode && input.length > 1 && input[1] === '=')\n type = 'inverse', matchLength = 2, value = '>';\n break;\n\n case '>':\n if (input.length > 1 && input[1] === '>')\n type = '>>', matchLength = 2;\n break;\n\n case '_':\n // Try to find a blank node. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a blank node.\n // Therefore, try inserting a space if we're at the end of the input.\n if ((match = this._blank.exec(input)) ||\n inputFinished && (match = this._blank.exec(`${input} `)))\n type = 'blank', prefix = '_', value = match[1];\n break;\n\n case '\"':\n // Try to find a literal without escape sequences\n if (match = this._simpleQuotedString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n break;\n\n case \"'\":\n if (!this._lineMode) {\n // Try to find a literal without escape sequences\n if (match = this._simpleApostropheString.exec(input))\n value = match[1];\n // Try to find a literal wrapped in three pairs of quotes\n else {\n ({ value, matchLength } = this._parseLiteral(input));\n if (value === null)\n return reportSyntaxError(this);\n }\n if (match !== null || matchLength !== 0) {\n type = 'literal';\n this._literalClosingPos = 0;\n }\n }\n break;\n\n case '?':\n // Try to find a variable\n if (this._n3Mode && (match = this._variable.exec(input)))\n type = 'var', value = match[0];\n break;\n\n case '@':\n // Try to find a language code\n if (this._previousMarker === 'literal' && (match = this._langcode.exec(input)))\n type = 'langcode', value = match[1];\n // Try to find a keyword\n else if (match = this._keyword.exec(input))\n type = match[0];\n break;\n\n case '.':\n // Try to find a dot as punctuation\n if (input.length === 1 ? inputFinished : (input[1] < '0' || input[1] > '9')) {\n type = '.';\n matchLength = 1;\n break;\n }\n // Fall through to numerical case (could be a decimal dot)\n\n case '0':\n case '1':\n case '2':\n case '3':\n case '4':\n case '5':\n case '6':\n case '7':\n case '8':\n case '9':\n case '+':\n case '-':\n // Try to find a number. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a number.\n // Therefore, try inserting a space if we're at the end of the input.\n if (match = this._number.exec(input) ||\n inputFinished && (match = this._number.exec(`${input} `))) {\n type = 'literal', value = match[0];\n prefix = (typeof match[1] === 'string' ? xsd.double :\n (typeof match[2] === 'string' ? xsd.decimal : xsd.integer));\n }\n break;\n\n case 'B':\n case 'b':\n case 'p':\n case 'P':\n case 'G':\n case 'g':\n // Try to find a SPARQL-style keyword\n if (match = this._sparqlKeyword.exec(input))\n type = match[0].toUpperCase();\n else\n inconclusive = true;\n break;\n\n case 'f':\n case 't':\n // Try to match a boolean\n if (match = this._boolean.exec(input))\n type = 'literal', value = match[0], prefix = xsd.boolean;\n else\n inconclusive = true;\n break;\n\n case 'a':\n // Try to find an abbreviated predicate\n if (match = this._shortPredicates.exec(input))\n type = 'abbreviation', value = 'a';\n else\n inconclusive = true;\n break;\n\n case '=':\n // Try to find an implication arrow or equals sign\n if (this._n3Mode && input.length > 1) {\n type = 'abbreviation';\n if (input[1] !== '>')\n matchLength = 1, value = '=';\n else\n matchLength = 2, value = '>';\n }\n break;\n\n case '!':\n if (!this._n3Mode)\n break;\n case ',':\n case ';':\n case '[':\n case ']':\n case '(':\n case ')':\n case '}':\n if (!this._lineMode) {\n matchLength = 1;\n type = firstChar;\n }\n break;\n case '{':\n // We need at least 2 tokens lookahead to distinguish \"{|\" and \"{ \"\n if (!this._lineMode && input.length >= 2) {\n // Try to find a quoted triple annotation start\n if (input[1] === '|')\n type = '{|', matchLength = 2;\n else\n type = firstChar, matchLength = 1;\n }\n break;\n case '|':\n // We need 2 tokens lookahead to parse \"|}\"\n // Try to find a quoted triple annotation end\n if (input.length >= 2 && input[1] === '}')\n type = '|}', matchLength = 2;\n break;\n\n default:\n inconclusive = true;\n }\n\n // Some first characters do not allow an immediate decision, so inspect more\n if (inconclusive) {\n // Try to find a prefix\n if ((this._previousMarker === '@prefix' || this._previousMarker === 'PREFIX') &&\n (match = this._prefix.exec(input)))\n type = 'prefix', value = match[1] || '';\n // Try to find a prefixed name. Since it can contain (but not end with) a dot,\n // we always need a non-dot character before deciding it is a prefixed name.\n // Therefore, try inserting a space if we're at the end of the input.\n else if ((match = this._prefixed.exec(input)) ||\n inputFinished && (match = this._prefixed.exec(`${input} `)))\n type = 'prefixed', prefix = match[1] || '', value = this._unescape(match[2]);\n }\n\n // A type token is special: it can only be emitted after an IRI or prefixed name is read\n if (this._previousMarker === '^^') {\n switch (type) {\n case 'prefixed': type = 'type'; break;\n case 'IRI': type = 'typeIRI'; break;\n default: type = '';\n }\n }\n\n // What if nothing of the above was found?\n if (!type) {\n // We could be in streaming mode, and then we just wait for more input to arrive.\n // Otherwise, a syntax error has occurred in the input.\n // One exception: error on an unaccounted linebreak (= not inside a triple-quoted literal).\n if (inputFinished || (!/^'''|^\"\"\"/.test(input) && /\\n|\\r/.test(input)))\n return reportSyntaxError(this);\n else\n return this._input = input;\n }\n\n // Emit the parsed token\n const length = matchLength || match[0].length;\n const token = emitToken(type, value, prefix, line, length);\n this.previousToken = token;\n this._previousMarker = type;\n\n // Advance to next part to tokenize\n input = input.substr(length, input.length);\n }\n\n // Emits the token through the callback\n function emitToken(type, value, prefix, line, length) {\n const start = input ? currentLineLength - input.length : currentLineLength;\n const end = start + length;\n const token = { type, value, prefix, line, start, end };\n callback(null, token);\n return token;\n }\n // Signals the syntax error through the callback\n function reportSyntaxError(self) { callback(self._syntaxError(/^\\S*/.exec(input)[0])); }\n }\n\n // ### `_unescape` replaces N3 escape codes by their corresponding characters\n _unescape(item) {\n let invalid = false;\n const replaced = item.replace(escapeSequence, (sequence, unicode4, unicode8, escapedChar) => {\n // 4-digit unicode character\n if (typeof unicode4 === 'string')\n return String.fromCharCode(Number.parseInt(unicode4, 16));\n // 8-digit unicode character\n if (typeof unicode8 === 'string') {\n let charCode = Number.parseInt(unicode8, 16);\n return charCode <= 0xFFFF ? String.fromCharCode(Number.parseInt(unicode8, 16)) :\n String.fromCharCode(0xD800 + ((charCode -= 0x10000) >> 10), 0xDC00 + (charCode & 0x3FF));\n }\n // fixed escape sequence\n if (escapedChar in escapeReplacements)\n return escapeReplacements[escapedChar];\n // invalid escape sequence\n invalid = true;\n return '';\n });\n return invalid ? null : replaced;\n }\n\n // ### `_parseLiteral` parses a literal into an unescaped value\n _parseLiteral(input) {\n // Ensure we have enough lookahead to identify triple-quoted strings\n if (input.length >= 3) {\n // Identify the opening quote(s)\n const opening = input.match(/^(?:\"\"\"|\"|'''|'|)/)[0];\n const openingLength = opening.length;\n\n // Find the next candidate closing quotes\n let closingPos = Math.max(this._literalClosingPos, openingLength);\n while ((closingPos = input.indexOf(opening, closingPos)) > 0) {\n // Count backslashes right before the closing quotes\n let backslashCount = 0;\n while (input[closingPos - backslashCount - 1] === '\\\\')\n backslashCount++;\n\n // An even number of backslashes (in particular 0)\n // means these are actual, non-escaped closing quotes\n if (backslashCount % 2 === 0) {\n // Extract and unescape the value\n const raw = input.substring(openingLength, closingPos);\n const lines = raw.split(/\\r\\n|\\r|\\n/).length - 1;\n const matchLength = closingPos + openingLength;\n // Only triple-quoted strings can be multi-line\n if (openingLength === 1 && lines !== 0 ||\n openingLength === 3 && this._lineMode)\n break;\n this._line += lines;\n return { value: this._unescape(raw), matchLength };\n }\n closingPos++;\n }\n this._literalClosingPos = input.length - openingLength + 1;\n }\n return { value: '', matchLength: 0 };\n }\n\n // ### `_syntaxError` creates a syntax error for the given issue\n _syntaxError(issue) {\n this._input = null;\n const err = new Error(`Unexpected \"${issue}\" on line ${this._line}.`);\n err.context = {\n token: undefined,\n line: this._line,\n previousToken: this.previousToken,\n };\n return err;\n }\n\n // ### Strips off any starting UTF BOM mark.\n _readStartingBom(input) {\n return input.startsWith('\\ufeff') ? input.substr(1) : input;\n }\n\n // ## Public methods\n\n // ### `tokenize` starts the transformation of an N3 document into an array of tokens.\n // The input can be a string or a stream.\n tokenize(input, callback) {\n this._line = 1;\n\n // If the input is a string, continuously emit tokens through the callback until the end\n if (typeof input === 'string') {\n this._input = this._readStartingBom(input);\n // If a callback was passed, asynchronously call it\n if (typeof callback === 'function')\n queueMicrotask(() => this._tokenizeToEnd(callback, true));\n // If no callback was passed, tokenize synchronously and return\n else {\n const tokens = [];\n let error;\n this._tokenizeToEnd((e, t) => e ? (error = e) : tokens.push(t), true);\n if (error) throw error;\n return tokens;\n }\n }\n // Otherwise, the input must be a stream\n else {\n this._pendingBuffer = null;\n if (typeof input.setEncoding === 'function')\n input.setEncoding('utf8');\n // Adds the data chunk to the buffer and parses as far as possible\n input.on('data', data => {\n if (this._input !== null && data.length !== 0) {\n // Prepend any previous pending writes\n if (this._pendingBuffer) {\n data = Buffer.concat([this._pendingBuffer, data]);\n this._pendingBuffer = null;\n }\n // Hold if the buffer ends in an incomplete unicode sequence\n if (data[data.length - 1] & 0x80) {\n this._pendingBuffer = data;\n }\n // Otherwise, tokenize as far as possible\n else {\n // Only read a BOM at the start\n if (typeof this._input === 'undefined')\n this._input = this._readStartingBom(typeof data === 'string' ? data : data.toString());\n else\n this._input += data;\n this._tokenizeToEnd(callback, false);\n }\n }\n });\n // Parses until the end\n input.on('end', () => {\n if (typeof this._input === 'string')\n this._tokenizeToEnd(callback, true);\n });\n input.on('error', callback);\n }\n }\n}\n","// **N3Parser** parses N3 documents.\nimport N3Lexer from './N3Lexer';\nimport N3DataFactory from './N3DataFactory';\nimport namespaces from './IRIs';\n\nlet blankNodePrefix = 0;\n\n// ## Constructor\nexport default class N3Parser {\n constructor(options) {\n this._contextStack = [];\n this._graph = null;\n\n // Set the document IRI\n options = options || {};\n this._setBase(options.baseIRI);\n options.factory && initDataFactory(this, options.factory);\n\n // Set supported features depending on the format\n const format = (typeof options.format === 'string') ?\n options.format.match(/\\w*$/)[0].toLowerCase() : '',\n isTurtle = /turtle/.test(format), isTriG = /trig/.test(format),\n isNTriples = /triple/.test(format), isNQuads = /quad/.test(format),\n isN3 = this._n3Mode = /n3/.test(format),\n isLineMode = isNTriples || isNQuads;\n if (!(this._supportsNamedGraphs = !(isTurtle || isN3)))\n this._readPredicateOrNamedGraph = this._readPredicate;\n // Support triples in other graphs\n this._supportsQuads = !(isTurtle || isTriG || isNTriples || isN3);\n // Support nesting of triples\n this._supportsRDFStar = format === '' || /star|\\*$/.test(format);\n // Disable relative IRIs in N-Triples or N-Quads mode\n if (isLineMode)\n this._resolveRelativeIRI = iri => { return null; };\n this._blankNodePrefix = typeof options.blankNodePrefix !== 'string' ? '' :\n options.blankNodePrefix.replace(/^(?!_:)/, '_:');\n this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3 });\n // Disable explicit quantifiers by default\n this._explicitQuantifiers = !!options.explicitQuantifiers;\n }\n\n // ## Static class methods\n\n // ### `_resetBlankNodePrefix` restarts blank node prefix identification\n static _resetBlankNodePrefix() {\n blankNodePrefix = 0;\n }\n\n // ## Private methods\n\n // ### `_setBase` sets the base IRI to resolve relative IRIs\n _setBase(baseIRI) {\n if (!baseIRI) {\n this._base = '';\n this._basePath = '';\n }\n else {\n // Remove fragment if present\n const fragmentPos = baseIRI.indexOf('#');\n if (fragmentPos >= 0)\n baseIRI = baseIRI.substr(0, fragmentPos);\n // Set base IRI and its components\n this._base = baseIRI;\n this._basePath = baseIRI.indexOf('/') < 0 ? baseIRI :\n baseIRI.replace(/[^\\/?]*(?:\\?.*)?$/, '');\n baseIRI = baseIRI.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\\/\\/[^\\/]*)?/i);\n this._baseRoot = baseIRI[0];\n this._baseScheme = baseIRI[1];\n }\n }\n\n // ### `_saveContext` stores the current parsing context\n // when entering a new scope (list, blank node, formula)\n _saveContext(type, graph, subject, predicate, object) {\n const n3Mode = this._n3Mode;\n this._contextStack.push({\n type,\n subject, predicate, object, graph,\n inverse: n3Mode ? this._inversePredicate : false,\n blankPrefix: n3Mode ? this._prefixes._ : '',\n quantified: n3Mode ? this._quantified : null,\n });\n // The settings below only apply to N3 streams\n if (n3Mode) {\n // Every new scope resets the predicate direction\n this._inversePredicate = false;\n // In N3, blank nodes are scoped to a formula\n // (using a dot as separator, as a blank node label cannot start with it)\n this._prefixes._ = (this._graph ? `${this._graph.value}.` : '.');\n // Quantifiers are scoped to a formula\n this._quantified = Object.create(this._quantified);\n }\n }\n\n // ### `_restoreContext` restores the parent context\n // when leaving a scope (list, blank node, formula)\n _restoreContext(type, token) {\n // Obtain the previous context\n const context = this._contextStack.pop();\n if (!context || context.type !== type)\n return this._error(`Unexpected ${token.type}`, token);\n\n // Restore the quad of the previous context\n this._subject = context.subject;\n this._predicate = context.predicate;\n this._object = context.object;\n this._graph = context.graph;\n\n // Restore N3 context settings\n if (this._n3Mode) {\n this._inversePredicate = context.inverse;\n this._prefixes._ = context.blankPrefix;\n this._quantified = context.quantified;\n }\n }\n\n // ### `_readInTopContext` reads a token when in the top context\n _readInTopContext(token) {\n switch (token.type) {\n // If an EOF token arrives in the top context, signal that we're done\n case 'eof':\n if (this._graph !== null)\n return this._error('Unclosed graph', token);\n delete this._prefixes._;\n return this._callback(null, null, this._prefixes);\n // It could be a prefix declaration\n case 'PREFIX':\n this._sparqlStyle = true;\n case '@prefix':\n return this._readPrefix;\n // It could be a base declaration\n case 'BASE':\n this._sparqlStyle = true;\n case '@base':\n return this._readBaseIRI;\n // It could be a graph\n case '{':\n if (this._supportsNamedGraphs) {\n this._graph = '';\n this._subject = null;\n return this._readSubject;\n }\n case 'GRAPH':\n if (this._supportsNamedGraphs)\n return this._readNamedGraphLabel;\n // Otherwise, the next token must be a subject\n default:\n return this._readSubject(token);\n }\n }\n\n // ### `_readEntity` reads an IRI, prefixed name, blank node, or variable\n _readEntity(token, quantifier) {\n let value;\n switch (token.type) {\n // Read a relative or absolute IRI\n case 'IRI':\n case 'typeIRI':\n const iri = this._resolveIRI(token.value);\n if (iri === null)\n return this._error('Invalid IRI', token);\n value = this._namedNode(iri);\n break;\n // Read a prefixed name\n case 'type':\n case 'prefixed':\n const prefix = this._prefixes[token.prefix];\n if (prefix === undefined)\n return this._error(`Undefined prefix \"${token.prefix}:\"`, token);\n value = this._namedNode(prefix + token.value);\n break;\n // Read a blank node\n case 'blank':\n value = this._blankNode(this._prefixes[token.prefix] + token.value);\n break;\n // Read a variable\n case 'var':\n value = this._variable(token.value.substr(1));\n break;\n // Everything else is not an entity\n default:\n return this._error(`Expected entity but got ${token.type}`, token);\n }\n // In N3 mode, replace the entity if it is quantified\n if (!quantifier && this._n3Mode && (value.id in this._quantified))\n value = this._quantified[value.id];\n return value;\n }\n\n // ### `_readSubject` reads a quad's subject\n _readSubject(token) {\n this._predicate = null;\n switch (token.type) {\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph,\n this._subject = this._blankNode(), null, null);\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this.RDF_NIL, null, null);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph,\n this._graph = this._blankNode(), null, null);\n return this._readSubject;\n case '}':\n // No subject; the graph in which we are reading is closed instead\n return this._readPunctuation(token);\n case '@forSome':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forSome\"', token);\n this._subject = null;\n this._predicate = this.N3_FORSOME;\n this._quantifier = this._blankNode;\n return this._readQuantifierList;\n case '@forAll':\n if (!this._n3Mode)\n return this._error('Unexpected \"@forAll\"', token);\n this._subject = null;\n this._predicate = this.N3_FORALL;\n this._quantifier = this._variable;\n return this._readQuantifierList;\n case 'literal':\n if (!this._n3Mode)\n return this._error('Unexpected literal', token);\n\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._completeSubjectLiteral;\n }\n else\n this._subject = this._literal(token.value, this._namedNode(token.prefix));\n\n break;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n this._saveContext('<<', this._graph, null, null, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the subject entity\n if ((this._subject = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the subject might be a path\n if (this._n3Mode)\n return this._getPathReader(this._readPredicateOrNamedGraph);\n }\n\n // The next token must be a predicate,\n // or, if the subject was actually a graph IRI, a named graph\n return this._readPredicateOrNamedGraph;\n }\n\n // ### `_readPredicate` reads a quad's predicate\n _readPredicate(token) {\n const type = token.type;\n switch (type) {\n case 'inverse':\n this._inversePredicate = true;\n case 'abbreviation':\n this._predicate = this.ABBREVIATIONS[token.value];\n break;\n case '.':\n case ']':\n case '}':\n // Expected predicate didn't come, must have been trailing semicolon\n if (this._predicate === null)\n return this._error(`Unexpected ${type}`, token);\n this._subject = null;\n return type === ']' ? this._readBlankNodeTail(token) : this._readPunctuation(token);\n case ';':\n // Additional semicolons can be safely ignored\n return this._predicate !== null ? this._readPredicate :\n this._error('Expected predicate but got ;', token);\n case '[':\n if (this._n3Mode) {\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject,\n this._subject = this._blankNode(), null);\n return this._readBlankNodeHead;\n }\n case 'blank':\n if (!this._n3Mode)\n return this._error('Disallowed blank node as predicate', token);\n default:\n if ((this._predicate = this._readEntity(token)) === undefined)\n return;\n }\n // The next token must be an object\n return this._readObject;\n }\n\n // ### `_readObject` reads a quad's object\n _readObject(token) {\n switch (token.type) {\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n return this._readDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else\n this._object = this._literal(token.value, this._namedNode(token.prefix));\n break;\n case '[':\n // Start a new quad with a new blank node as subject\n this._saveContext('blank', this._graph, this._subject, this._predicate,\n this._subject = this._blankNode());\n return this._readBlankNodeHead;\n case '(':\n // Start a new list\n this._saveContext('list', this._graph, this._subject, this._predicate, this.RDF_NIL);\n this._subject = null;\n return this._readListItem;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._blankNode());\n return this._readSubject;\n case '<<':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n this._saveContext('<<', this._graph, this._subject, this._predicate, null);\n this._graph = null;\n return this._readSubject;\n default:\n // Read the object entity\n if ((this._object = this._readEntity(token)) === undefined)\n return;\n // In N3 mode, the object might be a path\n if (this._n3Mode)\n return this._getPathReader(this._getContextEndReader());\n }\n return this._getContextEndReader();\n }\n\n // ### `_readPredicateOrNamedGraph` reads a quad's predicate, or a named graph\n _readPredicateOrNamedGraph(token) {\n return token.type === '{' ? this._readGraph(token) : this._readPredicate(token);\n }\n\n // ### `_readGraph` reads a graph\n _readGraph(token) {\n if (token.type !== '{')\n return this._error(`Expected graph but got ${token.type}`, token);\n // The \"subject\" we read is actually the GRAPH's label\n this._graph = this._subject, this._subject = null;\n return this._readSubject;\n }\n\n // ### `_readBlankNodeHead` reads the head of a blank node\n _readBlankNodeHead(token) {\n if (token.type === ']') {\n this._subject = null;\n return this._readBlankNodeTail(token);\n }\n else {\n this._predicate = null;\n return this._readPredicate(token);\n }\n }\n\n // ### `_readBlankNodeTail` reads the end of a blank node\n _readBlankNodeTail(token) {\n if (token.type !== ']')\n return this._readBlankNodePunctuation(token);\n\n // Store blank node quad\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this blank node\n const empty = this._predicate === null;\n this._restoreContext('blank', token);\n // If the blank node was the object, restore previous context and read punctuation\n if (this._object !== null)\n return this._getContextEndReader();\n // If the blank node was the predicate, continue reading the object\n else if (this._predicate !== null)\n return this._readObject;\n // If the blank node was the subject, continue reading the predicate\n else\n // If the blank node was empty, it could be a named graph label\n return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank;\n }\n\n // ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node\n _readPredicateAfterBlank(token) {\n switch (token.type) {\n case '.':\n case '}':\n // No predicate is coming if the triple is terminated here\n this._subject = null;\n return this._readPunctuation(token);\n default:\n return this._readPredicate(token);\n }\n }\n\n // ### `_readListItem` reads items from a list\n _readListItem(token) {\n let item = null, // The item of the list\n list = null, // The list itself\n next = this._readListItem; // The next function to execute\n const previousList = this._subject, // The previous list that contains this list\n stack = this._contextStack, // The stack of parent contexts\n parent = stack[stack.length - 1]; // The parent containing the current list\n\n switch (token.type) {\n case '[':\n // Stack the current list quad and start a new quad with a blank node as subject\n this._saveContext('blank', this._graph,\n list = this._blankNode(), this.RDF_FIRST,\n this._subject = item = this._blankNode());\n next = this._readBlankNodeHead;\n break;\n case '(':\n // Stack the current list quad and start a new list\n this._saveContext('list', this._graph,\n list = this._blankNode(), this.RDF_FIRST, this.RDF_NIL);\n this._subject = null;\n break;\n case ')':\n // Closing the list; restore the parent context\n this._restoreContext('list', token);\n // If this list is contained within a parent list, return the membership quad here.\n // This will be ` rdf:first .`.\n if (stack.length !== 0 && stack[stack.length - 1].type === 'list')\n this._emit(this._subject, this._predicate, this._object, this._graph);\n // Was this list the parent's subject?\n if (this._predicate === null) {\n // The next token is the predicate\n next = this._readPredicate;\n // No list tail if this was an empty list\n if (this._subject === this.RDF_NIL)\n return next;\n }\n // The list was in the parent context's object\n else {\n next = this._getContextEndReader();\n // No list tail if this was an empty list\n if (this._object === this.RDF_NIL)\n return next;\n }\n // Close the list by making the head nil\n list = this.RDF_NIL;\n break;\n case 'literal':\n // Regular literal, can still get a datatype or language\n if (token.prefix.length === 0) {\n this._literalValue = token.value;\n next = this._readListItemDataTypeOrLang;\n }\n // Pre-datatyped string literal (prefix stores the datatype)\n else {\n item = this._literal(token.value, this._namedNode(token.prefix));\n next = this._getContextEndReader();\n }\n break;\n case '{':\n // Start a new formula\n if (!this._n3Mode)\n return this._error('Unexpected graph', token);\n this._saveContext('formula', this._graph, this._subject, this._predicate,\n this._graph = this._blankNode());\n return this._readSubject;\n default:\n if ((item = this._readEntity(token)) === undefined)\n return;\n }\n\n // Create a new blank node if no item head was assigned yet\n if (list === null)\n this._subject = list = this._blankNode();\n\n // Is this the first element of the list?\n if (previousList === null) {\n // This list is either the subject or the object of its parent\n if (parent.predicate === null)\n parent.subject = list;\n else\n parent.object = list;\n }\n else {\n // Continue the previous list with the current list\n this._emit(previousList, this.RDF_REST, list, this._graph);\n }\n // If an item was read, add it to the list\n if (item !== null) {\n // In N3 mode, the item might be a path\n if (this._n3Mode && (token.type === 'IRI' || token.type === 'prefixed')) {\n // Create a new context to add the item's path\n this._saveContext('item', this._graph, list, this.RDF_FIRST, item);\n this._subject = item, this._predicate = null;\n // _readPath will restore the context and output the item\n return this._getPathReader(this._readListItem);\n }\n // Output the item\n this._emit(list, this.RDF_FIRST, item, this._graph);\n }\n return next;\n }\n\n // ### `_readDataTypeOrLang` reads an _optional_ datatype or language\n _readDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, false);\n }\n\n\n // ### `_readListItemDataTypeOrLang` reads an _optional_ datatype or language in a list\n _readListItemDataTypeOrLang(token) {\n return this._completeObjectLiteral(token, true);\n }\n\n // ### `_completeLiteral` completes a literal with an optional datatype or language\n _completeLiteral(token) {\n // Create a simple string literal by default\n let literal = this._literal(this._literalValue);\n\n switch (token.type) {\n // Create a datatyped literal\n case 'type':\n case 'typeIRI':\n const datatype = this._readEntity(token);\n if (datatype === undefined) return; // No datatype means an error occurred\n literal = this._literal(this._literalValue, datatype);\n token = null;\n break;\n // Create a language-tagged string\n case 'langcode':\n literal = this._literal(this._literalValue, token.value);\n token = null;\n break;\n }\n\n return { token, literal };\n }\n\n // Completes a literal in subject position\n _completeSubjectLiteral(token) {\n this._subject = this._completeLiteral(token).literal;\n return this._readPredicateOrNamedGraph;\n }\n\n // Completes a literal in object position\n _completeObjectLiteral(token, listItem) {\n const completed = this._completeLiteral(token);\n if (!completed)\n return;\n this._object = completed.literal;\n\n // If this literal was part of a list, write the item\n // (we could also check the context stack, but passing in a flag is faster)\n if (listItem)\n this._emit(this._subject, this.RDF_FIRST, this._object, this._graph);\n // If the token was consumed, continue with the rest of the input\n if (completed.token === null)\n return this._getContextEndReader();\n // Otherwise, consume the token now\n else {\n this._readCallback = this._getContextEndReader();\n return this._readCallback(completed.token);\n }\n }\n\n // ### `_readFormulaTail` reads the end of a formula\n _readFormulaTail(token) {\n if (token.type !== '}')\n return this._readPunctuation(token);\n\n // Store the last quad of the formula\n if (this._subject !== null)\n this._emit(this._subject, this._predicate, this._object, this._graph);\n\n // Restore the parent context containing this formula\n this._restoreContext('formula', token);\n // If the formula was the subject, continue reading the predicate.\n // If the formula was the object, read punctuation.\n return this._object === null ? this._readPredicate : this._getContextEndReader();\n }\n\n // ### `_readPunctuation` reads punctuation between quads or quad parts\n _readPunctuation(token) {\n let next, graph = this._graph;\n const subject = this._subject, inversePredicate = this._inversePredicate;\n switch (token.type) {\n // A closing brace ends a graph\n case '}':\n if (this._graph === null)\n return this._error('Unexpected graph closing', token);\n if (this._n3Mode)\n return this._readFormulaTail(token);\n this._graph = null;\n // A dot just ends the statement, without sharing anything with the next\n case '.':\n this._subject = null;\n next = this._contextStack.length ? this._readSubject : this._readInTopContext;\n if (inversePredicate) this._inversePredicate = false;\n break;\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n // {| means that the current triple is annotated with predicate-object pairs.\n case '{|':\n if (!this._supportsRDFStar)\n return this._error('Unexpected RDF* syntax', token);\n // Continue using the last triple as quoted triple subject for the predicate-object pairs.\n const predicate = this._predicate, object = this._object;\n this._subject = this._quad(subject, predicate, object, this.DEFAULTGRAPH);\n next = this._readPredicate;\n break;\n // |} means that the current quoted triple in annotation syntax is finalized.\n case '|}':\n if (this._subject.termType !== 'Quad')\n return this._error('Unexpected asserted triple closing', token);\n this._subject = null;\n next = this._readPunctuation;\n break;\n default:\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (graph = this._readEntity(token)) !== undefined) {\n next = this._readQuadPunctuation;\n break;\n }\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n if (subject !== null) {\n const predicate = this._predicate, object = this._object;\n if (!inversePredicate)\n this._emit(subject, predicate, object, graph);\n else\n this._emit(object, predicate, subject, graph);\n }\n return next;\n }\n\n // ### `_readBlankNodePunctuation` reads punctuation in a blank node\n _readBlankNodePunctuation(token) {\n let next;\n switch (token.type) {\n // Semicolon means the subject is shared; predicate and object are different\n case ';':\n next = this._readPredicate;\n break;\n // Comma means both the subject and predicate are shared; the object is different\n case ',':\n next = this._readObject;\n break;\n default:\n return this._error(`Expected punctuation to follow \"${this._object.id}\"`, token);\n }\n // A quad has been completed now, so return it\n this._emit(this._subject, this._predicate, this._object, this._graph);\n return next;\n }\n\n // ### `_readQuadPunctuation` reads punctuation after a quad\n _readQuadPunctuation(token) {\n if (token.type !== '.')\n return this._error('Expected dot to follow quad', token);\n return this._readInTopContext;\n }\n\n // ### `_readPrefix` reads the prefix of a prefix declaration\n _readPrefix(token) {\n if (token.type !== 'prefix')\n return this._error('Expected prefix to follow @prefix', token);\n this._prefix = token.value;\n return this._readPrefixIRI;\n }\n\n // ### `_readPrefixIRI` reads the IRI of a prefix declaration\n _readPrefixIRI(token) {\n if (token.type !== 'IRI')\n return this._error(`Expected IRI to follow prefix \"${this._prefix}:\"`, token);\n const prefixNode = this._readEntity(token);\n this._prefixes[this._prefix] = prefixNode.value;\n this._prefixCallback(this._prefix, prefixNode);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readBaseIRI` reads the IRI of a base declaration\n _readBaseIRI(token) {\n const iri = token.type === 'IRI' && this._resolveIRI(token.value);\n if (!iri)\n return this._error('Expected valid IRI to follow base declaration', token);\n this._setBase(iri);\n return this._readDeclarationPunctuation;\n }\n\n // ### `_readNamedGraphLabel` reads the label of a named graph\n _readNamedGraphLabel(token) {\n switch (token.type) {\n case 'IRI':\n case 'blank':\n case 'prefixed':\n return this._readSubject(token), this._readGraph;\n case '[':\n return this._readNamedGraphBlankLabel;\n default:\n return this._error('Invalid graph label', token);\n }\n }\n\n // ### `_readNamedGraphLabel` reads a blank node label of a named graph\n _readNamedGraphBlankLabel(token) {\n if (token.type !== ']')\n return this._error('Invalid graph label', token);\n this._subject = this._blankNode();\n return this._readGraph;\n }\n\n // ### `_readDeclarationPunctuation` reads the punctuation of a declaration\n _readDeclarationPunctuation(token) {\n // SPARQL-style declarations don't have punctuation\n if (this._sparqlStyle) {\n this._sparqlStyle = false;\n return this._readInTopContext(token);\n }\n\n if (token.type !== '.')\n return this._error('Expected declaration to end with a dot', token);\n return this._readInTopContext;\n }\n\n // Reads a list of quantified symbols from a @forSome or @forAll statement\n _readQuantifierList(token) {\n let entity;\n switch (token.type) {\n case 'IRI':\n case 'prefixed':\n if ((entity = this._readEntity(token, true)) !== undefined)\n break;\n default:\n return this._error(`Unexpected ${token.type}`, token);\n }\n // Without explicit quantifiers, map entities to a quantified entity\n if (!this._explicitQuantifiers)\n this._quantified[entity.id] = this._quantifier(this._blankNode().value);\n // With explicit quantifiers, output the reified quantifier\n else {\n // If this is the first item, start a new quantifier list\n if (this._subject === null)\n this._emit(this._graph || this.DEFAULTGRAPH, this._predicate,\n this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);\n // Otherwise, continue the previous list\n else\n this._emit(this._subject, this.RDF_REST,\n this._subject = this._blankNode(), this.QUANTIFIERS_GRAPH);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, entity, this.QUANTIFIERS_GRAPH);\n }\n return this._readQuantifierPunctuation;\n }\n\n // Reads punctuation from a @forSome or @forAll statement\n _readQuantifierPunctuation(token) {\n // Read more quantifiers\n if (token.type === ',')\n return this._readQuantifierList;\n // End of the quantifier list\n else {\n // With explicit quantifiers, close the quantifier list\n if (this._explicitQuantifiers) {\n this._emit(this._subject, this.RDF_REST, this.RDF_NIL, this.QUANTIFIERS_GRAPH);\n this._subject = null;\n }\n // Read a dot\n this._readCallback = this._getContextEndReader();\n return this._readCallback(token);\n }\n }\n\n // ### `_getPathReader` reads a potential path and then resumes with the given function\n _getPathReader(afterPath) {\n this._afterPath = afterPath;\n return this._readPath;\n }\n\n // ### `_readPath` reads a potential path\n _readPath(token) {\n switch (token.type) {\n // Forward path\n case '!': return this._readForwardPath;\n // Backward path\n case '^': return this._readBackwardPath;\n // Not a path; resume reading where we left off\n default:\n const stack = this._contextStack, parent = stack.length && stack[stack.length - 1];\n // If we were reading a list item, we still need to output it\n if (parent && parent.type === 'item') {\n // The list item is the remaining subejct after reading the path\n const item = this._subject;\n // Switch back to the context of the list\n this._restoreContext('item', token);\n // Output the list item\n this._emit(this._subject, this.RDF_FIRST, item, this._graph);\n }\n return this._afterPath(token);\n }\n }\n\n // ### `_readForwardPath` reads a '!' path\n _readForwardPath(token) {\n let subject, predicate;\n const object = this._blankNode();\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's object\n if (this._predicate === null)\n subject = this._subject, this._subject = object;\n // If we were reading an object, replace the subject by the path's object\n else\n subject = this._object, this._object = object;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readBackwardPath` reads a '^' path\n _readBackwardPath(token) {\n const subject = this._blankNode();\n let predicate, object;\n // The next token is the predicate\n if ((predicate = this._readEntity(token)) === undefined)\n return;\n // If we were reading a subject, replace the subject by the path's subject\n if (this._predicate === null)\n object = this._subject, this._subject = subject;\n // If we were reading an object, replace the subject by the path's subject\n else\n object = this._object, this._object = subject;\n // Emit the path's current quad and read its next section\n this._emit(subject, predicate, object, this._graph);\n return this._readPath;\n }\n\n // ### `_readRDFStarTailOrGraph` reads the graph of a nested RDF* quad or the end of a nested RDF* triple\n _readRDFStarTailOrGraph(token) {\n if (token.type !== '>>') {\n // An entity means this is a quad (only allowed if not already inside a graph)\n if (this._supportsQuads && this._graph === null && (this._graph = this._readEntity(token)) !== undefined)\n return this._readRDFStarTail;\n return this._error(`Expected >> to follow \"${this._object.id}\"`, token);\n }\n return this._readRDFStarTail(token);\n }\n\n // ### `_readRDFStarTail` reads the end of a nested RDF* triple\n _readRDFStarTail(token) {\n if (token.type !== '>>')\n return this._error(`Expected >> but got ${token.type}`, token);\n // Read the quad and restore the previous context\n const quad = this._quad(this._subject, this._predicate, this._object,\n this._graph || this.DEFAULTGRAPH);\n this._restoreContext('<<', token);\n // If the triple was the subject, continue by reading the predicate.\n if (this._subject === null) {\n this._subject = quad;\n return this._readPredicate;\n }\n // If the triple was the object, read context end.\n else {\n this._object = quad;\n return this._getContextEndReader();\n }\n }\n\n // ### `_getContextEndReader` gets the next reader function at the end of a context\n _getContextEndReader() {\n const contextStack = this._contextStack;\n if (!contextStack.length)\n return this._readPunctuation;\n\n switch (contextStack[contextStack.length - 1].type) {\n case 'blank':\n return this._readBlankNodeTail;\n case 'list':\n return this._readListItem;\n case 'formula':\n return this._readFormulaTail;\n case '<<':\n return this._readRDFStarTailOrGraph;\n }\n }\n\n // ### `_emit` sends a quad through the callback\n _emit(subject, predicate, object, graph) {\n this._callback(null, this._quad(subject, predicate, object, graph || this.DEFAULTGRAPH));\n }\n\n // ### `_error` emits an error message through the callback\n _error(message, token) {\n const err = new Error(`${message} on line ${token.line}.`);\n err.context = {\n token: token,\n line: token.line,\n previousToken: this._lexer.previousToken,\n };\n this._callback(err);\n this._callback = noop;\n }\n\n // ### `_resolveIRI` resolves an IRI against the base path\n _resolveIRI(iri) {\n return /^[a-z][a-z0-9+.-]*:/i.test(iri) ? iri : this._resolveRelativeIRI(iri);\n }\n\n // ### `_resolveRelativeIRI` resolves an IRI against the base path,\n // assuming that a base path has been set and that the IRI is indeed relative\n _resolveRelativeIRI(iri) {\n // An empty relative IRI indicates the base IRI\n if (!iri.length)\n return this._base;\n // Decide resolving strategy based in the first character\n switch (iri[0]) {\n // Resolve relative fragment IRIs against the base IRI\n case '#': return this._base + iri;\n // Resolve relative query string IRIs by replacing the query string\n case '?': return this._base.replace(/(?:\\?.*)?$/, iri);\n // Resolve root-relative IRIs at the root of the base IRI\n case '/':\n // Resolve scheme-relative IRIs to the scheme\n return (iri[1] === '/' ? this._baseScheme : this._baseRoot) + this._removeDotSegments(iri);\n // Resolve all other IRIs at the base IRI's path\n default:\n // Relative IRIs cannot contain a colon in the first path segment\n return (/^[^/:]*:/.test(iri)) ? null : this._removeDotSegments(this._basePath + iri);\n }\n }\n\n // ### `_removeDotSegments` resolves './' and '../' path segments in an IRI as per RFC3986\n _removeDotSegments(iri) {\n // Don't modify the IRI if it does not contain any dot segments\n if (!/(^|\\/)\\.\\.?($|[/#?])/.test(iri))\n return iri;\n\n // Start with an imaginary slash before the IRI in order to resolve trailing './' and '../'\n const length = iri.length;\n let result = '', i = -1, pathStart = -1, segmentStart = 0, next = '/';\n\n while (i < length) {\n switch (next) {\n // The path starts with the first slash after the authority\n case ':':\n if (pathStart < 0) {\n // Skip two slashes before the authority\n if (iri[++i] === '/' && iri[++i] === '/')\n // Skip to slash after the authority\n while ((pathStart = i + 1) < length && iri[pathStart] !== '/')\n i = pathStart;\n }\n break;\n // Don't modify a query string or fragment\n case '?':\n case '#':\n i = length;\n break;\n // Handle '/.' or '/..' path segments\n case '/':\n if (iri[i + 1] === '.') {\n next = iri[++i + 1];\n switch (next) {\n // Remove a '/.' segment\n case '/':\n result += iri.substring(segmentStart, i - 1);\n segmentStart = i + 1;\n break;\n // Remove a trailing '/.' segment\n case undefined:\n case '?':\n case '#':\n return result + iri.substring(segmentStart, i) + iri.substr(i + 1);\n // Remove a '/..' segment\n case '.':\n next = iri[++i + 1];\n if (next === undefined || next === '/' || next === '?' || next === '#') {\n result += iri.substring(segmentStart, i - 2);\n // Try to remove the parent path from result\n if ((segmentStart = result.lastIndexOf('/')) >= pathStart)\n result = result.substr(0, segmentStart);\n // Remove a trailing '/..' segment\n if (next !== '/')\n return `${result}/${iri.substr(i + 1)}`;\n segmentStart = i + 1;\n }\n }\n }\n }\n next = iri[++i];\n }\n return result + iri.substring(segmentStart);\n }\n\n // ## Public methods\n\n // ### `parse` parses the N3 input and emits each parsed quad through the callback\n parse(input, quadCallback, prefixCallback) {\n // The read callback is the next function to be executed when a token arrives.\n // We start reading in the top context.\n this._readCallback = this._readInTopContext;\n this._sparqlStyle = false;\n this._prefixes = Object.create(null);\n this._prefixes._ = this._blankNodePrefix ? this._blankNodePrefix.substr(2)\n : `b${blankNodePrefix++}_`;\n this._prefixCallback = prefixCallback || noop;\n this._inversePredicate = false;\n this._quantified = Object.create(null);\n\n // Parse synchronously if no quad callback is given\n if (!quadCallback) {\n const quads = [];\n let error;\n this._callback = (e, t) => { e ? (error = e) : t && quads.push(t); };\n this._lexer.tokenize(input).every(token => {\n return this._readCallback = this._readCallback(token);\n });\n if (error) throw error;\n return quads;\n }\n\n // Parse asynchronously otherwise, executing the read callback when a token arrives\n this._callback = quadCallback;\n this._lexer.tokenize(input, (error, token) => {\n if (error !== null)\n this._callback(error), this._callback = noop;\n else if (this._readCallback)\n this._readCallback = this._readCallback(token);\n });\n }\n}\n\n// The empty function\nfunction noop() {}\n\n// Initializes the parser with the given data factory\nfunction initDataFactory(parser, factory) {\n // Set factory methods\n const namedNode = factory.namedNode;\n parser._namedNode = namedNode;\n parser._blankNode = factory.blankNode;\n parser._literal = factory.literal;\n parser._variable = factory.variable;\n parser._quad = factory.quad;\n parser.DEFAULTGRAPH = factory.defaultGraph();\n\n // Set common named nodes\n parser.RDF_FIRST = namedNode(namespaces.rdf.first);\n parser.RDF_REST = namedNode(namespaces.rdf.rest);\n parser.RDF_NIL = namedNode(namespaces.rdf.nil);\n parser.N3_FORALL = namedNode(namespaces.r.forAll);\n parser.N3_FORSOME = namedNode(namespaces.r.forSome);\n parser.ABBREVIATIONS = {\n 'a': namedNode(namespaces.rdf.type),\n '=': namedNode(namespaces.owl.sameAs),\n '>': namedNode(namespaces.log.implies),\n };\n parser.QUANTIFIERS_GRAPH = namedNode('urn:n3:quantifiers');\n}\ninitDataFactory(N3Parser.prototype, N3DataFactory);\n","// **N3Store** objects store N3 quads by graph in memory.\nimport { default as N3DataFactory, termToId, termFromId } from './N3DataFactory';\nimport { Readable } from 'readable-stream';\nimport namespaces from './IRIs';\nimport { isDefaultGraph } from './N3Util';\n\n// ## Constructor\nexport default class N3Store {\n constructor(quads, options) {\n // The number of quads is initially zero\n this._size = 0;\n // `_graphs` contains subject, predicate, and object indexes per graph\n this._graphs = Object.create(null);\n // `_ids` maps entities such as `http://xmlns.com/foaf/0.1/name` to numbers,\n // saving memory by using only numbers as keys in `_graphs`\n this._id = 0;\n this._ids = Object.create(null);\n this._entities = Object.create(null); // inverse of `_ids`\n // `_blankNodeIndex` is the index of the last automatically named blank node\n this._blankNodeIndex = 0;\n\n // Shift parameters if `quads` is not given\n if (!options && quads && !quads[0])\n options = quads, quads = null;\n options = options || {};\n this._factory = options.factory || N3DataFactory;\n\n // Add quads if passed\n if (quads)\n this.addQuads(quads);\n }\n\n _termFromId(id, factory) {\n if (id[0] === '.') {\n const entities = this._entities;\n const terms = id.split('.');\n const q = this._factory.quad(\n this._termFromId(entities[terms[1]]),\n this._termFromId(entities[terms[2]]),\n this._termFromId(entities[terms[3]]),\n terms[4] && this._termFromId(entities[terms[4]])\n );\n return q;\n }\n return termFromId(id, factory);\n }\n\n _termToNumericId(term) {\n if (term.termType === 'Quad') {\n const s = this._termToNumericId(term.subject),\n p = this._termToNumericId(term.predicate),\n o = this._termToNumericId(term.object);\n let g;\n\n return s && p && o && (isDefaultGraph(term.graph) || (g = this._termToNumericId(term.graph))) &&\n this._ids[g ? `.${s}.${p}.${o}.${g}` : `.${s}.${p}.${o}`];\n }\n return this._ids[termToId(term)];\n }\n\n _termToNewNumericId(term) {\n // This assumes that no graph term is present - we may wish to error if there is one\n const str = term && term.termType === 'Quad' ?\n `.${this._termToNewNumericId(term.subject)}.${this._termToNewNumericId(term.predicate)}.${this._termToNewNumericId(term.object)}${\n isDefaultGraph(term.graph) ? '' : `.${this._termToNewNumericId(term.graph)}`\n }`\n : termToId(term);\n\n return this._ids[str] || (this._ids[this._entities[++this._id] = str] = this._id);\n }\n\n // ## Public properties\n\n // ### `size` returns the number of quads in the store\n get size() {\n // Return the quad count if if was cached\n let size = this._size;\n if (size !== null)\n return size;\n\n // Calculate the number of quads by counting to the deepest level\n size = 0;\n const graphs = this._graphs;\n let subjects, subject;\n for (const graphKey in graphs)\n for (const subjectKey in (subjects = graphs[graphKey].subjects))\n for (const predicateKey in (subject = subjects[subjectKey]))\n size += Object.keys(subject[predicateKey]).length;\n return this._size = size;\n }\n\n // ## Private methods\n\n // ### `_addToIndex` adds a quad to a three-layered index.\n // Returns if the index has changed, if the entry did not already exist.\n _addToIndex(index0, key0, key1, key2) {\n // Create layers as necessary\n const index1 = index0[key0] || (index0[key0] = {});\n const index2 = index1[key1] || (index1[key1] = {});\n // Setting the key to _any_ value signals the presence of the quad\n const existed = key2 in index2;\n if (!existed)\n index2[key2] = null;\n return !existed;\n }\n\n // ### `_removeFromIndex` removes a quad from a three-layered index\n _removeFromIndex(index0, key0, key1, key2) {\n // Remove the quad from the index\n const index1 = index0[key0], index2 = index1[key1];\n delete index2[key2];\n\n // Remove intermediary index layers if they are empty\n for (const key in index2) return;\n delete index1[key1];\n for (const key in index1) return;\n delete index0[key0];\n }\n\n // ### `_findInIndex` finds a set of quads in a three-layered index.\n // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`.\n // Any of these keys can be undefined, which is interpreted as a wildcard.\n // `name0`, `name1`, and `name2` are the names of the keys at each level,\n // used when reconstructing the resulting quad\n // (for instance: _subject_, _predicate_, and _object_).\n // Finally, `graphId` will be the graph of the created quads.\n *_findInIndex(index0, key0, key1, key2, name0, name1, name2, graphId) {\n let tmp, index1, index2;\n const entityKeys = this._entities;\n const graph = this._termFromId(graphId, this._factory);\n const parts = { subject: null, predicate: null, object: null };\n\n // If a key is specified, use only that part of index 0.\n if (key0) (tmp = index0, index0 = {})[key0] = tmp[key0];\n for (const value0 in index0) {\n if (index1 = index0[value0]) {\n parts[name0] = this._termFromId(entityKeys[value0], this._factory);\n // If a key is specified, use only that part of index 1.\n if (key1) (tmp = index1, index1 = {})[key1] = tmp[key1];\n for (const value1 in index1) {\n if (index2 = index1[value1]) {\n parts[name1] = this._termFromId(entityKeys[value1], this._factory);\n // If a key is specified, use only that part of index 2, if it exists.\n const values = key2 ? (key2 in index2 ? [key2] : []) : Object.keys(index2);\n // Create quads for all items found in index 2.\n for (let l = 0; l < values.length; l++) {\n parts[name2] = this._termFromId(entityKeys[values[l]], this._factory);\n yield this._factory.quad(parts.subject, parts.predicate, parts.object, graph);\n }\n }\n }\n }\n }\n }\n\n // ### `_loop` executes the callback on all keys of index 0\n _loop(index0, callback) {\n for (const key0 in index0)\n callback(key0);\n }\n\n // ### `_loopByKey0` executes the callback on all keys of a certain entry in index 0\n _loopByKey0(index0, key0, callback) {\n let index1, key1;\n if (index1 = index0[key0]) {\n for (key1 in index1)\n callback(key1);\n }\n }\n\n // ### `_loopByKey1` executes the callback on given keys of all entries in index 0\n _loopByKey1(index0, key1, callback) {\n let key0, index1;\n for (key0 in index0) {\n index1 = index0[key0];\n if (index1[key1])\n callback(key0);\n }\n }\n\n // ### `_loopBy2Keys` executes the callback on given keys of certain entries in index 2\n _loopBy2Keys(index0, key0, key1, callback) {\n let index1, index2, key2;\n if ((index1 = index0[key0]) && (index2 = index1[key1])) {\n for (key2 in index2)\n callback(key2);\n }\n }\n\n // ### `_countInIndex` counts matching quads in a three-layered index.\n // The index base is `index0` and the keys at each level are `key0`, `key1`, and `key2`.\n // Any of these keys can be undefined, which is interpreted as a wildcard.\n _countInIndex(index0, key0, key1, key2) {\n let count = 0, tmp, index1, index2;\n\n // If a key is specified, count only that part of index 0\n if (key0) (tmp = index0, index0 = {})[key0] = tmp[key0];\n for (const value0 in index0) {\n if (index1 = index0[value0]) {\n // If a key is specified, count only that part of index 1\n if (key1) (tmp = index1, index1 = {})[key1] = tmp[key1];\n for (const value1 in index1) {\n if (index2 = index1[value1]) {\n // If a key is specified, count the quad if it exists\n if (key2) (key2 in index2) && count++;\n // Otherwise, count all quads\n else count += Object.keys(index2).length;\n }\n }\n }\n }\n return count;\n }\n\n // ### `_getGraphs` returns an array with the given graph,\n // or all graphs if the argument is null or undefined.\n _getGraphs(graph) {\n if (!isString(graph))\n return this._graphs;\n const graphs = {};\n graphs[graph] = this._graphs[graph];\n return graphs;\n }\n\n // ### `_uniqueEntities` returns a function that accepts an entity ID\n // and passes the corresponding entity to callback if it hasn't occurred before.\n _uniqueEntities(callback) {\n const uniqueIds = Object.create(null);\n return id => {\n if (!(id in uniqueIds)) {\n uniqueIds[id] = true;\n callback(this._termFromId(this._entities[id], this._factory));\n }\n };\n }\n\n // ## Public methods\n\n // ### `add` adds the specified quad to the dataset.\n // Returns the dataset instance it was called on.\n // Existing quads, as defined in Quad.equals, will be ignored.\n add(quad) {\n this.addQuad(quad);\n return this;\n }\n\n // ### `addQuad` adds a new quad to the store.\n // Returns if the quad index has changed, if the quad did not already exist.\n addQuad(subject, predicate, object, graph) {\n // Shift arguments if a quad object is given instead of components\n if (!predicate)\n graph = subject.graph, object = subject.object,\n predicate = subject.predicate, subject = subject.subject;\n\n // Convert terms to internal string representation\n graph = termToId(graph);\n\n // Find the graph that will contain the triple\n let graphItem = this._graphs[graph];\n // Create the graph if it doesn't exist yet\n if (!graphItem) {\n graphItem = this._graphs[graph] = { subjects: {}, predicates: {}, objects: {} };\n // Freezing a graph helps subsequent `add` performance,\n // and properties will never be modified anyway\n Object.freeze(graphItem);\n }\n\n // Since entities can often be long IRIs, we avoid storing them in every index.\n // Instead, we have a separate index that maps entities to numbers,\n // which are then used as keys in the other indexes.\n subject = this._termToNewNumericId(subject);\n predicate = this._termToNewNumericId(predicate);\n object = this._termToNewNumericId(object);\n\n const changed = this._addToIndex(graphItem.subjects, subject, predicate, object);\n this._addToIndex(graphItem.predicates, predicate, object, subject);\n this._addToIndex(graphItem.objects, object, subject, predicate);\n\n // The cached quad count is now invalid\n this._size = null;\n return changed;\n }\n\n // ### `addQuads` adds multiple quads to the store\n addQuads(quads) {\n for (let i = 0; i < quads.length; i++)\n this.addQuad(quads[i]);\n }\n\n // ### `delete` removes the specified quad from the dataset.\n // Returns the dataset instance it was called on.\n delete(quad) {\n this.removeQuad(quad);\n return this;\n }\n\n // ### `has` determines whether a dataset includes a certain quad or quad pattern.\n has(subjectOrQuad, predicate, object, graph) {\n if (subjectOrQuad && subjectOrQuad.subject)\n ({ subject: subjectOrQuad, predicate, object, graph } = subjectOrQuad);\n return !this.readQuads(subjectOrQuad, predicate, object, graph).next().done;\n }\n\n // ### `import` adds a stream of quads to the store\n import(stream) {\n stream.on('data', quad => { this.addQuad(quad); });\n return stream;\n }\n\n // ### `removeQuad` removes a quad from the store if it exists\n removeQuad(subject, predicate, object, graph) {\n // Shift arguments if a quad object is given instead of components\n if (!predicate)\n graph = subject.graph, object = subject.object,\n predicate = subject.predicate, subject = subject.subject;\n\n // Convert terms to internal string representation\n graph = termToId(graph);\n\n // Find internal identifiers for all components\n // and verify the quad exists.\n const graphs = this._graphs;\n let graphItem, subjects, predicates;\n if (!(subject = subject && this._termToNumericId(subject)) || !(predicate = predicate && this._termToNumericId(predicate)) ||\n !(object = object && this._termToNumericId(object)) || !(graphItem = graphs[graph]) ||\n !(subjects = graphItem.subjects[subject]) ||\n !(predicates = subjects[predicate]) ||\n !(object in predicates))\n return false;\n\n // Remove it from all indexes\n this._removeFromIndex(graphItem.subjects, subject, predicate, object);\n this._removeFromIndex(graphItem.predicates, predicate, object, subject);\n this._removeFromIndex(graphItem.objects, object, subject, predicate);\n if (this._size !== null) this._size--;\n\n // Remove the graph if it is empty\n for (subject in graphItem.subjects) return true;\n delete graphs[graph];\n return true;\n }\n\n // ### `removeQuads` removes multiple quads from the store\n removeQuads(quads) {\n for (let i = 0; i < quads.length; i++)\n this.removeQuad(quads[i]);\n }\n\n // ### `remove` removes a stream of quads from the store\n remove(stream) {\n stream.on('data', quad => { this.removeQuad(quad); });\n return stream;\n }\n\n // ### `removeMatches` removes all matching quads from the store\n // Setting any field to `undefined` or `null` indicates a wildcard.\n removeMatches(subject, predicate, object, graph) {\n const stream = new Readable({ objectMode: true });\n\n stream._read = () => {\n for (const quad of this.readQuads(subject, predicate, object, graph))\n stream.push(quad);\n stream.push(null);\n };\n\n return this.remove(stream);\n }\n\n // ### `deleteGraph` removes all triples with the given graph from the store\n deleteGraph(graph) {\n return this.removeMatches(null, null, null, graph);\n }\n\n // ### `getQuads` returns an array of quads matching a pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n getQuads(subject, predicate, object, graph) {\n return [...this.readQuads(subject, predicate, object, graph)];\n }\n\n // ### `readQuads` returns an generator of quads matching a pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n *readQuads(subject, predicate, object, graph) {\n // Convert terms to internal string representation\n graph = graph && termToId(graph);\n\n const graphs = this._getGraphs(graph);\n let content, subjectId, predicateId, objectId;\n\n // Translate IRIs to internal index keys.\n if (subject && !(subjectId = this._termToNumericId(subject)) ||\n predicate && !(predicateId = this._termToNumericId(predicate)) ||\n object && !(objectId = this._termToNumericId(object)))\n return;\n\n for (const graphId in graphs) {\n // Only if the specified graph contains triples, there can be results\n if (content = graphs[graphId]) {\n // Choose the optimal index, based on what fields are present\n if (subjectId) {\n if (objectId)\n // If subject and object are given, the object index will be the fastest\n yield* this._findInIndex(content.objects, objectId, subjectId, predicateId,\n 'object', 'subject', 'predicate', graphId);\n else\n // If only subject and possibly predicate are given, the subject index will be the fastest\n yield* this._findInIndex(content.subjects, subjectId, predicateId, null,\n 'subject', 'predicate', 'object', graphId);\n }\n else if (predicateId)\n // If only predicate and possibly object are given, the predicate index will be the fastest\n yield* this._findInIndex(content.predicates, predicateId, objectId, null,\n 'predicate', 'object', 'subject', graphId);\n else if (objectId)\n // If only object is given, the object index will be the fastest\n yield* this._findInIndex(content.objects, objectId, null, null,\n 'object', 'subject', 'predicate', graphId);\n else\n // If nothing is given, iterate subjects and predicates first\n yield* this._findInIndex(content.subjects, null, null, null,\n 'subject', 'predicate', 'object', graphId);\n }\n }\n }\n\n // ### `match` returns a new dataset that is comprised of all quads in the current instance matching the given arguments.\n // The logic described in Quad Matching is applied for each quad in this dataset to check if it should be included in the output dataset.\n // Note: This method always returns a new DatasetCore, even if that dataset contains no quads.\n // Note: Since a DatasetCore is an unordered set, the order of the quads within the returned sequence is arbitrary.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n // For backwards compatibility, the object return also implements the Readable stream interface.\n match(subject, predicate, object, graph) {\n return new DatasetCoreAndReadableStream(this, subject, predicate, object, graph);\n }\n\n // ### `countQuads` returns the number of quads matching a pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n countQuads(subject, predicate, object, graph) {\n // Convert terms to internal string representation\n graph = graph && termToId(graph);\n\n const graphs = this._getGraphs(graph);\n let count = 0, content, subjectId, predicateId, objectId;\n\n // Translate IRIs to internal index keys.\n if (subject && !(subjectId = this._termToNumericId(subject)) ||\n predicate && !(predicateId = this._termToNumericId(predicate)) ||\n object && !(objectId = this._termToNumericId(object)))\n return 0;\n\n for (const graphId in graphs) {\n // Only if the specified graph contains triples, there can be results\n if (content = graphs[graphId]) {\n // Choose the optimal index, based on what fields are present\n if (subject) {\n if (object)\n // If subject and object are given, the object index will be the fastest\n count += this._countInIndex(content.objects, objectId, subjectId, predicateId);\n else\n // If only subject and possibly predicate are given, the subject index will be the fastest\n count += this._countInIndex(content.subjects, subjectId, predicateId, objectId);\n }\n else if (predicate) {\n // If only predicate and possibly object are given, the predicate index will be the fastest\n count += this._countInIndex(content.predicates, predicateId, objectId, subjectId);\n }\n else {\n // If only object is possibly given, the object index will be the fastest\n count += this._countInIndex(content.objects, objectId, subjectId, predicateId);\n }\n }\n }\n return count;\n }\n\n // ### `forEach` executes the callback on all quads.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n forEach(callback, subject, predicate, object, graph) {\n this.some(quad => {\n callback(quad);\n return false;\n }, subject, predicate, object, graph);\n }\n\n // ### `every` executes the callback on all quads,\n // and returns `true` if it returns truthy for all them.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n every(callback, subject, predicate, object, graph) {\n let some = false;\n const every = !this.some(quad => {\n some = true;\n return !callback(quad);\n }, subject, predicate, object, graph);\n return some && every;\n }\n\n // ### `some` executes the callback on all quads,\n // and returns `true` if it returns truthy for any of them.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n some(callback, subject, predicate, object, graph) {\n for (const quad of this.readQuads(subject, predicate, object, graph))\n if (callback(quad))\n return true;\n return false;\n }\n\n // ### `getSubjects` returns all subjects that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n getSubjects(predicate, object, graph) {\n const results = [];\n this.forSubjects(s => { results.push(s); }, predicate, object, graph);\n return results;\n }\n\n // ### `forSubjects` executes the callback on all subjects that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n forSubjects(callback, predicate, object, graph) {\n // Convert terms to internal string representation\n graph = graph && termToId(graph);\n\n const graphs = this._getGraphs(graph);\n let content, predicateId, objectId;\n callback = this._uniqueEntities(callback);\n\n // Translate IRIs to internal index keys.\n if (predicate && !(predicateId = this._termToNumericId(predicate)) ||\n object && !(objectId = this._termToNumericId(object)))\n return;\n\n for (graph in graphs) {\n // Only if the specified graph contains triples, there can be results\n if (content = graphs[graph]) {\n // Choose optimal index based on which fields are wildcards\n if (predicateId) {\n if (objectId)\n // If predicate and object are given, the POS index is best.\n this._loopBy2Keys(content.predicates, predicateId, objectId, callback);\n else\n // If only predicate is given, the SPO index is best.\n this._loopByKey1(content.subjects, predicateId, callback);\n }\n else if (objectId)\n // If only object is given, the OSP index is best.\n this._loopByKey0(content.objects, objectId, callback);\n else\n // If no params given, iterate all the subjects\n this._loop(content.subjects, callback);\n }\n }\n }\n\n // ### `getPredicates` returns all predicates that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n getPredicates(subject, object, graph) {\n const results = [];\n this.forPredicates(p => { results.push(p); }, subject, object, graph);\n return results;\n }\n\n // ### `forPredicates` executes the callback on all predicates that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n forPredicates(callback, subject, object, graph) {\n // Convert terms to internal string representation\n graph = graph && termToId(graph);\n\n const graphs = this._getGraphs(graph);\n let content, subjectId, objectId;\n callback = this._uniqueEntities(callback);\n\n // Translate IRIs to internal index keys.\n if (subject && !(subjectId = this._termToNumericId(subject)) ||\n object && !(objectId = this._termToNumericId(object)))\n return;\n\n for (graph in graphs) {\n // Only if the specified graph contains triples, there can be results\n if (content = graphs[graph]) {\n // Choose optimal index based on which fields are wildcards\n if (subjectId) {\n if (objectId)\n // If subject and object are given, the OSP index is best.\n this._loopBy2Keys(content.objects, objectId, subjectId, callback);\n else\n // If only subject is given, the SPO index is best.\n this._loopByKey0(content.subjects, subjectId, callback);\n }\n else if (objectId)\n // If only object is given, the POS index is best.\n this._loopByKey1(content.predicates, objectId, callback);\n else\n // If no params given, iterate all the predicates.\n this._loop(content.predicates, callback);\n }\n }\n }\n\n // ### `getObjects` returns all objects that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n getObjects(subject, predicate, graph) {\n const results = [];\n this.forObjects(o => { results.push(o); }, subject, predicate, graph);\n return results;\n }\n\n // ### `forObjects` executes the callback on all objects that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n forObjects(callback, subject, predicate, graph) {\n // Convert terms to internal string representation\n graph = graph && termToId(graph);\n\n const graphs = this._getGraphs(graph);\n let content, subjectId, predicateId;\n callback = this._uniqueEntities(callback);\n\n // Translate IRIs to internal index keys.\n if (subject && !(subjectId = this._termToNumericId(subject)) ||\n predicate && !(predicateId = this._termToNumericId(predicate)))\n return;\n\n for (graph in graphs) {\n // Only if the specified graph contains triples, there can be results\n if (content = graphs[graph]) {\n // Choose optimal index based on which fields are wildcards\n if (subjectId) {\n if (predicateId)\n // If subject and predicate are given, the SPO index is best.\n this._loopBy2Keys(content.subjects, subjectId, predicateId, callback);\n else\n // If only subject is given, the OSP index is best.\n this._loopByKey1(content.objects, subjectId, callback);\n }\n else if (predicateId)\n // If only predicate is given, the POS index is best.\n this._loopByKey0(content.predicates, predicateId, callback);\n else\n // If no params given, iterate all the objects.\n this._loop(content.objects, callback);\n }\n }\n }\n\n // ### `getGraphs` returns all graphs that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n getGraphs(subject, predicate, object) {\n const results = [];\n this.forGraphs(g => { results.push(g); }, subject, predicate, object);\n return results;\n }\n\n // ### `forGraphs` executes the callback on all graphs that match the pattern.\n // Setting any field to `undefined` or `null` indicates a wildcard.\n forGraphs(callback, subject, predicate, object) {\n for (const graph in this._graphs) {\n this.some(quad => {\n callback(quad.graph);\n return true; // Halt iteration of some()\n }, subject, predicate, object, graph);\n }\n }\n\n // ### `createBlankNode` creates a new blank node, returning its name\n createBlankNode(suggestedName) {\n let name, index;\n // Generate a name based on the suggested name\n if (suggestedName) {\n name = suggestedName = `_:${suggestedName}`, index = 1;\n while (this._ids[name])\n name = suggestedName + index++;\n }\n // Generate a generic blank node name\n else {\n do { name = `_:b${this._blankNodeIndex++}`; }\n while (this._ids[name]);\n }\n // Add the blank node to the entities, avoiding the generation of duplicates\n this._ids[name] = ++this._id;\n this._entities[this._id] = name;\n return this._factory.blankNode(name.substr(2));\n }\n\n // ### `extractLists` finds and removes all list triples\n // and returns the items per list.\n extractLists({ remove = false, ignoreErrors = false } = {}) {\n const lists = {}; // has scalar keys so could be a simple Object\n const onError = ignoreErrors ? (() => true) :\n ((node, message) => { throw new Error(`${node.value} ${message}`); });\n\n // Traverse each list from its tail\n const tails = this.getQuads(null, namespaces.rdf.rest, namespaces.rdf.nil, null);\n const toRemove = remove ? [...tails] : [];\n tails.forEach(tailQuad => {\n const items = []; // the members found as objects of rdf:first quads\n let malformed = false; // signals whether the current list is malformed\n let head; // the head of the list (_:b1 in above example)\n let headPos; // set to subject or object when head is set\n const graph = tailQuad.graph; // make sure list is in exactly one graph\n\n // Traverse the list from tail to end\n let current = tailQuad.subject;\n while (current && !malformed) {\n const objectQuads = this.getQuads(null, null, current, null);\n const subjectQuads = this.getQuads(current, null, null, null);\n let quad, first = null, rest = null, parent = null;\n\n // Find the first and rest of this list node\n for (let i = 0; i < subjectQuads.length && !malformed; i++) {\n quad = subjectQuads[i];\n if (!quad.graph.equals(graph))\n malformed = onError(current, 'not confined to single graph');\n else if (head)\n malformed = onError(current, 'has non-list arcs out');\n\n // one rdf:first\n else if (quad.predicate.value === namespaces.rdf.first) {\n if (first)\n malformed = onError(current, 'has multiple rdf:first arcs');\n else\n toRemove.push(first = quad);\n }\n\n // one rdf:rest\n else if (quad.predicate.value === namespaces.rdf.rest) {\n if (rest)\n malformed = onError(current, 'has multiple rdf:rest arcs');\n else\n toRemove.push(rest = quad);\n }\n\n // alien triple\n else if (objectQuads.length)\n malformed = onError(current, 'can\\'t be subject and object');\n else {\n head = quad; // e.g. { (1 2 3) :p :o }\n headPos = 'subject';\n }\n }\n\n // { :s :p (1 2) } arrives here with no head\n // { (1 2) :p :o } arrives here with head set to the list.\n for (let i = 0; i < objectQuads.length && !malformed; ++i) {\n quad = objectQuads[i];\n if (head)\n malformed = onError(current, 'can\\'t have coreferences');\n // one rdf:rest\n else if (quad.predicate.value === namespaces.rdf.rest) {\n if (parent)\n malformed = onError(current, 'has incoming rdf:rest arcs');\n else\n parent = quad;\n }\n else {\n head = quad; // e.g. { :s :p (1 2) }\n headPos = 'object';\n }\n }\n\n // Store the list item and continue with parent\n if (!first)\n malformed = onError(current, 'has no list head');\n else\n items.unshift(first.object);\n current = parent && parent.subject;\n }\n\n // Don't remove any quads if the list is malformed\n if (malformed)\n remove = false;\n // Store the list under the value of its head\n else if (head)\n lists[head[headPos].value] = items;\n });\n\n // Remove list quads if requested\n if (remove)\n this.removeQuads(toRemove);\n return lists;\n }\n\n // ### Store is an iterable.\n // Can be used where iterables are expected: for...of loops, array spread operator,\n // `yield*`, and destructuring assignment (order is not guaranteed).\n *[Symbol.iterator]() {\n yield* this.readQuads();\n }\n}\n\n// Determines whether the argument is a string\nfunction isString(s) {\n return typeof s === 'string' || s instanceof String;\n}\n\n/**\n * A class that implements both DatasetCore and Readable.\n */\nclass DatasetCoreAndReadableStream extends Readable {\n constructor(n3Store, subject, predicate, object, graph) {\n super({ objectMode: true });\n Object.assign(this, { n3Store, subject, predicate, object, graph });\n }\n\n get filtered() {\n if (!this._filtered) {\n const { n3Store, graph, object, predicate, subject } = this;\n const newStore = this._filtered = new N3Store({ factory: n3Store._factory });\n for (const quad of n3Store.readQuads(subject, predicate, object, graph))\n newStore.addQuad(quad);\n }\n return this._filtered;\n }\n\n get size() {\n return this.filtered.size;\n }\n\n _read() {\n for (const quad of this)\n this.push(quad);\n this.push(null);\n }\n\n add(quad) {\n return this.filtered.add(quad);\n }\n\n delete(quad) {\n return this.filtered.delete(quad);\n }\n\n has(quad) {\n return this.filtered.has(quad);\n }\n\n match(subject, predicate, object, graph) {\n return new DatasetCoreAndReadableStream(this.filtered, subject, predicate, object, graph);\n }\n\n *[Symbol.iterator]() {\n yield* this._filtered || this.n3Store.readQuads(this.subject, this.predicate, this.object, this.graph);\n }\n}\n","// **N3StreamParser** parses a text stream into a quad stream.\nimport N3Parser from './N3Parser';\nimport { Transform } from 'readable-stream';\n\n// ## Constructor\nexport default class N3StreamParser extends Transform {\n constructor(options) {\n super({ decodeStrings: true });\n this._readableState.objectMode = true;\n\n // Set up parser with dummy stream to obtain `data` and `end` callbacks\n const parser = new N3Parser(options);\n let onData, onEnd;\n parser.parse({\n on: (event, callback) => {\n switch (event) {\n case 'data': onData = callback; break;\n case 'end': onEnd = callback; break;\n }\n },\n },\n // Handle quads by pushing them down the pipeline\n (error, quad) => { error && this.emit('error', error) || quad && this.push(quad); },\n // Emit prefixes through the `prefix` event\n (prefix, uri) => { this.emit('prefix', prefix, uri); }\n );\n\n // Implement Transform methods through parser callbacks\n this._transform = (chunk, encoding, done) => { onData(chunk); done(); };\n this._flush = done => { onEnd(); done(); };\n }\n\n // ### Parses a stream of strings\n import(stream) {\n stream.on('data', chunk => { this.write(chunk); });\n stream.on('end', () => { this.end(); });\n stream.on('error', error => { this.emit('error', error); });\n return this;\n }\n}\n","// **N3StreamWriter** serializes a quad stream into a text stream.\nimport { Transform } from 'readable-stream';\nimport N3Writer from './N3Writer';\n\n// ## Constructor\nexport default class N3StreamWriter extends Transform {\n constructor(options) {\n super({ encoding: 'utf8', writableObjectMode: true });\n\n // Set up writer with a dummy stream object\n const writer = this._writer = new N3Writer({\n write: (quad, encoding, callback) => { this.push(quad); callback && callback(); },\n end: callback => { this.push(null); callback && callback(); },\n }, options);\n\n // Implement Transform methods on top of writer\n this._transform = (quad, encoding, done) => { writer.addQuad(quad, done); };\n this._flush = done => { writer.end(done); };\n }\n\n// ### Serializes a stream of quads\n import(stream) {\n stream.on('data', quad => { this.write(quad); });\n stream.on('end', () => { this.end(); });\n stream.on('error', error => { this.emit('error', error); });\n stream.on('prefix', (prefix, iri) => { this._writer.addPrefix(prefix, iri); });\n return this;\n }\n}\n","// **N3Util** provides N3 utility functions.\n\nimport N3DataFactory from './N3DataFactory';\n\n// Tests whether the given term represents an IRI\nexport function isNamedNode(term) {\n return !!term && term.termType === 'NamedNode';\n}\n\n// Tests whether the given term represents a blank node\nexport function isBlankNode(term) {\n return !!term && term.termType === 'BlankNode';\n}\n\n// Tests whether the given term represents a literal\nexport function isLiteral(term) {\n return !!term && term.termType === 'Literal';\n}\n\n// Tests whether the given term represents a variable\nexport function isVariable(term) {\n return !!term && term.termType === 'Variable';\n}\n\n// Tests whether the given term represents the default graph\nexport function isDefaultGraph(term) {\n return !!term && term.termType === 'DefaultGraph';\n}\n\n// Tests whether the given quad is in the default graph\nexport function inDefaultGraph(quad) {\n return isDefaultGraph(quad.graph);\n}\n\n// Creates a function that prepends the given IRI to a local name\nexport function prefix(iri, factory) {\n return prefixes({ '': iri.value || iri }, factory)('');\n}\n\n// Creates a function that allows registering and expanding prefixes\nexport function prefixes(defaultPrefixes, factory) {\n // Add all of the default prefixes\n const prefixes = Object.create(null);\n for (const prefix in defaultPrefixes)\n processPrefix(prefix, defaultPrefixes[prefix]);\n // Set the default factory if none was specified\n factory = factory || N3DataFactory;\n\n // Registers a new prefix (if an IRI was specified)\n // or retrieves a function that expands an existing prefix (if no IRI was specified)\n function processPrefix(prefix, iri) {\n // Create a new prefix if an IRI is specified or the prefix doesn't exist\n if (typeof iri === 'string') {\n // Create a function that expands the prefix\n const cache = Object.create(null);\n prefixes[prefix] = local => {\n return cache[local] || (cache[local] = factory.namedNode(iri + local));\n };\n }\n else if (!(prefix in prefixes)) {\n throw new Error(`Unknown prefix: ${prefix}`);\n }\n return prefixes[prefix];\n }\n return processPrefix;\n}\n","// **N3Writer** writes N3 documents.\nimport namespaces from './IRIs';\nimport { default as N3DataFactory, Term } from './N3DataFactory';\nimport { isDefaultGraph } from './N3Util';\n\nconst DEFAULTGRAPH = N3DataFactory.defaultGraph();\n\nconst { rdf, xsd } = namespaces;\n\n// Characters in literals that require escaping\nconst escape = /[\"\\\\\\t\\n\\r\\b\\f\\u0000-\\u0019\\ud800-\\udbff]/,\n escapeAll = /[\"\\\\\\t\\n\\r\\b\\f\\u0000-\\u0019]|[\\ud800-\\udbff][\\udc00-\\udfff]/g,\n escapedCharacters = {\n '\\\\': '\\\\\\\\', '\"': '\\\\\"', '\\t': '\\\\t',\n '\\n': '\\\\n', '\\r': '\\\\r', '\\b': '\\\\b', '\\f': '\\\\f',\n };\n\n// ## Placeholder class to represent already pretty-printed terms\nclass SerializedTerm extends Term {\n // Pretty-printed nodes are not equal to any other node\n // (e.g., [] does not equal [])\n equals(other) {\n return other === this;\n }\n}\n\n// ## Constructor\nexport default class N3Writer {\n constructor(outputStream, options) {\n // ### `_prefixRegex` matches a prefixed name or IRI that begins with one of the added prefixes\n this._prefixRegex = /$0^/;\n\n // Shift arguments if the first argument is not a stream\n if (outputStream && typeof outputStream.write !== 'function')\n options = outputStream, outputStream = null;\n options = options || {};\n this._lists = options.lists;\n\n // If no output stream given, send the output as string through the end callback\n if (!outputStream) {\n let output = '';\n this._outputStream = {\n write(chunk, encoding, done) { output += chunk; done && done(); },\n end: done => { done && done(null, output); },\n };\n this._endStream = true;\n }\n else {\n this._outputStream = outputStream;\n this._endStream = options.end === undefined ? true : !!options.end;\n }\n\n // Initialize writer, depending on the format\n this._subject = null;\n if (!(/triple|quad/i).test(options.format)) {\n this._lineMode = false;\n this._graph = DEFAULTGRAPH;\n this._prefixIRIs = Object.create(null);\n options.prefixes && this.addPrefixes(options.prefixes);\n if (options.baseIRI) {\n this._baseMatcher = new RegExp(`^${escapeRegex(options.baseIRI)\n }${options.baseIRI.endsWith('/') ? '' : '[#?]'}`);\n this._baseLength = options.baseIRI.length;\n }\n }\n else {\n this._lineMode = true;\n this._writeQuad = this._writeQuadLine;\n }\n }\n\n // ## Private methods\n\n // ### Whether the current graph is the default graph\n get _inDefaultGraph() {\n return DEFAULTGRAPH.equals(this._graph);\n }\n\n // ### `_write` writes the argument to the output stream\n _write(string, callback) {\n this._outputStream.write(string, 'utf8', callback);\n }\n\n // ### `_writeQuad` writes the quad to the output stream\n _writeQuad(subject, predicate, object, graph, done) {\n try {\n // Write the graph's label if it has changed\n if (!graph.equals(this._graph)) {\n // Close the previous graph and start the new one\n this._write((this._subject === null ? '' : (this._inDefaultGraph ? '.\\n' : '\\n}\\n')) +\n (DEFAULTGRAPH.equals(graph) ? '' : `${this._encodeIriOrBlank(graph)} {\\n`));\n this._graph = graph;\n this._subject = null;\n }\n // Don't repeat the subject if it's the same\n if (subject.equals(this._subject)) {\n // Don't repeat the predicate if it's the same\n if (predicate.equals(this._predicate))\n this._write(`, ${this._encodeObject(object)}`, done);\n // Same subject, different predicate\n else\n this._write(`;\\n ${\n this._encodePredicate(this._predicate = predicate)} ${\n this._encodeObject(object)}`, done);\n }\n // Different subject; write the whole quad\n else\n this._write(`${(this._subject === null ? '' : '.\\n') +\n this._encodeSubject(this._subject = subject)} ${\n this._encodePredicate(this._predicate = predicate)} ${\n this._encodeObject(object)}`, done);\n }\n catch (error) { done && done(error); }\n }\n\n // ### `_writeQuadLine` writes the quad to the output stream as a single line\n _writeQuadLine(subject, predicate, object, graph, done) {\n // Write the quad without prefixes\n delete this._prefixMatch;\n this._write(this.quadToString(subject, predicate, object, graph), done);\n }\n\n // ### `quadToString` serializes a quad as a string\n quadToString(subject, predicate, object, graph) {\n return `${this._encodeSubject(subject)} ${\n this._encodeIriOrBlank(predicate)} ${\n this._encodeObject(object)\n }${graph && graph.value ? ` ${this._encodeIriOrBlank(graph)} .\\n` : ' .\\n'}`;\n }\n\n // ### `quadsToString` serializes an array of quads as a string\n quadsToString(quads) {\n return quads.map(t => {\n return this.quadToString(t.subject, t.predicate, t.object, t.graph);\n }).join('');\n }\n\n // ### `_encodeSubject` represents a subject\n _encodeSubject(entity) {\n return entity.termType === 'Quad' ?\n this._encodeQuad(entity) : this._encodeIriOrBlank(entity);\n }\n\n // ### `_encodeIriOrBlank` represents an IRI or blank node\n _encodeIriOrBlank(entity) {\n // A blank node or list is represented as-is\n if (entity.termType !== 'NamedNode') {\n // If it is a list head, pretty-print it\n if (this._lists && (entity.value in this._lists))\n entity = this.list(this._lists[entity.value]);\n return 'id' in entity ? entity.id : `_:${entity.value}`;\n }\n let iri = entity.value;\n // Use relative IRIs if requested and possible\n if (this._baseMatcher && this._baseMatcher.test(iri))\n iri = iri.substr(this._baseLength);\n // Escape special characters\n if (escape.test(iri))\n iri = iri.replace(escapeAll, characterReplacer);\n // Try to represent the IRI as prefixed name\n const prefixMatch = this._prefixRegex.exec(iri);\n return !prefixMatch ? `<${iri}>` :\n (!prefixMatch[1] ? iri : this._prefixIRIs[prefixMatch[1]] + prefixMatch[2]);\n }\n\n // ### `_encodeLiteral` represents a literal\n _encodeLiteral(literal) {\n // Escape special characters\n let value = literal.value;\n if (escape.test(value))\n value = value.replace(escapeAll, characterReplacer);\n\n // Write a language-tagged literal\n if (literal.language)\n return `\"${value}\"@${literal.language}`;\n\n // Write dedicated literals per data type\n if (this._lineMode) {\n // Only abbreviate strings in N-Triples or N-Quads\n if (literal.datatype.value === xsd.string)\n return `\"${value}\"`;\n }\n else {\n // Use common datatype abbreviations in Turtle or TriG\n switch (literal.datatype.value) {\n case xsd.string:\n return `\"${value}\"`;\n case xsd.boolean:\n if (value === 'true' || value === 'false')\n return value;\n break;\n case xsd.integer:\n if (/^[+-]?\\d+$/.test(value))\n return value;\n break;\n case xsd.decimal:\n if (/^[+-]?\\d*\\.\\d+$/.test(value))\n return value;\n break;\n case xsd.double:\n if (/^[+-]?(?:\\d+\\.\\d*|\\.?\\d+)[eE][+-]?\\d+$/.test(value))\n return value;\n break;\n }\n }\n\n // Write a regular datatyped literal\n return `\"${value}\"^^${this._encodeIriOrBlank(literal.datatype)}`;\n }\n\n // ### `_encodePredicate` represents a predicate\n _encodePredicate(predicate) {\n return predicate.value === rdf.type ? 'a' : this._encodeIriOrBlank(predicate);\n }\n\n // ### `_encodeObject` represents an object\n _encodeObject(object) {\n switch (object.termType) {\n case 'Quad':\n return this._encodeQuad(object);\n case 'Literal':\n return this._encodeLiteral(object);\n default:\n return this._encodeIriOrBlank(object);\n }\n }\n\n // ### `_encodeQuad` encodes an RDF* quad\n _encodeQuad({ subject, predicate, object, graph }) {\n return `<<${\n this._encodeSubject(subject)} ${\n this._encodePredicate(predicate)} ${\n this._encodeObject(object)}${\n isDefaultGraph(graph) ? '' : ` ${this._encodeIriOrBlank(graph)}`}>>`;\n }\n\n // ### `_blockedWrite` replaces `_write` after the writer has been closed\n _blockedWrite() {\n throw new Error('Cannot write because the writer has been closed.');\n }\n\n // ### `addQuad` adds the quad to the output stream\n addQuad(subject, predicate, object, graph, done) {\n // The quad was given as an object, so shift parameters\n if (object === undefined)\n this._writeQuad(subject.subject, subject.predicate, subject.object, subject.graph, predicate);\n // The optional `graph` parameter was not provided\n else if (typeof graph === 'function')\n this._writeQuad(subject, predicate, object, DEFAULTGRAPH, graph);\n // The `graph` parameter was provided\n else\n this._writeQuad(subject, predicate, object, graph || DEFAULTGRAPH, done);\n }\n\n // ### `addQuads` adds the quads to the output stream\n addQuads(quads) {\n for (let i = 0; i < quads.length; i++)\n this.addQuad(quads[i]);\n }\n\n // ### `addPrefix` adds the prefix to the output stream\n addPrefix(prefix, iri, done) {\n const prefixes = {};\n prefixes[prefix] = iri;\n this.addPrefixes(prefixes, done);\n }\n\n // ### `addPrefixes` adds the prefixes to the output stream\n addPrefixes(prefixes, done) {\n // Ignore prefixes if not supported by the serialization\n if (!this._prefixIRIs)\n return done && done();\n\n // Write all new prefixes\n let hasPrefixes = false;\n for (let prefix in prefixes) {\n let iri = prefixes[prefix];\n if (typeof iri !== 'string')\n iri = iri.value;\n hasPrefixes = true;\n // Finish a possible pending quad\n if (this._subject !== null) {\n this._write(this._inDefaultGraph ? '.\\n' : '\\n}\\n');\n this._subject = null, this._graph = '';\n }\n // Store and write the prefix\n this._prefixIRIs[iri] = (prefix += ':');\n this._write(`@prefix ${prefix} <${iri}>.\\n`);\n }\n // Recreate the prefix matcher\n if (hasPrefixes) {\n let IRIlist = '', prefixList = '';\n for (const prefixIRI in this._prefixIRIs) {\n IRIlist += IRIlist ? `|${prefixIRI}` : prefixIRI;\n prefixList += (prefixList ? '|' : '') + this._prefixIRIs[prefixIRI];\n }\n IRIlist = escapeRegex(IRIlist, /[\\]\\/\\(\\)\\*\\+\\?\\.\\\\\\$]/g, '\\\\$&');\n this._prefixRegex = new RegExp(`^(?:${prefixList})[^\\/]*$|` +\n `^(${IRIlist})([_a-zA-Z][\\\\-_a-zA-Z0-9]*)$`);\n }\n // End a prefix block with a newline\n this._write(hasPrefixes ? '\\n' : '', done);\n }\n\n // ### `blank` creates a blank node with the given content\n blank(predicate, object) {\n let children = predicate, child, length;\n // Empty blank node\n if (predicate === undefined)\n children = [];\n // Blank node passed as blank(Term(\"predicate\"), Term(\"object\"))\n else if (predicate.termType)\n children = [{ predicate: predicate, object: object }];\n // Blank node passed as blank({ predicate: predicate, object: object })\n else if (!('length' in predicate))\n children = [predicate];\n\n switch (length = children.length) {\n // Generate an empty blank node\n case 0:\n return new SerializedTerm('[]');\n // Generate a non-nested one-triple blank node\n case 1:\n child = children[0];\n if (!(child.object instanceof SerializedTerm))\n return new SerializedTerm(`[ ${this._encodePredicate(child.predicate)} ${\n this._encodeObject(child.object)} ]`);\n // Generate a multi-triple or nested blank node\n default:\n let contents = '[';\n // Write all triples in order\n for (let i = 0; i < length; i++) {\n child = children[i];\n // Write only the object is the predicate is the same as the previous\n if (child.predicate.equals(predicate))\n contents += `, ${this._encodeObject(child.object)}`;\n // Otherwise, write the predicate and the object\n else {\n contents += `${(i ? ';\\n ' : '\\n ') +\n this._encodePredicate(child.predicate)} ${\n this._encodeObject(child.object)}`;\n predicate = child.predicate;\n }\n }\n return new SerializedTerm(`${contents}\\n]`);\n }\n }\n\n // ### `list` creates a list node with the given content\n list(elements) {\n const length = elements && elements.length || 0, contents = new Array(length);\n for (let i = 0; i < length; i++)\n contents[i] = this._encodeObject(elements[i]);\n return new SerializedTerm(`(${contents.join(' ')})`);\n }\n\n // ### `end` signals the end of the output stream\n end(done) {\n // Finish a possible pending quad\n if (this._subject !== null) {\n this._write(this._inDefaultGraph ? '.\\n' : '\\n}\\n');\n this._subject = null;\n }\n // Disallow further writing\n this._write = this._blockedWrite;\n\n // Try to end the underlying stream, ensuring done is called exactly one time\n let singleDone = done && ((error, result) => { singleDone = null, done(error, result); });\n if (this._endStream) {\n try { return this._outputStream.end(singleDone); }\n catch (error) { /* error closing stream */ }\n }\n singleDone && singleDone();\n }\n}\n\n// Replaces a character by its escaped version\nfunction characterReplacer(character) {\n // Replace a single character by its escaped version\n let result = escapedCharacters[character];\n if (result === undefined) {\n // Replace a single character with its 4-bit unicode escape sequence\n if (character.length === 1) {\n result = character.charCodeAt(0).toString(16);\n result = '\\\\u0000'.substr(0, 6 - result.length) + result;\n }\n // Replace a surrogate pair with its 8-bit unicode escape sequence\n else {\n result = ((character.charCodeAt(0) - 0xD800) * 0x400 +\n character.charCodeAt(1) + 0x2400).toString(16);\n result = '\\\\U00000000'.substr(0, 10 - result.length) + result;\n }\n }\n return result;\n}\n\nfunction escapeRegex(regex) {\n return regex.replace(/[\\]\\/\\(\\)\\*\\+\\?\\.\\\\\\$]/g, '\\\\$&');\n}\n","import Lexer from './N3Lexer';\nimport Parser from './N3Parser';\nimport Writer from './N3Writer';\nimport Store from './N3Store';\nimport StreamParser from './N3StreamParser';\nimport StreamWriter from './N3StreamWriter';\nimport * as Util from './N3Util';\n\nimport {\n default as DataFactory,\n\n Term,\n NamedNode,\n Literal,\n BlankNode,\n Variable,\n DefaultGraph,\n Quad,\n Triple,\n\n termFromId,\n termToId,\n} from './N3DataFactory';\n\n// Named exports\nexport {\n Lexer,\n Parser,\n Writer,\n Store,\n StreamParser,\n StreamWriter,\n Util,\n\n DataFactory,\n\n Term,\n NamedNode,\n Literal,\n BlankNode,\n Variable,\n DefaultGraph,\n Quad,\n Triple,\n\n termFromId,\n termToId,\n};\n\n// Export all named exports as a default object for backward compatibility\nexport default {\n Lexer,\n Parser,\n Writer,\n Store,\n StreamParser,\n StreamWriter,\n Util,\n\n DataFactory,\n\n Term,\n NamedNode,\n Literal,\n BlankNode,\n Variable,\n DefaultGraph,\n Quad,\n Triple,\n\n termFromId,\n termToId,\n};\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","/*! queue-microtask. MIT License. Feross Aboukhadijeh */\nlet promise\n\nmodule.exports = typeof queueMicrotask === 'function'\n ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global)\n // reuse resolved promise, and allocate it lazily\n : cb => (promise || (promise = Promise.resolve()))\n .then(cb)\n .catch(err => setTimeout(() => { throw err }, 0))\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./lib/BlankNode\"), exports);\n__exportStar(require(\"./lib/DataFactory\"), exports);\n__exportStar(require(\"./lib/DefaultGraph\"), exports);\n__exportStar(require(\"./lib/Literal\"), exports);\n__exportStar(require(\"./lib/NamedNode\"), exports);\n__exportStar(require(\"./lib/Quad\"), exports);\n__exportStar(require(\"./lib/Variable\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BlankNode = void 0;\n/**\n * A term that represents an RDF blank node with a label.\n */\nclass BlankNode {\n constructor(value) {\n this.termType = 'BlankNode';\n this.value = value;\n }\n equals(other) {\n return !!other && other.termType === 'BlankNode' && other.value === this.value;\n }\n}\nexports.BlankNode = BlankNode;\n//# sourceMappingURL=BlankNode.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DataFactory = void 0;\nconst BlankNode_1 = require(\"./BlankNode\");\nconst DefaultGraph_1 = require(\"./DefaultGraph\");\nconst Literal_1 = require(\"./Literal\");\nconst NamedNode_1 = require(\"./NamedNode\");\nconst Quad_1 = require(\"./Quad\");\nconst Variable_1 = require(\"./Variable\");\nlet dataFactoryCounter = 0;\n/**\n * A factory for instantiating RDF terms and quads.\n */\nclass DataFactory {\n constructor(options) {\n this.blankNodeCounter = 0;\n options = options || {};\n this.blankNodePrefix = options.blankNodePrefix || `df_${dataFactoryCounter++}_`;\n }\n /**\n * @param value The IRI for the named node.\n * @return A new instance of NamedNode.\n * @see NamedNode\n */\n namedNode(value) {\n return new NamedNode_1.NamedNode(value);\n }\n /**\n * @param value The optional blank node identifier.\n * @return A new instance of BlankNode.\n * If the `value` parameter is undefined a new identifier\n * for the blank node is generated for each call.\n * @see BlankNode\n */\n blankNode(value) {\n return new BlankNode_1.BlankNode(value || `${this.blankNodePrefix}${this.blankNodeCounter++}`);\n }\n /**\n * @param value The literal value.\n * @param languageOrDatatype The optional language or datatype.\n * If `languageOrDatatype` is a NamedNode,\n * then it is used for the value of `NamedNode.datatype`.\n * Otherwise `languageOrDatatype` is used for the value\n * of `NamedNode.language`.\n * @return A new instance of Literal.\n * @see Literal\n */\n literal(value, languageOrDatatype) {\n return new Literal_1.Literal(value, languageOrDatatype);\n }\n /**\n * This method is optional.\n * @param value The variable name\n * @return A new instance of Variable.\n * @see Variable\n */\n variable(value) {\n return new Variable_1.Variable(value);\n }\n /**\n * @return An instance of DefaultGraph.\n */\n defaultGraph() {\n return DefaultGraph_1.DefaultGraph.INSTANCE;\n }\n /**\n * @param subject The quad subject term.\n * @param predicate The quad predicate term.\n * @param object The quad object term.\n * @param graph The quad graph term.\n * @return A new instance of Quad.\n * @see Quad\n */\n quad(subject, predicate, object, graph) {\n return new Quad_1.Quad(subject, predicate, object, graph || this.defaultGraph());\n }\n /**\n * Create a deep copy of the given term using this data factory.\n * @param original An RDF term.\n * @return A deep copy of the given term.\n */\n fromTerm(original) {\n // TODO: remove nasty any casts when this TS bug has been fixed:\n // https://github.com/microsoft/TypeScript/issues/26933\n switch (original.termType) {\n case 'NamedNode':\n return this.namedNode(original.value);\n case 'BlankNode':\n return this.blankNode(original.value);\n case 'Literal':\n if (original.language) {\n return this.literal(original.value, original.language);\n }\n if (!original.datatype.equals(Literal_1.Literal.XSD_STRING)) {\n return this.literal(original.value, this.fromTerm(original.datatype));\n }\n return this.literal(original.value);\n case 'Variable':\n return this.variable(original.value);\n case 'DefaultGraph':\n return this.defaultGraph();\n case 'Quad':\n return this.quad(this.fromTerm(original.subject), this.fromTerm(original.predicate), this.fromTerm(original.object), this.fromTerm(original.graph));\n }\n }\n /**\n * Create a deep copy of the given quad using this data factory.\n * @param original An RDF quad.\n * @return A deep copy of the given quad.\n */\n fromQuad(original) {\n return this.fromTerm(original);\n }\n /**\n * Reset the internal blank node counter.\n */\n resetBlankNodeCounter() {\n this.blankNodeCounter = 0;\n }\n}\nexports.DataFactory = DataFactory;\n//# sourceMappingURL=DataFactory.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultGraph = void 0;\n/**\n * A singleton term instance that represents the default graph.\n * It's only allowed to assign a DefaultGraph to the .graph property of a Quad.\n */\nclass DefaultGraph {\n constructor() {\n this.termType = 'DefaultGraph';\n this.value = '';\n // Private constructor\n }\n equals(other) {\n return !!other && other.termType === 'DefaultGraph';\n }\n}\nexports.DefaultGraph = DefaultGraph;\nDefaultGraph.INSTANCE = new DefaultGraph();\n//# sourceMappingURL=DefaultGraph.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Literal = void 0;\nconst NamedNode_1 = require(\"./NamedNode\");\n/**\n * A term that represents an RDF literal, containing a string with an optional language tag or datatype.\n */\nclass Literal {\n constructor(value, languageOrDatatype) {\n this.termType = 'Literal';\n this.value = value;\n if (typeof languageOrDatatype === 'string') {\n this.language = languageOrDatatype;\n this.datatype = Literal.RDF_LANGUAGE_STRING;\n }\n else if (languageOrDatatype) {\n this.language = '';\n this.datatype = languageOrDatatype;\n }\n else {\n this.language = '';\n this.datatype = Literal.XSD_STRING;\n }\n }\n equals(other) {\n return !!other && other.termType === 'Literal' && other.value === this.value &&\n other.language === this.language && this.datatype.equals(other.datatype);\n }\n}\nexports.Literal = Literal;\nLiteral.RDF_LANGUAGE_STRING = new NamedNode_1.NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString');\nLiteral.XSD_STRING = new NamedNode_1.NamedNode('http://www.w3.org/2001/XMLSchema#string');\n//# sourceMappingURL=Literal.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NamedNode = void 0;\n/**\n * A term that contains an IRI.\n */\nclass NamedNode {\n constructor(value) {\n this.termType = 'NamedNode';\n this.value = value;\n }\n equals(other) {\n return !!other && other.termType === 'NamedNode' && other.value === this.value;\n }\n}\nexports.NamedNode = NamedNode;\n//# sourceMappingURL=NamedNode.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Quad = void 0;\n/**\n * An instance of DefaultGraph represents the default graph.\n * It's only allowed to assign a DefaultGraph to the .graph property of a Quad.\n */\nclass Quad {\n constructor(subject, predicate, object, graph) {\n this.termType = 'Quad';\n this.value = '';\n this.subject = subject;\n this.predicate = predicate;\n this.object = object;\n this.graph = graph;\n }\n equals(other) {\n // `|| !other.termType` is for backwards-compatibility with old factories without RDF* support.\n return !!other && (other.termType === 'Quad' || !other.termType) &&\n this.subject.equals(other.subject) &&\n this.predicate.equals(other.predicate) &&\n this.object.equals(other.object) &&\n this.graph.equals(other.graph);\n }\n}\nexports.Quad = Quad;\n//# sourceMappingURL=Quad.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Variable = void 0;\n/**\n * A term that represents a variable.\n */\nclass Variable {\n constructor(value) {\n this.termType = 'Variable';\n this.value = value;\n }\n equals(other) {\n return !!other && other.termType === 'Variable' && other.value === this.value;\n }\n}\nexports.Variable = Variable;\n//# sourceMappingURL=Variable.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./lib/Resolve\"), exports);\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.removeDotSegmentsOfPath = exports.removeDotSegments = exports.resolve = void 0;\n/**\n * Convert the given relative IRI to an absolute IRI\n * by taking into account the given optional baseIRI.\n *\n * @param {string} relativeIRI The relative IRI to convert to an absolute IRI.\n * @param {string} baseIRI The optional base IRI.\n * @return {string} an absolute IRI.\n */\nfunction resolve(relativeIRI, baseIRI) {\n baseIRI = baseIRI || '';\n const baseFragmentPos = baseIRI.indexOf('#');\n // Ignore any fragments in the base IRI\n if (baseFragmentPos > 0) {\n baseIRI = baseIRI.substr(0, baseFragmentPos);\n }\n // Convert empty value directly to base IRI\n if (!relativeIRI.length) {\n // At this point, the baseIRI MUST be absolute, otherwise we error\n if (baseIRI.indexOf(':') < 0) {\n throw new Error(`Found invalid baseIRI '${baseIRI}' for value '${relativeIRI}'`);\n }\n return baseIRI;\n }\n // If the value starts with a query character, concat directly (but strip the existing query)\n if (relativeIRI.startsWith('?')) {\n const baseQueryPos = baseIRI.indexOf('?');\n if (baseQueryPos > 0) {\n baseIRI = baseIRI.substr(0, baseQueryPos);\n }\n return baseIRI + relativeIRI;\n }\n // If the value starts with a fragment character, concat directly\n if (relativeIRI.startsWith('#')) {\n return baseIRI + relativeIRI;\n }\n // Ignore baseIRI if it is empty\n if (!baseIRI.length) {\n const relativeColonPos = relativeIRI.indexOf(':');\n if (relativeColonPos < 0) {\n throw new Error(`Found invalid relative IRI '${relativeIRI}' for a missing baseIRI`);\n }\n return removeDotSegmentsOfPath(relativeIRI, relativeColonPos);\n }\n // Ignore baseIRI if the value is absolute\n const valueColonPos = relativeIRI.indexOf(':');\n if (valueColonPos >= 0) {\n return removeDotSegmentsOfPath(relativeIRI, valueColonPos);\n }\n // At this point, the baseIRI MUST be absolute, otherwise we error\n const baseColonPos = baseIRI.indexOf(':');\n if (baseColonPos < 0) {\n throw new Error(`Found invalid baseIRI '${baseIRI}' for value '${relativeIRI}'`);\n }\n const baseIRIScheme = baseIRI.substr(0, baseColonPos + 1);\n // Inherit the baseIRI scheme if the value starts with '//'\n if (relativeIRI.indexOf('//') === 0) {\n return baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos);\n }\n // Check cases where '://' occurs in the baseIRI, and where there is no '/' after a ':' anymore.\n let baseSlashAfterColonPos;\n if (baseIRI.indexOf('//', baseColonPos) === baseColonPos + 1) {\n // If there is no additional '/' after the '//'.\n baseSlashAfterColonPos = baseIRI.indexOf('/', baseColonPos + 3);\n if (baseSlashAfterColonPos < 0) {\n // If something other than a '/' follows the '://', append the value after a '/',\n // otherwise, prefix the value with only the baseIRI scheme.\n if (baseIRI.length > baseColonPos + 3) {\n return baseIRI + '/' + removeDotSegmentsOfPath(relativeIRI, valueColonPos);\n }\n else {\n return baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos);\n }\n }\n }\n else {\n // If there is not even a single '/' after the ':'\n baseSlashAfterColonPos = baseIRI.indexOf('/', baseColonPos + 1);\n if (baseSlashAfterColonPos < 0) {\n // If we don't have a '/' after the ':',\n // prefix the value with only the baseIRI scheme.\n return baseIRIScheme + removeDotSegmentsOfPath(relativeIRI, valueColonPos);\n }\n }\n // If the value starts with a '/', then prefix it with everything before the first effective slash of the base IRI.\n if (relativeIRI.indexOf('/') === 0) {\n return baseIRI.substr(0, baseSlashAfterColonPos) + removeDotSegments(relativeIRI);\n }\n let baseIRIPath = baseIRI.substr(baseSlashAfterColonPos);\n const baseIRILastSlashPos = baseIRIPath.lastIndexOf('/');\n // Ignore everything after the last '/' in the baseIRI path\n if (baseIRILastSlashPos >= 0 && baseIRILastSlashPos < baseIRIPath.length - 1) {\n baseIRIPath = baseIRIPath.substr(0, baseIRILastSlashPos + 1);\n // Also remove the first character of the relative path if it starts with '.' (and not '..' or './')\n // This change is only allowed if there is something else following the path\n if (relativeIRI[0] === '.' && relativeIRI[1] !== '.' && relativeIRI[1] !== '/' && relativeIRI[2]) {\n relativeIRI = relativeIRI.substr(1);\n }\n }\n // Prefix the value with the baseIRI path where\n relativeIRI = baseIRIPath + relativeIRI;\n // Remove dot segment from the IRI\n relativeIRI = removeDotSegments(relativeIRI);\n // Prefix our transformed value with the part of the baseIRI until the first '/' after the first ':'.\n return baseIRI.substr(0, baseSlashAfterColonPos) + relativeIRI;\n}\nexports.resolve = resolve;\n/**\n * Remove dot segments from the given path,\n * as described in https://www.ietf.org/rfc/rfc3986.txt (page 32).\n * @param {string} path An IRI path.\n * @return {string} A path, will always start with a '/'.\n */\nfunction removeDotSegments(path) {\n // Prepare a buffer with segments between each '/.\n // Each segment represents an array of characters.\n const segmentBuffers = [];\n let i = 0;\n while (i < path.length) {\n // Remove '/.' or '/..'\n switch (path[i]) {\n case '/':\n if (path[i + 1] === '.') {\n if (path[i + 2] === '.') {\n // Start a new segment if we find an invalid character after the '.'\n if (!isCharacterAllowedAfterRelativePathSegment(path[i + 3])) {\n segmentBuffers.push([]);\n i++;\n break;\n }\n // Go to parent directory,\n // so we remove a parent segment\n segmentBuffers.pop();\n // Ensure that we end with a slash if there is a trailing '/..'\n if (!path[i + 3]) {\n segmentBuffers.push([]);\n }\n i += 3;\n }\n else {\n // Start a new segment if we find an invalid character after the '.'\n if (!isCharacterAllowedAfterRelativePathSegment(path[i + 2])) {\n segmentBuffers.push([]);\n i++;\n break;\n }\n // Ensure that we end with a slash if there is a trailing '/.'\n if (!path[i + 2]) {\n segmentBuffers.push([]);\n }\n // Go to the current directory,\n // so we do nothing\n i += 2;\n }\n }\n else {\n // Start a new segment\n segmentBuffers.push([]);\n i++;\n }\n break;\n case '#':\n case '?':\n // Query and fragment string should be appended unchanged\n if (!segmentBuffers.length) {\n segmentBuffers.push([]);\n }\n segmentBuffers[segmentBuffers.length - 1].push(path.substr(i));\n // Break the while loop\n i = path.length;\n break;\n default:\n // Not a special character, just append it to our buffer\n if (!segmentBuffers.length) {\n segmentBuffers.push([]);\n }\n segmentBuffers[segmentBuffers.length - 1].push(path[i]);\n i++;\n break;\n }\n }\n return '/' + segmentBuffers.map((buffer) => buffer.join('')).join('/');\n}\nexports.removeDotSegments = removeDotSegments;\n/**\n * Removes dot segments of the given IRI.\n * @param {string} iri An IRI (or part of IRI).\n * @param {number} colonPosition The position of the first ':' in the IRI.\n * @return {string} The IRI where dot segments were removed.\n */\nfunction removeDotSegmentsOfPath(iri, colonPosition) {\n // Determine where we should start looking for the first '/' that indicates the start of the path\n let searchOffset = colonPosition + 1;\n if (colonPosition >= 0) {\n if (iri[colonPosition + 1] === '/' && iri[colonPosition + 2] === '/') {\n searchOffset = colonPosition + 3;\n }\n }\n else {\n if (iri[0] === '/' && iri[1] === '/') {\n searchOffset = 2;\n }\n }\n // Determine the path\n const pathSeparator = iri.indexOf('/', searchOffset);\n if (pathSeparator < 0) {\n return iri;\n }\n const base = iri.substr(0, pathSeparator);\n const path = iri.substr(pathSeparator);\n // Remove dot segments from the path\n return base + removeDotSegments(path);\n}\nexports.removeDotSegmentsOfPath = removeDotSegmentsOfPath;\nfunction isCharacterAllowedAfterRelativePathSegment(character) {\n return !character || character === '#' || character === '?' || character === '/';\n}\n//# sourceMappingURL=Resolve.js.map","export type AccessMode = 'r' | 'rw';\nexport type AccessScope = string;\n\ninterface ScopeEntry {\n name: string;\n mode: AccessMode;\n}\n\ninterface ScopeModeMap {\n // NOTE: key is actually AccessScope\n [key: string]: AccessMode;\n}\n\n/**\n * @class\n *\n * This class is for requesting and managing access to modules/folders on the\n * remote. It gets initialized as `remoteStorage.access`.\n */\nexport class Access {\n scopeModeMap: ScopeModeMap;\n rootPaths: string[];\n storageType: string;\n\n // TODO create custom type for init function\n static _rs_init(): void {\n return;\n }\n\n constructor() {\n this.reset();\n }\n\n /**\n * Holds an array of claimed scopes:\n *\n * ```javascript\n * [{ name: \"\", mode: \"\" }]\n * ```\n *\n * @ignore\n */\n get scopes(): ScopeEntry[] {\n return Object.keys(this.scopeModeMap).map((key) => {\n return { name: key, mode: this.scopeModeMap[key] };\n });\n }\n\n get scopeParameter(): string {\n return this.scopes.map((scope) => {\n return `${this._scopeNameForParameter(scope)}:${scope.mode}`;\n }).join(' ');\n }\n\n /**\n * Claim access on a given scope with given mode.\n *\n * @param scope - An access scope, such as `contacts` or `calendar`\n * @param mode - Access mode. Either `r` for read-only or `rw` for read/write\n *\n * @example\n * ```javascript\n * remoteStorage.access.claim('contacts', 'r');\n * remoteStorage.access.claim('pictures', 'rw');\n * ```\n *\n * Claiming root access, meaning complete access to all files and folders of a storage, can be done using an asterisk for the scope:\n *\n * ```javascript\n * remoteStorage.access.claim('*', 'rw');\n * ```\n */\n claim (scope: AccessScope, mode: AccessMode): void {\n if (typeof (scope) !== 'string' || scope.indexOf('/') !== -1 || scope.length === 0) {\n throw new Error('Scope should be a non-empty string without forward slashes');\n }\n if (!mode.match(/^rw?$/)) {\n throw new Error('Mode should be either \\'r\\' or \\'rw\\'');\n }\n this._adjustRootPaths(scope);\n this.scopeModeMap[scope] = mode;\n }\n\n /**\n * Get the access mode for a given scope.\n *\n * @param scope - Access scope\n * @returns Access mode\n * @ignore\n */\n get (scope: AccessScope): AccessMode {\n return this.scopeModeMap[scope];\n }\n\n\n /**\n * Remove access for the given scope.\n *\n * @param scope - Access scope\n * @ignore\n */\n remove (scope: AccessScope): void {\n const savedMap: ScopeModeMap = {};\n for (const name in this.scopeModeMap) {\n savedMap[name] = this.scopeModeMap[name];\n }\n this.reset();\n delete savedMap[scope];\n for (const name in savedMap) {\n this.claim(name as AccessScope, savedMap[name]);\n }\n }\n\n /**\n * Verify permission for a given scope.\n *\n * @param scope - Access scope\n * @param mode - Access mode\n * @returns `true` if the requested access mode is active, `false` otherwise\n * @ignore\n */\n checkPermission (scope: AccessScope, mode: AccessMode): boolean {\n const actualMode = this.get(scope);\n return actualMode && (mode === 'r' || actualMode === 'rw');\n }\n\n /**\n * Verify permission for a given path.\n *\n * @param path - Path\n * @param mode - Access mode\n * @returns true if the requested access mode is active, false otherwise\n * @ignore\n */\n checkPathPermission (path: string, mode: AccessMode): boolean {\n if (this.checkPermission('*', mode)) {\n return true;\n }\n // TODO check if this is reliable\n const scope = this._getModuleName(path) as AccessScope;\n return !!this.checkPermission(scope, mode);\n }\n\n /**\n * Reset all access permissions.\n *\n * @ignore\n */\n reset(): void {\n this.rootPaths = [];\n this.scopeModeMap = {};\n }\n\n /**\n * Return the module name for a given path.\n */\n private _getModuleName (path): string {\n if (path[0] !== '/') {\n throw new Error('Path should start with a slash');\n }\n const moduleMatch = path.replace(/^\\/public/, '').match(/^\\/([^/]*)\\//);\n return moduleMatch ? moduleMatch[1] : '*';\n }\n\n /**\n * TODO: document\n */\n private _adjustRootPaths (newScope: AccessScope): void {\n if ('*' in this.scopeModeMap || newScope === '*') {\n this.rootPaths = ['/'];\n } else if (!(newScope in this.scopeModeMap)) {\n this.rootPaths.push('/' + newScope + '/');\n this.rootPaths.push('/public/' + newScope + '/');\n }\n }\n\n /**\n * TODO: document\n */\n private _scopeNameForParameter (scope: ScopeEntry): string {\n if (scope.name === '*' && this.storageType) {\n if (this.storageType === '2012.04') {\n return '';\n } else if (this.storageType.match(/remotestorage-0[01]/)) {\n return 'root';\n }\n }\n return scope.name;\n }\n\n /**\n * Set the storage type of the remote.\n *\n * @param type - Storage type\n * @internal\n */\n setStorageType (type: string): void {\n this.storageType = type;\n }\n}\n\nexport default Access;\n","import log from './log';\nimport RemoteStorage from './remotestorage';\nimport { localStorageAvailable, globalContext, toBase64 } from './util';\nimport UnauthorizedError from './unauthorized-error';\nimport { EventHandler } from './eventhandling';\nimport { requestWithTimeout } from \"./requests\";\nimport { Remote } from \"./remote\";\n\ninterface AuthResult {\n access_token?: string;\n refresh_token?: string;\n code?: string;\n rsDiscovery?: object;\n error?: string;\n remotestorage?: string;\n state?: string;\n}\n\ninterface InAppBrowserEvent extends Event {\n type: 'loadstart'|'loadstop'|'loaderror'|'message'|'exit';\n url: string;\n code?: number;\n message?: string;\n data?: string;\n}\n\nexport interface AuthorizeOptions {\n /** URL of the authorization endpoint */\n authURL: string;\n /** access scope */\n scope?: string;\n redirectUri?: string;\n /**\n * client identifier\n * @defaultValue Origin of the redirectUri\n * */\n clientId?: string;\n response_type?: 'token' | 'code';\n state?: string;\n code_challenge?: string;\n code_challenge_method?: 'S256' | 'plain';\n token_access_type?: 'online' | 'offline'; // Dropbox only\n}\n\n// This is set in _rs_init and needed for removal in _rs_cleanup\nlet onFeaturesLoaded: EventHandler;\n\nfunction extractParams (url?: string): AuthResult {\n // FF already decodes the URL fragment in document.location.hash, so use this instead:\n // eslint-disable-next-line\n const location = url || Authorize.getLocation().href;\n\n const queryParam = {};\n for (const [key, value] of new URL(location).searchParams) {\n queryParam[key] = value;\n }\n\n const hashPos = location.indexOf('#');\n if (hashPos === -1) { return queryParam; }\n const urlFragment = location.substring(hashPos+1);\n // if hash is not of the form #key=val&key=val, it's probably not for us\n if (!urlFragment.includes('=')) { return queryParam; }\n\n return urlFragment.split('&').reduce(function(params, kvs) {\n const kv = kvs.split('=');\n\n if (kv[0] === 'state' && kv[1].match(/rsDiscovery/)) {\n // extract rsDiscovery data from the state param\n let stateValue = decodeURIComponent(kv[1]);\n const encodedData = stateValue.substr(stateValue.indexOf('rsDiscovery='))\n .split('&')[0]\n .split('=')[1];\n\n params['rsDiscovery'] = JSON.parse(atob(encodedData));\n\n // remove rsDiscovery param\n stateValue = stateValue.replace(new RegExp('&?rsDiscovery=' + encodedData), '');\n\n if (stateValue.length > 0) {\n params['state'] = stateValue;\n }\n } else {\n params[decodeURIComponent(kv[0])] = decodeURIComponent(kv[1]);\n }\n\n return params;\n }, queryParam);\n}\n\nfunction buildOAuthURL (options: AuthorizeOptions): string {\n const redirect = new URL(options.redirectUri);\n if (! options.state) {\n options.state = redirect.hash ? redirect.hash.substring(1) : '';\n }\n\n if (! options.response_type) {\n options.response_type = 'token';\n }\n\n const url = new URL(options.authURL);\n\n // We don't add a trailing slash as only pathname to redirectUri.\n url.searchParams.set('redirect_uri', options.redirectUri.replace(/#.*$/, ''));\n url.searchParams.set('scope', options.scope);\n url.searchParams.set('client_id', options.clientId);\n\n for (const key of ['state', 'response_type', 'code_challenge', 'code_challenge_method', 'token_access_type']) {\n const value = options[key];\n if (value) {\n url.searchParams.set(key, value);\n }\n }\n\n return url.href;\n}\n\nexport class Authorize {\n static IMPLIED_FAKE_TOKEN = false;\n\n /**\n * Navigates browser to provider's OAuth page. When user grants access,\n * browser will navigate back to redirectUri and OAuth will continue\n * with onFeaturesLoaded.\n */\n static authorize (remoteStorage: RemoteStorage, options: AuthorizeOptions): void {\n log('[Authorize] authURL = ', options.authURL, 'scope = ', options.scope, 'redirectUri = ', options.redirectUri, 'clientId = ', options.clientId, 'response_type =', options.response_type );\n\n if (!options.scope) {\n throw new Error(\"Cannot authorize due to undefined or empty scope; did you forget to access.claim()?\");\n }\n\n // TODO add a test for this\n // keep track of the discovery data during redirect if we can't save it in localStorage\n if (!localStorageAvailable() && remoteStorage.backend === 'remotestorage') {\n options.redirectUri += options.redirectUri.indexOf('#') > 0 ? '&' : '#';\n\n const discoveryData = {\n userAddress: remoteStorage.remote.userAddress,\n href: remoteStorage.remote.href,\n storageApi: remoteStorage.remote.storageApi,\n properties: remoteStorage.remote.properties\n };\n\n options.redirectUri += 'rsDiscovery=' + toBase64(JSON.stringify(discoveryData));\n }\n\n const url = buildOAuthURL(options);\n\n // FIXME declare potential `cordova` property on global somehow, so we don't have to\n // use a string accessor here.\n if (globalContext['cordova']) {\n Authorize\n .openWindow(url, options.redirectUri, 'location=yes,clearsessioncache=yes,clearcache=yes')\n .then((authResult: AuthResult) => {\n remoteStorage.remote.configure({ token: authResult.access_token });\n });\n return;\n }\n\n Authorize.setLocation(url);\n }\n\n /** On success, calls remote.configure() with new access token */\n static async refreshAccessToken (rs: RemoteStorage, remote: Remote, refreshToken: string): Promise {\n await remote.configure({token: null, tokenType: null});\n const formValues = new URLSearchParams({\n grant_type: 'refresh_token',\n client_id: remote.clientId,\n refresh_token: refreshToken,\n });\n const xhr = await requestWithTimeout('POST', remote.TOKEN_URL, {\n headers: {'Content-Type': 'application/x-www-form-urlencoded'},\n body: formValues.toString(),\n responseType: 'json'\n });\n if (xhr?.status === 200) {\n log(`[Authorize] access token good for ${xhr?.response?.expires_in} seconds`);\n const settings = {\n token: xhr?.response?.access_token,\n tokenType: xhr?.response?.token_type,\n };\n if (settings.token) {\n await remote.configure(settings);\n } else {\n throw new Error(`no access_token in \"successful\" refresh: ${xhr.response}`);\n }\n } else {\n await remote.configure({refreshToken: null});\n throw new UnauthorizedError(\"refresh token rejected:\" + JSON.stringify(xhr.response));\n }\n }\n\n /**\n * Get current document location\n *\n * Override this method if access to document.location is forbidden\n */\n static getLocation = function (): Location {\n return document.location;\n };\n\n /**\n * Open new InAppBrowser window for OAuth in Cordova\n */\n static openWindow = function (url: string, redirectUri: string, options: string): Promise {\n return new Promise((resolve, reject) => {\n\n const newWindow = open(url, '_blank', options);\n\n if (!newWindow || newWindow.closed) {\n reject('Authorization popup was blocked'); return;\n }\n\n function handleExit (): void {\n reject('Authorization was canceled');\n }\n\n function handleLoadstart (event: InAppBrowserEvent): void {\n if (event.url.indexOf(redirectUri) !== 0) { return; }\n\n newWindow.removeEventListener('exit', handleExit);\n newWindow.close();\n\n const authResult: AuthResult = extractParams(event.url);\n\n if (!authResult) {\n reject('Authorization error'); return;\n }\n\n resolve(authResult);\n }\n\n newWindow.addEventListener('loadstart', handleLoadstart);\n newWindow.addEventListener('exit', handleExit);\n });\n };\n\n /**\n * Set current document location\n *\n * Override this method if access to document.location is forbidden\n */\n static setLocation (location: string | Location): void {\n if (typeof location === 'string') {\n document.location.href = location;\n } else if (typeof location === 'object') {\n document.location = location;\n } else {\n throw \"Invalid location \" + location;\n }\n }\n\n static _rs_supported (): boolean {\n return typeof(document) !== 'undefined';\n }\n\n static _rs_init = function (remoteStorage: RemoteStorage): void {\n const params = extractParams();\n let location: Location;\n\n if (params) {\n location = Authorize.getLocation();\n location.hash = '';\n }\n\n // eslint-disable-next-line\n onFeaturesLoaded = function(): void {\n let authParamsUsed = false;\n\n if (!params) {\n remoteStorage.remote.stopWaitingForToken();\n return;\n }\n\n if (params.error) {\n if (params.error === 'access_denied') {\n throw new UnauthorizedError('Authorization failed: access denied', { code: 'access_denied' });\n } else {\n throw new UnauthorizedError(`Authorization failed: ${params.error}`);\n }\n }\n\n // rsDiscovery came with the redirect, because it couldn't be\n // saved in localStorage\n if (params.rsDiscovery) {\n remoteStorage.remote.configure(params.rsDiscovery);\n }\n\n if (params.access_token) {\n remoteStorage.remote.configure({ token: params.access_token });\n authParamsUsed = true;\n }\n\n if (params.remotestorage) {\n remoteStorage.connect(params.remotestorage);\n authParamsUsed = true;\n }\n\n if (params.state) {\n location = Authorize.getLocation();\n Authorize.setLocation(location.href.split('#')[0]+'#'+params.state);\n }\n\n if (params.code) { // OAuth2 code or PKCE flow\n fetchTokens(params.code); // remote.configure() called asynchronously\n authParamsUsed = true;\n }\n\n if (!authParamsUsed) {\n remoteStorage.remote.stopWaitingForToken();\n }\n };\n\n // OAuth2 PKCE flow\n async function fetchTokens(code: string) {\n const codeVerifier = sessionStorage.getItem('remotestorage:codeVerifier');\n if (!codeVerifier) {\n log(\"[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage\");\n return;\n }\n location = Authorize.getLocation();\n let redirectUri = location.origin;\n if (location.pathname !== '/') {\n redirectUri += location.pathname;\n }\n const formValues = new URLSearchParams({\n code: code,\n grant_type: 'authorization_code',\n client_id: remoteStorage.remote.clientId,\n redirect_uri: redirectUri,\n code_verifier: codeVerifier\n });\n const xhr = await requestWithTimeout(\n 'POST',\n remoteStorage.remote.TOKEN_URL,\n {\n headers: {'Content-Type': 'application/x-www-form-urlencoded'},\n body: formValues.toString(),\n responseType: 'json'\n }\n );\n\n switch (xhr.status) {\n case 200:\n log(`[Authorize] access token good for ${xhr?.response?.expires_in} seconds`);\n const settings = {\n token: xhr?.response?.access_token,\n refreshToken: xhr?.response?.refresh_token,\n tokenType: xhr?.response?.token_type,\n };\n if (settings.token) {\n remoteStorage.remote.configure(settings);\n } else {\n remoteStorage._emit('error', new Error(`no access_token in \"successful\" response: ${xhr.response}`));\n }\n sessionStorage.removeItem('remotestorage:codeVerifier');\n break;\n default:\n remoteStorage._emit('error', new Error(`${xhr.statusText}: ${xhr.response}`));\n }\n }\n\n remoteStorage.on('features-loaded', onFeaturesLoaded);\n };\n\n static _rs_cleanup (remoteStorage: RemoteStorage): void {\n remoteStorage.removeEventListener('features-loaded', onFeaturesLoaded);\n }\n}\n\nexport default Authorize;\n","import tv4 from 'tv4';\nimport type { JsonSchemas } from './interfaces/json_schema';\nimport type { ChangeObj } from './interfaces/change_obj';\nimport type { QueuedRequestResponse } from './interfaces/queued_request_response';\nimport Types from './types';\nimport SchemaNotFound from './schema-not-found-error';\nimport EventHandling from './eventhandling';\nimport config from './config';\nimport { applyMixins, cleanPath, isFolder } from './util';\nimport RemoteStorage from './remotestorage';\n\nfunction getModuleNameFromBase(path: string): string {\n const parts = path.split('/');\n return path.length > 2 ? parts[1] : 'root';\n}\n\n/**\n * A `BaseClient` instance is the main endpoint you will use for interacting\n * with a connected storage: listing, reading, creating, updating and deleting\n * documents, as well as handling incoming changes.\n *\n * Base clients are usually used in [data modules](../../../data-modules/),\n * which are loaded with two `BaseClient` instances by default: one for private\n * and one for public documents.\n *\n * However, you can also instantiate a BaseClient outside of a data module using\n * the `remoteStorage.scope()` function. Similarly, you can create a new scoped\n * client within another client, using the `BaseClient`'s own {@link scope}.\n *\n * ## Read/write operations\n *\n * A `BaseClient` deals with three types of data: folders, objects and files.\n *\n * * {@link getListing} returns a mapping of all items within a folder.\n *\n * * {@link getObject} and {@link storeObject} operate on JSON objects. Each object\n * has a type.\n *\n * * {@link getFile} and {@link storeFile} operates on files. Each file has a MIME\n * type.\n *\n * * {@link getAll} returns all objects or files for the given folder path.\n *\n * * {@link remove} operates on either objects or files (but not folders; folders\n * are created and removed implictly).\n *\n * ## Caching logic for read operations\n *\n * All functions requesting/reading data will immediately return data from the\n * local store, *as long as it is reasonably up-to-date*. If data is assumed to be\n * potentially outdated, they will check the remote storage for changes first, and then\n * return the requested data.\n *\n * The default maximum age of requested data is two times the periodic sync\n * interval (10 seconds by default).\n *\n * However, you can adjust this behavior by using the `maxAge` argument with any\n * of these functions, thereby changing the maximum age or removing the\n * requirement entirely.\n *\n * * If the `maxAge` requirement is set, and the last sync request for the path\n * is further in the past than the maximum age given, the folder will first be\n * checked for changes on the remote, and then the promise will be fulfilled\n * with the up-to-date document or listing.\n *\n * * If the `maxAge` requirement is set, and cannot be met because of network\n * problems, the promise will be rejected.\n *\n * * If the `maxAge` requirement is set to `false`, or the library is in\n * offline mode, or no remote storage is connected (a.k.a. \"anonymous mode\"),\n * the promise will always be fulfilled with data from the local store.\n *\n * > [!NOTE]\n * > If {@link caching!Caching caching} for the folder is turned off, none of\n * > this applies and data will always be requested from the remote store\n * > directly.\n *\n * ## Change events\n *\n * A `BaseClient` emits only one type of event, named `change`, which you can add\n * a handler for using the `.on()` function (same as with {@link RemoteStorage}):\n *\n * ```js\n * client.on('change', function (evt) {\n * console.log('data was added, updated, or removed:', evt)\n * });\n * ```\n *\n * Using this event, your app can stay informed about data changes, both remote\n * (from other devices or browsers), as well as locally (e.g. other browser tabs).\n *\n * In order to determine where a change originated from, look at the `origin`\n * property of the event. Possible values are `window`, `local`, `remote`, and\n * `conflict`, explained in detail below.\n *\n * #### Example\n *\n * ```js\n * {\n * // Absolute path of the changed node, from the storage root\n * path: path,\n * // Path of the changed node, relative to this baseclient's scope root\n * relativePath: relativePath,\n * // See origin descriptions below\n * origin: 'window|local|remote|conflict',\n * // Old body of the changed node (local version in conflicts; undefined if creation)\n * oldValue: oldBody,\n * // New body of the changed node (remote version in conflicts; undefined if deletion)\n * newValue: newBody,\n * // Body when local and remote last agreed; only present in conflict events\n * lastCommonValue: lastCommonBody,\n * // Old contentType of the changed node (local version for conflicts; undefined if creation)\n * oldContentType: oldContentType,\n * // New contentType of the changed node (remote version for conflicts; undefined if deletion)\n * newContentType: newContentType,\n * // ContentType when local and remote last agreed; only present in conflict events\n * lastCommonContentType: lastCommonContentType\n * }\n * ```\n *\n * ### `local`\n *\n * Events with origin `local` are fired conveniently during the page load, so\n * that you can fill your views when the page loads.\n *\n * Example:\n *\n * ```js\n * {\n * path: '/public/design/color.txt',\n * relativePath: 'color.txt',\n * origin: 'local',\n * oldValue: undefined,\n * newValue: 'white',\n * oldContentType: undefined,\n * newContentType: 'text/plain'\n * }\n * ```\n *\n * > [!TIP]\n * > You may also use for example {@link getAll} instead, and choose to\n * > deactivate these.\n *\n * ### `remote`\n *\n * Events with origin `remote` are fired when remote changes are discovered\n * during sync.\n *\n * > [!NOTE]\n * > Automatically receiving remote changes depends on the {@link caching!Caching} settings\n * > for your module/paths.\n *\n * ### `window`\n *\n * Events with origin `window` are fired whenever you change a value by calling a\n * method on the `BaseClient`; these are disabled by default.\n *\n * > [!TIP]\n * > You can enable them by configuring `changeEvents` for your\n * > {@link RemoteStorage remoteStorage} instance.\n *\n * ### `conflict`\n *\n * Events with origin `conflict` are fired when a conflict occurs while pushing\n * out your local changes to the remote store.\n *\n * Let's say you changed the content of `color.txt` from `white` to `blue`; if\n * you have set `config.changeEvents.window` to `true` for your {@link\n * RemoteStorage} instance, then you will receive:\n *\n * ```js\n * {\n * path: '/public/design/color.txt',\n * relativePath: 'color.txt',\n * origin: 'window',\n * oldValue: 'white',\n * newValue: 'blue',\n * oldContentType: 'text/plain',\n * newContentType: 'text/plain'\n * }\n * ```\n *\n * But when this change is pushed out by asynchronous synchronization, this change\n * may be rejected by the server, if the remote version has in the meantime changed\n * from `white` to for instance `red`; this will then lead to a change event with\n * origin `conflict` (usually a few seconds after the event with origin `window`,\n * if you have those activated). Note that since you already changed it from\n * `white` to `blue` in the local version a few seconds ago, `oldValue` is now\n * your local value of `blue`:\n *\n * ```js\n * {\n * path: '/public/design/color.txt',\n * relativePath: 'color.txt',\n * origin: 'conflict',\n * oldValue: 'blue',\n * newValue: 'red',\n * oldContentType: 'text/plain',\n * newContentType: 'text/plain',\n * // Most recent known common ancestor body of local and remote\n * lastCommonValue: 'white',\n * // Most recent known common ancestor contentType of local and remote\n * lastCommonContentType: 'text/plain'\n * }\n * ```\n *\n * #### Conflict Resolution\n *\n * Conflicts are resolved by calling {@link storeObject} or {@link storeFile} on\n * the device where the conflict surfaced. Other devices are not aware of the\n * conflict.\n *\n * If there is an algorithm to merge the differences between local and remote\n * versions of the data, conflicts may be automatically resolved.\n * {@link storeObject} or {@link storeFile} must not be called synchronously from\n * the change event handler, nor by chaining Promises. {@link storeObject} or\n * {@link storeFile} must not be called until the next iteration of the JavaScript\n * Task Queue, using for example\n * [`setTimeout()`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout).\n *\n * If no algorithm exists, conflict resolution typically involves displaying local\n * and remote versions to the user, and having the user merge them, or choose\n * which version to keep.\n */\nexport class BaseClient {\n /**\n * The {@link RemoteStorage} instance this {@link BaseClient} operates on.\n *\n * @internal\n */\n storage: RemoteStorage;\n\n /**\n * Base path, which this {@link BaseClient} operates on.\n *\n * For the module's `privateClient` this would be the module name, and for the\n * corresponding `publicClient` it is `/public//`.\n */\n base: string;\n\n moduleName: string;\n\n constructor(storage: RemoteStorage, base: string) {\n if (base[base.length - 1] !== '/') {\n throw \"Not a folder: \" + base;\n }\n\n if (base === '/') {\n // allow absolute and relative paths for the root scope.\n this.makePath = (path: string): string => {\n return (path[0] === '/' ? '' : '/') + path;\n };\n }\n\n this.storage = storage;\n this.base = base;\n this.moduleName = getModuleNameFromBase(this.base);\n\n this.addEvents(['change']);\n this.on = this.on.bind(this);\n storage.onChange(this.base, this._fireChange.bind(this));\n }\n\n /**\n * Instantiate a new client, scoped to a subpath of the current client's\n * path.\n *\n * @param path - The path to scope the new client to\n *\n * @returns A new `BaseClient` operating on a subpath of the current base path\n */\n scope (path: string): BaseClient {\n return new BaseClient(this.storage, this.makePath(path));\n }\n\n /**\n * Get a list of child nodes below a given path.\n *\n * @param path - The path to query. It must end with a forward slash.\n * @param maxAge - (optional) Either `false` or the maximum age of cached\n * listing in milliseconds. See [caching logic for read\n * operations](#caching-logic-for-read-operations).\n *\n * @returns A promise for a folder listing object\n *\n * @example\n * ```js\n * client.getListing().then(listing => console.log(listing));\n * ```\n *\n * The folder listing is returned as a JSON object, with the root keys\n * representing the pathnames of child nodes. Keys ending in a forward slash\n * represent _folder nodes_ (subdirectories), while all other keys represent\n * _data nodes_ (files/objects).\n *\n * Data node information contains the item's ETag, content type and -length.\n *\n * Example of a listing object:\n *\n * ```js\n * {\n * \"@context\": \"http://remotestorage.io/spec/folder-description\",\n * \"items\": {\n * \"thumbnails/\": true,\n * \"screenshot-20170902-1913.png\": {\n * \"ETag\": \"6749fcb9eef3f9e46bb537ed020aeece\",\n * \"Content-Length\": 53698,\n * \"Content-Type\": \"image/png;charset=binary\"\n * },\n * \"screenshot-20170823-0142.png\": {\n * \"ETag\": \"92ab84792ef3f9e46bb537edac9bc3a1\",\n * \"Content-Length\": 412401,\n * \"Content-Type\": \"image/png;charset=binary\"\n * }\n * }\n * }\n * ```\n *\n * > [!WARNING]\n * > At the moment, this function only returns detailed metadata, when\n * > caching is turned off. With caching turned on, it will only contain the\n * > item names as properties with `true` as value. See issues 721 and 1108 —\n * > contributions welcome!\n */\n // TODO add real return type\n async getListing (path?: string, maxAge?: false | number): Promise {\n if (typeof path !== 'string') { path = ''; }\n else if (path.length > 0 && !isFolder(path)) {\n return Promise.reject(\"Not a folder: \" + path);\n }\n\n return this.storage.get(this.makePath(path), maxAge).then((r: QueuedRequestResponse) => {\n return r.statusCode === 404 ? {} : r.body;\n });\n }\n\n /**\n * Get all objects directly below a given path.\n *\n * @param path - (optional) Path to the folder. Must end in a forward slash.\n * @param maxAge - (optional) Either `false` or the maximum age of cached\n * objects in milliseconds. See [caching logic for read\n * operations](#caching-logic-for-read-operations).\n\n *\n * @returns A promise for a collection of items\n *\n * @example\n * ```js\n * client.getAll('example-subdirectory/').then(objects => {\n * for (var path in objects) {\n * console.log(path, objects[path]);\n * }\n * });\n * ```\n *\n * Example response:\n *\n * ```js\n * {\n * \"27b8dc16483734625fff9de653a14e03\": {\n * \"@context\": \"http://remotestorage.io/spec/modules/bookmarks/archive-bookmark\",\n * \"id\": \"27b8dc16483734625fff9de653a14e03\",\n * \"url\": \"https://unhosted.org/\",\n * \"title\": \"Unhosted Web Apps\",\n * \"description\": \"Freedom from web 2.0's monopoly platforms\",\n * \"tags\": [\n * \"unhosted\",\n * \"remotestorage\"\n * ],\n * \"createdAt\": \"2017-11-02T15:22:25.289Z\",\n * \"updatedAt\": \"2019-11-07T17:52:22.643Z\"\n * },\n * \"900a5ca174bf57c56b79af0653053bdc\": {\n * \"@context\": \"http://remotestorage.io/spec/modules/bookmarks/archive-bookmark\",\n * \"id\": \"900a5ca174bf57c56b79af0653053bdc\",\n * \"url\": \"https://remotestorage.io/\",\n * \"title\": \"remoteStorage\",\n * \"description\": \"An open protocol for per-user storage on the Web\",\n * \"tags\": [\n * \"unhosted\",\n * \"remotestorage\"\n * ],\n * \"createdAt\": \"2019-11-07T17:59:34.883Z\"\n * }\n * }\n * ```\n * > [!NOTE]\n * > For items that are not JSON-stringified objects (for example stored using\n * > {@link storeFile} instead of {@link storeObject}), the object's value is\n * > filled in with `true`.\n *\n */\n // TODO add real return type\n async getAll (path?: string, maxAge?: false | number): Promise {\n if (typeof path !== 'string') { path = ''; }\n else if (path.length > 0 && !isFolder(path)) {\n return Promise.reject(\"Not a folder: \" + path);\n }\n\n return this.storage.get(this.makePath(path), maxAge).then((r: QueuedRequestResponse) => {\n if (r.statusCode === 404) { return {}; }\n if (typeof r.body === 'object') {\n const keys = Object.keys(r.body);\n // treat this like 404. it probably means a folder listing that\n // has changes that haven't been pushed out yet.\n if (keys.length === 0) { return {}; }\n\n const calls = keys.map((key: string) => {\n return this.storage.get(this.makePath(path + key), maxAge)\n .then((o: QueuedRequestResponse) => {\n if (typeof o.body === 'string') {\n try { o.body = JSON.parse(o.body); }\n catch (e) { /* empty */ }\n }\n if (typeof o.body === 'object') {\n r.body[key] = o.body;\n }\n });\n });\n\n return Promise.all(calls).then(() => { return r.body; });\n }\n });\n }\n\n /**\n * Get the file at the given path. A file is raw data, as opposed to\n * a JSON object (use {@link getObject} for that).\n *\n *\n * @param path - Relative path from the module root (without leading slash).\n * @param maxAge - (optional) Either ``false`` or the maximum age of\n * the cached file in milliseconds. See [caching logic for read\n * operations](#caching-logic-for-read-operations).\n *\n * @returns An object containing the content type as well as the file's content:\n *\n * * `mimeType`
\n * String representing the MIME Type of the document.\n * * `data`
\n * Raw data of the document (either a string or an ArrayBuffer)\n *\n * @example\n * Displaying an image:\n *\n * ```js\n * client.getFile('path/to/some/image').then(file => {\n * const blob = new Blob([file.data], { type: file.mimeType });\n * const targetElement = document.findElementById('my-image-element');\n * targetElement.src = window.URL.createObjectURL(blob);\n * });\n * ```\n */\n // TODO add real return type\n async getFile (path: string, maxAge?: false | number): Promise {\n if (typeof path !== 'string') {\n return Promise.reject('Argument \\'path\\' of baseClient.getFile must be a string');\n }\n\n return this.storage.get(this.makePath(path), maxAge).then((r: QueuedRequestResponse) => {\n return {\n data: r.body,\n contentType: r.contentType,\n revision: r.revision // (this is new)\n };\n });\n }\n\n /**\n * Store raw data at a given path.\n *\n * @param mimeType - MIME media type of the data being stored\n * @param path - Path relative to the module root\n * @param body - Raw data to store\n *\n * @returns A promise for the created/updated revision (ETag)\n *\n * @example\n * UTF-8 data:\n *\n * ```js\n * client.storeFile('text/html', 'index.html', '

Hello World!

')\n * .then(() => { console.log(\"File saved\") });\n * ```\n *\n * Binary data:\n *\n * ```js\n * const input = document.querySelector('form#upload input[type=file]');\n * const file = input.files[0];\n * const fileReader = new FileReader();\n *\n * fileReader.onload = function () {\n * client.storeFile(file.type, file.name, fileReader.result)\n * .then(() => { console.log(\"File saved\") });\n * };\n *\n * fileReader.readAsArrayBuffer(file);\n * ```\n */\n async storeFile (mimeType: string, path: string, body: string | ArrayBuffer | ArrayBufferView): Promise {\n if (typeof mimeType !== 'string') {\n return Promise.reject('Argument \\'mimeType\\' of baseClient.storeFile must be a string');\n }\n if (typeof path !== 'string') {\n return Promise.reject('Argument \\'path\\' of baseClient.storeFile must be a string');\n }\n if ((typeof body !== 'string') && (typeof body !== 'object')) {\n return Promise.reject('Argument \\'body\\' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView');\n }\n if (!this.storage.access.checkPathPermission(this.makePath(path), 'rw')) {\n console.warn('WARNING: Editing a document to which only read access (\\'r\\') was claimed');\n }\n\n return this.storage.put(this.makePath(path), body, mimeType).then((r: QueuedRequestResponse) => {\n if (r.statusCode === 200 || r.statusCode === 201) {\n return r.revision;\n } else {\n return Promise.reject(\"Request (PUT \" + this.makePath(path) + \") failed with status: \" + r.statusCode);\n }\n });\n }\n\n /**\n * Get a JSON object from the given path.\n *\n * @param path - Relative path from the module root (without leading slash).\n * @param maxAge - (optional) Either `false` or the maximum age of\n * cached object in milliseconds. See [caching logic for read\n * operations](#caching-logic-for-read-operations).\n *\n * @returns A promise, resolving with the requested object, or `null` if non-existent\n *\n * @example\n * client.getObject('/path/to/object').then(obj => console.log(obj));\n */\n\n // TODO add real return type\n async getObject (path: string, maxAge?: false | number): Promise {\n if (typeof path !== 'string') {\n return Promise.reject('Argument \\'path\\' of baseClient.getObject must be a string');\n }\n\n return this.storage.get(this.makePath(path), maxAge).then((r: QueuedRequestResponse) => {\n if (typeof r.body === 'object') { // will be the case for documents stored with rs.js <= 0.10.0-beta2\n return r.body;\n } else if (typeof r.body === 'string') {\n try {\n return JSON.parse(r.body);\n } catch (e) {\n throw new Error(\"Not valid JSON: \" + this.makePath(path));\n }\n } else if (typeof r.body !== 'undefined' && r.statusCode === 200) {\n return Promise.reject(\"Not an object: \" + this.makePath(path));\n }\n });\n }\n\n /**\n * Store an object at given path. Triggers synchronization. See {@link\n * declareType} and\n * [Defining data types](../../../data-modules/defining-data-types)\n * for info on object types.\n *\n * Must not be called more than once per second for any given `path`.\n *\n * @param typeAlias - Unique type of this object within this module.\n * @param path - Path relative to the module root.\n * @param object - A JavaScript object to be stored at the given path.\n * Must be serializable as JSON.\n *\n * @returns Resolves with revision on success. Rejects with an error object,\n * if schema validations fail.\n *\n * @example\n * const bookmark = {\n * url: 'http://unhosted.org',\n * description: 'Unhosted Adventures',\n * tags: ['unhosted', 'remotestorage', 'no-backend']\n * }\n * const path = MD5Hash(bookmark.url);\n\n * client.storeObject('bookmark', path, bookmark)\n * .then(() => console.log('bookmark saved'))\n * .catch((err) => console.log(err));\n */\n async storeObject (typeAlias: string, path: string, object: object): Promise {\n if (typeof typeAlias !== 'string') {\n return Promise.reject('Argument \\'typeAlias\\' of baseClient.storeObject must be a string');\n }\n if (typeof path !== 'string') {\n return Promise.reject('Argument \\'path\\' of baseClient.storeObject must be a string');\n }\n if (typeof object !== 'object') {\n return Promise.reject('Argument \\'object\\' of baseClient.storeObject must be an object');\n }\n\n this._attachType(object, typeAlias);\n\n try {\n const validationResult = this.validate(object);\n if (!validationResult.valid) {\n return Promise.reject(validationResult);\n }\n } catch (exc) {\n return Promise.reject(exc);\n }\n\n return this.storage.put(this.makePath(path), JSON.stringify(object), 'application/json; charset=UTF-8').then((r: QueuedRequestResponse) => {\n if (r.statusCode === 200 || r.statusCode === 201) {\n return r.revision;\n } else {\n return Promise.reject(\"Request (PUT \" + this.makePath(path) + \") failed with status: \" + r.statusCode);\n }\n });\n }\n\n /**\n * Remove node at given path from storage. Triggers synchronization.\n *\n * @param path - Path relative to the module root.\n *\n * @example\n * client.remove('path/to/object').then(() => console.log('item deleted'));\n */\n // TODO add real return type\n // TODO Don't return the RemoteResponse directly, handle response properly\n remove (path: string): Promise {\n if (typeof path !== 'string') {\n return Promise.reject('Argument \\'path\\' of baseClient.remove must be a string');\n }\n if (!this.storage.access.checkPathPermission(this.makePath(path), 'rw')) {\n console.warn('WARNING: Removing a document to which only read access (\\'r\\') was claimed');\n }\n\n return this.storage.delete(this.makePath(path));\n }\n\n /**\n * Retrieve full URL of a document. Useful for example for sharing the public\n * URL of an item in the ``/public`` folder.\n *\n * @param path - Path relative to the module root.\n *\n * @returns The full URL of the item, including the storage origin, or `undefined`\n * if no remote storage is connected\n *\n * > [!WARNING]\n * > This method currently only works for remoteStorage\n * > backends. The GitHub issues for implementing it for Dropbox and Google\n * > are 1052 and 1054.\n */\n // TODO refactor this into the Remote interface\n getItemURL (path: string): string | undefined {\n if (typeof path !== 'string') {\n throw 'Argument \\'path\\' of baseClient.getItemURL must be a string';\n }\n if (this.storage.connected) {\n path = cleanPath(this.makePath(path));\n return this.storage.remote.href + path;\n } else {\n return undefined;\n }\n }\n\n /**\n * Set caching strategy for a given path and its children.\n *\n * See [Caching strategies](../../caching/classes/Caching.html#caching-strategies)\n * for a detailed description of the available strategies.\n *\n * @param path - Path to cache\n * @param strategy - Caching strategy. One of 'ALL', 'SEEN', or FLUSH'.\n * Defaults to 'ALL'.\n *\n * @returns The same `BaseClient` instance this method is called on to allow\n * for method chaining\n *\n * @example\n * client.cache('lists/', 'SEEN');\n */\n cache (path: string, strategy: 'ALL' | 'SEEN' | 'FLUSH' = 'ALL'): BaseClient {\n if (typeof path !== 'string') {\n throw 'Argument \\'path\\' of baseClient.cache must be a string';\n }\n if (typeof strategy !== 'string') {\n throw 'Argument \\'strategy\\' of baseClient.cache must be a string or undefined';\n }\n if (strategy !== 'FLUSH' &&\n strategy !== 'SEEN' &&\n strategy !== 'ALL') {\n throw 'Argument \\'strategy\\' of baseclient.cache must be one of '\n + '[\"FLUSH\", \"SEEN\", \"ALL\"]';\n }\n\n this.storage.caching.set(this.makePath(path), strategy);\n return this;\n }\n\n /**\n * Declare a remoteStorage object type using a JSON Schema. Visit\n * [json-schema.org](http://json-schema.org) for details.\n *\n * See [Defining data types](../../../data-modules/defining-data-types) for more info.\n *\n * @param alias - A type alias/shortname\n * @param uriOrSchema - JSON-LD URI of the schema, or a JSON Schema object.\n * The URI is automatically generated if none given.\n * @param schema - (optional) A JSON Schema object describing the object type\n *\n * @example\n * client.declareType('todo-item', {\n * \"type\": \"object\",\n * \"properties\": {\n * \"id\": {\n * \"type\": \"string\"\n * },\n * \"title\": {\n * \"type\": \"string\"\n * },\n * \"finished\": {\n * \"type\": \"boolean\"\n * \"default\": false\n * },\n * \"createdAt\": {\n * \"type\": \"date\"\n * }\n * },\n * \"required\": [\"id\", \"title\"]\n * })\n **/\n declareType (alias: string, uriOrSchema: string|tv4.JsonSchema, schema?: tv4.JsonSchema): void {\n let uri: string;\n\n if (schema && typeof uriOrSchema === 'string') {\n uri = uriOrSchema;\n } else if (!schema && typeof uriOrSchema !== 'string') {\n schema = uriOrSchema;\n uri = this._defaultTypeURI(alias);\n } else if (!schema && typeof uriOrSchema === 'string') {\n throw new Error('declareType() requires a JSON Schema object to be passed, in order to validate object types/formats');\n }\n\n BaseClient.Types.declare(this.moduleName, alias, uri, schema);\n }\n\n /**\n * Validate an object against the associated schema.\n *\n * @param object - JS object to validate. Must have a `@context` property.\n *\n * @returns An object containing information about the validation result\n *\n * @example\n * var result = client.validate(document);\n *\n * // result:\n * // {\n * // error: null,\n * // missing: [],\n * // valid: true\n * // }\n **/\n validate (object: {[key: string]: any}): {[key: string]: any} {\n const schema = BaseClient.Types.getSchema(object['@context']);\n if (schema) {\n return tv4.validateResult(object, schema);\n } else {\n throw new SchemaNotFound(object['@context']);\n }\n }\n\n /**\n * TODO document\n *\n * @private\n */\n schemas = {\n configurable: true,\n\n get (): JsonSchemas {\n return BaseClient.Types.inScope(this.moduleName);\n }\n };\n\n /**\n * The default JSON-LD @context URL for RS types/objects/documents\n *\n * @private\n */\n _defaultTypeURI (alias: string): string {\n return 'http://remotestorage.io/spec/modules/' + encodeURIComponent(this.moduleName) + '/' + encodeURIComponent(alias);\n }\n\n /**\n * Attaches the JSON-LD @context to an object\n *\n * @private\n */\n _attachType (object: object, alias: string): void {\n object['@context'] = BaseClient.Types.resolveAlias(this.moduleName + '/' + alias) || this._defaultTypeURI(alias);\n }\n\n /**\n * TODO: document\n *\n * @private\n */\n makePath (path: string): string {\n return this.base + (path || '');\n }\n\n /**\n * TODO: document\n *\n * @private\n */\n _fireChange (event: ChangeObj): void {\n if (config.changeEvents[event.origin]) {\n ['new', 'old', 'lastCommon'].forEach(function (fieldNamePrefix) {\n if ((!event[fieldNamePrefix + 'ContentType'])\n || (/^application\\/(.*)json(.*)/.exec(event[fieldNamePrefix + 'ContentType']))) {\n if (typeof event[fieldNamePrefix + 'Value'] === 'string') {\n try {\n event[fieldNamePrefix + 'Value'] = JSON.parse(event[fieldNamePrefix + 'Value']);\n } catch (e) {\n // empty\n }\n }\n }\n });\n this._emit('change', event);\n }\n }\n\n static Types = Types;\n\n static _rs_init (): void {\n return;\n }\n}\n\nexport interface BaseClient extends EventHandling {}\napplyMixins(BaseClient, [EventHandling]);\n\nexport default BaseClient;\n","import { containingFolder, isFolder } from './util';\nimport log from './log';\n\n/**\n * @class\n *\n * The caching class gets initialized as `remoteStorage.caching`, unless the\n * {@link remotestorage!RemoteStorage RemoteStorage} instance is created with the option `cache: false`, disabling\n * caching entirely.\n *\n * In case your app hasn't explictly configured caching, the default setting is to\n * cache any documents that have been either created or requested since your app\n * loaded. For offline-capable apps, it usually makes sense to enable full,\n * automatic caching of all documents, which is what {@link enable} will do.\n *\n * Enabling full caching has several benefits:\n *\n * * Speed of access: locally cached data is available to the app a lot faster.\n * * Offline mode: when all data is cached, it can also be read when your app\n * starts while being offline.\n * * Initial synchronization time: the amount of data your app caches can\n * have a significant impact on its startup time.\n *\n * Caching can be configured on a per-path basis. When caching is enabled for a\n * folder, it causes all subdirectories to be cached as well.\n *\n * ## Caching strategies\n *\n * For each subtree, you can set the caching strategy to ``ALL``, ``SEEN``\n * (default), and ``FLUSH``.\n *\n * * `ALL` means that once all outgoing changes have been pushed, sync will\n * start retrieving nodes to cache pro-actively. If a local copy exists\n * of everything, it will check on each sync whether the ETag of the root\n * folder changed, and retrieve remote changes if they exist.\n * * `SEEN` does this only for documents and folders that have been either\n * read from or written to at least once since connecting to the current\n * remote backend, plus their parent/ancestor folders up to the root (to\n * make tree-based sync possible).\n * * `FLUSH` will only cache outgoing changes, and forget them as soon as\n * they have been saved to remote successfully.\n **/\nexport class Caching {\n pendingActivations: string[] = [];\n // TODO add correct type\n activateHandler: (firstPending: string) => void;\n\n private _rootPaths: object;\n\n constructor () {\n this.reset();\n }\n\n /**\n * Configure caching for a given path explicitly.\n *\n * Not needed when using ``enable``/``disable``.\n *\n * @param path - Path to cache\n * @param strategy - Caching strategy. One of 'ALL', 'SEEN', or 'FLUSH'.\n *\n * @example\n * ```js\n * remoteStorage.caching.set('/bookmarks/archive/', 'SEEN');\n * ```\n */\n set (path: string, strategy: 'ALL' | 'SEEN' | 'FLUSH'): void {\n if (typeof path !== 'string') {\n throw new Error('path should be a string');\n }\n if (!isFolder(path)) {\n throw new Error('path should be a folder');\n }\n // FIXME We need to get to the access instance somehow. But I'm not sure\n // this check is even necessary in the first place. -raucao\n // if (!this._remoteStorage.access.checkPathPermission(path, 'r')) {\n // throw new Error('No access to path \"' + path + '\". You have to claim access to it first.');\n // }\n if (!strategy.match(/^(FLUSH|SEEN|ALL)$/)) {\n throw new Error(\"strategy should be 'FLUSH', 'SEEN', or 'ALL'\");\n }\n\n this._rootPaths[path] = strategy;\n\n if (strategy === 'ALL') {\n if (this.activateHandler) {\n this.activateHandler(path);\n } else {\n this.pendingActivations.push(path);\n }\n }\n }\n\n /**\n * Enable caching for a given path.\n *\n * Uses caching strategy ``ALL``.\n *\n * @param path - Path to enable caching for\n * @returns\n *\n * @example\n * ```js\n * remoteStorage.caching.enable('/bookmarks/');\n * ```\n */\n enable (path: string): void {\n this.set(path, 'ALL');\n }\n\n /**\n * Disable caching for a given path.\n *\n * Uses caching strategy ``FLUSH`` (meaning items are only cached until\n * successfully pushed to the remote).\n *\n * @param path - Path to disable caching for\n *\n * @example\n * ```js\n * remoteStorage.caching.disable('/bookmarks/');\n * ```\n */\n disable (path: string): void {\n this.set(path, 'FLUSH');\n }\n\n /**\n * Set a callback for when caching is activated for a path.\n *\n * @param cb - Callback function\n */\n onActivate (cb: (firstPending: string) => void): void {\n log('[Caching] Setting activate handler', cb, this.pendingActivations);\n this.activateHandler = cb;\n for (let i = 0; i < this.pendingActivations.length; i++) {\n cb(this.pendingActivations[i]);\n }\n this.pendingActivations = [];\n }\n\n /**\n * Retrieve caching setting for a given path, or its next parent\n * with a caching strategy set.\n *\n * @param path - Path to retrieve setting for\n * @returns caching strategy for the path\n *\n * @example\n * ```js\n * remoteStorage.caching.checkPath('documents/').then(strategy => {\n * console.log(`caching strategy for 'documents/': ${strategy}`));\n * // \"caching strategy for 'documents/': SEEN\"\n * });\n * ```\n **/\n checkPath (path: string): string {\n if (this._rootPaths[path] !== undefined) {\n return this._rootPaths[path];\n } else if (path === '/') {\n return 'SEEN';\n } else {\n return this.checkPath(containingFolder(path));\n }\n }\n\n /**\n * Reset the state of caching by deleting all caching information.\n *\n * @example\n * ```js\n * remoteStorage.caching.reset();\n * ```\n **/\n reset (): void {\n this._rootPaths = {};\n }\n\n /**\n * Setup function that is called on initialization.\n *\n * @internal\n **/\n static _rs_init (/*remoteStorage*/): void {\n return;\n }\n}\n\nexport default Caching;\n","import type { ChangeObj } from './interfaces/change_obj';\nimport type { QueuedRequestResponse } from './interfaces/queued_request_response';\nimport type { RSEvent } from './interfaces/rs_event';\nimport type { RSNode, RSNodes, ProcessNodes } from './interfaces/rs_node';\nimport EventHandling from './eventhandling';\nimport config from './config';\nimport log from './log';\nimport {\n applyMixins,\n deepClone,\n equal,\n isDocument,\n isFolder,\n pathsFromRoot\n} from './util';\n\nfunction getLatest (node: RSNode): any {\n if (typeof (node) !== 'object' || typeof (node.path) !== 'string') {\n return;\n }\n if (isFolder(node.path)) {\n if (node.local && node.local.itemsMap) {\n return node.local;\n }\n if (node.common && node.common.itemsMap) {\n return node.common;\n }\n } else {\n if (node.local) {\n if (node.local.body && node.local.contentType) {\n return node.local;\n }\n if (node.local.body === false) {\n return;\n }\n }\n if (node.common && node.common.body && node.common.contentType) {\n return node.common;\n }\n // Migration code! Once all apps use at least this version of the lib, we\n // can publish clean-up code that migrates over any old-format data, and\n // stop supporting it. For now, new apps will support data in both\n // formats, thanks to this:\n if (node.body && node.contentType) {\n return {\n body: node.body,\n contentType: node.contentType\n };\n }\n }\n}\n\nfunction isOutdated (nodes: RSNodes, maxAge: number): boolean {\n for (const path in nodes) {\n if (nodes[path] && nodes[path].remote) {\n return true;\n }\n const nodeVersion = getLatest(nodes[path]);\n if (nodeVersion && nodeVersion.timestamp && (new Date().getTime()) - nodeVersion.timestamp <= maxAge) {\n return false;\n } else if (!nodeVersion) {\n return true;\n }\n }\n return true;\n}\n\n\nfunction makeNode (path: string): RSNode {\n const node: RSNode = {path: path, common: {}};\n\n if (isFolder(path)) {\n node.common.itemsMap = {};\n }\n return node;\n}\n\nfunction updateFolderNodeWithItemName (node: RSNode, itemName: string): RSNode {\n if (!node.common) {\n node.common = {\n itemsMap: {}\n };\n }\n if (!node.common.itemsMap) {\n node.common.itemsMap = {};\n }\n if (!node.local) {\n node.local = deepClone(node.common);\n }\n if (!node.local.itemsMap) {\n node.local.itemsMap = node.common.itemsMap;\n }\n node.local.itemsMap[itemName] = true;\n\n return node;\n}\n\n/**\n * This module defines functions that are mixed into remoteStorage.local when\n * it is instantiated (currently one of indexeddb.js, localstorage.js, or\n * inmemorystorage.js).\n *\n * All remoteStorage.local implementations should therefore implement\n * this.getNodes, this.setNodes, and this.forAllNodes. The rest is blended in\n * here to create a GPD (get/put/delete) interface which the BaseClient can\n * talk to.\n *\n * @interface\n */\n\nabstract class CachingLayer {\n // FIXME\n // this process of updating nodes needs to be heavily documented first, then\n // refactored. Right now it's almost impossible to refactor as there's no\n // explanation of why things are implemented certain ways or what the goal(s)\n // of the behavior are. -slvrbckt (+1 -les)\n private _updateNodesRunning = false;\n private _updateNodesQueued = [];\n\n\n // functions that will be overwritten\n // ----------------------------------\n abstract getNodes(paths: string[]): Promise;\n\n abstract diffHandler(...args: any[]);\n\n abstract forAllNodes(cb: (node) => any): Promise;\n\n abstract setNodes(nodes: RSNodes): Promise;\n\n\n // --------------------------------------------------\n\n // TODO: improve our code structure so that this function\n // could call sync.queueGetRequest directly instead of needing\n // this hacky third parameter as a callback\n async get (path: string, maxAge: number, queueGetRequest: (path2: string) => Promise): Promise {\n if (typeof (maxAge) === 'number') {\n return this.getNodes(pathsFromRoot(path))\n .then((objs) => {\n const node: RSNode = getLatest(objs[path]);\n\n if (isOutdated(objs, maxAge)) {\n return queueGetRequest(path);\n } else if (node) {\n return {\n statusCode: 200,\n body: node.body || node.itemsMap,\n contentType: node.contentType\n };\n } else {\n return { statusCode: 404 };\n }\n });\n } else {\n return this.getNodes([path])\n .then((objs) => {\n const node: RSNode = getLatest(objs[path]);\n\n if (node) {\n if (isFolder(path)) {\n for (const i in node.itemsMap) {\n // the hasOwnProperty check here is only because our jshint settings require it:\n if (node.itemsMap.hasOwnProperty(i) && node.itemsMap[i] === false) {\n delete node.itemsMap[i];\n }\n }\n }\n return {\n statusCode: 200,\n body: node.body || node.itemsMap,\n contentType: node.contentType\n };\n } else {\n return {statusCode: 404};\n }\n });\n }\n }\n\n async put (path: string, body: unknown, contentType: string): Promise {\n const paths = pathsFromRoot(path);\n\n function _processNodes(nodePaths: string[], nodes: RSNodes): RSNodes {\n try {\n for (let i = 0, len = nodePaths.length; i < len; i++) {\n const nodePath = nodePaths[i];\n let node = nodes[nodePath];\n let previous: RSNode;\n\n if (!node) {\n nodes[nodePath] = node = makeNode(nodePath);\n }\n\n // Document\n if (i === 0) {\n previous = getLatest(node);\n node.local = {\n body: body,\n contentType: contentType,\n previousBody: (previous ? previous.body : undefined),\n previousContentType: (previous ? previous.contentType : undefined),\n };\n }\n // Folder\n else {\n const itemName = nodePaths[i - 1].substring(nodePath.length);\n node = updateFolderNodeWithItemName(node, itemName);\n }\n }\n return nodes;\n } catch (e) {\n log('[Cachinglayer] Error during PUT', nodes, e);\n throw e;\n }\n }\n\n return this._updateNodes(paths, _processNodes);\n }\n\n delete (path: string): unknown {\n const paths = pathsFromRoot(path);\n\n return this._updateNodes(paths, function (nodePaths, nodes) {\n for (let i = 0, len = nodePaths.length; i < len; i++) {\n const nodePath = nodePaths[i];\n const node = nodes[nodePath];\n let previous;\n\n if (!node) {\n console.error('Cannot delete non-existing node ' + nodePath);\n continue;\n }\n\n if (i === 0) {\n // Document\n previous = getLatest(node);\n node.local = {\n body: false,\n previousBody: (previous ? previous.body : undefined),\n previousContentType: (previous ? previous.contentType : undefined),\n };\n } else {\n // Folder\n if (!node.local) {\n node.local = deepClone(node.common);\n }\n const itemName = nodePaths[i - 1].substring(nodePath.length);\n delete node.local.itemsMap[itemName];\n\n if (Object.getOwnPropertyNames(node.local.itemsMap).length > 0) {\n // This folder still contains other items, don't remove any further ancestors\n break;\n }\n }\n }\n return nodes;\n });\n }\n\n flush(path: string): unknown {\n\n return this._getAllDescendentPaths(path).then((paths: string[]) => {\n return this.getNodes(paths);\n }).then((nodes: RSNodes) => {\n for (const nodePath in nodes) {\n const node = nodes[nodePath];\n\n if (node && node.common && node.local) {\n this._emitChange({\n path: node.path,\n origin: 'local',\n oldValue: (node.local.body === false ? undefined : node.local.body),\n newValue: (node.common.body === false ? undefined : node.common.body)\n });\n }\n nodes[nodePath] = undefined;\n }\n\n return this.setNodes(nodes);\n });\n }\n\n private _emitChange(obj: ChangeObj): void {\n if (config.changeEvents[obj.origin]) {\n this._emit('change', obj);\n }\n }\n\n fireInitial (): void {\n if (!config.changeEvents.local) { return; }\n\n this.forAllNodes((node) => {\n if (isDocument(node.path)) {\n const latest = getLatest(node);\n if (latest) {\n this._emitChange({\n path: node.path,\n origin: 'local',\n oldValue: undefined,\n oldContentType: undefined,\n newValue: latest.body,\n newContentType: latest.contentType\n });\n }\n }\n }).then(() => {\n this._emit('local-events-done');\n });\n }\n\n // TODO add proper type\n onDiff(diffHandler: any) {\n this.diffHandler = diffHandler;\n }\n\n migrate(node: RSNode): RSNode {\n if (typeof (node) === 'object' && !node.common) {\n node.common = {};\n if (typeof (node.path) === 'string') {\n if (node.path.substr(-1) === '/' && typeof (node.body) === 'object') {\n node.common.itemsMap = node.body;\n }\n } else {\n //save legacy content of document node as local version\n if (!node.local) {\n node.local = {};\n }\n node.local.body = node.body;\n node.local.contentType = node.contentType;\n }\n }\n return node;\n }\n\n\n private _updateNodes(paths: string[], _processNodes: ProcessNodes): Promise {\n return new Promise((resolve, reject) => {\n this._doUpdateNodes(paths, _processNodes, {\n resolve: resolve,\n reject: reject\n });\n });\n }\n\n private _doUpdateNodes(paths: string[], _processNodes: ProcessNodes, promise) {\n if (this._updateNodesRunning) {\n this._updateNodesQueued.push({\n paths: paths,\n cb: _processNodes,\n promise: promise\n });\n return;\n } else {\n this._updateNodesRunning = true;\n }\n\n this.getNodes(paths).then((nodes) => {\n const existingNodes = deepClone(nodes);\n const changeEvents = [];\n\n nodes = _processNodes(paths, nodes);\n\n for (const path in nodes) {\n const node = nodes[path];\n if (equal(node, existingNodes[path])) {\n delete nodes[path];\n } else if (isDocument(path)) {\n if (\n !equal(node.local.body, node.local.previousBody) ||\n node.local.contentType !== node.local.previousContentType\n ) {\n changeEvents.push({\n path: path,\n origin: 'window',\n oldValue: node.local.previousBody,\n newValue: node.local.body === false ? undefined : node.local.body,\n oldContentType: node.local.previousContentType,\n newContentType: node.local.contentType\n });\n }\n delete node.local.previousBody;\n delete node.local.previousContentType;\n }\n }\n\n this.setNodes(nodes).then(() => {\n this._emitChangeEvents(changeEvents);\n promise.resolve({statusCode: 200});\n });\n }).then(() => {\n return Promise.resolve();\n }, (err) => {\n promise.reject(err);\n }).then(() => {\n this._updateNodesRunning = false;\n const nextJob = this._updateNodesQueued.shift();\n if (nextJob) {\n this._doUpdateNodes(nextJob.paths, nextJob.cb, nextJob.promise);\n }\n });\n }\n\n private _emitChangeEvents(events: RSEvent[]) {\n for (let i = 0, len = events.length; i < len; i++) {\n this._emitChange(events[i]);\n if (this.diffHandler) {\n this.diffHandler(events[i].path);\n }\n }\n }\n\n private _getAllDescendentPaths(path: string) {\n if (isFolder(path)) {\n return this.getNodes([path]).then((nodes) => {\n const allPaths = [path];\n const latest = getLatest(nodes[path]);\n\n const itemNames = Object.keys(latest.itemsMap);\n const calls = itemNames.map((itemName) => {\n return this._getAllDescendentPaths(path + itemName).then((paths) => {\n for (let i = 0, len = paths.length; i < len; i++) {\n allPaths.push(paths[i]);\n }\n });\n });\n return Promise.all(calls).then(() => {\n return allPaths;\n });\n });\n } else {\n return Promise.resolve([path]);\n }\n }\n\n // treated as private but made public for unit testing\n _getInternals() {\n return {\n getLatest: getLatest,\n makeNode: makeNode,\n isOutdated: isOutdated\n };\n }\n}\n\n\ninterface CachingLayer extends EventHandling {}\napplyMixins(CachingLayer, [EventHandling]);\n\nexport = CachingLayer;\n","/**\n * The default config, merged with the object passed to the constructor of the\n * RemoteStorage object\n */\nconst config = {\n cache: true,\n changeEvents: {\n local: true,\n window: false,\n remote: true,\n conflict: true\n },\n cordovaRedirectUri: undefined,\n logging: false,\n modules: [],\n // the following are not public and will probably be moved away from the\n // default config\n backgroundSyncInterval: 60000,\n disableFeatures: [],\n discoveryTimeout: 10000,\n isBackground: false,\n requestTimeout: 30000,\n syncInterval: 10000\n};\n\nexport = config;\n","'use strict';\n\nimport WebFinger from 'webfinger.js';\nimport type { StorageInfo } from './interfaces/storage_info';\nimport log from './log';\nimport { globalContext, localStorageAvailable } from './util';\n\n// feature detection flags\nlet hasLocalStorage;\n\n// used to store settings in localStorage\nconst SETTINGS_KEY = 'remotestorage:discover';\n\n// cache loaded from localStorage\n// TODO use class property\nlet cachedInfo = {};\n\n/**\n * This function deals with the Webfinger lookup, discovering a connecting\n * user's storage details.\n *\n * @param {string} userAddress - user@host or URL\n *\n * @returns {Promise} A promise for an object with the following properties.\n * href - Storage base URL,\n * storageApi - RS protocol version,\n * authUrl - OAuth URL,\n * properties - Webfinger link properties\n **/\n\nconst Discover = function Discover(userAddress: string): Promise {\n return new Promise((resolve, reject) => {\n\n if (userAddress in cachedInfo) {\n return resolve(cachedInfo[userAddress]);\n }\n\n const webFinger = new WebFinger({\n tls_only: false,\n uri_fallback: true,\n request_timeout: 5000\n });\n\n return webFinger.lookup(userAddress, function (err, response) {\n if (err) {\n return reject(err);\n } else if ((typeof response.idx.links.remotestorage !== 'object') ||\n (typeof response.idx.links.remotestorage.length !== 'number') ||\n (response.idx.links.remotestorage.length <= 0)) {\n log(\"[Discover] WebFinger record for \" + userAddress + \" does not have remotestorage defined in the links section \", JSON.stringify(response.json));\n return reject(\"WebFinger record for \" + userAddress + \" does not have remotestorage defined in the links section.\");\n }\n\n const rs = response.idx.links.remotestorage[0];\n const authURL = rs.properties['http://tools.ietf.org/html/rfc6749#section-4.2'] ||\n rs.properties['auth-endpoint'];\n const storageApi = rs.properties['http://remotestorage.io/spec/version'] ||\n rs.type;\n\n // cache fetched data\n cachedInfo[userAddress] = {\n href: rs.href,\n storageApi: storageApi,\n authURL: authURL,\n properties: rs.properties\n };\n\n if (hasLocalStorage) {\n localStorage.setItem(SETTINGS_KEY, JSON.stringify({ cache: cachedInfo }));\n }\n\n return resolve(cachedInfo[userAddress]);\n });\n });\n};\n\nDiscover.DiscoveryError = function(message) {\n this.name = 'DiscoveryError';\n this.message = message;\n this.stack = (new Error()).stack;\n};\nDiscover.DiscoveryError.prototype = Object.create(Error.prototype);\nDiscover.DiscoveryError.prototype.constructor = Discover.DiscoveryError;\n\nDiscover._rs_init = function (/*remoteStorage*/): void {\n hasLocalStorage = localStorageAvailable();\n if (hasLocalStorage) {\n try {\n const settings = JSON.parse(localStorage[SETTINGS_KEY]);\n cachedInfo = settings.cache;\n } catch(e) {\n /* empty */\n }\n }\n};\n\nDiscover._rs_supported = function (): boolean {\n return Object.prototype.hasOwnProperty.call(globalContext, 'fetch') ||\n Object.prototype.hasOwnProperty.call(globalContext, 'XMLHttpRequest');\n};\n\nDiscover._rs_cleanup = function (): void {\n if (hasLocalStorage) {\n delete localStorage[SETTINGS_KEY];\n }\n};\n\n\nexport = Discover;\n","import EventHandling from './eventhandling';\nimport BaseClient from './baseclient';\nimport RevisionCache from './revisioncache';\nimport SyncError from './sync-error';\nimport UnauthorizedError from './unauthorized-error';\nimport {\n applyMixins,\n isFolder,\n shouldBeTreatedAsBinary,\n getJSONFromLocalStorage,\n getTextFromArrayBuffer,\n localStorageAvailable,\n generateCodeVerifier,\n} from './util';\nimport {requestWithTimeout, isArrayBufferView, retryAfterMs} from \"./requests\";\nimport {Remote, RemoteBase, RemoteResponse, RemoteSettings} from \"./remote\";\nimport RemoteStorage from \"./remotestorage\";\nimport Authorize from \"./authorize\";\n\n/**\n * WORK IN PROGRESS, NOT RECOMMENDED FOR PRODUCTION USE\n *\n * Dropbox backend for RemoteStorage.js\n * This file exposes a get/put/delete interface which is compatible with\n * .\n *\n * When remoteStorage.backend is set to 'dropbox', this backend will\n * initialize and replace remoteStorage.remote with remoteStorage.dropbox.\n *\n * In order to ensure compatibility with the public folder, \n * gets hijacked to return the Dropbox public share URL.\n *\n * To use this backend, you need to specify the Dropbox app key like so:\n *\n * @example\n * remoteStorage.setApiKeys({\n * dropbox: 'your-app-key'\n * });\n *\n * An app key can be obtained by registering your app at https://www.dropbox.com/developers/apps\n *\n * Known issues:\n *\n * - Storing files larger than 150MB is not yet supported\n * - Listing and deleting folders with more than 10'000 files will cause problems\n * - Content-Type is not supported; TODO: use file_properties\n * - Dropbox preserves cases but is not case-sensitive\n * - getItemURL is asynchronous which means it returns useful values\n * after the syncCycle\n */\n\nlet hasLocalStorage;\nconst AUTH_URL = 'https://www.dropbox.com/oauth2/authorize';\nconst ACCOUNT_URL = 'https://api.dropboxapi.com/2/users/get_current_account';\nconst TOKEN_URL = 'https://api.dropboxapi.com/oauth2/token';\nconst OAUTH_SCOPE = 'account_info.read files.content.read files.content.write files.metadata.read files.metadata.write';\nconst SETTINGS_KEY = 'remotestorage:dropbox';\nconst FOLDER_URL = 'https://api.dropboxapi.com/2/files/list_folder';\nconst CONTINUE_URL = 'https://api.dropboxapi.com/2/files/list_folder/continue';\nconst DOWNLOAD_URL = 'https://content.dropboxapi.com/2/files/download';\nconst UPLOAD_URL = 'https://content.dropboxapi.com/2/files/upload';\nconst DELETE_URL = 'https://api.dropboxapi.com/2/files/delete';\nconst METADATA_URL = 'https://api.dropboxapi.com/2/files/get_metadata';\nconst CREATE_SHARED_URL = 'https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings';\nconst LIST_SHARED_URL = 'https://api.dropbox.com/2/sharing/list_shared_links';\nconst PATH_PREFIX = '/remotestorage';\nconst NUM_RETRIES = 3;\n\ninterface Metadata {\n \".tag\": \"folder\" | \"file\";\n id: string;\n name: string;\n path_display: string;\n path_lower: string;\n property_groups: any[];\n sharing_info: {\n no_access?: boolean;\n parent_shared_folder_id: string;\n read_only: boolean;\n traverse_only?: boolean;\n modified_by?: string;\n };\n\n client_modified?: string; // date\n content_hash?: string;\n file_lock_info?: {\n created: string; // date\n is_lockholder: boolean;\n lockholder_name: string;\n };\n has_explicit_shared_members?: boolean;\n is_downloadable?: boolean;\n rev?: string;\n server_modified?: string; // date\n size?: number;\n\n preview_url?: string;\n}\n\n/**\n * Maps a remoteStorage path to a path in Dropbox.\n *\n * @param {string} path - Path\n * @returns {string} Actual path in Dropbox\n *\n * @private\n */\nfunction getDropboxPath (path: string): string {\n return (PATH_PREFIX + '/' + path).replace(/\\/+$/, '').replace(/\\/+/g, '/');\n}\n\n// This function is simple and has OK performance compared to more\n// complicated ones: https://jsperf.com/json-escape-unicode/4\nconst charsToEncode = /[\\u007f-\\uffff]/g;\nfunction httpHeaderSafeJson(obj) {\n return JSON.stringify(obj).replace(charsToEncode,\n function(c) {\n return '\\\\u'+('000'+c.charCodeAt(0).toString(16)).slice(-4);\n }\n );\n}\n\nfunction compareApiError (response: {error_summary: string}, expect: string[]): boolean {\n return new RegExp('^' + expect.join('\\\\/') + '(\\\\/|$)').test(response.error_summary);\n}\n\nfunction isBinaryData (data): boolean {\n return data instanceof ArrayBuffer || isArrayBufferView(data);\n}\n\n/**\n * @class\n */\nclass Dropbox extends RemoteBase implements Remote {\n clientId: string;\n TOKEN_URL: string; // OAuth2 PKCE\n token: string;\n refreshToken: string; // OAuth2 PKCE\n tokenType: string; // OAuth2 PKCE\n userAddress: string;\n\n _initialFetchDone: boolean;\n _revCache: RevisionCache;\n _fetchDeltaCursor: string;\n _fetchDeltaPromise: Promise;\n _itemRefs: { [key: string]: string };\n\n // TODO remove when refactoring eventhandling\n _emit: any;\n\n constructor (rs) {\n super(rs);\n this.online = true; // TODO implement offline detection on failed request\n this.storageApi = 'draft-dejong-remotestorage-19';\n this._initialFetchDone = false;\n\n this.addEvents(['connected', 'not-connected']);\n\n this.clientId = rs.apiKeys.dropbox.appKey;\n this.TOKEN_URL = TOKEN_URL;\n this._revCache = new RevisionCache('rev');\n this._fetchDeltaCursor = null;\n this._fetchDeltaPromise = null;\n this._itemRefs = {};\n\n hasLocalStorage = localStorageAvailable();\n\n if (hasLocalStorage){\n const settings = getJSONFromLocalStorage(SETTINGS_KEY);\n if (settings) {\n this.configure(settings); // can't await in constructor\n }\n this._itemRefs = getJSONFromLocalStorage(`${SETTINGS_KEY}:shares`) || {};\n }\n if (this.connected) {\n setTimeout(this._emit.bind(this), 0, 'connected');\n }\n }\n\n /**\n * Set the backed to 'dropbox' and start the authentication flow in order\n * to obtain an API token from Dropbox.\n */\n async connect () {\n // TODO handling when token is already present\n try {\n this.rs.setBackend('dropbox');\n if (this.token) {\n hookIt(this.rs);\n } else { // OAuth2 PKCE\n const {codeVerifier, codeChallenge, state} = await generateCodeVerifier();\n sessionStorage.setItem('remotestorage:codeVerifier', codeVerifier);\n sessionStorage.setItem('remotestorage:state', state);\n this.rs.authorize({\n authURL: AUTH_URL,\n scope: OAUTH_SCOPE,\n clientId: this.clientId,\n response_type: 'code',\n state: state,\n code_challenge: codeChallenge,\n code_challenge_method: 'S256',\n token_access_type: 'offline'\n });\n }\n } catch (err) {\n this.rs._emit('error', err);\n this.rs.setBackend(undefined);\n throw err;\n }\n }\n\n /**\n * Sets the connected flag\n * Accepts its parameters according to the .\n * @param {Object} settings\n * @param {string} [settings.userAddress] - The user's email address\n * @param {string} [settings.token] - Authorization token\n * @param {string} [settings.refreshToken] - OAuth2 PKCE refresh token\n * @param {string} [settings.tokenType] - usually 'bearer' - no support for 'mac' tokens yet\n *\n * @protected\n **/\n async configure (settings: RemoteSettings): Promise {\n // We only update this.userAddress if settings.userAddress is set to a string or to null:\n if (typeof settings.userAddress !== 'undefined') { this.userAddress = settings.userAddress; }\n // Same for this.token. If only one of these two is set, we leave the other one at its existing value:\n if (typeof settings.token !== 'undefined') { this.token = settings.token as string; }\n if (typeof settings.refreshToken !== 'undefined') { this.refreshToken = settings.refreshToken; }\n if (typeof settings.tokenType !== 'undefined') { this.tokenType = settings.tokenType; }\n\n const writeSettingsToCache = () => {\n if (hasLocalStorage) {\n localStorage.setItem(SETTINGS_KEY, JSON.stringify({\n userAddress: this.userAddress,\n token: this.token,\n refreshToken: this.refreshToken,\n tokenType: this.tokenType,\n }));\n }\n };\n\n const handleError = () => {\n this.connected = false;\n if (hasLocalStorage) {\n localStorage.removeItem(SETTINGS_KEY);\n }\n this.rs.setBackend(undefined);\n };\n\n if (this.refreshToken || this.token) {\n this.connected = true;\n if (this.userAddress) {\n this._emit('connected');\n writeSettingsToCache();\n } else {\n try {\n const info = await this.info();\n this.userAddress = info.email;\n this._emit('connected');\n writeSettingsToCache();\n } catch (err) {\n this.connected = false;\n this.rs._emit('error', new Error('Could not fetch user info.'));\n writeSettingsToCache.apply(this);\n }\n }\n } else {\n handleError();\n }\n }\n\n /**\n * Get all items in a folder.\n *\n * @param path {string} - path of the folder to get, with leading slash\n * @return {Object}\n * statusCode - HTTP status code\n * body - array of the items found\n * contentType - 'application/json; charset=UTF-8'\n * revision - revision of the folder\n *\n * @private\n */\n _getFolder (path: string) {\n const revCache = this._revCache;\n\n const processResponse = (resp) => {\n let body;\n\n if (resp.status !== 200 && resp.status !== 409) {\n return Promise.reject('Unexpected response status: ' + resp.status);\n }\n\n try {\n body = JSON.parse(resp.responseText);\n } catch (e) {\n return Promise.reject(e);\n }\n\n if (resp.status === 409) {\n if (compareApiError(body, ['path', 'not_found'])) {\n // if the folder is not found, handle it as an empty folder\n return Promise.resolve({});\n }\n\n return Promise.reject(new Error('API returned an error: ' + body.error_summary));\n }\n\n const listing = body.entries.reduce((map, item) => {\n try {\n const isDir = item['.tag'] === 'folder';\n const itemName = item.path_display.split('/').slice(-1)[0] + (isDir ? '/' : '');\n if (isDir) {\n map[itemName] = {ETag: revCache.get(path + itemName)};\n } else {\n const date = new Date(item.server_modified);\n map[itemName] = {ETag: item.rev, 'Content-Length': item.size, 'Last-Modified': date.toUTCString()};\n this._revCache.set(path + itemName, item.rev);\n }\n } catch (err) {\n console.error(`[Dropbox] folder “${path}” has entry ${JSON.stringify(item)}:`, err);\n }\n return map;\n }, {});\n\n if (body.has_more) {\n return loadNext(body.cursor).then(function (nextListing) {\n return Object.assign(listing, nextListing);\n });\n }\n\n return Promise.resolve(listing);\n };\n\n const loadNext = (cursor) => {\n const params = {\n body: { cursor: cursor }\n };\n\n return this._request('POST', CONTINUE_URL, params).then(processResponse);\n };\n\n return this._request('POST', FOLDER_URL, {\n body: {\n path: getDropboxPath(path)\n }\n }).then(processResponse).then(function (listing) {\n return Promise.resolve({\n statusCode: 200,\n body: listing,\n contentType: 'application/json; charset=UTF-8',\n revision: revCache.get(path)\n });\n });\n }\n\n /**\n * Checks for the path in ``_revCache`` and decides based on that if file\n * has changed. Calls ``_getFolder`` is the path points to a folder.\n *\n * Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``.\n *\n * Compatible with ``WireClient.get``\n *\n * @param path {string} - path of the folder to get, with leading slash\n * @param options {Object}\n *\n * @protected\n */\n get (path: string, options: { ifNoneMatch?: string } = {}): Promise {\n if (! this.connected) { return Promise.reject(\"not connected (path: \" + path + \")\"); }\n const savedRev = this._revCache.get(path);\n if (savedRev === null) {\n // file was deleted server side\n return Promise.resolve({statusCode: 404});\n }\n if (options && options.ifNoneMatch) {\n // We must wait for local revision cache to be initialized before\n // checking if local revision is outdated\n if (! this._initialFetchDone) {\n return this.fetchDelta().then(() => {\n return this.get(path, options);\n });\n }\n\n if (savedRev && (savedRev === options.ifNoneMatch)) {\n // nothing changed.\n return Promise.resolve({statusCode: 304});\n }\n }\n\n // use _getFolder for folders\n if (path.slice(-1) === '/') {\n return this._getFolder(path);\n }\n\n const params = {\n headers: {\n 'Dropbox-API-Arg': httpHeaderSafeJson({path: getDropboxPath(path)}),\n },\n responseType: 'arraybuffer'\n };\n if (options && options.ifNoneMatch) {\n params.headers['If-None-Match'] = options.ifNoneMatch;\n }\n\n return this._request('GET', DOWNLOAD_URL, params).then(resp => {\n const status = resp.status;\n let meta, body, mime, rev;\n if (status !== 200 && status !== 409) {\n return Promise.resolve({statusCode: status});\n }\n meta = resp.getResponseHeader('Dropbox-API-Result');\n //first encode the response as text, and later check if\n //text appears to actually be binary data\n return getTextFromArrayBuffer(resp.response, 'UTF-8').then(responseText => {\n body = responseText;\n if (status === 409) {\n meta = body;\n }\n\n try {\n meta = JSON.parse(meta);\n } catch(e) {\n return Promise.reject(e);\n }\n\n if (status === 409) {\n if (compareApiError(meta, ['path', 'not_found'])) {\n return {statusCode: 404};\n }\n return Promise.reject(new Error('API error while downloading file (\"' + path + '\"): ' + meta.error_summary));\n }\n\n mime = resp.getResponseHeader('Content-Type');\n rev = meta.rev;\n this._revCache.set(path, rev);\n this._shareIfNeeded(path); // There doesn't appear to be a need to await this.\n\n if (shouldBeTreatedAsBinary(responseText, mime)) {\n // return unprocessed response\n body = resp.response;\n } else {\n // handling json (always try)\n try {\n body = JSON.parse(body);\n mime = 'application/json; charset=UTF-8';\n } catch(e) {\n //Failed parsing Json, assume it is something else then\n }\n }\n\n return {\n statusCode: status,\n body: body,\n contentType: mime,\n revision: rev\n };\n });\n });\n }\n\n /**\n * Checks for the path in ``_revCache`` and decides based on that if file\n * has changed.\n *\n * Compatible with ``WireClient``\n *\n * Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``.\n *\n * @param {string} path - path of the folder to put, with leading slash\n * @param {XMLHttpRequestBodyInit} body - Blob | BufferSource | FormData | URLSearchParams | string\n * @param {string} contentType - MIME type of body\n * @param {Object} options\n * @param {string} options.ifNoneMatch - When *, only create or update the file if it doesn't yet exist\n * @param {string} options.ifMatch - Only saves if this matches current revision\n * @returns {Promise} Resolves with an object containing the status code,\n * content-type and revision\n * @protected\n */\n async put (path: string, body, contentType: string, options: { ifMatch?: string; ifNoneMatch?: string } = {}): Promise {\n if (!this.connected) {\n throw new Error(\"not connected (path: \" + path + \")\");\n }\n\n // check if file has changed and return 412\n const savedRev = this._revCache.get(path);\n if (options && options.ifMatch &&\n savedRev && (savedRev !== options.ifMatch)) {\n return {statusCode: 412, revision: savedRev};\n }\n if (options && (options.ifNoneMatch === '*') &&\n savedRev && (savedRev !== 'rev')) {\n return {statusCode: 412, revision: savedRev};\n }\n\n if ((!contentType.match(/charset=/)) && isBinaryData(body)) {\n contentType += '; charset=binary';\n }\n\n if (body.length > 150 * 1024 * 1024) {\n //https://www.dropbox.com/developers/core/docs#chunked-upload\n throw new Error(\"Cannot upload file larger than 150MB\");\n }\n\n const needsMetadata = options && (options.ifMatch || (options.ifNoneMatch === '*'));\n const uploadParams = {\n body: body,\n contentType: contentType,\n path: path\n };\n\n if (needsMetadata) {\n const metadata = await this._getMetadata(path);\n if (options && (options.ifNoneMatch === '*') && metadata) {\n // if !!metadata === true, the file exists\n return {\n statusCode: 412,\n revision: metadata.rev\n };\n }\n\n if (options && options.ifMatch && metadata && (metadata.rev !== options.ifMatch)) {\n return {\n statusCode: 412,\n revision: metadata.rev\n };\n }\n }\n const result = await this._uploadSimple(uploadParams);\n this._shareIfNeeded(path); // There doesn't appear to be a need to await this.\n return result;\n }\n\n /**\n * Checks for the path in ``_revCache`` and decides based on that if file\n * has changed.\n *\n * Compatible with ``WireClient.delete``\n *\n * Calls ``Dropbox.share`` afterwards to fill ``_itemRefs``.\n *\n * @param {string} path - path of the folder to delete, with leading slash\n * @param {Object} options\n *\n * @protected\n */\n async 'delete' (path: string, options: { ifMatch?: string } = {}): Promise {\n if (!this.connected) {\n throw new Error(\"not connected (path: \" + path + \")\");\n }\n\n // check if file has changed and return 412\n const savedRev = this._revCache.get(path);\n if (options?.ifMatch && savedRev && (options.ifMatch !== savedRev)) {\n return { statusCode: 412, revision: savedRev };\n }\n\n if (options?.ifMatch) {\n const metadata = await this._getMetadata(path);\n if (options?.ifMatch && metadata && (metadata.rev !== options.ifMatch)) {\n return {\n statusCode: 412,\n revision: metadata.rev\n };\n }\n }\n\n return this._deleteSimple(path);\n }\n\n /**\n * Calls share, if the provided path resides in a public folder.\n * @private\n */\n _shareIfNeeded (path: string): Promise {\n if (path.match(/^\\/public\\/.*[^/]$/) && this._itemRefs[path] === undefined) {\n return this.share(path);\n }\n }\n\n /**\n * Gets a publicly-accessible URL for the path from Dropbox and stores it\n * in ``_itemRefs``.\n *\n * @return {Promise} a promise for the URL\n *\n * @private\n */\n share (path: string): Promise {\n const options = {\n body: {path: getDropboxPath(path)}\n };\n\n return this._request('POST', CREATE_SHARED_URL, options).then((response) => {\n if (response.status !== 200 && response.status !== 409) {\n return Promise.reject(new Error('Invalid response status:' + response.status));\n }\n\n let body;\n\n try {\n body = JSON.parse(response.responseText);\n } catch (e) {\n return Promise.reject(new Error('Invalid response body: ' + response.responseText));\n }\n\n if (response.status === 409) {\n if (compareApiError(body, ['shared_link_already_exists'])) {\n return this._getSharedLink(path);\n }\n\n return Promise.reject(new Error('API error: ' + body.error_summary));\n }\n\n return Promise.resolve(body.url);\n }).then((link) => {\n this._itemRefs[path] = link;\n\n if (hasLocalStorage) {\n localStorage.setItem(SETTINGS_KEY+':shares', JSON.stringify(this._itemRefs));\n }\n\n return Promise.resolve(link);\n }, (error) => {\n error.message = 'Sharing Dropbox file or folder (\"' + path + '\") failed: ' + error.message;\n return Promise.reject(error);\n });\n }\n\n /**\n * Fetches the user's info from dropbox and returns a promise for it.\n *\n * @return {Promise} a promise for user info object (email - the user's email address)\n *\n * @protected\n */\n info (): Promise<{email: string}> {\n return this._request('POST', ACCOUNT_URL, {}).then(function (response) {\n let email;\n\n try {\n const info = JSON.parse(response.responseText);\n email = info?.email;\n } catch (e) {\n return Promise.reject(new Error('Could not query current account info: Invalid API response: ' + response.responseText));\n }\n\n return Promise.resolve({\n email: email\n });\n });\n }\n\n /**\n * Makes a network request.\n *\n * @param {string} method - Request method\n * @param {string} url - Target URL\n * @param {object} options - Request options\n * @param {number} numAttempts - # of times same request repeated\n * @returns {Promise} Resolves with the response of the network request\n *\n * @private\n */\n async _request (method: string, url: string, options, numAttempts = 1): Promise {\n if (this.isForbiddenRequestMethod(method, url)) {\n throw `Don't use ${method} on directories!`;\n }\n\n if (! this.token) { throw new UnauthorizedError(\"No access token\"); }\n\n if (!options.headers) { options.headers = {}; }\n options.headers['Authorization'] = 'Bearer ' + this.token;\n\n if (typeof options.body === 'object' && !isBinaryData(options.body)) {\n options.body = JSON.stringify(options.body);\n options.headers['Content-Type'] = 'application/json; charset=UTF-8';\n }\n\n this.rs._emit('wire-busy', {\n method: method,\n isFolder: isFolder(url)\n });\n\n try {\n const xhr = await requestWithTimeout(method, url, options);\n if (!this.online) {\n this.online = true;\n this.rs._emit('network-online');\n }\n this.rs._emit('wire-done', {\n method: method,\n isFolder: isFolder(url),\n success: true\n });\n if (xhr?.status === 401 && this.refreshToken) {\n if (numAttempts >= NUM_RETRIES) {\n console.error(`Abandoned after ${numAttempts} attempts: ${method} ${url}`);\n return xhr;\n } else {\n this.rs._emit('wire-busy', {\n method: method,\n isFolder: isFolder(url)\n });\n await Authorize.refreshAccessToken(this.rs, this, this.refreshToken);\n this.rs._emit('wire-done', {\n method: method,\n isFolder: isFolder(url),\n success: true\n });\n // re-runs original request\n return this._request(method, url, options, numAttempts + 1);\n }\n } else if ([503, 429].includes(xhr?.status)) {\n // 503 Service Unavailable; 429 Too Many Requests\n if (this.online) {\n this.online = false;\n this.rs._emit('network-offline');\n }\n\n if (numAttempts >= NUM_RETRIES) {\n console.warn(`Abandoned after ${numAttempts} attempts: ${method} ${url}`);\n return xhr;\n } else {\n await new Promise(resolve => setTimeout(resolve, retryAfterMs(xhr)));\n // re-runs original request\n return this._request(method, url, options, numAttempts+1);\n }\n } else {\n\n return xhr;\n }\n } catch (error) {\n if (this.online) {\n this.online = false;\n this.rs._emit('network-offline');\n }\n this.rs._emit('wire-done', {\n method: method,\n isFolder: isFolder(url),\n success: false\n });\n throw error;\n }\n }\n\n /**\n * Fetches the revision of all the files from dropbox API and puts them\n * into ``_revCache``. These values can then be used to determine if\n * something has changed.\n *\n * @private\n */\n fetchDelta (...args: undefined[]): Promise {\n // If fetchDelta was already called, and didn't finish, return the existing\n // promise instead of calling Dropbox API again\n if (this._fetchDeltaPromise) {\n return this._fetchDeltaPromise;\n }\n\n /** This should resolve (with no value) on success, and reject on error. */\n const fetch = async (cursor: string) => {\n let url;\n let requestBody;\n\n if (typeof cursor === 'string') {\n url = CONTINUE_URL;\n requestBody = { cursor };\n } else {\n url = FOLDER_URL;\n requestBody = {\n path: PATH_PREFIX,\n recursive: true,\n include_deleted: true\n };\n }\n\n try {\n const response = await this._request('POST', url, {body: requestBody});\n if (response.status === 401) {\n throw new UnauthorizedError();\n }\n\n if (response.status !== 200 && response.status !== 409) {\n throw new Error('Invalid response status: ' + response.status);\n }\n\n let responseBody;\n\n try {\n responseBody = JSON.parse(response.responseText);\n } catch (e) {\n throw new Error('Invalid response body: ' + response.responseText);\n }\n\n if (response.status === 409) {\n if (compareApiError(responseBody, ['path', 'not_found'])) {\n responseBody = {\n cursor: null,\n entries: [],\n has_more: false\n };\n } else {\n throw new Error('API returned an error: ' + responseBody.error_summary);\n }\n }\n\n if (!cursor) {\n //we are doing a complete fetch, so propagation would introduce unnecessary overhead\n this._revCache.deactivatePropagation();\n }\n\n responseBody.entries.forEach(entry => {\n const path = entry.path_display.slice(PATH_PREFIX.length);\n\n if (entry['.tag'] === 'deleted') {\n // there's no way to know whether the entry was a file or a folder\n this._revCache.delete(path);\n this._revCache.delete(path + '/');\n } else if (entry['.tag'] === 'file') {\n this._revCache.set(path, entry.rev);\n }\n });\n\n this._fetchDeltaCursor = responseBody.cursor;\n if (responseBody.has_more) {\n return fetch(responseBody.cursor);\n } else {\n this._revCache.activatePropagation();\n this._initialFetchDone = true;\n }\n } catch (error) {\n if (error === 'timeout') {\n // Offline is handled elsewhere already, just ignore it here\n return;\n } else {\n throw error;\n }\n }\n };\n\n this._fetchDeltaPromise = fetch(this._fetchDeltaCursor).catch(error => {\n if (typeof(error) === 'object' && 'message' in error) {\n error.message = 'Dropbox: fetchDelta: ' + error.message;\n } else {\n error = `Dropbox: fetchDelta: ${error}`;\n }\n this.rs._emit('error', error);\n this._fetchDeltaPromise = null;\n return Promise.reject(error);\n }).then(() => {\n this._fetchDeltaPromise = null;\n return Promise.resolve(args);\n });\n\n return this._fetchDeltaPromise;\n }\n\n /**\n * Gets metadata for a path (can point to either a file or a folder).\n *\n * @param {string} path - the path to get metadata for\n *\n * @returns {Promise} A promise for the metadata\n *\n * @private\n */\n _getMetadata (path: string): Promise {\n const requestBody = {\n path: getDropboxPath(path)\n };\n\n return this._request('POST', METADATA_URL, { body: requestBody }).then((response) => {\n if (response.status !== 200 && response.status !== 409) {\n return Promise.reject(new Error('Invalid response status:' + response.status));\n }\n\n let responseBody;\n\n try {\n responseBody = JSON.parse(response.responseText);\n } catch (e) {\n return Promise.reject(new Error('Invalid response body: ' + response.responseText));\n }\n\n if (response.status === 409) {\n if (compareApiError(responseBody, ['path', 'not_found'])) {\n return Promise.resolve();\n }\n\n return Promise.reject(new Error('API error: ' + responseBody.error_summary));\n }\n\n return Promise.resolve(responseBody);\n }).then(undefined, (error) => {\n error.message = 'Could not load metadata for file or folder (\"' + path + '\"): ' + error.message;\n return Promise.reject(error);\n });\n }\n\n /**\n * Upload a simple file (the size is no more than 150MB).\n *\n * @param {Object} params\n * @param {string} params.ifMatch - Only update the file if its ETag\n * matches this string\n * @param {string} params.path - path of the file\n * @param {string} params.body - contents of the file to upload\n * @param {string} params.contentType - mime type of the file *\n * @return {Promise} A promise for an object with the following structure:\n * statusCode - HTTP status code\n * revision - revision of the newly-created file, if any\n *\n * @private\n */\n _uploadSimple (params: { body: XMLHttpRequestBodyInit; contentType?: string; path: string; ifMatch?: string; }): Promise {\n const args = {\n path: getDropboxPath(params.path),\n mode: { '.tag': 'overwrite', update: undefined },\n mute: true\n };\n\n if (params.ifMatch) {\n args.mode = { '.tag': 'update', update: params.ifMatch };\n }\n\n return this._request('POST', UPLOAD_URL, {\n body: params.body,\n headers: {\n 'Content-Type': 'application/octet-stream',\n 'Dropbox-API-Arg': httpHeaderSafeJson(args)\n }\n }).then(response => {\n if (response.status !== 200 && response.status !== 409) {\n return Promise.resolve({statusCode: response.status});\n }\n\n let body;\n\n try {\n body = JSON.parse(response.responseText);\n } catch (e) {\n return Promise.reject(new Error('Invalid API result: ' + response.responseText));\n }\n\n if (response.status === 409) {\n if (compareApiError(body, ['path', 'conflict'])) {\n return this._getMetadata(params.path).then(function (metadata) {\n return Promise.resolve({\n statusCode: 412,\n revision: metadata.rev\n });\n });\n }\n this.rs._emit('error', new Error(body.error_summary));\n return Promise.resolve({statusCode: response.status});\n }\n\n this._revCache.set(params.path, body.rev);\n\n return Promise.resolve({ statusCode: response.status, revision: body.rev });\n });\n }\n\n /**\n * Deletes a file or a folder.\n *\n * @param {string} path - the path to delete\n *\n * @returns {Promise} A promise for an object with the following structure:\n * statusCode - HTTP status code\n *\n * @private\n */\n _deleteSimple (path: string): Promise {\n const requestBody = { path: getDropboxPath(path) };\n\n return this._request('POST', DELETE_URL, { body: requestBody }).then((response) => {\n if (response.status !== 200 && response.status !== 409) {\n return Promise.resolve({statusCode: response.status});\n }\n\n let responseBody;\n\n try {\n responseBody = JSON.parse(response.responseText);\n } catch (e) {\n return Promise.reject(new Error('Invalid response body: ' + response.responseText));\n }\n\n if (response.status === 409) {\n if (compareApiError(responseBody, ['path_lookup', 'not_found'])) {\n return Promise.resolve({statusCode: 404});\n }\n this.rs._emit('error', new Error(responseBody.error_summary));\n }\n\n return Promise.resolve({statusCode: response.status});\n }).then(result => {\n if (result.statusCode === 200 || result.statusCode === 404) {\n this._revCache.delete(path);\n delete this._itemRefs[path];\n }\n return Promise.resolve(result);\n }, (error) => {\n error.message = 'Could not delete Dropbox file or folder (\"' + path + '\"): ' + error.message;\n return Promise.reject(error);\n });\n }\n\n /**\n * Requests the link for an already-shared file or folder.\n *\n * @param {string} path - path to the file or folder\n *\n * @returns {Promise} A promise for the shared link\n *\n * @private\n */\n async _getSharedLink (path: string): Promise {\n const options = {\n body: {\n path: getDropboxPath(path),\n direct_only: true\n }\n };\n\n return this._request('POST', LIST_SHARED_URL, options).then((response) => {\n if (response.status !== 200 && response.status !== 409) {\n return Promise.reject(new Error('Invalid response status: ' + response.status));\n }\n\n let body;\n\n try {\n body = JSON.parse(response.responseText);\n } catch (e) {\n return Promise.reject(new Error('Invalid response body: ' + response.responseText));\n }\n\n if (response.status === 409) {\n return Promise.reject(new Error('API error: ' + body?.error_summary || response.responseText));\n }\n\n if (!body.links.length) {\n return Promise.reject(new Error('No links returned'));\n }\n\n return Promise.resolve(body.links[0].url);\n }, error => {\n error.message = 'Could not get link to a shared file or folder (\"' + path + '\"): ' + error.message;\n return Promise.reject(error);\n });\n }\n\n /**\n * Initialize the Dropbox backend.\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @protected\n */\n static _rs_init (rs: RemoteStorage): void {\n hasLocalStorage = localStorageAvailable();\n if ( rs.apiKeys.dropbox ) {\n rs.dropbox = new Dropbox(rs);\n }\n if (rs.backend === 'dropbox') {\n hookIt(rs);\n }\n }\n\n /**\n * Inform about the availability of the Dropbox backend.\n *\n * @returns {Boolean}\n *\n * @protected\n */\n static _rs_supported (): boolean {\n return true;\n }\n\n /**\n * Remove Dropbox as a backend.\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @protected\n */\n static _rs_cleanup (rs: RemoteStorage): void {\n unHookIt(rs);\n if (hasLocalStorage){\n localStorage.removeItem(SETTINGS_KEY);\n }\n rs.setBackend(undefined);\n }\n}\n\n/**\n * Hooking the sync\n *\n * TODO: document\n */\nfunction hookSync(rs, ...args): void {\n if (rs._dropboxOrigSync) { return; } // already hooked\n rs._dropboxOrigSync = rs.sync.sync.bind(rs.sync);\n rs.sync.sync = function () {\n return this.dropbox.fetchDelta(rs, ...args).\n then(rs._dropboxOrigSync, function (err) {\n rs._emit('error', new SyncError(err));\n rs._emit('sync-done');\n });\n }.bind(rs);\n}\n\n/**\n * Unhooking the sync\n *\n * TODO: document\n */\nfunction unHookSync(rs): void {\n if (! rs._dropboxOrigSync) { return; } // not hooked\n rs.sync.sync = rs._dropboxOrigSync;\n delete rs._dropboxOrigSync;\n}\n\n/**\n * Hook RemoteStorage.syncCycle as it's the first function called\n * after RemoteStorage.sync is initialized, so we can then hook\n * the sync function\n * @param {object} rs RemoteStorage instance\n * @param {array} args remaining arguments\n */\nfunction hookSyncCycle(rs, ...args): void {\n if (rs._dropboxOrigSyncCycle) { return; } // already hooked\n rs._dropboxOrigSyncCycle = rs.syncCycle;\n rs.syncCycle = () => {\n if (rs.sync) {\n hookSync(rs);\n rs._dropboxOrigSyncCycle(rs, ...args);\n unHookSyncCycle(rs);\n } else {\n throw new Error('expected sync to be initialized by now');\n }\n };\n}\n\n/**\n * Restore RemoteStorage's syncCycle original implementation\n * @param {object} rs RemoteStorage instance\n */\nfunction unHookSyncCycle(rs): void {\n if (!rs._dropboxOrigSyncCycle) { return; } // not hooked\n rs.syncCycle = rs._dropboxOrigSyncCycle;\n delete rs._dropboxOrigSyncCycle;\n}\n\n/**\n * Overwrite BaseClient's getItemURL with our own implementation\n *\n * TODO: getItemURL still needs to be implemented\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @private\n */\nfunction hookGetItemURL (rs): void {\n if (rs._origBaseClientGetItemURL) { return; }\n rs._origBaseClientGetItemURL = BaseClient.prototype.getItemURL;\n BaseClient.prototype.getItemURL = function (/*path*/) {\n throw new Error('getItemURL is not implemented for Dropbox yet');\n };\n}\n\n/**\n * Restore BaseClient's getItemURL original implementation\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @private\n */\nfunction unHookGetItemURL(rs): void {\n if (! rs._origBaseClientGetItemURL) { return; }\n BaseClient.prototype.getItemURL = rs._origBaseClientGetItemURL;\n delete rs._origBaseClientGetItemURL;\n}\n\n/**\n * TODO: document\n */\nfunction hookRemote(rs): void {\n if (rs._origRemote) { return; }\n rs._origRemote = rs.remote;\n rs.remote = rs.dropbox;\n}\n\n/**\n * TODO: document\n */\nfunction unHookRemote(rs): void {\n if (rs._origRemote) {\n rs.remote = rs._origRemote;\n delete rs._origRemote;\n }\n}\n\n/**\n * TODO: document\n */\nfunction hookIt(rs: RemoteStorage): void {\n hookRemote(rs);\n if (rs.sync) {\n hookSync(rs);\n } else {\n // when sync is not available yet, we hook the syncCycle function which is called\n // right after sync is initialized\n hookSyncCycle(rs);\n }\n hookGetItemURL(rs);\n}\n\n/**\n * TODO: document\n */\nfunction unHookIt(rs: RemoteStorage): void {\n unHookRemote(rs);\n unHookSync(rs);\n unHookGetItemURL(rs);\n unHookSyncCycle(rs);\n}\n\ninterface Dropbox extends EventHandling {}\napplyMixins(Dropbox, [EventHandling]);\n\nexport = Dropbox;\n","import EventHandling from './eventhandling';\nimport { applyMixins } from './util';\n\nclass Env {\n hiddenProperty: \"hidden\" | \"mozHidden\" | \"msHidden\" | \"webkitHidden\";\n visibilityChangeEvent: \"visibilitychange\" | \"mozvisibilitychange\" | \"msvisibilitychange\" | \"webkitvisibilitychange\";\n mode: \"browser\" | \"node\";\n\n constructor() {\n this.addEvents([\"background\", \"foreground\"]);\n\n this.mode = typeof(window) !== 'undefined' ? 'browser' : 'node';\n\n if (this.mode === 'browser') {\n this.setBrowserPrefixedNames();\n document.addEventListener(this.visibilityChangeEvent, this.setVisibility.bind(this), false);\n this.setVisibility();\n }\n }\n\n setBrowserPrefixedNames (): void {\n if (this.mode !== 'browser') { return; }\n\n if (typeof document.hidden !== \"undefined\") {\n this.hiddenProperty = \"hidden\";\n this.visibilityChangeEvent = \"visibilitychange\";\n } else if (typeof document[\"mozHidden\"] !== \"undefined\") {\n this.hiddenProperty = \"mozHidden\";\n this.visibilityChangeEvent = \"mozvisibilitychange\";\n } else if (typeof document[\"msHidden\"] !== \"undefined\") {\n this.hiddenProperty = \"msHidden\";\n this.visibilityChangeEvent = \"msvisibilitychange\";\n } else if (typeof document[\"webkitHidden\"] !== \"undefined\") {\n this.hiddenProperty = \"webkitHidden\";\n this.visibilityChangeEvent = \"webkitvisibilitychange\";\n }\n }\n\n setVisibility (): void {\n if (document[this.hiddenProperty]) {\n this.goBackground();\n } else {\n this.goForeground();\n }\n }\n\n isBrowser (): boolean {\n return this.mode === \"browser\";\n }\n\n isNode (): boolean {\n return this.mode === \"node\";\n }\n\n goBackground (): void {\n this._emit(\"background\");\n }\n\n goForeground (): void {\n this._emit(\"foreground\");\n }\n\n static _rs_init (/* remoteStorage */): void {\n return;\n }\n\n static _rs_cleanup (/* remoteStorage */): void {\n return;\n }\n}\n\ninterface Env extends EventHandling {}\napplyMixins(Env, [EventHandling]);\n\nexport = Env;\n","import log from './log';\n\n/**\n */\nexport type EventHandler = (event?: unknown) => void;\n\nexport class EventHandling {\n /**\n * @internal\n */\n _handlers: { [key: string]: EventHandler[] };\n\n /**\n * Register event names\n *\n * TODO see if necessary, or can be done on the fly in addEventListener\n *\n * @internal\n */\n addEvents(additionalEvents: string[]): void {\n additionalEvents.forEach(evName => this._addEvent(evName));\n }\n\n /**\n * Install an event handler for the given event name\n *\n * Usually called via [`on()`](#on)\n */\n addEventListener (eventName: string, handler: EventHandler): void {\n // Check type for public consumption of API\n if (typeof (eventName) !== 'string') {\n throw new Error('Argument eventName should be a string');\n }\n if (typeof (handler) !== 'function') {\n throw new Error('Argument handler should be a function');\n }\n log('[EventHandling] Adding event listener', eventName);\n this._validateEvent(eventName);\n this._handlers[eventName].push(handler);\n }\n\n /**\n * Register an event handler for the given event name\n *\n * Alias for {@link addEventListener}\n *\n * @param eventName - Name of the event\n * @param handler - Function to handle the event\n *\n * @example\n * remoteStorage.on('connected', function() {\n * console.log('storage account has been connected');\n * });\n */\n on (eventName: string, handler: EventHandler): void {\n return this.addEventListener(eventName, handler);\n }\n\n /**\n * Remove a previously installed event handler\n */\n removeEventListener (eventName: string, handler: EventHandler): void {\n this._validateEvent(eventName);\n const hl = this._handlers[eventName].length;\n for (let i = 0; i < hl; i++) {\n if (this._handlers[eventName][i] === handler) {\n this._handlers[eventName].splice(i, 1);\n return;\n }\n }\n }\n\n /**\n * @internal\n */\n _emit (eventName: string, ...args: unknown[]): void {\n this._validateEvent(eventName);\n this._handlers[eventName].slice().forEach((handler) => {\n handler.apply(this, args);\n });\n }\n\n /**\n * @internal\n */\n _validateEvent (eventName: string): void {\n if (!(eventName in this._handlers)) {\n throw new Error(\"Unknown event: \" + eventName);\n }\n }\n\n /**\n * @internal\n */\n _delegateEvent (eventName: string, target): void {\n target.on(eventName, (event) => {\n this._emit(eventName, event);\n });\n }\n\n /**\n * @internal\n */\n _addEvent (eventName: string): void {\n if (typeof this._handlers === 'undefined') {\n this._handlers = {};\n }\n this._handlers[eventName] = [];\n }\n}\n\nexport default EventHandling;\n","'use strict';\n\nimport config from './config';\nimport Env from './env';\nimport log from './log';\nimport { extend, logError } from './util';\nimport SGPD from './syncedgetputdelete';\n\nimport Access from './access';\nimport Authorize from './authorize';\nimport Discover from './discover';\nimport BaseClient from './baseclient';\nimport GoogleDrive from './googledrive';\nimport Dropbox from './dropbox';\nimport Solid from './solid';\nimport WireClient from './wireclient';\nimport Sync from './sync';\n\n// Caching\nimport Caching from './caching';\nimport IndexedDB from './indexeddb';\nimport LocalStorage from './localstorage';\nimport InMemoryStorage from './inmemorystorage';\n\nconst Features = {\n features: [],\n featuresDone: 0,\n readyFired: false,\n\n loadFeatures (): void {\n this.features = [];\n this.featuresDone = 0;\n this.readyFired = false;\n\n this.featureModules = {\n 'WireClient': WireClient,\n 'Dropbox': Dropbox,\n 'GoogleDrive': GoogleDrive,\n 'Solid': Solid,\n 'Access': Access,\n 'Discover': Discover,\n 'Authorize': Authorize,\n 'BaseClient': BaseClient,\n 'Env': Env\n };\n\n // enable caching related modules if needed\n if (config.cache) {\n // TODO replace util.extend with modern JS {...object, ...object}\n extend(this.featureModules, {\n 'Caching': Caching,\n 'IndexedDB': IndexedDB,\n 'LocalStorage': LocalStorage,\n 'InMemoryStorage': InMemoryStorage,\n 'Sync': Sync\n });\n }\n\n // disable features set in the config object passed to the RemoteStorage\n // constructor\n // For example: ['IndexedDB']\n config.disableFeatures.forEach(feature => {\n if (this.featureModules[feature]) {\n // this.featureModules[feature] = undefined\n delete this.featureModules[feature];\n }\n });\n\n this._allLoaded = false;\n\n for (const featureName in this.featureModules) {\n // FIXME: this has to push the promised return value into an\n // array of promises and use Promise.all to emit `ready`\n // instead of increment a counter of loaded features. -les\n this.loadFeature(featureName);\n }\n },\n\n /**\n * Method: hasFeature\n *\n * Checks whether a feature is enabled or not within remoteStorage.\n * Returns a boolean.\n *\n * Parameters:\n * name - Capitalized name of the feature. e.g. Authorize, or IndexedDB\n *\n * Example:\n * (start code)\n * if (remoteStorage.hasFeature('LocalStorage')) {\n * console.log('LocalStorage is enabled!');\n * }\n * (end code)\n *\n */\n hasFeature (feature) {\n for (let i = this.features.length - 1; i >= 0; i--) {\n if (this.features[i].name === feature) {\n return this.features[i].supported;\n }\n }\n return false;\n },\n\n loadFeature (featureName) {\n const feature = this.featureModules[featureName];\n const supported = !feature._rs_supported || feature._rs_supported();\n\n log(`[RemoteStorage] [FEATURE ${featureName}] initializing ...`);\n\n if (typeof supported === 'object') {\n supported.then( () => {\n this.featureSupported(featureName, true);\n this.initFeature(featureName);\n }, () => {\n this.featureSupported(featureName, false);\n });\n } else if (typeof supported === 'boolean') {\n this.featureSupported(featureName, supported);\n if (supported) {\n this.initFeature(featureName);\n }\n } else {\n this.featureSupported(featureName, false);\n }\n },\n\n initFeature (featureName) {\n const feature = this.featureModules[featureName];\n let initResult;\n try {\n initResult = feature._rs_init(this);\n } catch(e) {\n this.featureFailed(featureName, e);\n return;\n }\n\n if (typeof(initResult) === 'object' && typeof(initResult.then) === 'function') {\n initResult.then(\n () => { this.featureInitialized(featureName); },\n (err) => { this.featureFailed(featureName, err); }\n );\n } else {\n this.featureInitialized(featureName);\n }\n },\n\n featureFailed (featureName, err) {\n log(`[RemoteStorage] [FEATURE ${featureName}] initialization failed (${err})`);\n this.featureDone();\n },\n\n featureSupported (featureName, success) {\n log(`[RemoteStorage] [FEATURE ${featureName}]${success ? '' : 'not '} supported`);\n if (!success) {\n this.featureDone();\n }\n },\n\n featureInitialized (featureName) {\n log(`[RemoteStorage] [FEATURE ${featureName}] initialized`);\n this.features.push({\n name : featureName,\n init : this.featureModules[featureName]._rs_init,\n supported : true,\n cleanup : this.featureModules[featureName]._rs_cleanup\n });\n this.featureDone();\n },\n\n featureDone () {\n this.featuresDone++;\n if (this.featuresDone === Object.keys(this.featureModules).length) {\n setTimeout(this.featuresLoaded.bind(this), 0);\n }\n },\n\n _setCachingModule () {\n const cachingModules = ['IndexedDB', 'LocalStorage', 'InMemoryStorage'];\n\n cachingModules.some( cachingLayer => {\n if (this.features.some(feature => feature.name === cachingLayer)) {\n this.features.local = this.featureModules[cachingLayer];\n return true;\n }\n });\n },\n\n _fireReady() {\n try {\n if (!this.readyFired) {\n this._emit('ready');\n this.readyFired = true;\n }\n } catch(e) {\n console.error(\"'ready' failed: \", e, e.stack);\n this._emit('error', e);\n }\n },\n\n featuresLoaded () {\n log(`[RemoteStorage] All features loaded`);\n\n this._setCachingModule();\n // eslint-disable-next-line new-cap\n this.local = config.cache && this.features.local && new this.features.local();\n\n // this.remote set by WireClient._rs_init as lazy property on\n // RS.prototype\n\n if (this.local && this.remote) {\n this._setGPD(SGPD, this);\n this._bindChange(this.local);\n } else if (this.remote) {\n this._setGPD(this.remote, this.remote);\n }\n if (this.remote) {\n this.remote.on('connected', () => {\n this._fireReady();\n this._emit('connected');\n });\n this.remote.on('not-connected', () => {\n this._fireReady();\n this._emit('not-connected');\n });\n if (this.remote.connected) {\n this._fireReady();\n this._emit('connected');\n }\n\n if (!this.hasFeature('Authorize')) {\n this.remote.stopWaitingForToken();\n }\n }\n\n this._collectCleanupFunctions();\n\n try {\n this._allLoaded = true;\n this._emit('features-loaded');\n } catch(exc) {\n logError(exc);\n this._emit('error', exc);\n }\n this._processPending();\n },\n\n _collectCleanupFunctions (): void {\n this._cleanups = [];\n for (let i=0; i < this.features.length; i++) {\n const cleanup = this.features[i].cleanup;\n if (typeof(cleanup) === 'function') {\n this._cleanups.push(cleanup);\n }\n }\n }\n};\n\nexport = Features;\n","import BaseClient from './baseclient';\nimport EventHandling from './eventhandling';\nimport {\n applyMixins,\n isFolder,\n cleanPath,\n shouldBeTreatedAsBinary,\n getJSONFromLocalStorage,\n getTextFromArrayBuffer,\n localStorageAvailable\n} from './util';\nimport {requestWithTimeout, RequestOptions} from \"./requests\";\nimport {Remote, RemoteBase, RemoteResponse, RemoteSettings} from \"./remote\";\n\nconst BASE_URL = 'https://www.googleapis.com';\nconst AUTH_URL = 'https://accounts.google.com/o/oauth2/auth';\nconst AUTH_SCOPE = 'https://www.googleapis.com/auth/drive';\nconst SETTINGS_KEY = 'remotestorage:googledrive';\nconst PATH_PREFIX = '/remotestorage';\n\nconst GD_DIR_MIME_TYPE = 'application/vnd.google-apps.folder';\nconst RS_DIR_MIME_TYPE = 'application/json; charset=UTF-8';\n\nlet hasLocalStorage;\n\n/**\n * Produce a title from a filename for metadata.\n *\n * @param {string} filename\n * @returns {string} title\n *\n * @private\n */\nfunction metaTitleFromFileName (filename: string): string {\n if (filename.substr(-1) === '/') {\n filename = filename.substr(0, filename.length - 1);\n }\n\n return decodeURIComponent(filename);\n}\n\n/**\n * Get the parent directory for the given path.\n *\n * @param {string} path\n * @returns {string} parent directory\n *\n * @private\n */\nfunction parentPath (path: string): string {\n return path.replace(/[^\\/]+\\/?$/, '');\n}\n\n/**\n * Get only the filename from a full path.\n *\n * @param {string} path\n * @returns {string} filename\n *\n * @private\n */\nfunction baseName (path: string): string {\n const parts = path.split('/');\n if (path.substr(-1) === '/') {\n return parts[parts.length-2]+'/';\n } else {\n return parts[parts.length-1];\n }\n}\n\n/**\n * Prepend the path with the remoteStorage base directory.\n *\n * @param {string} path - Path\n * @returns {string} Actual path on Google Drive\n *\n * @private\n */\nfunction googleDrivePath (path: string): string {\n return cleanPath(`${PATH_PREFIX}/${path}`);\n}\n\n/**\n * Internal cache object for storing Google file IDs.\n *\n * @param {number} maxAge - Maximum age (in seconds) the content should be cached for\n */\nclass FileIdCache {\n maxAge: number;\n _items = {};\n\n constructor(maxAge?: number) {\n this.maxAge = maxAge;\n this._items = {};\n }\n\n get (key): number | undefined {\n const item = this._items[key];\n const now = new Date().getTime();\n return (item && item.t >= (now - this.maxAge)) ? item.v : undefined;\n }\n\n set (key, value): void {\n this._items[key] = {\n v: value,\n t: new Date().getTime()\n };\n }\n}\n\n/**\n * Overwrite BaseClient's getItemURL with our own implementation\n *\n * TODO: Still needs to be implemented. At the moment it just throws\n * and error saying that it's not implemented yet.\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @private\n */\nfunction hookGetItemURL (rs): void {\n if (rs._origBaseClientGetItemURL) { return; }\n rs._origBaseClientGetItemURL = BaseClient.prototype.getItemURL;\n BaseClient.prototype.getItemURL = function (/* path */): never {\n throw new Error('getItemURL is not implemented for Google Drive yet');\n };\n}\n\n/**\n * Restore BaseClient's getItemURL original implementation\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @private\n */\nfunction unHookGetItemURL (rs): void {\n if (!rs._origBaseClientGetItemURL) { return; }\n BaseClient.prototype.getItemURL = rs._origBaseClientGetItemURL;\n delete rs._origBaseClientGetItemURL;\n}\n\n/**\n * @class GoogleDrive\n *\n * To use this backend, you need to specify the app's client ID like so:\n *\n * @example\n * remoteStorage.setApiKeys({\n * googledrive: 'your-client-id'\n * });\n *\n * A client ID can be obtained by registering your app in the Google\n * Developers Console: https://console.developers.google.com/flows/enableapi?apiid=drive\n *\n * Docs: https://developers.google.com/drive/v3/web/quickstart/js\n**/\nclass GoogleDrive extends RemoteBase implements Remote {\n clientId: string;\n token: string;\n\n _fileIdCache: FileIdCache;\n\n constructor(remoteStorage, clientId) {\n super(remoteStorage);\n this.online = true;\n this.storageApi = 'draft-dejong-remotestorage-19';\n this.addEvents(['connected', 'not-connected']);\n\n this.clientId = clientId;\n\n this._fileIdCache = new FileIdCache(60 * 5); // IDs expire after 5 minutes (is this a good idea?)\n\n hasLocalStorage = localStorageAvailable();\n\n if (hasLocalStorage){\n const settings = getJSONFromLocalStorage(SETTINGS_KEY);\n if (settings) {\n this.configure(settings);\n }\n }\n }\n\n /**\n * Configure the Google Drive backend.\n *\n * Fetches the user info from Google when no ``userAddress`` is given.\n *\n * @param {Object} settings\n * @param {string} [settings.userAddress] - The user's email address\n * @param {string} [settings.token] - Authorization token\n *\n * @protected\n */\n configure (settings: RemoteSettings) { // Settings parameter compatible with WireClient\n // We only update this.userAddress if settings.userAddress is set to a string or to null\n if (typeof settings.userAddress !== 'undefined') { this.userAddress = settings.userAddress; }\n // Same for this.token. If only one of these two is set, we leave the other one at its existing value\n if (typeof settings.token !== 'undefined') { this.token = settings.token as string; }\n\n const writeSettingsToCache = function() {\n if (hasLocalStorage) {\n localStorage.setItem(SETTINGS_KEY, JSON.stringify({\n userAddress: this.userAddress,\n token: this.token\n }));\n }\n };\n\n const handleError = function() {\n this.connected = false;\n delete this.token;\n if (hasLocalStorage) {\n localStorage.removeItem(SETTINGS_KEY);\n }\n };\n\n if (this.token) {\n this.connected = true;\n\n if (this.userAddress) {\n this._emit('connected');\n writeSettingsToCache.apply(this);\n } else {\n this.info().then((info) => {\n this.userAddress = info.user.emailAddress;\n this._emit('connected');\n writeSettingsToCache.apply(this);\n }).catch(() => {\n handleError.apply(this);\n this.rs._emit('error', new Error('Could not fetch user info.'));\n });\n }\n } else {\n handleError.apply(this);\n }\n }\n\n /**\n * Initiate the authorization flow's OAuth dance.\n */\n connect (): void {\n this.rs.setBackend('googledrive');\n this.rs.authorize({ authURL: AUTH_URL, scope: AUTH_SCOPE, clientId: this.clientId });\n }\n\n /**\n * Request a resource (file or directory).\n *\n * @param {string} path - Path of the resource\n * @param {Object} options - Request options\n * @returns {Promise} Resolves with an object containing the status code,\n * body, content-type and revision\n *\n * @protected\n */\n get (path: string, options: { ifNoneMatch?: string } = {}): Promise {\n if (isFolder(path)) {\n return this._getFolder(googleDrivePath(path));\n } else {\n return this._getFile(googleDrivePath(path), options);\n }\n }\n\n /**\n * Create or update a file.\n *\n * @param {string} path - File path\n * @param body - File content\n * @param {string} contentType - File content-type\n * @param {Object} options\n * @param {string} options.ifNoneMatch - Only create of update the file if the\n * current ETag doesn't match this string\n * @returns {Promise} Resolves with an object containing the status code,\n * content-type and revision\n *\n * @protected\n */\n put (path: string, body: XMLHttpRequestBodyInit, contentType: string, options: { ifMatch?: string; ifNoneMatch?: string } = {}): Promise {\n const fullPath = googleDrivePath(path);\n\n function putDone(response) {\n if (response.status >= 200 && response.status < 300) {\n const meta = JSON.parse(response.responseText);\n const etagWithoutQuotes: string = this.stripQuotes(meta.etag);\n return Promise.resolve({statusCode: 200, contentType: meta.mimeType, revision: etagWithoutQuotes});\n } else if (response.status === 412) {\n return Promise.resolve({statusCode: 412, revision: 'conflict'});\n } else {\n return Promise.reject(\"PUT failed with status \" + response.status + \" (\" + response.responseText + \")\");\n }\n }\n\n return this._getFileId(fullPath).then((id) => {\n if (id) {\n if (options && (options.ifNoneMatch === '*')) {\n return putDone({ status: 412 });\n }\n return this._updateFile(id, fullPath, body, contentType, options).then(putDone);\n } else {\n return this._createFile(fullPath, body, contentType).then(putDone);\n }\n });\n }\n\n /**\n * Delete a file.\n *\n * @param {string} path - File path\n * @param {Object} options\n * @param {string} options.ifMatch - only delete the file if it's ETag\n * matches this string\n * @returns {Promise} Resolves with an object containing the status code\n *\n * @protected\n */\n delete (path: string, options: { ifMatch?: string } = {}): Promise {\n const fullPath = googleDrivePath(path);\n\n return this._getFileId(fullPath).then((id) => {\n if (!id) {\n // File doesn't exist. Ignore.\n return Promise.resolve({statusCode: 200});\n }\n\n return this._getMeta(id).then((meta) => {\n let etagWithoutQuotes;\n if ((typeof meta === 'object') && (typeof meta.etag === 'string')) {\n etagWithoutQuotes = this.stripQuotes(meta.etag);\n }\n if (options && options.ifMatch && (options.ifMatch !== etagWithoutQuotes)) {\n return {statusCode: 412, revision: etagWithoutQuotes};\n }\n\n return this._request('DELETE', BASE_URL + '/drive/v2/files/' + id, {}).then((response) => {\n if (response.status === 200 || response.status === 204) {\n return {statusCode: 200};\n } else {\n return Promise.reject(\"Delete failed: \" + response.status + \" (\" + response.responseText + \")\");\n }\n });\n });\n });\n }\n\n /**\n * Fetch the user's info from Google.\n *\n * @returns {Promise} resolves with the user's info.\n *\n * @protected\n */\n info () {\n const url = BASE_URL + '/drive/v2/about?fields=user';\n // requesting user info(mainly for userAdress)\n return this._request('GET', url, {}).then(function (resp){\n try {\n const info = JSON.parse(resp.responseText);\n return Promise.resolve(info);\n } catch (e) {\n return Promise.reject(e);\n }\n });\n }\n\n /**\n * Update an existing file.\n *\n * @param {string} id - File ID\n * @param {string} path - File path\n * @param body - File content\n * @param {string} contentType - File content-type\n * @param {Object} options\n * @param {string} options.ifMatch - Only update the file if its ETag\n * matches this string\n * @returns {Promise} Resolves with the response of the network request\n *\n * @private\n */\n _updateFile (id, path, body, contentType, options) {\n const metadata = {\n mimeType: contentType\n };\n const headers = {\n 'Content-Type': 'application/json; charset=UTF-8'\n };\n\n if (options && options.ifMatch) {\n headers['If-Match'] = this.addQuotes(options.ifMatch);\n }\n\n return this._request('PUT', BASE_URL + '/upload/drive/v2/files/' + id + '?uploadType=resumable', {\n body: JSON.stringify(metadata),\n headers: headers\n }).then((response) => {\n if (response.status === 412) {\n return (response);\n } else {\n return this._request('PUT', response.getResponseHeader('Location'), {\n body: contentType.match(/^application\\/json/) ? JSON.stringify(body) : body\n });\n }\n });\n }\n\n /**\n * Create a new file.\n *\n * @param {string} path - File path\n * @param body - File content\n * @param {string} contentType - File content-type\n * @returns {Promise} Resolves with the response of the network request\n *\n * @private\n */\n _createFile (path, body, contentType) {\n return this._getParentId(path).then((parentId) => {\n const fileName = baseName(path);\n const metadata = {\n title: metaTitleFromFileName(fileName),\n mimeType: contentType,\n parents: [{\n kind: \"drive#fileLink\",\n id: parentId\n }]\n };\n return this._request('POST', BASE_URL + '/upload/drive/v2/files?uploadType=resumable', {\n body: JSON.stringify(metadata),\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n }\n }).then((response) => {\n return this._request('POST', response.getResponseHeader('Location'), {\n body: contentType.match(/^application\\/json/) ? JSON.stringify(body) : body\n });\n });\n });\n }\n\n /**\n * Request a file.\n *\n * @param {string} path - File path\n * @param {Object} options\n * @param {string} [options.ifNoneMath] - Only return the file if its ETag\n * doesn't match the given string\n * @returns {Promise} Resolves with an object containing the status code,\n * body, content-type and revision\n *\n * @private\n */\n _getFile (path, options) {\n return this._getFileId(path).then((id) => {\n return this._getMeta(id).then((meta) => {\n let etagWithoutQuotes;\n if (typeof(meta) === 'object' && typeof(meta.etag) === 'string') {\n etagWithoutQuotes = this.stripQuotes(meta.etag);\n }\n\n if (options && options.ifNoneMatch && (etagWithoutQuotes === options.ifNoneMatch)) {\n return Promise.resolve({statusCode: 304});\n }\n\n if (!meta.downloadUrl) {\n if (meta.exportLinks && meta.exportLinks['text/html']) {\n // Documents that were generated inside GoogleDocs have no\n // downloadUrl, but you can export them to text/html instead:\n meta.mimeType += ';export=text/html';\n meta.downloadUrl = meta.exportLinks['text/html'];\n } else {\n // empty file\n return Promise.resolve({statusCode: 200, body: '', contentType: meta.mimeType, revision: etagWithoutQuotes});\n }\n }\n\n const params: RequestOptions = {\n responseType: 'arraybuffer'\n };\n return this._request('GET', meta.downloadUrl, params).then((response) => {\n //first encode the response as text, and later check if\n //text appears to actually be binary data\n return getTextFromArrayBuffer(response.response, 'UTF-8').then(function (responseText) {\n let body = responseText;\n if (meta.mimeType.match(/^application\\/json/)) {\n try {\n body = JSON.parse(body as string);\n } catch(e) {\n // body couldn't be parsed as JSON, so we'll just return it as is\n }\n } else if (shouldBeTreatedAsBinary(responseText, meta.mimeType)) {\n //return unprocessed response\n body = response.response;\n }\n\n return {\n statusCode: 200,\n body: body,\n contentType: meta.mimeType,\n revision: etagWithoutQuotes\n };\n });\n });\n });\n });\n }\n\n /**\n * Request a directory.\n *\n * @param {string} path - Directory path\n * @returns {Promise} Resolves with an object containing the status code,\n * body and content-type\n *\n * @private\n */\n _getFolder (path: string) {\n return this._getFileId(path).then((id) => {\n let data, etagWithoutQuotes, itemsMap;\n if (! id) {\n return Promise.resolve({statusCode: 404});\n }\n\n const query = '\\'' + id + '\\' in parents';\n const fields = 'items(downloadUrl,etag,fileSize,id,mimeType,title,labels)';\n return this._request('GET', BASE_URL + '/drive/v2/files?'\n + 'q=' + encodeURIComponent(query)\n + '&fields=' + encodeURIComponent(fields)\n + '&maxResults=1000'\n + '&trashed=false',\n {})\n .then((response) => {\n if (response.status !== 200) {\n return Promise.reject('request failed or something: ' + response.status);\n }\n\n try {\n data = JSON.parse(response.responseText);\n } catch(e) {\n return Promise.reject('non-JSON response from GoogleDrive');\n }\n\n itemsMap = {};\n for (const item of data.items) {\n if (item.labels?.trashed) { continue; } // ignore deleted files\n\n etagWithoutQuotes = this.stripQuotes(item.etag);\n if (item.mimeType === GD_DIR_MIME_TYPE) {\n this._fileIdCache.set(path + cleanPath(item.title) + '/', item.id);\n itemsMap[item.title + '/'] = {\n ETag: etagWithoutQuotes\n };\n } else {\n this._fileIdCache.set(path + cleanPath(item.title), item.id);\n itemsMap[item.title] = {\n ETag: etagWithoutQuotes,\n 'Content-Type': item.mimeType,\n 'Content-Length': item.fileSize\n };\n }\n }\n\n // FIXME: add revision of folder!\n return Promise.resolve({statusCode: 200, body: itemsMap, contentType: RS_DIR_MIME_TYPE, revision: undefined});\n });\n });\n }\n\n /**\n * Get the ID of a parent path.\n *\n * Creates the directory if it doesn't exist yet.\n *\n * @param {string} path - Full path of a directory or file\n * @returns {Promise} Resolves with ID of the parent directory.\n *\n * @private\n */\n _getParentId (path) {\n const foldername = parentPath(path);\n\n return this._getFileId(foldername).then((parentId) => {\n if (parentId) {\n return Promise.resolve(parentId);\n } else {\n return this._createFolder(foldername);\n }\n });\n }\n\n /**\n * Create a directory.\n *\n * Creates all parent directories as well if any of them didn't exist yet.\n *\n * @param {string} path - Directory path\n * @returns {Promise} Resolves with the ID of the new directory\n *\n * @private\n */\n _createFolder (path) {\n return this._getParentId(path).then((parentId) => {\n return this._request('POST', BASE_URL + '/drive/v2/files', {\n body: JSON.stringify({\n title: metaTitleFromFileName(baseName(path)),\n mimeType: GD_DIR_MIME_TYPE,\n parents: [{\n id: parentId\n }]\n }),\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n }\n }).then((response) => {\n const meta = JSON.parse(response.responseText);\n return Promise.resolve(meta.id);\n });\n });\n }\n\n /**\n * Get the ID of a file.\n *\n * @param {string} path - File path\n * @returns {Promise} Resolves with the ID\n *\n * @private\n */\n _getFileId (path) {\n let id;\n\n if (path === '/') {\n // \"root\" is a special alias for the fileId of the root folder\n return Promise.resolve('root');\n } else if ((id = this._fileIdCache.get(path))) {\n // id is cached.\n return Promise.resolve(id);\n }\n // id is not cached (or file doesn't exist).\n // load parent folder listing to propagate / update id cache.\n return this._getFolder(parentPath(path)).then(() => {\n id = this._fileIdCache.get(path);\n if (!id) {\n if (path.substr(-1) === '/') {\n return this._createFolder(path).then(() => {\n return this._getFileId(path);\n });\n } else {\n return Promise.resolve();\n }\n }\n return Promise.resolve(id);\n });\n }\n\n /**\n * Get the metadata for a given file ID.\n *\n * @param {string} id - File ID\n * @returns {Promise} Resolves with an object containing the metadata\n *\n * @private\n */\n _getMeta (id) {\n return this._request('GET', BASE_URL + '/drive/v2/files/' + id, {}).then(function (response) {\n if (response.status === 200) {\n return Promise.resolve(JSON.parse(response.responseText));\n } else {\n return Promise.reject(\"request (getting metadata for \" + id + \") failed with status: \" + response.status);\n }\n });\n }\n\n /**\n * Make a network request.\n *\n * @param {string} method - Request method\n * @param {string} url - Target URL\n * @param {Object} options - Request options\n * @returns {Promise} Resolves with the response of the network request\n *\n * @private\n */\n _request (method: string, url: string, options: RequestOptions) {\n if (this.isForbiddenRequestMethod(method, url)) {\n return Promise.reject(`Don't use ${method} on directories!`);\n }\n\n if (! options.headers) { options.headers = {}; }\n options.headers['Authorization'] = 'Bearer ' + this.token;\n\n this.rs._emit('wire-busy', {\n method: method,\n isFolder: isFolder(url)\n });\n\n return requestWithTimeout(method, url, options).then((xhr) => {\n // Google tokens expire from time to time...\n if (xhr && xhr.status === 401) {\n this.connect();\n return;\n } else {\n if (!this.online) {\n this.online = true;\n this.rs._emit('network-online');\n }\n this.rs._emit('wire-done', {\n method: method,\n isFolder: isFolder(url),\n success: true\n });\n\n return Promise.resolve(xhr);\n }\n }, (error) => {\n if (this.online) {\n this.online = false;\n this.rs._emit('network-offline');\n }\n this.rs._emit('wire-done', {\n method: method,\n isFolder: isFolder(url),\n success: false\n });\n\n return Promise.reject(error);\n });\n }\n\n /**\n * Initialize the Google Drive backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n static _rs_init (remoteStorage): void {\n const config = remoteStorage.apiKeys.googledrive;\n if (config) {\n remoteStorage.googledrive = new GoogleDrive(remoteStorage, config.clientId);\n if (remoteStorage.backend === 'googledrive') {\n remoteStorage._origRemote = remoteStorage.remote;\n remoteStorage.remote = remoteStorage.googledrive;\n\n hookGetItemURL(remoteStorage);\n }\n }\n }\n\n /**\n * Inform about the availability of the Google Drive backend.\n *\n * @returns {Boolean}\n *\n * @protected\n */\n static _rs_supported (): boolean {\n return true;\n }\n\n /**\n * Remove Google Drive as a backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n static _rs_cleanup (remoteStorage): void {\n remoteStorage.setBackend(undefined);\n if (remoteStorage._origRemote) {\n remoteStorage.remote = remoteStorage._origRemote;\n delete remoteStorage._origRemote;\n }\n unHookGetItemURL(remoteStorage);\n }\n}\n\ninterface GoogleDrive extends EventHandling {}\napplyMixins(GoogleDrive, [EventHandling]);\n\nexport = GoogleDrive;\n","/**\n * TODO rewrite, doesn't expose GPD anymore, it's in cachinglayer now\n *\n * This file exposes a get/put/delete interface, accessing data in an IndexedDB.\n *\n * There are multiple parts to this interface:\n *\n * The RemoteStorage integration:\n * - IndexedDB._rs_supported() determines if IndexedDB support\n * is available. If it isn't, RemoteStorage won't initialize the feature.\n * - IndexedDB._rs_init() initializes the feature. It returns\n * a promise that is fulfilled as soon as the database has been opened and\n * migrated.\n *\n * The storage interface (IndexedDB object):\n * - Usually this is accessible via \"remoteStorage.local\"\n * - #get() takes a path and returns a promise.\n * - #put() takes a path, body and contentType and also returns a promise.\n * - #delete() takes a path and also returns a promise.\n * - #on('change', ...) events, being fired whenever something changes in\n * the storage. Change events roughly follow the StorageEvent pattern.\n * They have \"oldValue\" and \"newValue\" properties, which can be used to\n * distinguish create/update/delete operations and analyze changes in\n * change handlers. In addition they carry a \"origin\" property, which\n * is either \"window\", \"local\", or \"remote\". \"remote\" events are fired\n * whenever a change comes in from Sync.\n *\n * The sync interface (also on IndexedDB object):\n * - #getNodes([paths]) returns the requested nodes in a promise.\n * - #setNodes(map) stores all the nodes given in the (path -> node) map.\n *\n * @interface\n */\n\nimport type { RSNode, RSNodes } from './interfaces/rs_node';\nimport EventHandling from './eventhandling';\nimport CachingLayer from './cachinglayer';\nimport log from './log';\nimport {\n applyMixins,\n deepClone,\n getGlobalContext\n} from './util';\n\nconst DB_VERSION = 2;\n\nconst DEFAULT_DB_NAME = 'remotestorage';\n\n// TODO very weird that this is re-assigned\nlet DEFAULT_DB;\n\nclass IndexedDB extends CachingLayer {\n db: any;\n getsRunning: number;\n putsRunning: number;\n changesQueued: { [key: string]: unknown };\n changesRunning: { [key: string]: unknown };\n commitSlownessWarning: any; // TODO null | number (but node's setInterval returns an unknown type)\n\n constructor(database) {\n super();\n this.addEvents(['change', 'local-events-done']);\n\n this.db = database || DEFAULT_DB;\n\n if (!this.db) {\n // TODO shouldn't this throw an error?\n log(\"[IndexedDB] Failed to open DB\");\n return undefined;\n }\n\n this.getsRunning = 0;\n this.putsRunning = 0;\n\n /**\n * Given a node for which uncommitted changes exist, this cache\n * stores either the entire uncommitted node, or false for a deletion.\n * The node's path is used as the key.\n *\n * changesQueued stores changes for which no IndexedDB transaction has\n * been started yet.\n */\n this.changesQueued = {};\n\n /**\n * Given a node for which uncommitted changes exist, this cache\n * stores either the entire uncommitted node, or false for a deletion.\n * The node's path is used as the key.\n *\n * At any time there is at most one IndexedDB transaction running.\n * changesRunning stores the changes that are included in that currently\n * running IndexedDB transaction, or if none is running, of the last one\n * that ran.\n */\n this.changesRunning = {};\n\n // TODO document\n this.commitSlownessWarning = null;\n }\n\n /**\n * TODO: Document\n */\n async getNodes (paths: string[]): Promise {\n const misses = [], fromCache = {};\n for (let i = 0, len = paths.length; i < len; i++) {\n if (this.changesQueued[paths[i]] !== undefined) {\n fromCache[paths[i]] = deepClone(this.changesQueued[paths[i]] || undefined);\n } else if (this.changesRunning[paths[i]] !== undefined) {\n fromCache[paths[i]] = deepClone(this.changesRunning[paths[i]] || undefined);\n } else {\n misses.push(paths[i]);\n }\n }\n if (misses.length > 0) {\n return this.getNodesFromDb(misses).then(function (nodes) {\n for (const i in fromCache) {\n nodes[i] = fromCache[i];\n }\n return nodes;\n });\n } else {\n return Promise.resolve(fromCache);\n }\n }\n\n /**\n * TODO: Document\n */\n async setNodes (nodes: RSNodes): Promise {\n for (const i in nodes) {\n this.changesQueued[i] = nodes[i] || false;\n }\n this.maybeFlush();\n return Promise.resolve();\n }\n\n /**\n * TODO: Document\n */\n maybeFlush (): void {\n if (this.putsRunning === 0) {\n this.flushChangesQueued();\n } else {\n if (!this.commitSlownessWarning) {\n this.commitSlownessWarning = global.setInterval(function () {\n console.warn('WARNING: waited more than 10 seconds for previous commit to finish');\n }, 10000);\n }\n }\n }\n\n /**\n * TODO: Document\n */\n flushChangesQueued (): void {\n if (this.commitSlownessWarning) {\n clearInterval(this.commitSlownessWarning);\n this.commitSlownessWarning = null;\n }\n if (Object.keys(this.changesQueued).length > 0) {\n this.changesRunning = this.changesQueued;\n this.changesQueued = {};\n this.setNodesInDb(this.changesRunning).then(this.flushChangesQueued.bind(this));\n }\n }\n\n /**\n * TODO: Document\n */\n getNodesFromDb (paths: string[]): Promise {\n return new Promise((resolve, reject) => {\n\n const transaction = this.db.transaction(['nodes'], 'readonly');\n const nodes = transaction.objectStore('nodes');\n const retrievedNodes = {};\n\n this.getsRunning++;\n\n paths.map((path: string) => {\n nodes.get(path).onsuccess = (evt) => {\n retrievedNodes[path] = evt.target.result;\n };\n });\n\n transaction.oncomplete = () => {\n resolve(retrievedNodes);\n this.getsRunning--;\n };\n\n transaction.onerror = transaction.onabort = () => {\n reject('get transaction error/abort');\n this.getsRunning--;\n };\n\n });\n }\n\n /**\n * TODO: Document\n */\n async setNodesInDb (nodes: { [key: string]: unknown }): Promise {\n return new Promise((resolve, reject) => {\n\n const transaction = this.db.transaction(['nodes'], 'readwrite');\n const nodesStore = transaction.objectStore('nodes');\n const startTime = new Date().getTime();\n\n this.putsRunning++;\n\n log('[IndexedDB] Starting put', nodes, this.putsRunning);\n\n for (const path in nodes) {\n const node = nodes[path];\n if (typeof (node) === 'object') {\n try {\n nodesStore.put(node);\n } catch (e) {\n log('[IndexedDB] Error while putting', node, e);\n throw e;\n }\n } else {\n try {\n nodesStore.delete(path);\n } catch (e) {\n log('[IndexedDB] Error while removing', nodesStore, node, e);\n throw e;\n }\n }\n }\n\n transaction.oncomplete = () => {\n this.putsRunning--;\n log('[IndexedDB] Finished put', nodes, this.putsRunning, (new Date().getTime() - startTime) + 'ms');\n resolve();\n };\n\n transaction.onerror = () => {\n this.putsRunning--;\n reject('transaction error');\n };\n\n transaction.onabort = () => {\n reject('transaction abort');\n this.putsRunning--;\n };\n\n });\n }\n\n /**\n * TODO: Document\n */\n // TODO add real types once known\n reset (callback: (p: unknown) => unknown): void {\n const dbName = this.db.name;\n\n this.db.close();\n\n IndexedDB.clean(this.db.name, () => {\n IndexedDB.open(dbName, (err, other) => {\n if (err) {\n log('[IndexedDB] Error while resetting local storage', err);\n } else {\n // hacky!\n this.db = other;\n }\n if (typeof callback === 'function') {\n callback(self);\n }\n });\n });\n }\n\n /**\n * TODO: Document\n */\n async forAllNodes (cb: (node: RSNode) => void): Promise {\n return new Promise((resolve/*, reject*/) => {\n\n const transaction = this.db.transaction(['nodes'], 'readonly');\n const cursorReq = transaction.objectStore('nodes').openCursor();\n\n cursorReq.onsuccess = (evt) => {\n const cursor = evt.target.result;\n\n if (cursor) {\n cb(this.migrate(cursor.value));\n cursor.continue();\n } else {\n resolve();\n }\n };\n });\n }\n\n closeDB (): void {\n if (this.putsRunning === 0) { // check if we are currently writing to the DB\n this.db.close();\n } else {\n setTimeout(this.closeDB.bind(this), 100); // try again a little later\n }\n }\n\n /**\n * TODO: Document\n */\n // TODO add real types once known\n static open (name: string, callback: (p: unknown, p2?: unknown) => unknown) {\n const timer = setTimeout(function () {\n callback(\"timeout trying to open db\");\n }, 10000);\n\n try {\n const req = indexedDB.open(name, DB_VERSION);\n\n req.onerror = function () {\n log('[IndexedDB] Opening DB failed', req);\n\n clearTimeout(timer);\n callback(req.error);\n };\n\n req.onupgradeneeded = function (event) {\n const db = req.result;\n\n log(\"[IndexedDB] Upgrade: from \", event.oldVersion, \" to \", event.newVersion);\n\n if (event.oldVersion !== 1) {\n log(\"[IndexedDB] Creating object store: nodes\");\n db.createObjectStore('nodes', {keyPath: 'path'});\n }\n\n log(\"[IndexedDB] Creating object store: changes\");\n\n db.createObjectStore('changes', {keyPath: 'path'});\n };\n\n req.onsuccess = function () {\n clearTimeout(timer);\n\n // check if all object stores exist\n const db = req.result;\n if (!db.objectStoreNames.contains('nodes') || !db.objectStoreNames.contains('changes')) {\n log(\"[IndexedDB] Missing object store. Resetting the database.\");\n IndexedDB.clean(name, function () {\n IndexedDB.open(name, callback);\n });\n return;\n }\n\n callback(null, req.result);\n };\n } catch (error) {\n log(\"[IndexedDB] Failed to open database: \" + error);\n log(\"[IndexedDB] Resetting database and trying again.\");\n\n clearTimeout(timer);\n\n IndexedDB.clean(name, function () {\n IndexedDB.open(name, callback);\n });\n }\n }\n\n /**\n * TODO: Document\n */\n static clean (databaseName: string, callback: () => void) {\n const req = indexedDB.deleteDatabase(databaseName);\n\n req.onsuccess = function () {\n log('[IndexedDB] Done removing DB');\n callback();\n };\n\n // TODO check if this does anything as onabort does not exist on type according to ts\n req.onerror = (req as any).onabort = function (evt) {\n console.error('Failed to remove database \"' + databaseName + '\"', evt);\n };\n }\n\n /**\n * Initialize the IndexedDB backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n // TODO add real type once known\n static _rs_init (remoteStorage: unknown): Promise {\n\n return new Promise((resolve, reject) => {\n\n IndexedDB.open(DEFAULT_DB_NAME, function (err, db) {\n if (err) {\n reject(err);\n } else {\n DEFAULT_DB = db;\n // TODO remove once real type once known\n (db as any).onerror = () => {\n (remoteStorage as any)._emit('error', err);\n };\n resolve();\n }\n });\n\n });\n }\n\n /**\n * Inform about the availability of the IndexedDB backend.\n *\n * @param {Object} rs - RemoteStorage instance\n * @returns {Boolean}\n *\n * @protected\n */\n static _rs_supported (): Promise {\n return new Promise((resolve, reject) => {\n\n const context = getGlobalContext();\n\n // FIXME: this is causing an error in chrome\n // context.indexedDB = context.indexedDB || context.webkitIndexedDB ||\n // context.mozIndexedDB || context.oIndexedDB ||\n // context.msIndexedDB;\n\n // Detect browsers with known IndexedDb issues (e.g. Android pre-4.4)\n let poorIndexedDbSupport = false;\n if (typeof navigator !== 'undefined' &&\n navigator.userAgent.match(/Android (2|3|4\\.[0-3])/)) {\n // Chrome and Firefox support IndexedDB\n if (!navigator.userAgent.match(/Chrome|Firefox/)) {\n poorIndexedDbSupport = true;\n }\n }\n\n if ('indexedDB' in context && !poorIndexedDbSupport) {\n try {\n const check = indexedDB.open(\"rs-check\");\n check.onerror = function (/* event */) {\n reject();\n };\n check.onsuccess = function (/* event */) {\n check.result.close();\n indexedDB.deleteDatabase(\"rs-check\");\n resolve();\n };\n } catch (e) {\n reject();\n }\n } else {\n reject();\n }\n\n });\n }\n\n /**\n * Remove IndexedDB as a backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n static _rs_cleanup (remoteStorage: any) {\n return new Promise((resolve/*, reject*/) => {\n if (remoteStorage.local) {\n remoteStorage.local.closeDB();\n }\n\n IndexedDB.clean(DEFAULT_DB_NAME, resolve as () => void);\n });\n }\n\n diffHandler() {\n // empty\n }\n}\n\n// TODO move to CachingLayer, same for all layers\ninterface IndexedDB extends EventHandling {}\napplyMixins(IndexedDB, [EventHandling]);\n\nexport = IndexedDB;\n","import type { RSNode, RSNodes } from './interfaces/rs_node';\nimport EventHandling from './eventhandling';\nimport CachingLayer from './cachinglayer';\nimport { applyMixins, deepClone } from './util';\n\n/**\n * In-memory caching adapter. Used when no IndexedDB or localStorage\n * available.\n *\n * @class\n **/\n\nclass InMemoryStorage extends CachingLayer {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _storage: { [key: string]: any } = {};\n\n constructor() {\n super();\n this.addEvents(['change', 'local-events-done']);\n }\n\n getNodes(paths: string[]): Promise {\n const nodes: RSNodes = {};\n\n for (let i = 0, len = paths.length; i < len; i++) {\n // Should use a clone of whatever we are retrieving to prevent\n // mutation, also to follow the same behavior as localStorage\n // and indexeddb.\n nodes[paths[i]] = deepClone(this._storage[paths[i]]);\n }\n\n return Promise.resolve(nodes);\n }\n\n setNodes(nodes: RSNodes): Promise {\n for (const path in nodes) {\n if (nodes[path] === undefined) {\n delete this._storage[path];\n } else {\n this._storage[path] = nodes[path];\n }\n }\n\n return Promise.resolve();\n }\n\n forAllNodes(cb: (node: RSNode) => void): Promise {\n for (const path in this._storage) {\n cb(this.migrate(this._storage[path]));\n }\n return Promise.resolve();\n }\n\n diffHandler(): void {\n // empty\n }\n\n /**\n * Initialize the InMemoryStorage backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n protected static _rs_init(): void {\n // empty\n }\n\n /**\n * Inform about the availability of the InMemoryStorage backend.\n *\n * @returns {Boolean}\n *\n * @protected\n */\n protected static _rs_supported(): true {\n // In-memory storage is always supported\n return true;\n }\n\n /**\n * Remove InMemoryStorage as a backend.\n *\n * @protected\n */\n protected static _rs_cleanup(): void {\n // empty\n }\n}\n\n// TODO move to CachingLayer, same for all layers\ninterface InMemoryStorage extends EventHandling {}\napplyMixins(InMemoryStorage, [EventHandling]);\n\nexport = InMemoryStorage;\n","import type { RSNode, RSNodes } from './interfaces/rs_node';\nimport CachingLayer from './cachinglayer';\nimport EventHandling from './eventhandling';\nimport log from './log';\nimport { applyMixins, localStorageAvailable } from './util';\n\n/**\n * localStorage caching adapter. Used when no IndexedDB available.\n **/\n\nconst NODES_PREFIX = \"remotestorage:cache:nodes:\";\nconst CHANGES_PREFIX = \"remotestorage:cache:changes:\";\n\nfunction isRemoteStorageKey(key: string): boolean {\n return key.substr(0, NODES_PREFIX.length) === NODES_PREFIX ||\n key.substr(0, CHANGES_PREFIX.length) === CHANGES_PREFIX;\n}\n\nfunction isNodeKey(key: string): boolean {\n return key.substr(0, NODES_PREFIX.length) === NODES_PREFIX;\n}\n\nclass LocalStorage extends CachingLayer {\n constructor() {\n super();\n this.addEvents(['change', 'local-events-done']);\n }\n\n // TODO fix this\n diffHandler(...args: any[]): void {\n return;\n }\n\n getNodes(paths: string[]): Promise {\n const nodes = {};\n\n for (let i = 0, len = paths.length; i < len; i++) {\n try {\n nodes[paths[i]] = JSON.parse(localStorage[NODES_PREFIX + paths[i]]);\n } catch (e) {\n nodes[paths[i]] = undefined;\n }\n }\n\n return Promise.resolve(nodes);\n }\n\n setNodes(nodes: RSNodes): Promise {\n for (const path in nodes) {\n // TODO shouldn't we use getItem/setItem?\n localStorage[NODES_PREFIX + path] = JSON.stringify(nodes[path]);\n }\n\n return Promise.resolve();\n }\n\n forAllNodes(cb: (node: RSNode) => void): Promise {\n let node: RSNode | undefined;\n\n for (let i = 0, len = localStorage.length; i < len; i++) {\n if (isNodeKey(localStorage.key(i))) {\n try {\n // NOTE: this is coming from caching layer todo fix via interface or similar\n node = this.migrate(JSON.parse(localStorage[localStorage.key(i)]));\n } catch (e) {\n node = undefined;\n }\n if (node) {\n cb(node);\n }\n }\n }\n return Promise.resolve();\n }\n\n /**\n * Initialize the LocalStorage backend.\n *\n * @protected\n */\n static _rs_init(): void {\n return;\n }\n\n /**\n * Inform about the availability of the LocalStorage backend.\n *\n * @protected\n */\n static _rs_supported(): boolean {\n return localStorageAvailable();\n }\n\n /**\n * Remove LocalStorage as a backend.\n *\n * @protected\n *\n * TODO: tests missing!\n */\n static _rs_cleanup(): void {\n const keys = [];\n\n for (let i = 0, len = localStorage.length; i < len; i++) {\n const key = localStorage.key(i);\n if (isRemoteStorageKey(key)) {\n keys.push(key);\n }\n }\n\n keys.forEach((key) => {\n log('[LocalStorage] Removing', key);\n delete localStorage[key];\n });\n }\n}\n\n// TODO move to CachingLayer, same for all layers\ninterface LocalStorage extends EventHandling {}\napplyMixins(LocalStorage, [EventHandling]);\n\nexport = LocalStorage;\n","import config from './config';\n\n/**\n * Log using console.log, when remoteStorage logging is enabled.\n *\n * You can enable logging with ``RemoteStorage#enableLog``.\n *\n * (You can also enable logging during remoteStorage object creation. See:\n * {@link RemoteStorage}).\n */\nfunction log(...args): void {\n if (config.logging) {\n // eslint-disable-next-line no-console\n console.log(...args);\n }\n}\n\nexport = log;\n","import RemoteStorage from \"./remotestorage\";\nimport EventHandling from \"./eventhandling\";\nimport { isFolder } from \"./util\";\n\n/**\n * The ancestor for WireClient, GoogleDrive & Dropbox\n */\nexport class RemoteBase extends EventHandling {\n rs: RemoteStorage;\n\n connected: boolean;\n online: boolean;\n userAddress: string;\n storageApi: string;\n\n constructor(rs: RemoteStorage) {\n super();\n this.rs = rs;\n this.connected = false;\n // TODO: Should `online` be set true or false for all, here or in configure?\n }\n\n stopWaitingForToken (): void {\n if (!this.connected) {\n this._emit('not-connected');\n }\n }\n\n addQuotes (str: string): string {\n if (typeof (str) !== 'string') {\n return str;\n }\n if (str === '*') {\n return '*';\n }\n\n return '\"' + str + '\"';\n }\n\n stripQuotes (str: string): string {\n if (typeof (str) !== 'string') {\n return str;\n }\n\n return str.replace(/^[\"']|[\"']$/g, '');\n }\n\n isForbiddenRequestMethod(method: string, uri: string): boolean {\n if (method === 'PUT' || method === 'DELETE') {\n return isFolder(uri);\n } else {\n return false;\n }\n }\n}\n\n\nexport interface RemoteSettings {\n userAddress?: string;\n href?: string; // remoteStorage server's base URL\n storageApi?: string; // spec version\n token?: string | false; // OAuth2 access token\n refreshToken?: string; // OAuth2 refresh token\n tokenType?: string; // type of access token; usually 'bearer'\n properties?: object;\n}\n\nexport interface RemoteResponse {\n statusCode: number;\n revision?: string;\n contentType?: string;\n body?: any;\n}\n\n/**\n * The public interface for WireClient, GoogleDrive, Dropbox & Solid\n */\nexport interface Remote {\n /**\n * Whether or not a remote store is connected\n */\n connected: boolean;\n\n /**\n * Whether last sync action was successful or not\n */\n online: boolean;\n\n /**\n * The user address of the connected user\n */\n userAddress: string;\n\n /**\n * Holds the spec version the server claims to be compatible with\n *\n * @example\n * ```js\n * remoteStorage.remote.storageApi\n * // 'draft-dejong-remotestorage-12'\n * ```\n *\n * @internal\n */\n storageApi: string;\n\n /**\n * Holds the server's base URL, as obtained in the Webfinger discovery\n *\n * @example\n * ```js\n * remoteStorage.remote.href\n * // 'https://storage.example.com/users/jblogg/'\n * ```\n *\n * @internal\n */\n href?: string;\n\n /**\n * The JSON-parsed properties object from the user's WebFinger record\n */\n properties?: object;\n\n /**\n * OAuth2 client ID\n *\n * @internal\n */\n clientId?: string;\n\n /**\n * OAuth2 PKCE\n *\n * @internal\n */\n TOKEN_URL?: string;\n\n configure (settings): void // TODO: harmonize settings & use type\n\n configure (settings: RemoteSettings): void;\n\n /**\n * Initiate the authorization flow's OAuth dance.\n *\n * @internal\n */\n connect? (): void;\n\n stopWaitingForToken (): void;\n\n get (path: string, options: { ifMatch?: string; ifNoneMatch?: string }): Promise;\n\n put (path: string, body: XMLHttpRequestBodyInit, contentType: string, options: { ifMatch?: string; ifNoneMatch?: string }): Promise\n\n delete (path: string, options: { ifMatch?: string }): Promise;\n}\n","'use strict';\n\nimport config from './config';\nimport log from './log';\nimport {\n applyMixins,\n getGlobalContext,\n getJSONFromLocalStorage,\n extend,\n localStorageAvailable\n} from './util';\n\nimport Access from './access';\nimport Authorize from './authorize';\nimport BaseClient from './baseclient';\nimport Caching from './caching';\nimport IndexedDB from './indexeddb';\nimport InMemoryStorage from './inmemorystorage';\nimport LocalStorage from './localstorage';\nimport { EventHandling, EventHandler } from './eventhandling';\nimport GoogleDrive from './googledrive';\nimport Dropbox from './dropbox';\nimport Solid from './solid';\nimport Discover from './discover';\nimport SyncError from './sync-error';\nimport UnauthorizedError from './unauthorized-error';\nimport Features from './features';\nimport { Remote } from \"./remote\";\n\nimport type { AuthorizeOptions } from './authorize';\nimport type { StorageInfo } from './interfaces/storage_info';\nimport type { Sync } from './sync';\n\n// TODO this is assigned to RemoteStorage.util later; check if still needed\nimport * as util from './util';\n\nconst globalContext = getGlobalContext();\n// declare global {\n// interface Window { cordova: any };\n// }\n\nlet hasLocalStorage: boolean;\n\n// TODO document and/or refactor (seems weird)\nfunction emitUnauthorized(r) {\n if (r.statusCode === 403 || r.statusCode === 401) {\n this._emit('error', new UnauthorizedError());\n }\n return Promise.resolve(r);\n}\n\n/**\n* Check if interval is valid: numeric and between 2s and 1hr inclusive\n*/\nfunction isValidInterval(interval: unknown): interval is number {\n return (typeof interval === 'number' &&\n interval >= 2000 &&\n interval <= 3600000);\n}\n\n/**\n * Represents a data module\n *\n * @example\n * ```js\n * {\n * name: 'examples',\n * builder: function(privateClient, publicClient) {\n * return {\n * exports: {\n * addItem(item): function() {\n * // Generate a random ID/path\n * const path = [...Array(10)].map(() => String.fromCharCode(Math.floor(Math.random() * 95) + 32)).join('');\n * // Store the object, and ensure it conforms to the JSON Schema\n * // type `example-item`\n * privateClient.storeObject('example-item', path, item);\n * }\n * }\n * }\n * }\n * }\n * ```\n */\nexport interface RSModule {\n /**\n * The module's name, which is also the category (i.e. base folder) for document URLs on the remote storage\n */\n name: string;\n /**\n * A module builder function, which defines the actual module\n */\n builder: (privateClient: BaseClient, publicClient: BaseClient) => {\n exports: {\n [key: string]: any;\n };\n };\n}\n\nenum ApiKeyType {\n GOOGLE = 'googledrive',\n DROPBOX = 'dropbox'\n}\n\n/**\n * Create a `remoteStorage` class instance so:\n *\n * ```js\n * const remoteStorage = new RemoteStorage();\n * ```\n *\n * The constructor can optionally be called with a configuration object. This\n * example shows all default values:\n *\n * ```js\n * const remoteStorage = new RemoteStorage({\n * cache: true,\n * changeEvents: {\n * local: true,\n * window: false,\n * remote: true,\n * conflict: true\n * },\n * cordovaRedirectUri: undefined,\n * logging: false,\n * modules: []\n * });\n * ```\n *\n * > [!NOTE]\n * > In the current version, it is only possible to use a single `remoteStorage`\n * > instance. You cannot connect to two different remotes in parallel yet.\n * > We intend to support this eventually.\n *\n * > [!TIP]\n * > For the change events configuration, you have to set all events\n * > explicitly. Otherwise it disables the unspecified ones.\n *\n * ## Events\n *\n * You can add event handlers to your `remoteStorage` instance by using the\n * {@link on} function. For example:\n *\n * ```js\n * remoteStorage.on('connected', function() {\n * // Storage account has been connected, let’s roll!\n * });\n * ```\n *\n * ### `ready`\n *\n * Emitted when all features are loaded and the RS instance is ready to be used\n * in your app\n *\n * ### `not-connected`\n *\n * Emitted when ready, but no storage connected (\"anonymous mode\")\n *\n * ### `connected`\n *\n * Emitted when a remote storage has been connected\n *\n * ### `disconnected`\n *\n * Emitted after disconnect\n *\n * ### `error`\n *\n * Emitted when an error occurs; receives an error object as argument\n *\n * There are a handful of known errors, which are identified by the `name`\n * property of the error object:\n *\n * * `Unauthorized`\n *\n * Emitted when a network request resulted in a 401 or 403 response. You can\n * use this event to handle invalid OAuth tokens in custom UI (i.e. when a\n * stored token has been revoked or expired by the RS server).\n *\n * * `DiscoveryError`\n *\n * A variety of storage discovery errors, e.g. from user address input\n * validation, or user address lookup issues\n *\n * #### Example\n *\n * ```js\n * remoteStorage.on('error', err => console.log(err));\n *\n * // {\n * // name: \"Unauthorized\",\n * // message: \"App authorization expired or revoked.\",\n * // stack: \"Error↵ at new a.Unauthorized (vendor.js:65710:41870)\"\n * // }\n * ```\n *\n * ### `connecting`\n *\n * Emitted before webfinger lookup\n *\n * ### `authing`\n *\n * Emitted before redirecting to the OAuth server\n *\n * ### `wire-busy`\n *\n * Emitted when a network request starts\n *\n * ### `wire-done`\n *\n * Emitted when a network request completes\n *\n * ### `sync-req-done`\n *\n * Emitted when a single sync request has finished. Callback functions\n * receive an object as argument, informing the client of remaining items\n * in the current sync task queue.\n *\n * #### Example\n *\n * ```js\n * remoteStorage.on('sync-req-done', result => console.log(result));\n * // { tasksRemaining: 21 }\n * ```\n *\n * > [!NOTE]\n * > The internal task queue holds at most 100 items at the same time,\n * > regardless of the overall amount of items to sync. Therefore, this number\n * > is only an indicator of sync status, not a precise amount of items left\n * > to sync. It can be useful to determine if your app should display any\n * > kind of sync status/progress information for the cycle or not.\n *\n * ### `sync-done`\n *\n * Emitted when a sync cycle has been completed and a new sync is scheduled.\n *\n * The callback function receives an object as argument, informing the client\n * if the sync process has completed successfully or not.\n *\n * #### Example\n *\n * ```js\n * remoteStorage.on('sync-done', result => console.log(result));\n * // { completed: true }\n * ```\n *\n * If `completed` is `false`, it means that some of the sync requests have\n * failed and will be retried in the next sync cycle (usually a few seconds\n * later in this case). This is not an unusual scenario on mobile networks or\n * when doing a large initial sync for example.\n *\n * For an app's user interface, you may want to consider the sync process as\n * ongoing in this case, and wait until your app sees a positive `completed`\n * status before updating the UI.\n *\n * ### `network-offline`\n *\n * Emitted once when a wire request fails for the first time, and\n * `remote.online` is set to false\n *\n * ### `network-online`\n *\n * Emitted once when a wire request succeeds for the first time after a failed\n * one, and `remote.online` is set back to true\n *\n * ### `sync-interval-change`\n *\n * Emitted when the sync interval changes\n */\nexport class RemoteStorage {\n /**\n * Pending get/put/delete calls\n * @internal\n */\n _pending: {[key: string]: any}[] = [];\n\n /**\n * TODO: document\n * @internal\n */\n _cleanups: [] = [];\n\n /**\n * TODO: document\n * @internal\n */\n _pathHandlers: { [key: string]: any } = { change: {} };\n\n /**\n * Holds OAuth app keys for Dropbox, Google Drive\n * @internal\n */\n apiKeys: {googledrive?: {clientId: string}; dropbox?: {appKey: string}} = {};\n\n /**\n */\n access: Access;\n /**\n */\n sync: Sync;\n /**\n */\n caching: Caching;\n\n /**\n * @internal\n */\n _syncTimer: any;\n /**\n * @internal\n */\n syncStopped: boolean;\n /**\n * @internal\n */\n get: Function;\n /**\n * @internal\n */\n put: Function;\n /**\n * @internal\n */\n delete: Function;\n\n /**\n */\n backend: 'remotestorage' | 'dropbox' | 'googledrive' | 'solid';\n\n /**\n * Depending on the chosen backend, this is either an instance of `WireClient`,\n * `Dropbox`, `GoogleDrive` or `Solid`.\n *\n * See {@link Remote} for public API\n *\n * @example\n * remoteStorage.remote.connected\n * // false\n */\n remote: Remote;\n\n /**\n * Access to the local caching backend used. Usually either a\n * `RemoteStorage.IndexedDB` or `RemoteStorage.LocalStorage` instance.\n *\n * Not available, when caching is turned off.\n *\n * @internal\n */\n local: IndexedDB | LocalStorage | InMemoryStorage;\n\n /**\n * @internal\n */\n dropbox: Dropbox;\n /**\n * @internal\n */\n googledrive: GoogleDrive;\n solid: Solid;\n\n /**\n * @internal\n */\n fireInitial: Function;\n\n\n constructor (cfg?: object) {\n // Initial configuration property settings.\n // TODO use modern JS to merge object properties\n if (typeof cfg === 'object') { extend(config, cfg); }\n\n this.addEvents([\n 'ready', 'authing', 'connecting', 'pod-not-selected', 'connected', 'disconnected',\n 'not-connected', 'conflict', 'error', 'features-loaded',\n 'sync-interval-change', 'sync-req-done', 'sync-done',\n 'wire-busy', 'wire-done', 'network-offline', 'network-online'\n ]);\n\n this._setGPD({\n get: this._pendingGPD('get'),\n put: this._pendingGPD('put'),\n delete: this._pendingGPD('delete')\n });\n\n hasLocalStorage = localStorageAvailable();\n\n if (hasLocalStorage) {\n this.apiKeys = getJSONFromLocalStorage('remotestorage:api-keys') || {};\n this.setBackend(localStorage.getItem('remotestorage:backend') || 'remotestorage');\n }\n\n // Keep a reference to the orginal `on` function\n const origOn = this.on;\n\n this.on = function (eventName: string, handler: Function): void {\n if (this._allLoaded) {\n // check if the handler should be called immediately, because the\n // event has happened already\n switch(eventName) {\n case 'features-loaded':\n setTimeout(handler, 0);\n break;\n case 'ready':\n if (this.remote) {\n setTimeout(handler, 0);\n }\n break;\n case 'connected':\n if (this.remote && this.remote.connected) {\n setTimeout(handler, 0);\n }\n break;\n case 'not-connected':\n if (this.remote && !this.remote.connected) {\n setTimeout(handler, 0);\n }\n break;\n case 'pod-not-selected':\n if ((this.remote instanceof Solid)\n && this.remote.getPodURLs().length > 0\n && this.remote.getPodURL() === null) {\n setTimeout(handler, 0);\n }\n break;\n }\n }\n\n return origOn.call(this, eventName, handler);\n };\n\n // load all features and emit `ready`\n this._init();\n\n /**\n * TODO: document\n */\n this.fireInitial = function () {\n if (this.local) {\n setTimeout(this.local.fireInitial.bind(this.local), 0);\n }\n }.bind(this);\n\n this.on('ready', this.fireInitial.bind(this));\n this.loadModules();\n }\n\n /**\n * Indicating if remoteStorage is currently connected.\n */\n get connected (): boolean {\n return this.remote.connected;\n }\n\n /**\n * FIXME: Instead of doing this, would be better to only\n * export setAuthURL / getAuthURL from RemoteStorage prototype\n *\n * @ignore\n */\n static Authorize = Authorize;\n\n static SyncError = SyncError;\n static Unauthorized = UnauthorizedError;\n static DiscoveryError = Discover.DiscoveryError;\n static util = util;\n\n /**\n * Load all modules passed as arguments\n *\n * @internal\n */\n loadModules(): void {\n config.modules.forEach(this.addModule.bind(this));\n }\n\n /**\n * Initiate the OAuth authorization flow.\n *\n * @internal\n */\n authorize (options: AuthorizeOptions): void {\n this.access.setStorageType(this.remote.storageApi);\n if (typeof options.scope === 'undefined') {\n options.scope = this.access.scopeParameter;\n }\n\n if (globalContext.cordova) {\n options.redirectUri = config.cordovaRedirectUri;\n } else {\n const location = Authorize.getLocation();\n let redirectUri = location.origin;\n if (location.pathname !== '/') {\n redirectUri += location.pathname;\n }\n\n options.redirectUri = redirectUri;\n }\n\n if (typeof options.clientId === 'undefined') {\n options.clientId = options.redirectUri.match(/^(https?:\\/\\/[^/]+)/)[0];\n }\n\n Authorize.authorize(this, options);\n }\n\n /**\n * TODO: document\n * @internal\n */\n impliedauth (storageApi?: string, redirectUri?: string): void {\n // TODO shouldn't these be default argument values?\n storageApi = storageApi || this.remote.storageApi;\n redirectUri = redirectUri || String(document.location);\n\n log('ImpliedAuth proceeding due to absent authURL; storageApi = ' + storageApi + ' redirectUri = ' + redirectUri);\n // Set a fixed access token, signalling to not send it as Bearer\n this.remote.configure({\n token: Authorize.IMPLIED_FAKE_TOKEN\n });\n document.location.href = redirectUri;\n }\n\n /**\n * Connect to a remoteStorage server.\n *\n * Discovers the WebFinger profile of the given user address and initiates\n * the OAuth dance.\n *\n * This method must be called *after* all required access has been claimed.\n * When using the connect widget, it will call this method when the user\n * clicks/taps the \"connect\" button.\n *\n * Special cases:\n *\n * 1. If a bearer token is supplied as second argument, the OAuth dance\n * will be skipped and the supplied token be used instead. This is\n * useful outside of browser environments, where the token has been\n * acquired in a different way.\n *\n * 2. If the Webfinger profile for the given user address doesn't contain\n * an auth URL, the library will assume that client and server have\n * established authorization among themselves, which will omit bearer\n * tokens in all requests later on. This is useful for example when using\n * Kerberos and similar protocols.\n *\n * @param userAddress - The user address (user@host) or URL to connect to.\n * @param token - (optional) A bearer token acquired beforehand\n *\n * @example\n * remoteStorage.connect('user@example.com');\n */\n connect (userAddress: string, token?: string): void {\n this.setBackend('remotestorage');\n if (userAddress.indexOf('@') < 0 && !userAddress.match(/^(https?:\\/\\/)?[^\\s\\/$\\.?#]+\\.[^\\s]*$/)) {\n this._emit('error', new RemoteStorage.DiscoveryError(\"Not a valid user address or URL.\"));\n return;\n }\n\n // Prefix URL with https:// if it's missing\n if (userAddress.indexOf('@') < 0 && !userAddress.match(/^https?:\\/\\//)) {\n userAddress = `https://${userAddress}`;\n }\n\n if (globalContext.cordova) {\n if (typeof config.cordovaRedirectUri !== 'string') {\n this._emit('error', new RemoteStorage.DiscoveryError(\"Please supply a custom HTTPS redirect URI for your Cordova app\"));\n return;\n }\n if (!globalContext.cordova.InAppBrowser) {\n this._emit('error', new RemoteStorage.DiscoveryError(\"Please include the InAppBrowser Cordova plugin to enable OAuth\"));\n return;\n }\n }\n\n this.remote.configure({\n userAddress: userAddress\n });\n this._emit('connecting');\n\n const discoveryTimeout = setTimeout((): void => {\n this._emit('error', new RemoteStorage.DiscoveryError(\"No storage information found for this user address.\"));\n }, config.discoveryTimeout);\n\n Discover(userAddress).then((info: StorageInfo): void => {\n clearTimeout(discoveryTimeout);\n this._emit('authing');\n info.userAddress = userAddress;\n this.remote.configure(info);\n if (! this.remote.connected) {\n if (info.authURL) {\n if (typeof token === 'undefined') {\n // Normal authorization step; the default way to connect\n this.authorize({ authURL: info.authURL });\n } else if (typeof token === 'string') {\n // Token supplied directly by app/developer/user\n log('Skipping authorization sequence and connecting with known token');\n this.remote.configure({ token: token });\n } else {\n throw new Error(\"Supplied bearer token must be a string\");\n }\n } else {\n // In lieu of an excplicit authURL, assume that the browser and\n // server handle any authorization needs; for instance, TLS may\n // trigger the browser to use a client certificate, or a 401 Not\n // Authorized response may make the browser send a Kerberos ticket\n // using the SPNEGO method.\n this.impliedauth();\n }\n }\n }, (/*err*/) => {\n clearTimeout(discoveryTimeout);\n this._emit('error', new RemoteStorage.DiscoveryError(\"No storage information found for this user address.\"));\n });\n }\n\n /**\n * Reconnect the remote server to get a new authorization.\n *\n * Useful when not using the connect widget and encountering an\n * `Unauthorized` event.\n */\n reconnect (): void {\n this.remote.configure({ token: null });\n\n if (this.backend === 'remotestorage') {\n this.connect(this.remote.userAddress);\n } else {\n this.remote.connect();\n }\n }\n\n /**\n * \"Disconnect\" from remote server to terminate current session.\n *\n * This method clears all stored settings and deletes the entire local\n * cache.\n */\n disconnect (): void {\n if (this.remote) {\n this.remote.configure({\n userAddress: null,\n href: null,\n storageApi: null,\n token: null,\n properties: null\n });\n }\n this._setGPD({\n get: this._pendingGPD('get'),\n put: this._pendingGPD('put'),\n delete: this._pendingGPD('delete')\n });\n const n = this._cleanups.length;\n let i = 0;\n\n const oneDone = (): void => {\n i++;\n if (i >= n) {\n this._init();\n // FIXME Re-enable when modules are all imports\n // log('Done cleaning up, emitting disconnected and disconnect events');\n this._emit('disconnected');\n }\n };\n\n if (n > 0) {\n this._cleanups.forEach((cleanup: (thisarg: object) => Promise) => {\n const cleanupResult = cleanup(this);\n if (typeof(cleanupResult) === 'object' && typeof(cleanupResult.then) === 'function') {\n cleanupResult.then(oneDone);\n } else {\n oneDone();\n }\n });\n } else {\n oneDone();\n }\n }\n\n /**\n * TODO: document\n * @internal\n */\n setBackend (what): void {\n this.backend = what;\n if (hasLocalStorage) {\n if (what) {\n localStorage.setItem('remotestorage:backend', what);\n } else {\n localStorage.removeItem('remotestorage:backend');\n }\n }\n }\n\n /**\n * Add a `change` event handler for the given path. Whenever a change\n * happens (as determined by the local backend, such as e.g.\n * `RemoteStorage.IndexedDB`), and the affected path is equal to or below the\n * given 'path', the given handler is called.\n *\n * > [!TIP]\n * > You should usually not use this method, but instead use the\n * > `change` events provided by {@link BaseClient}.\n *\n * @param path - Absolute path to attach handler to\n * @param handler - A function to handle the change\n *\n * @example\n * remoteStorage.onChange('/bookmarks/', function() {\n * // your code here\n * })\n */\n onChange (path: string, handler: EventHandler): void {\n if (! this._pathHandlers.change[path]) {\n this._pathHandlers.change[path] = [];\n }\n this._pathHandlers.change[path].push(handler);\n }\n\n /**\n * Enable remoteStorage debug logging.\n *\n * Usually done when instantiating remoteStorage:\n *\n * ```js\n * const remoteStorage = new RemoteStorage({ logging: true });\n * ```\n */\n enableLog (): void {\n config.logging = true;\n }\n\n /**\n * Disable remoteStorage debug logging\n */\n disableLog (): void {\n config.logging = false;\n }\n\n /**\n * Log something to the debug log\n *\n * @internal\n */\n log (...args): void {\n log.apply(RemoteStorage, args);\n }\n\n /**\n * Set the OAuth key/ID for GoogleDrive and/or Dropbox backend support.\n *\n * @param apiKeys - A config object\n *\n * @example\n * remoteStorage.setApiKeys({\n * dropbox: 'your-app-key',\n * googledrive: 'your-client-id'\n * });\n */\n setApiKeys (apiKeys: {[key in ApiKeyType]?: string}): void | boolean { // TODO fix the input type\n const validTypes: string[] = [ApiKeyType.GOOGLE, ApiKeyType.DROPBOX];\n if (typeof apiKeys !== 'object' || !Object.keys(apiKeys).every(type => validTypes.includes(type))) {\n console.error('setApiKeys() was called with invalid arguments') ;\n return false;\n }\n\n Object.keys(apiKeys).forEach(type => {\n const key = apiKeys[type];\n if (!key) { delete this.apiKeys[type]; return; }\n\n switch(type) {\n case ApiKeyType.DROPBOX:\n this.apiKeys[ApiKeyType.DROPBOX] = { appKey: key };\n if (typeof this.dropbox === 'undefined' ||\n this.dropbox.clientId !== key) {\n Dropbox._rs_init(this);\n }\n break;\n case ApiKeyType.GOOGLE:\n this.apiKeys[ApiKeyType.GOOGLE] = { clientId: key };\n if (typeof this.googledrive === 'undefined' ||\n this.googledrive.clientId !== key) {\n GoogleDrive._rs_init(this);\n }\n break;\n }\n return true;\n });\n\n if (hasLocalStorage) {\n localStorage.setItem('remotestorage:api-keys', JSON.stringify(this.apiKeys));\n }\n\n }\n\n /**\n * Set redirect URI to be used for the OAuth redirect within the\n * in-app-browser window in Cordova apps. See\n * [Usage in Cordova apps](../../../cordova) for details.\n *\n * @param uri - A valid HTTP(S) URI\n *\n * @example\n * remoteStorage.setCordovaRedirectUri('https://app.example.com');\n */\n setCordovaRedirectUri (uri: string): void {\n if (typeof uri !== 'string' || !uri.match(/http(s)?:\\/\\//)) {\n throw new Error(\"Cordova redirect URI must be a URI string\");\n }\n config.cordovaRedirectUri = uri;\n }\n\n //\n // FEATURES INITIALIZATION\n //\n\n /**\n * @internal\n */\n _init = Features.loadFeatures;\n /**\n * @internal\n */\n features = Features.features;\n /**\n * @internal\n */\n loadFeature = Features.loadFeature;\n /**\n * @internal\n */\n featureSupported = Features.featureSupported;\n /**\n * @internal\n */\n featureDone = Features.featureDone;\n /**\n * @internal\n */\n featuresDone = Features.featuresDone;\n /**\n * @internal\n */\n featuresLoaded = Features.featuresLoaded;\n /**\n * @internal\n */\n featureInitialized = Features.featureInitialized;\n /**\n * @internal\n */\n featureFailed = Features.featureFailed;\n /**\n * @internal\n */\n hasFeature = Features.hasFeature;\n /**\n * @internal\n */\n _setCachingModule = Features._setCachingModule;\n /**\n * @internal\n */\n _collectCleanupFunctions = Features._collectCleanupFunctions;\n /**\n * @internal\n */\n _fireReady = Features._fireReady;\n /**\n * @internal\n */\n initFeature = Features.initFeature;\n\n //\n // GET/PUT/DELETE INTERFACE HELPERS\n //\n\n /**\n * TODO: document\n * @internal\n */\n _setGPD (impl, context?) {\n function wrap(func) {\n return function (...args) {\n return func.apply(context, args)\n .then(emitUnauthorized.bind(this));\n };\n }\n this.get = wrap(impl.get);\n this.put = wrap(impl.put);\n this.delete = wrap(impl.delete);\n }\n\n /**\n * TODO: document\n * @internal\n */\n _pendingGPD (methodName): () => Promise {\n return (...args) => {\n const methodArguments = Array.prototype.slice.call(args);\n return new Promise((resolve, reject) => {\n this._pending.push({\n method: methodName,\n args: methodArguments,\n promise: {\n resolve: resolve,\n reject: reject\n }\n });\n });\n };\n }\n\n /**\n * TODO: document\n * @internal\n */\n _processPending (): void {\n this._pending.forEach((pending) => {\n try {\n this[pending.method](...pending.args).then(pending.promise.resolve, pending.promise.reject);\n } catch(e) {\n pending.promise.reject(e);\n }\n });\n this._pending = [];\n }\n\n //\n // CHANGE EVENT HANDLING\n //\n\n /**\n * TODO: document\n * @internal\n */\n _bindChange (object: { on }): void {\n object.on('change', this._dispatchEvent.bind(this, 'change'));\n }\n\n /**\n * TODO: document\n * @internal\n */\n _dispatchEvent (eventName: string, event): void {\n Object.keys(this._pathHandlers[eventName]).forEach((path: string) => {\n const pl = path.length;\n if (event.path.substr(0, pl) === path) {\n this._pathHandlers[eventName][path].forEach((handler) => {\n const ev: { relativePath?: string } = {};\n for (const key in event) { ev[key] = event[key]; }\n ev.relativePath = event.path.replace(new RegExp('^' + path), '');\n try {\n handler(ev);\n } catch(e) {\n console.error(\"'change' handler failed: \", e, e.stack);\n this._emit('error', e);\n }\n });\n }\n });\n }\n\n /**\n * This method allows you to quickly instantiate a BaseClient, which you can\n * use to directly read and manipulate data in the connected storage account.\n *\n * Please use this method only for debugging and development, and choose or\n * create a [data module](../../../data-modules/) for your app to use.\n *\n * @param path - The base directory of the BaseClient that will be returned\n * (with a leading and a trailing slash)\n *\n * @returns A client with the specified scope (category/base directory)\n *\n * @example\n * remoteStorage.scope('/pictures/').getListing('');\n * remoteStorage.scope('/public/pictures/').getListing('');\n */\n scope (path: string): BaseClient {\n if (typeof(path) !== 'string') {\n throw 'Argument \\'path\\' of baseClient.scope must be a string';\n }\n if (!this.access.checkPathPermission(path, 'r')) {\n console.warn('WARNING: Please use remoteStorage.access.claim() to ask for access permissions first: https://remotestoragejs.readthedocs.io/en/latest/js-api/access.html#claim');\n }\n return new BaseClient(this, path);\n }\n\n /**\n * Get the value of the sync interval when application is in the foreground\n *\n * @returns A number of milliseconds\n *\n * @example\n * remoteStorage.getSyncInterval();\n * // 10000\n */\n getSyncInterval (): number {\n return config.syncInterval;\n }\n\n /**\n * Set the value of the sync interval when application is in the foreground\n *\n * @param interval - Sync interval in milliseconds (between 2000 and 3600000 [1 hour])\n *\n * @example\n remoteStorage.setSyncInterval(20000);\n */\n setSyncInterval (interval: number): void {\n if (!isValidInterval(interval)) {\n throw interval + \" is not a valid sync interval\";\n }\n const oldValue = config.syncInterval;\n config.syncInterval = interval;\n\n this._emit('sync-interval-change', {\n oldValue: oldValue,\n newValue: interval\n });\n }\n\n /**\n * Get the value of the sync interval when application is in the background\n *\n * @returns A number of milliseconds\n *\n * @example\n * remoteStorage.getBackgroundSyncInterval();\n * // 60000\n */\n getBackgroundSyncInterval (): number {\n return config.backgroundSyncInterval;\n }\n\n /**\n * Set the value of the sync interval when the application is in the\n * background\n *\n * @param interval - Sync interval in milliseconds (between 2000 and 3600000 [1 hour])\n *\n * @example\n * remoteStorage.setBackgroundSyncInterval(90000);\n */\n setBackgroundSyncInterval (interval: number): void {\n if (!isValidInterval(interval)) {\n throw interval + \" is not a valid sync interval\";\n }\n const oldValue = config.backgroundSyncInterval;\n config.backgroundSyncInterval = interval;\n\n this._emit('sync-interval-change', {\n oldValue: oldValue,\n newValue: interval\n });\n }\n\n /**\n * Get the value of the current sync interval. Can be background or\n * foreground, custom or default.\n *\n * @returns number of milliseconds\n *\n * @example\n * remoteStorage.getCurrentSyncInterval();\n * // 15000\n */\n getCurrentSyncInterval (): number {\n return config.isBackground ? config.backgroundSyncInterval : config.syncInterval;\n }\n\n /**\n * Get the value of the current network request timeout\n *\n * @returns A number of milliseconds\n *\n * @example\n * remoteStorage.getRequestTimeout();\n * // 30000\n */\n getRequestTimeout (): number {\n return config.requestTimeout;\n }\n\n /**\n * Set the timeout for network requests.\n *\n * @param timeout - Timeout in milliseconds\n *\n * @example\n * remoteStorage.setRequestTimeout(30000);\n */\n setRequestTimeout (timeout: number): void {\n if (typeof timeout !== 'number') {\n throw timeout + \" is not a valid request timeout\";\n }\n config.requestTimeout = timeout;\n }\n\n /**\n * TODO: document\n * @internal\n */\n syncCycle (): void {\n if (!this.sync || this.sync.stopped) { return; }\n\n this.on('sync-done', (): void => {\n // FIXME Re-enable when modules are all imports\n // log('[Sync] Sync done. Setting timer to', this.getCurrentSyncInterval());\n if (this.sync && !this.sync.stopped) {\n if (this._syncTimer) {\n clearTimeout(this._syncTimer);\n this._syncTimer = undefined;\n }\n this._syncTimer = setTimeout(this.sync.sync.bind(this.sync), this.getCurrentSyncInterval());\n }\n });\n\n this.sync.sync();\n }\n\n /**\n * Start synchronization with remote storage, downloading and uploading any\n * changes within the cached paths.\n *\n * Please consider: local changes will attempt sync immediately, and remote\n * changes should also be synced timely when using library defaults. So\n * this is mostly useful for letting users sync manually, when pressing a\n * sync button for example. This might feel safer to them sometimes, esp.\n * when shifting between offline and online a lot.\n *\n * @returns A Promise which resolves when the sync has finished\n */\n startSync (): Promise {\n if (!config.cache) {\n console.warn('Nothing to sync, because caching is disabled.');\n return Promise.resolve();\n }\n this.sync.stopped = false;\n this.syncStopped = false;\n return this.sync.sync();\n }\n\n /**\n * Stop the periodic synchronization.\n */\n stopSync (): void {\n clearTimeout(this._syncTimer);\n this._syncTimer = undefined;\n\n if (this.sync) {\n // FIXME Re-enable when modules are all imports\n // log('[Sync] Stopping sync');\n this.sync.stopped = true;\n } else {\n // The sync class has not been initialized yet, so we make sure it will\n // not start the syncing process as soon as it's initialized.\n // FIXME Re-enable when modules are all imports\n // log('[Sync] Will instantiate sync stopped');\n this.syncStopped = true;\n }\n }\n\n /**\n * Add remoteStorage data module\n *\n * @param module - A data module object\n *\n * @example\n *\n * Usually, you will import your data module from either a package or a local path.\n * Let's say you want to use the\n * [bookmarks module](https://github.com/raucao/remotestorage-module-bookmarks)\n * in order to load data stored from [Webmarks](https://webmarks.5apps.com) for\n * example:\n *\n * ```js\n * import Bookmarks from 'remotestorage-module-bookmarks';\n *\n * remoteStorage.addModule(Bookmarks);\n * ```\n *\n * You can also forgo this function entirely and add modules when creating your\n * remoteStorage instance:\n *\n * ```js\n * const remoteStorage = new RemoteStorage({ modules: [ Bookmarks ] });\n * ```\n *\n * After the module has been added, it can be used like so:\n *\n * ```js\n * remoteStorage.bookmarks.archive.getAll(false)\n * .then(bookmarks => console.log(bookmarks));\n * ```\n */\n addModule (module: RSModule): void {\n const moduleName = module.name;\n const moduleBuilder = module.builder;\n\n Object.defineProperty(this, moduleName, {\n configurable: true,\n get: function () {\n const instance = this._loadModule(moduleName, moduleBuilder);\n Object.defineProperty(this, moduleName, {\n value: instance\n });\n return instance;\n }\n });\n\n if (moduleName.indexOf('-') !== -1) {\n const camelizedName = moduleName.replace(/\\-[a-z]/g, function (s) {\n return s[1].toUpperCase();\n });\n\n Object.defineProperty(this, camelizedName, {\n get: function () {\n return this[moduleName];\n }\n });\n }\n }\n\n /**\n * Load module\n *\n * @private\n */\n _loadModule (moduleName: string, moduleBuilder): { [key: string]: unknown } {\n if (moduleBuilder) {\n const module = moduleBuilder(\n new BaseClient(this, '/' + moduleName + '/'),\n new BaseClient(this, '/public/' + moduleName + '/')\n );\n return module.exports;\n } else {\n throw \"Unknown module: \" + moduleName;\n }\n }\n}\n\n/**\n * @property access\n *\n * Tracking claimed access scopes. A instance.\n*/\nObject.defineProperty(RemoteStorage.prototype, 'access', {\n get: function() {\n const access = new Access();\n Object.defineProperty(this, 'access', {\n value: access\n });\n return access;\n },\n configurable: true\n});\n\n// TODO Clean up/harmonize how modules are loaded and/or document this architecture properly\n//\n// At this point the remoteStorage object has not been created yet.\n// Only its prototype exists so far, so we define a self-constructing\n// property on there:\n\n/**\n * Property: caching\n *\n * Caching settings. A instance.\n */\n// FIXME Was in rs_init of Caching but don't want to require RemoteStorage from there.\nObject.defineProperty(RemoteStorage.prototype, 'caching', {\n configurable: true,\n get: function () {\n const caching = new Caching();\n Object.defineProperty(this, 'caching', {\n value: caching\n });\n return caching;\n }\n});\n\nexport interface RemoteStorage extends EventHandling {}\napplyMixins(RemoteStorage, [EventHandling]);\n\nexport default RemoteStorage;\n","/**\n * This file implements an HTTP request with timeout, on top of fetch or XHR.\n * The returned value always looks like an XHR.\n * It is used by authorize.ts, wireclient.ts, googledrive.ts and dropbox.ts.\n * The timeout is set by RemoteStorage#setRequestTimeout(timeout)\n */\n\nimport log from \"./log\";\nimport config from \"./config\";\n\n\n/**\n * Extracts a retry interval from header,\n * defaulting to three tries and a pause, within sync interval\n * */\nexport function retryAfterMs(xhr: XMLHttpRequest): number {\n const serverMs = parseInt(xhr.getResponseHeader('Retry-After')) * 1000;\n if (serverMs >= 1000) { // sanity check\n return serverMs;\n } else { // value is NaN if no such header, or malformed\n // three tries and a pause, within sync interval,\n // with lower & upper bounds\n return Math.max(1500, Math.min(60_000, Math.round(config.syncInterval / (2.9 + Math.random() * 0.2))));\n }\n}\n\nexport let isArrayBufferView: { (arg0: unknown): any; (object: any): boolean; (object: any): boolean };\n\nif (typeof ((global || window as any).ArrayBufferView) === 'function') {\n isArrayBufferView = function (object) {\n return object && (object instanceof (global || window as any).ArrayBufferView);\n };\n} else {\n const arrayBufferViews = [\n Int8Array, Uint8Array, Int16Array, Uint16Array,\n Int32Array, Uint32Array, Float32Array, Float64Array\n ];\n isArrayBufferView = function (object): boolean {\n for (let i = 0; i < 8; i++) {\n if (object instanceof arrayBufferViews[i]) {\n return true;\n }\n }\n return false;\n };\n}\n\n\nexport interface RequestOptions {\n body?: XMLHttpRequestBodyInit;\n headers?: HeadersInit;\n responseType?: XMLHttpRequestResponseType;\n}\n\nexport async function requestWithTimeout(method: string, url: string, options: RequestOptions): Promise {\n if (typeof fetch === 'function') {\n return _fetchRequestWithTimeout(method, url, options);\n } else if (typeof XMLHttpRequest === 'function') {\n return _xhrRequestWithTimeout(method, url, options);\n } else {\n return Promise.reject('[Requests] You need to add a polyfill for fetch or XMLHttpRequest');\n }\n}\n\nasync function _fetchRequestWithTimeout(method: string, url: string, options: RequestOptions): Promise {\n const abortController = typeof AbortController === 'function' ?\n new AbortController() :\n null;\n let timeoutId;\n\n const timeoutPromise: Promise = new Promise((_resolve, reject) => {\n timeoutId = setTimeout(() => {\n if (abortController) {\n abortController.abort();\n }\n reject('timeout');\n }, config.requestTimeout);\n });\n\n let syntheticXhr;\n const responseHeaders = {};\n\n const networkPromise: Promise = fetch(url, {\n method: method,\n headers: options.headers,\n body: options.body,\n signal: abortController ? abortController.signal : undefined\n }).then((response) => {\n log('[requests fetch]', response);\n\n response.headers.forEach((value: string, headerName: string) => {\n responseHeaders[headerName.toUpperCase()] = value;\n });\n\n syntheticXhr = {\n readyState: 4,\n status: response.status,\n statusText: response.statusText,\n response: undefined,\n getResponseHeader: (headerName: string): string => {\n return responseHeaders[headerName.toUpperCase()] || null;\n },\n // responseText: 'foo',\n responseType: options.responseType,\n responseURL: url,\n };\n switch (options.responseType) {\n case 'arraybuffer':\n return response.arrayBuffer();\n case 'blob':\n return response.blob();\n case 'json':\n return response.json();\n case undefined:\n case '':\n case 'text':\n return response.text();\n default: // document\n throw new Error(\"responseType 'document' is not currently supported using fetch\");\n }\n }).then((processedBody) => {\n syntheticXhr.response = processedBody;\n if (!options.responseType || options.responseType === 'text') {\n syntheticXhr.responseText = processedBody;\n }\n return syntheticXhr;\n }).finally(() => {\n clearTimeout(timeoutId);\n });\n\n return Promise.race([networkPromise, timeoutPromise]);\n}\n\nasync function _xhrRequestWithTimeout(method: string, url: string, options: RequestOptions): Promise {\n return new Promise((resolve, reject) => {\n\n log('[requests XHR]', method, url);\n\n let timedOut = false;\n\n const timer = setTimeout(() => {\n timedOut = true;\n reject('timeout');\n }, config.requestTimeout);\n\n const xhr = new XMLHttpRequest();\n xhr.open(method, url, true);\n\n if (options.responseType) {\n xhr.responseType = options.responseType;\n }\n\n if (options.headers) {\n for (const key in options.headers) {\n xhr.setRequestHeader(key, options.headers[key]);\n }\n }\n\n xhr.onload = (): void => {\n if (timedOut) {\n return;\n }\n clearTimeout(timer);\n resolve(xhr);\n };\n\n xhr.onerror = (error): void => {\n if (timedOut) {\n return;\n }\n clearTimeout(timer);\n reject(error);\n };\n\n let body = options.body;\n\n if (typeof (body) === 'object' && !isArrayBufferView(body) && body instanceof ArrayBuffer) {\n body = new Uint8Array(body);\n }\n xhr.send(body);\n });\n}\n","/**\n * A cache which can propagate changes up to parent folders and generate new\n * revision ids for them. The generated revision id is consistent across\n * different sessions. The keys for the cache are case-insensitive.\n *\n * @param defaultValue {string} the value that is returned for all keys that\n * don't exist in the cache\n * @class\n */\n\nclass RevisionCache {\n defaultValue: string;\n\n private _itemsRev: { [key: string]: any } = {};\n private _storage: { [key: string]: string } = {};\n private _canPropagate = false;\n\n constructor(defaultValue: string) {\n this.defaultValue = defaultValue;\n this.activatePropagation();\n }\n\n\n /**\n * Get a value from the cache or defaultValue, if the key is not in the\n * cache\n */\n get(key: string): string {\n key = key.toLowerCase();\n let stored = this._storage[key];\n if (typeof stored === 'undefined') {\n stored = this.defaultValue;\n this._storage[key] = stored;\n }\n return stored;\n }\n\n /**\n * Set a value\n */\n set(key: string, value): unknown {\n key = key.toLowerCase();\n if (this._storage[key] === value) {\n return value;\n }\n this._storage[key] = value;\n if (!value) {\n delete this._itemsRev[key];\n }\n this._updateParentFolderItemRev(key, value);\n if (this._canPropagate) {\n this._propagate(key);\n }\n return value;\n }\n\n /**\n * Delete a value\n */\n delete(key: string): unknown {\n return this.set(key, null);\n }\n\n /**\n * Disables automatic update of folder revisions when a key value is updated\n */\n deactivatePropagation(): true {\n this._canPropagate = false;\n return true;\n }\n\n /**\n * Enables automatic update of folder revisions when a key value is updated\n * and refreshes the folder revision ids for entire tree.\n */\n activatePropagation(): true {\n if (this._canPropagate) {\n return true;\n }\n this._generateFolderRev(\"/\");\n this._canPropagate = true;\n return true;\n }\n\n /**\n * Returns a hash code for a string.\n */\n private _hashCode(str: string): number {\n let hash = 0;\n if (str.length === 0) {\n return hash;\n }\n for (let i = 0; i < str.length; i++) {\n const chr = str.charCodeAt(i);\n // eslint-disable-next-line no-bitwise\n hash = ((hash << 5) - hash) + chr;\n // eslint-disable-next-line no-bitwise\n hash |= 0; // Convert to 32bit integer\n }\n return hash;\n }\n\n /**\n * Takes an array of strings and returns a hash of the items\n */\n private _generateHash(items: string[]): string {\n // We sort the items before joining them to ensure correct hash generation\n // every time\n const files = items.sort().join('|');\n const hash = \"\" + this._hashCode(files);\n return hash;\n }\n\n /**\n * Update the revision of a key in it's parent folder data\n */\n private _updateParentFolderItemRev(key: string, rev): void {\n if (key !== '/') {\n const parentFolder = this._getParentFolder(key);\n if (!this._itemsRev[parentFolder]) {\n this._itemsRev[parentFolder] = {};\n }\n const parentFolderItemsRev = this._itemsRev[parentFolder];\n if (!rev) {\n delete parentFolderItemsRev[key];\n } else {\n parentFolderItemsRev[key] = rev;\n }\n //reset revision until root\n this._updateParentFolderItemRev(parentFolder, this.defaultValue);\n }\n }\n\n private _getParentFolder(key: string): string {\n return key.substr(0, key.lastIndexOf('/', key.length - 2) + 1);\n }\n\n /**\n * Propagate the changes to the parent folders and generate new revision ids\n * for them\n */\n private _propagate(key: string): void {\n if (key !== '/') {\n const parentFolder = this._getParentFolder(key);\n const parentFolderItemsRev = this._itemsRev[parentFolder];\n const hashItems = [];\n for (const path in parentFolderItemsRev) {\n hashItems.push(parentFolderItemsRev[path]);\n }\n const newRev = this._generateHash(hashItems);\n this.set(parentFolder, newRev);\n }\n }\n\n /**\n * Generate revision id for a folder and it's subfolders, by hashing it's\n * listing\n */\n private _generateFolderRev(folder: string): string {\n const itemsRev = this._itemsRev[folder];\n let hash = this.defaultValue;\n if (itemsRev) {\n const hashItems = [];\n for (const path in itemsRev) {\n const isDir: boolean = (path.substr(-1) === '/');\n let hashItem;\n if (isDir) {\n hashItem = this._generateFolderRev(path);\n } else {\n hashItem = itemsRev[path];\n }\n hashItems.push(hashItem);\n }\n if (hashItems.length > 0) {\n hash = this._generateHash(hashItems);\n }\n }\n this.set(folder, hash);\n return hash;\n }\n}\n\nexport = RevisionCache;\n","class SchemaNotFound extends Error {\n constructor(uri: string) {\n super();\n const error = new Error(\"Schema not found: \" + uri);\n error.name = \"SchemaNotFound\";\n return error;\n }\n}\n\nexport = SchemaNotFound;\n","import {\n InMemoryStorage,\n Session\n} from \"@inrupt/solid-client-authn-browser\";\nimport {\n getFile, overwriteFile, getContentType,\n getPodUrlAll, deleteFile, getContainedResourceUrlAll, getSolidDataset,\n FetchError, UrlString,\n getThing, getInteger, getDatetime\n} from \"@inrupt/solid-client\";\nimport BaseClient from './baseclient';\nimport EventHandling from './eventhandling';\nimport {\n cleanPath,\n applyMixins,\n getJSONFromLocalStorage,\n localStorageAvailable\n} from './util';\nimport {Remote, RemoteBase, RemoteResponse, RemoteSettings} from \"./remote\";\nimport { ConfigObserver } from \"./interfaces/configObserver\";\nimport ConfigStorage from \"./solidStorage\";\nimport Blob from \"blob\";\n\nconst SETTINGS_KEY = 'remotestorage:solid';\n\nlet hasLocalStorage;\n\n/**\n * Overwrite BaseClient's getItemURL with our own implementation\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @private\n */\nfunction hookGetItemURL (rs): void {\n if (rs._origBaseClientGetItemURL) { return; }\n rs._origBaseClientGetItemURL = BaseClient.prototype.getItemURL;\n BaseClient.prototype.getItemURL = function (path: string): string {\n if (typeof path !== 'string') {\n throw 'Argument \\'path\\' of baseClient.getItemURL must be a string';\n }\n if (this.storage.connected) {\n if (path.startsWith('/')) {\n path = path.substring(1);\n }\n return this.selectedPodURL + cleanPath(path);\n } else {\n return undefined;\n }\n };\n}\n\n/**\n * Restore BaseClient's getItemURL original implementation\n *\n * @param {object} rs - RemoteStorage instance\n *\n * @private\n */\nfunction unHookGetItemURL (rs): void {\n if (!rs._origBaseClientGetItemURL) { return; }\n BaseClient.prototype.getItemURL = rs._origBaseClientGetItemURL;\n delete rs._origBaseClientGetItemURL;\n}\n\n/**\n * Convert XMLHttpRequestBodyInit to Blob\n *\n * @param {XMLHttpRequestBodyInit} body - Request body\n * @returns {Blob} Blob equivalent of the body\n * \n * @private\n */\nfunction requestBodyToBlob(body: XMLHttpRequestBodyInit): Blob {\n if (typeof(body) === 'object') {\n if (body instanceof Blob) {\n return body;\n }\n if (body instanceof DataView) {\n return new Blob([ body ], { type : \"application/octet-stream\" });\n }\n if (body instanceof ArrayBuffer) {\n return new Blob([ new DataView(body) ]);\n }\n if (ArrayBuffer.isView(body)) {\n return new Blob([ body ], { type : \"application/octet-stream\" });\n }\n if (body instanceof FormData) {\n return new Blob([ new URLSearchParams([JSON.parse(JSON.stringify(body.entries()))]).toString() ],\n { type : 'application/x-www-form-urlencoded' });\n }\n if (body instanceof URLSearchParams) {\n return new Blob([ body.toString() ], { type : 'application/x-www-form-urlencoded' });\n }\n }\n if (typeof(body) === \"string\") {\n return new Blob([ body ], { type : 'plain/text' });\n }\n \n return new Blob([ JSON.stringify(body) ], { type : 'application/json' });\n}\n\n/**\n * @class Solid\n *\n * To use this backend, you need to specify the authURL before calling connect like so:\n * \n * @example\n * solid.setAuthURL('https://login.example.com');\n * solid.connect();\n * \n * If connect is successful a list of available pods for the Solid account is retrieved and\n * a `pod-not-selected` event is fired. After receiving this event you have to call getPodURLs\n * to get the list of available pods and set one of them to be used by calling setPodURL. After\n * setting the pod URL the `connected` event is fired.\n * \n * You can find a list of running solid servers on the solid project website here:\n * https://solidproject.org/for-developers#hosted-pod-services\n**/\nclass Solid extends RemoteBase implements Remote, ConfigObserver {\n authURL: string;\n podURLs: string[] = null;\n selectedPodURL: string;\n sessionProperties: object;\n configStorage: ConfigStorage;\n session: Session;\n\n constructor(remoteStorage) {\n super(remoteStorage);\n this.online = true;\n this.addEvents(['connected', 'not-connected', 'pod-not-selected']);\n \n // We use a custom ConfigStore to store the solid session in a rs friendly manner to\n // make configuration and disconnect work.\n this.configStorage = new ConfigStorage(this);\n this.session = new Session({\n secureStorage: new InMemoryStorage(), // Inrupt prefers InMemoryStorage for tokens. We respect that.\n insecureStorage: this.configStorage\n }, 'any');\n\n hasLocalStorage = localStorageAvailable();\n\n if (hasLocalStorage){\n const settings = getJSONFromLocalStorage(SETTINGS_KEY);\n if (settings) {\n this.configure(settings);\n }\n }\n }\n\n /**\n * Solid Session storage state changed.\n * \n * This function is called by the ConfigStore that we provided to Session as an insecure storage.\n * \n * @param {string} config - The entire Session configuration object serialized into a string\n * \n * @private\n */\n onConfigChanged(config: string): void {\n if (config) {\n const sessionConfig = JSON.parse(config);\n\n if (typeof sessionConfig.clientSecret !== 'undefined') {\n let settings = getJSONFromLocalStorage(SETTINGS_KEY);\n\n if (!settings) {\n settings = { };\n }\n\n settings.href = this.authURL;\n settings.properties = {\n sessionProperties: sessionConfig,\n podURL: this.selectedPodURL\n };\n\n this.sessionProperties = sessionConfig;\n\n localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings));\n return;\n }\n }\n\n this.podURLs = null;\n localStorage.removeItem(SETTINGS_KEY);\n }\n\n /**\n * Configure the Solid backend.\n *\n * @param {Object} settings\n * @param {string} [settings.userAddress] - The user's identity prodiver URL\n * @param {string} [settings.href] - The authURL\n * @param {object} [settings.properties] - All storage for Inrupt session is saved into properties plus the pod URL\n *\n * @protected\n */\n configure (settings: RemoteSettings) {\n // We only update this.userAddress if settings.userAddress is set to a string or to null\n if (typeof settings.userAddress !== 'undefined') { this.userAddress = settings.userAddress; }\n // We only update this.authURL if settings.href is set to a string or to null\n if (typeof settings.href !== 'undefined') { this.authURL = settings.href; }\n // Read session properties and pod URL from the properties if it exists\n if (typeof settings.properties !== 'undefined') {\n const properties = settings.properties as {sessionProperties: object, podURL: string};\n\n if (properties) {\n if (typeof properties.sessionProperties !== 'undefined') {\n this.sessionProperties = properties.sessionProperties;\n }\n else {\n this.sessionProperties = null;\n }\n if (typeof properties.podURL !== 'undefined') {\n this.selectedPodURL = properties.podURL;\n }\n else {\n this.selectedPodURL = null;\n }\n }\n else {\n this.sessionProperties = null;\n this.selectedPodURL = null;\n }\n }\n\n const writeSettingsToCache = function() {\n if (hasLocalStorage) {\n localStorage.setItem(SETTINGS_KEY, JSON.stringify({\n userAddress: this.userAddress,\n href: this.authURL,\n properties: {\n sessionProperties: this.sessionProperties,\n podURL: this.selectedPodURL\n }\n }));\n }\n };\n\n const handleError = function() {\n this.connected = false;\n this.sessionProperties = null;\n this.podURLs = null;\n if (hasLocalStorage) {\n localStorage.removeItem(SETTINGS_KEY);\n }\n };\n\n if (this.sessionProperties) {\n this.configStorage.setConfig(JSON.stringify(this.sessionProperties));\n this.connected = this.session.info && this.session.info.isLoggedIn;\n writeSettingsToCache.apply(this);\n } else {\n handleError.apply(this);\n }\n }\n\n /**\n * Set the auth URL\n * \n * @param {string} authURL - Auth URL\n * \n * @public\n */\n setAuthURL(authURL: string): void {\n this.authURL = authURL;\n }\n\n /**\n * Get a list of pod URLs for this Solid account.\n * \n * If the Solid Session is not connected, this function returns null.\n * \n * @returns Get the list of pod URLs\n * \n * @public\n */\n getPodURLs(): string[] {\n return this.podURLs;\n }\n\n /**\n * Set the pod URL to use as the storage.\n * \n * Pod URL must be one of the URLs provided by the getPodURLs function. This function does\n * not validate this constraint.\n * \n * If the Solid Session is connected and the pod URL is updated to be null, a\n * `pod-not-selected` event will be fired. If Session is connected and the pod URL is set,\n * a `connected` event will be fired.\n * \n * @param {string} podURL - URL of the pod to be used as storage\n * \n * @public\n */\n setPodURL(podURL: string): void {\n if (this.selectedPodURL === podURL) {\n return;\n }\n\n this.selectedPodURL = podURL;\n\n if (this.session.info && this.session.info.isLoggedIn) {\n if (this.selectedPodURL) {\n let settings = getJSONFromLocalStorage(SETTINGS_KEY);\n if (!settings) {\n settings = { };\n }\n \n settings.userAddress = this.session.info.webId;\n settings.href = this.authURL;\n settings.properties = {\n sessionProperties: this.sessionProperties,\n podURL: this.selectedPodURL\n };\n \n localStorage.setItem(SETTINGS_KEY, JSON.stringify(settings));\n \n this.connected = true;\n this._emit('connected');\n }\n else {\n this.connected = false;\n this.rs._emit('pod-not-selected');\n }\n }\n }\n\n /**\n * Get the pod URL that is being used as the storage.\n * \n * @returns {string} The in-use pod URL or null\n * \n * @public\n */\n getPodURL(): string {\n return this.selectedPodURL;\n }\n\n /**\n * Initiate the authorization flow's OAuth dance.\n * \n * @public\n */\n connect (): void {\n this.rs.setBackend('solid');\n \n if (!this.authURL) {\n this.rs._emit('error', new Error(`No authURL is configured.`));\n return;\n }\n\n this.session.login({\n oidcIssuer: this.authURL,\n redirectUrl: new URL(\"/\", window.location.href).toString(),\n clientName: \"Remote Storage\"\n });\n }\n\n /**\n * Get the connected Solid session\n * \n * @returns {Session} that is being used by this instance or null if Session is not connected\n * \n * @public\n */\n getSession(): Session {\n return (this.session.info && this.session.info.isLoggedIn)?this.session:null;\n }\n\n /**\n * Convert path to file URL\n *\n * @param {string} path - Path of the resource\n * @returns {string} Full URL of the resource on the pod\n * \n * @private\n */\n getFileURL(path: string): string {\n if (path.startsWith('/')) {\n path = path.substring(1);\n }\n if (path.length === 0) {\n path = '/';\n }\n return this.selectedPodURL + path;\n }\n\n /**\n * Request a resource (file or directory).\n *\n * @param {string} path - Path of the resource\n * @param {Object} options - Request options\n * @returns {Promise} Resolves with an object containing the status code,\n * body, content-type and revision\n *\n * @protected\n */\n get (path: string, options: { ifNoneMatch?: string } = {}): Promise {\n const fileURL = this.getFileURL(path);\n\n if (path.slice(-1) === '/') {\n return getSolidDataset(fileURL, { fetch: this.session.fetch }).then(containerDataset => {\n const URLs: UrlString[] = getContainedResourceUrlAll(containerDataset);\n const listing = URLs.reduce((map, item) => {\n const itemName = item.substring(fileURL.length);\n const isFolder = itemName.slice(-1) === '/';\n\n if (isFolder) {\n map[itemName] = { }; // We are skipping ETag\n }\n else {\n const fileDataset = getThing(containerDataset, item);\n\n map[itemName] = {\n 'Content-Length': getInteger(fileDataset, 'http://www.w3.org/ns/posix/stat#size'),\n 'Last-Modified': getDatetime(fileDataset, 'http://purl.org/dc/terms/modified').toUTCString(), // date.toUTCString()\n };\n }\n\n return map;\n }, { });\n \n return Promise.resolve({\n statusCode: 200,\n body: listing,\n contentType: 'application/json; charset=UTF-8',\n // revision: ? Skipping ETag\n } as RemoteResponse);\n }).catch(error => {\n if (error instanceof FetchError) {\n if (error.statusCode === 404) {\n return Promise.resolve({\n statusCode: 200,\n body: { },\n contentType: 'application/json; charset=UTF-8',\n // revision: ?\n } as RemoteResponse);\n }\n }\n\n return Promise.reject('Failed to get container: ' + error.message);\n });\n }\n\n return getFile(fileURL, { fetch: this.session.fetch}).then(file => {\n return {\n statusCode: 200,\n body: file,\n contentType: getContentType(file)\n } as RemoteResponse;\n }).catch(error => {\n const statusCode = error.statusCode;\n\n if (statusCode === 401 || statusCode === 403 || statusCode === 404) {\n return {\n statusCode: statusCode\n } as RemoteResponse;\n }\n\n return Promise.reject('Failed to get the file: ' + error.message);\n });\n }\n\n /**\n * Create or update a file.\n *\n * @param {string} path - File path\n * @param body - File content\n * @param {string} contentType - File content-type\n * @param {Object} options\n * @param {string} options.ifNoneMatch - Only create or update the file if the\n * current ETag doesn't match this string\n * @returns {Promise} Resolves with an object containing the status code,\n * content-type and revision\n *\n * @protected\n */\n put (path: string, body: XMLHttpRequestBodyInit, contentType: string, options: { ifMatch?: string; ifNoneMatch?: string } = {}): Promise {\n const fileURL = this.getFileURL(path);\n const fetch = this.session.fetch;\n\n const overwrite = function(): Promise {\n const blob = requestBodyToBlob(body);\n return overwriteFile(fileURL, blob, {\n contentType: contentType,\n fetch: fetch\n }).then(savedFile => {\n return {\n statusCode: 201\n } as RemoteResponse;\n }).catch(error => {\n return Promise.reject(\"PUT failed with status \" + error.statusCode + \" (\" + error.message + \")\");\n });\n };\n\n return getFile(fileURL, { fetch: fetch}).then(file => {\n if (options && (options.ifNoneMatch === '*')) {\n return {statusCode: 412, revision: 'conflict'} as RemoteResponse;\n }\n\n return overwrite();\n }).catch(error => {\n const statusCode = error.statusCode;\n\n if (statusCode === 404) {\n return overwrite();\n }\n\n return Promise.reject(\"PUT failed with status \" + statusCode + \" (\" + error.message + \")\");\n });\n }\n\n /**\n * Delete a file.\n *\n * @param {string} path - File path\n * @param {Object} options\n * @param {string} options.ifMatch - only delete the file if it's ETag\n * matches this string\n * @returns {Promise} Resolves with an object containing the status code\n *\n * @protected\n */\n delete (path: string, options: { ifMatch?: string } = {}): Promise {\n const fileURL = this.getFileURL(path);\n\n return deleteFile(fileURL, { fetch: this.session.fetch }).then(() => {\n return {statusCode: 200} as RemoteResponse;\n }).catch(error => {\n const statusCode = error.statusCode;\n\n if (statusCode === 404) {\n return {statusCode: 200} as RemoteResponse;\n }\n\n return Promise.reject(\"DELETE failed with status \" + statusCode + \" (\" + error.message + \")\");\n });\n }\n\n /**\n * Initialize the Solid backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n static _rs_init (remoteStorage): void {\n const solid = new Solid(remoteStorage);\n remoteStorage.solid = solid;\n if (remoteStorage.backend === 'solid') {\n remoteStorage._origRemote = remoteStorage.remote;\n remoteStorage.remote = remoteStorage.solid;\n\n hookGetItemURL(remoteStorage);\n\n (async () => {\n const session = solid.session;\n await session.handleIncomingRedirect();\n if (session.info.isLoggedIn) {\n const webId = session.info.webId;\n solid.userAddress = webId;\n\n if (solid.selectedPodURL) {\n solid._emit('connected');\n }\n else {\n solid.podURLs = await getPodUrlAll(webId, { fetch: fetch });\n remoteStorage._emit('pod-not-selected');\n }\n }\n else if (solid.sessionProperties) {\n solid.connect();\n }\n })();\n }\n }\n\n /**\n * Inform about the availability of the Solid backend.\n *\n * @returns {Boolean}\n *\n * @protected\n */\n static _rs_supported (): boolean {\n return true;\n }\n\n /**\n * Remove Solid as a backend.\n *\n * @param {Object} remoteStorage - RemoteStorage instance\n *\n * @protected\n */\n static _rs_cleanup (remoteStorage): void {\n remoteStorage.setBackend(undefined);\n if (remoteStorage._origRemote) {\n remoteStorage.remote = remoteStorage._origRemote;\n delete remoteStorage._origRemote;\n }\n unHookGetItemURL(remoteStorage);\n }\n}\n\napplyMixins(Solid, [EventHandling]);\n\nexport = Solid;\n","import {\n IStorage,\n} from \"@inrupt/solid-client-authn-browser\";\nimport { ConfigObserver } from \"./interfaces/configObserver\";\n\nclass BrowserStorage implements IStorage {\n get storage(): typeof window.localStorage {\n return window.localStorage;\n }\n\n async get(key: string): Promise {\n return this.storage.getItem(key) || undefined;\n }\n\n async set(key: string, value: string): Promise {\n this.storage.setItem(key, value);\n }\n\n async delete(key: string): Promise {\n this.storage.removeItem(key);\n }\n}\n\nexport default class ConfigStorage implements IStorage {\n private browserStorage: BrowserStorage = new BrowserStorage();\n private config: string;\n private observer: ConfigObserver;\n\n constructor(observer: ConfigObserver) {\n this.observer = observer;\n }\n\n private isConfigKey(key: string): boolean {\n return key.startsWith('solidClientAuthenticationUser');\n }\n\n public setConfig(config: string): void {\n this.config = config;\n }\n\n async get(key: string): Promise {\n if (this.isConfigKey(key)) {\n return this.config;\n }\n else {\n this.browserStorage.get(key);\n }\n }\n\n async set(key: string, value: string): Promise {\n if (this.isConfigKey(key)) {\n if (this.config) {\n const oldConfig = JSON.parse(this.config);\n const additionalConfig = JSON.parse(value);\n const newConfig = { ...oldConfig, ...additionalConfig };\n this.config = JSON.stringify(newConfig);\n }\n else {\n this.config = value;\n }\n this.observer.onConfigChanged(this.config);\n }\n else {\n this.browserStorage.set(key, value);\n }\n }\n\n async delete(key: string): Promise {\n if (this.isConfigKey(key)) {\n this.config = undefined;\n this.observer.onConfigChanged(this.config);\n }\n else {\n this.browserStorage.delete(key);\n }\n }\n}","class SyncError extends Error {\n originalError: Error;\n\n constructor (originalError: string | Error) {\n super();\n this.name = 'SyncError';\n this.message = 'Sync failed: ';\n if (typeof originalError === 'string') {\n this.message += originalError;\n } else {\n this.message += originalError.message;\n this.stack = originalError.stack;\n this.originalError = originalError;\n }\n }\n}\n\nexport = SyncError;\n","import type { RSNode, RSNodes } from './interfaces/rs_node';\nimport config from './config';\nimport Env from './env';\nimport EventHandling from './eventhandling';\nimport log from './log';\nimport Authorize from './authorize';\nimport SyncError from './sync-error';\nimport UnauthorizedError from './unauthorized-error';\nimport {\n applyMixins,\n deepClone,\n equal,\n isFolder,\n isDocument,\n pathsFromRoot\n} from './util';\n\nlet syncCycleCb, syncOnConnect;\n\ninterface ResponseStatus {\n statusCode: string | number;\n successful: boolean | undefined;\n conflict: boolean | undefined;\n unAuth: boolean | undefined;\n notFound: boolean | undefined;\n changed: boolean | undefined;\n networkProblems: boolean | undefined;\n}\n\ninterface SyncTask {\n action: any;\n path: string;\n promise: Promise;\n}\n\nfunction taskFor (action, path: string, promise: Promise): SyncTask {\n return { action, path, promise };\n}\n\nfunction nodeChanged (node: RSNode, etag: string): boolean {\n return node.common.revision !== etag &&\n (!node.remote || node.remote.revision !== etag);\n}\n\nfunction isStaleChild (node: RSNode): boolean {\n return node.remote && node.remote.revision && !node.remote.itemsMap && !node.remote.body;\n}\n\nfunction hasCommonRevision (node: RSNode): boolean {\n return node.common && node.common.revision;\n}\n\nfunction hasNoRemoteChanges (node: RSNode): boolean {\n if (node.remote && node.remote.revision &&\n node.remote.revision !== node.common.revision) {\n return false;\n }\n return (node.common.body === undefined && node.remote.body === false) ||\n (node.remote.body === node.common.body &&\n node.remote.contentType === node.common.contentType);\n}\n\nfunction mergeMutualDeletion (node: RSNode): RSNode {\n if (node.remote && node.remote.body === false &&\n node.local && node.local.body === false) {\n delete node.local;\n }\n return node;\n}\n\nfunction handleVisibility (env, rs): void {\n function handleChange (isForeground): void {\n const oldValue = rs.getCurrentSyncInterval();\n config.isBackground = !isForeground;\n const newValue = rs.getCurrentSyncInterval();\n rs._emit('sync-interval-change', {oldValue: oldValue, newValue: newValue});\n }\n env.on('background', () => handleChange(false));\n env.on('foreground', () => handleChange(true));\n}\n\n/**\n * This class basically does six things:\n *\n * - retrieve the remote version of relevant documents and folders\n * - add all local and remote documents together into one tree\n * - push local documents out if they don't exist remotely\n * - push local changes out to remote documents (conditionally, to avoid race\n * conditions where both have changed)\n * - adopt the local version of a document to its remote version if both exist\n * and they differ\n * - delete the local version of a document if it was deleted remotely\n * - if any GET requests were waiting for remote data, resolve them once this\n * data comes in.\n *\n * It does this using requests to documents and folders. Whenever a folder GET\n * comes in, it gives information about all the documents it contains (this is\n * the `markChildren` function).\n **/\nexport class Sync {\n // TODO remove when RS is defined, or if unnecessary\n rs: { [propName: string]: any };\n\n numThreads: number;\n done: boolean;\n stopped: boolean;\n\n // TODO define in more detail\n _tasks: object;\n _running: object;\n _timeStarted: object;\n _finishedTasks: Array = [];\n\n constructor (remoteStorage: object) {\n this.rs = remoteStorage;\n\n this._tasks = {};\n this._running = {};\n this._timeStarted = {};\n\n this.numThreads = 10;\n\n this.rs.local.onDiff(path => {\n this.addTask(path);\n this.doTasks();\n });\n\n this.rs.caching.onActivate((path: string): void => {\n this.addTask(path);\n this.doTasks();\n });\n\n this.addEvents(['done', 'req-done']);\n }\n\n public now (): number {\n return new Date().getTime();\n }\n\n public queueGetRequest (path: string): object {\n return new Promise((resolve, reject) => {\n if (!this.rs.remote.connected) {\n reject('cannot fulfill maxAge requirement - remote is not connected');\n } else if (!this.rs.remote.online) {\n reject('cannot fulfill maxAge requirement - remote is not online');\n } else {\n this.addTask(path, function (): void {\n this.rs.local.get(path).then(r => resolve(r));\n }.bind(this));\n\n this.doTasks();\n }\n });\n }\n\n // FIXME force02 sounds like rs spec 02, thus could be removed\n public corruptServerItemsMap (itemsMap, force02?: boolean): boolean {\n if ((typeof(itemsMap) !== 'object') || (Array.isArray(itemsMap))) {\n return true;\n }\n\n for (const itemName in itemsMap) {\n const item = itemsMap[itemName];\n\n if (typeof(item) !== 'object') {\n return true;\n }\n if (typeof(item.ETag) !== 'string') {\n return true;\n }\n if (isFolder(itemName)) {\n if (itemName.substring(0, itemName.length-1).indexOf('/') !== -1) {\n return true;\n }\n } else {\n if (itemName.indexOf('/') !== -1) {\n return true;\n }\n if (force02) {\n if (typeof(item['Content-Type']) !== 'string') {\n return true;\n }\n if (typeof(item['Content-Length']) !== 'number') {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n public corruptItemsMap (itemsMap): boolean {\n if ((typeof(itemsMap) !== 'object') || (Array.isArray(itemsMap))) {\n return true;\n }\n\n for (const path in itemsMap) {\n if (typeof itemsMap[path] !== 'boolean') {\n return true;\n }\n }\n\n return false;\n }\n\n public corruptRevision (rev): boolean {\n return ((typeof(rev) !== 'object') ||\n (Array.isArray(rev)) ||\n (rev.revision && typeof(rev.revision) !== 'string') ||\n (rev.body && typeof(rev.body) !== 'string' && typeof(rev.body) !== 'object') ||\n (rev.contentType && typeof(rev.contentType) !== 'string') ||\n (rev.contentLength && typeof(rev.contentLength) !== 'number') ||\n (rev.timestamp && typeof(rev.timestamp) !== 'number') ||\n (rev.itemsMap && this.corruptItemsMap(rev.itemsMap)));\n }\n\n public isCorrupt (node: RSNode): boolean {\n return ((typeof(node) !== 'object') ||\n (Array.isArray(node)) ||\n (typeof(node.path) !== 'string') ||\n (this.corruptRevision(node.common)) ||\n (node.local && this.corruptRevision(node.local)) ||\n (node.remote && this.corruptRevision(node.remote)) ||\n (node.push && this.corruptRevision(node.push)));\n }\n\n public hasTasks (): boolean {\n return Object.getOwnPropertyNames(this._tasks).length > 0;\n }\n\n public async collectDiffTasks (): Promise {\n let num = 0;\n\n return this.rs.local.forAllNodes((node: RSNode) => {\n if (num > 100) { return; }\n\n if (this.isCorrupt(node)) {\n log('[Sync] WARNING: corrupt node in local cache', node);\n if (typeof(node) === 'object' && node.path) {\n this.addTask(node.path);\n num++;\n }\n } else if (this.needsFetch(node) && this.rs.access.checkPathPermission(node.path, 'r')) {\n this.addTask(node.path);\n num++;\n } else if (isDocument(node.path) && this.needsPush(node) &&\n this.rs.access.checkPathPermission(node.path, 'rw')) {\n this.addTask(node.path);\n num++;\n }\n })\n .then((): number => num)\n .catch(e => { throw e; });\n }\n\n public inConflict (node: RSNode): boolean {\n return (node.local && node.remote &&\n (node.remote.body !== undefined || node.remote.itemsMap));\n }\n\n public needsRefresh (node: RSNode): boolean {\n if (node.common) {\n if (!node.common.timestamp) {\n return true;\n }\n return (this.now() - node.common.timestamp > config.syncInterval);\n }\n return false;\n }\n\n public needsFetch (node: RSNode): boolean {\n if (this.inConflict(node)) {\n return true;\n }\n if (node.common &&\n node.common.itemsMap === undefined &&\n node.common.body === undefined) {\n return true;\n }\n if (node.remote &&\n node.remote.itemsMap === undefined &&\n node.remote.body === undefined) {\n return true;\n }\n return false;\n }\n\n public needsPush (node: RSNode): boolean {\n if (this.inConflict(node)) {\n return false;\n }\n if (node.local && !node.push) {\n return true;\n }\n }\n\n public needsRemotePut (node: RSNode): boolean {\n return node.local && node.local.body;\n }\n\n public needsRemoteDelete (node: RSNode): boolean {\n return node.local && node.local.body === false;\n }\n\n public getParentPath (path: string): string {\n const parts = path.match(/^(.*\\/)([^\\/]+\\/?)$/);\n\n if (parts) {\n return parts[1];\n } else {\n throw new Error('Not a valid path: \"'+path+'\"');\n }\n }\n\n public deleteChildPathsFromTasks (): void {\n for (const path in this._tasks) {\n const paths = pathsFromRoot(path);\n\n for (let i=1; i {\n return this.rs.local.forAllNodes((node: RSNode) => {\n let parentPath: string;\n if (this.needsRefresh(node)) {\n try {\n parentPath = this.getParentPath(node.path);\n } catch(e) {\n // node.path is already '/', can't take parentPath\n }\n if (parentPath && this.rs.access.checkPathPermission(parentPath, 'r')) {\n this.addTask(parentPath);\n } else if (this.rs.access.checkPathPermission(node.path, 'r')) {\n this.addTask(node.path);\n }\n }\n })\n .then(() => this.deleteChildPathsFromTasks())\n .catch((e: Error) => { throw e; });\n }\n\n public flush (nodes: RSNodes): RSNodes {\n for (const path in nodes) {\n // Strategy is 'FLUSH' and no local changes exist\n if (this.rs.caching.checkPath(path) === 'FLUSH' &&\n nodes[path] && !nodes[path].local) {\n log('[Sync] Flushing', path);\n nodes[path] = undefined; // Cause node to be flushed from cache\n }\n }\n return nodes;\n }\n\n public doTask (path: string): object {\n return this.rs.local.getNodes([path]).then((nodes: RSNodes) => {\n const node = nodes[path];\n // First fetch:\n if (typeof(node) === 'undefined') {\n return taskFor('get', path, this.rs.remote.get(path));\n }\n // Fetch known-stale child:\n else if (isStaleChild(node)) {\n return taskFor('get', path, this.rs.remote.get(path));\n }\n // Push PUT:\n else if (this.needsRemotePut(node)) {\n node.push = deepClone(node.local);\n node.push.timestamp = this.now();\n\n return this.rs.local.setNodes(this.flush(nodes)).then(() => {\n let options;\n if (hasCommonRevision(node)) {\n options = { ifMatch: node.common.revision };\n } else {\n // Initial PUT (fail if something is already there)\n options = { ifNoneMatch: '*' };\n }\n\n return taskFor('put', path,\n this.rs.remote.put(path, node.push.body, node.push.contentType, options)\n );\n });\n }\n // Push DELETE:\n else if (this.needsRemoteDelete(node)) {\n node.push = { body: false, timestamp: this.now() };\n\n return this.rs.local.setNodes(this.flush(nodes)).then(() => {\n if (hasCommonRevision(node)) {\n return taskFor('delete', path,\n this.rs.remote.delete(path, { ifMatch: node.common.revision })\n );\n } else { // Ascertain current common or remote revision first\n return taskFor('get', path, this.rs.remote.get(path));\n }\n });\n }\n // Conditional refresh:\n else if (hasCommonRevision(node)) {\n return taskFor('get', path,\n this.rs.remote.get(path, { ifNoneMatch: node.common.revision })\n );\n }\n else {\n return taskFor('get', path, this.rs.remote.get(path));\n }\n });\n }\n\n public autoMergeFolder (node: RSNode): RSNode {\n if (node.remote.itemsMap) {\n node.common = node.remote;\n delete node.remote;\n\n if (node.common.itemsMap) {\n for (const itemName in node.common.itemsMap) {\n if (!node.local.itemsMap[itemName]) {\n // Indicates the node is either newly being fetched\n // has been deleted locally (whether or not leading to conflict);\n // before listing it in local listings, check if a local deletion\n // exists.\n node.local.itemsMap[itemName] = false;\n }\n }\n\n if (equal(node.local.itemsMap, node.common.itemsMap)) {\n delete node.local;\n }\n }\n }\n return node;\n }\n\n public autoMergeDocument (node: RSNode): RSNode {\n if (hasNoRemoteChanges(node)) {\n node = mergeMutualDeletion(node);\n delete node.remote;\n } else if (node.remote.body !== undefined) {\n // keep/revert:\n log('[Sync] Emitting keep/revert');\n\n this.rs.local._emitChange({\n origin: 'conflict',\n path: node.path,\n oldValue: node.local.body,\n newValue: node.remote.body,\n lastCommonValue: node.common.body,\n oldContentType: node.local.contentType,\n newContentType: node.remote.contentType,\n lastCommonContentType: node.common.contentType\n });\n\n if (node.remote.body) {\n node.common = node.remote;\n } else {\n node.common = {};\n }\n delete node.remote;\n delete node.local;\n }\n\n return node;\n }\n\n public autoMerge (node: RSNode): RSNode {\n if (node.remote) {\n if (node.local) {\n if (isFolder(node.path)) {\n return this.autoMergeFolder(node);\n } else {\n return this.autoMergeDocument(node);\n }\n } else { // no local changes\n if (isFolder(node.path)) {\n if (node.remote.itemsMap !== undefined) {\n node.common = node.remote;\n delete node.remote;\n }\n } else {\n if (node.remote.body !== undefined) {\n const change = {\n origin: 'remote',\n path: node.path,\n oldValue: (node.common.body === false ? undefined : node.common.body),\n newValue: (node.remote.body === false ? undefined : node.remote.body),\n oldContentType: node.common.contentType,\n newContentType: node.remote.contentType\n };\n if (change.oldValue || change.newValue) {\n this.rs.local._emitChange(change);\n }\n\n if (!node.remote.body) { // no remote, so delete/don't create\n return;\n }\n\n node.common = node.remote;\n delete node.remote;\n }\n }\n }\n } else {\n if (node.common.body) {\n this.rs.local._emitChange({\n origin: 'remote',\n path: node.path,\n oldValue: node.common.body,\n newValue: undefined,\n oldContentType: node.common.contentType,\n newContentType: undefined\n });\n }\n\n return undefined;\n }\n\n return node;\n }\n\n public async updateCommonTimestamp (path: string, revision: string): Promise {\n return this.rs.local.getNodes([path]).then((nodes: RSNodes) => {\n if (nodes[path] &&\n nodes[path].common &&\n nodes[path].common.revision === revision) {\n nodes[path].common.timestamp = this.now();\n }\n return this.rs.local.setNodes(this.flush(nodes));\n });\n }\n\n public async markChildren (path, itemsMap, changedNodes: RSNodes, missingChildren): Promise {\n const paths = [];\n const meta = {};\n const recurse = {};\n\n for (const item in itemsMap) {\n paths.push(path+item);\n meta[path+item] = itemsMap[item];\n }\n for (const childName in missingChildren) {\n paths.push(path+childName);\n }\n\n return this.rs.local.getNodes(paths).then((nodes: RSNodes) => {\n let cachingStrategy;\n let node;\n\n for (const nodePath in nodes) {\n node = nodes[nodePath];\n\n if (meta[nodePath]) {\n if (node && node.common) {\n if (nodeChanged(node, meta[nodePath].ETag)) {\n changedNodes[nodePath] = deepClone(node);\n changedNodes[nodePath].remote = {\n revision: meta[nodePath].ETag,\n timestamp: this.now()\n };\n changedNodes[nodePath] = this.autoMerge(changedNodes[nodePath]);\n }\n } else {\n cachingStrategy = this.rs.caching.checkPath(nodePath);\n if (cachingStrategy === 'ALL') {\n changedNodes[nodePath] = {\n path: nodePath,\n common: {\n timestamp: this.now()\n },\n remote: {\n revision: meta[nodePath].ETag,\n timestamp: this.now()\n }\n };\n }\n }\n\n if (changedNodes[nodePath] && meta[nodePath]['Content-Type']) {\n changedNodes[nodePath].remote.contentType = meta[nodePath]['Content-Type'];\n }\n\n if (changedNodes[nodePath] && meta[nodePath]['Content-Length']) {\n changedNodes[nodePath].remote.contentLength = meta[nodePath]['Content-Length'];\n }\n } else if (missingChildren[nodePath.substring(path.length)] && node && node.common) {\n if (node.common.itemsMap) {\n for (const commonItem in node.common.itemsMap) {\n recurse[nodePath+commonItem] = true;\n }\n }\n\n if (node.local && node.local.itemsMap) {\n for (const localItem in node.local.itemsMap) {\n recurse[nodePath+localItem] = true;\n }\n }\n\n if (node.remote || isFolder(nodePath)) {\n changedNodes[nodePath] = undefined;\n } else {\n changedNodes[nodePath] = this.autoMerge(node);\n\n if (typeof changedNodes[nodePath] === 'undefined') {\n const parentPath = this.getParentPath(nodePath);\n const parentNode = changedNodes[parentPath];\n const itemName = nodePath.substring(path.length);\n if (parentNode && parentNode.local) {\n delete parentNode.local.itemsMap[itemName];\n\n if (equal(parentNode.local.itemsMap, parentNode.common.itemsMap)) {\n delete parentNode.local;\n }\n }\n }\n }\n }\n }\n\n return this.deleteRemoteTrees(Object.keys(recurse), changedNodes)\n .then(changedObjs2 => {\n return this.rs.local.setNodes(this.flush(changedObjs2));\n });\n });\n }\n\n public async deleteRemoteTrees (paths: Array, changedNodes: RSNodes): Promise {\n if (paths.length === 0) {\n return Promise.resolve(changedNodes);\n }\n\n return this.rs.local.getNodes(paths).then(async (nodes: RSNodes) => {\n const subPaths = {};\n\n function collectSubPaths (folder, path: string): void {\n if (folder && folder.itemsMap) {\n for (const itemName in folder.itemsMap) {\n subPaths[path+itemName] = true;\n }\n }\n }\n\n for (const path in nodes) {\n const node = nodes[path];\n\n // TODO Why check for the node here? I don't think this check ever applies\n if (!node) { continue; }\n\n if (isFolder(path)) {\n collectSubPaths(node.common, path);\n collectSubPaths(node.local, path);\n } else {\n if (node.common && typeof(node.common.body) !== undefined) {\n changedNodes[path] = deepClone(node);\n changedNodes[path].remote = {\n body: false,\n timestamp: this.now()\n };\n changedNodes[path] = this.autoMerge(changedNodes[path]);\n }\n }\n }\n\n // Recurse whole tree depth levels at once:\n return this.deleteRemoteTrees(Object.keys(subPaths), changedNodes)\n .then(changedNodes2 => {\n return this.rs.local.setNodes(this.flush(changedNodes2));\n });\n });\n }\n\n public async completeFetch (path: string, bodyOrItemsMap: object, contentType: string, revision: string): Promise {\n let paths: Array;\n let parentPath: string;\n const pathsFromRootArr = pathsFromRoot(path);\n\n if (isFolder(path)) {\n paths = [path];\n } else {\n parentPath = pathsFromRootArr[1];\n paths = [path, parentPath];\n }\n\n return this.rs.local.getNodes(paths).then((nodes: RSNodes) => {\n let itemName: string;\n let node: RSNode = nodes[path];\n let parentNode: RSNode;\n const missingChildren = {};\n\n function collectMissingChildren (folder): void {\n if (folder && folder.itemsMap) {\n for (itemName in folder.itemsMap) {\n if (!bodyOrItemsMap[itemName]) {\n missingChildren[itemName] = true;\n }\n }\n }\n }\n\n if (typeof(node) !== 'object' ||\n node.path !== path ||\n typeof(node.common) !== 'object') {\n node = { path: path, common: {} };\n nodes[path] = node;\n }\n\n node.remote = {\n revision: revision,\n timestamp: this.now()\n };\n\n if (isFolder(path)) {\n collectMissingChildren(node.common);\n collectMissingChildren(node.remote);\n\n node.remote.itemsMap = {};\n for (itemName in bodyOrItemsMap) {\n node.remote.itemsMap[itemName] = true;\n }\n } else {\n node.remote.body = bodyOrItemsMap;\n node.remote.contentType = contentType;\n\n parentNode = nodes[parentPath];\n if (parentNode && parentNode.local && parentNode.local.itemsMap) {\n itemName = path.substring(parentPath.length);\n parentNode.local.itemsMap[itemName] = true;\n if (equal(parentNode.local.itemsMap, parentNode.common.itemsMap)) {\n delete parentNode.local;\n }\n }\n }\n\n nodes[path] = this.autoMerge(node);\n\n return {\n toBeSaved: nodes,\n missingChildren: missingChildren\n };\n });\n }\n\n public async completePush (path: string, action, conflict, revision: string): Promise {\n return this.rs.local.getNodes([path]).then((nodes: RSNodes) => {\n const node = nodes[path];\n\n if (!node.push) {\n this.stopped = true;\n throw new Error('completePush called but no push version!');\n }\n\n if (conflict) {\n log('[Sync] We have a conflict');\n\n if (!node.remote || node.remote.revision !== revision) {\n node.remote = {\n revision: revision || 'conflict',\n timestamp: this.now()\n };\n delete node.push;\n }\n\n nodes[path] = this.autoMerge(node);\n } else {\n node.common = {\n revision: revision,\n timestamp: this.now()\n };\n\n if (action === 'put') {\n node.common.body = node.push.body;\n node.common.contentType = node.push.contentType;\n\n if (equal(node.local.body, node.push.body) &&\n node.local.contentType === node.push.contentType) {\n delete node.local;\n }\n\n delete node.push;\n } else if (action === 'delete') {\n if (node.local.body === false) { // No new local changes since push; flush it.\n nodes[path] = undefined;\n } else {\n delete node.push;\n }\n }\n }\n\n return this.rs.local.setNodes(this.flush(nodes));\n });\n }\n\n public async dealWithFailure (path: string): Promise {\n return this.rs.local.getNodes([path]).then((nodes: RSNodes) => {\n if (nodes[path]) {\n delete nodes[path].push;\n return this.rs.local.setNodes(this.flush(nodes));\n }\n });\n }\n\n public interpretStatus (statusCode: string | number): ResponseStatus {\n const status: ResponseStatus = {\n statusCode: statusCode,\n successful: undefined,\n conflict: undefined,\n unAuth: undefined,\n notFound: undefined,\n changed: undefined,\n networkProblems: undefined\n };\n\n if (typeof statusCode === 'string' &&\n (statusCode === 'offline' || statusCode === 'timeout')) {\n status.successful = false;\n status.networkProblems = true;\n return status;\n } else if (typeof statusCode === 'number') {\n const series = Math.floor(statusCode / 100);\n\n status.successful = (series === 2 ||\n statusCode === 304 ||\n statusCode === 412 ||\n statusCode === 404),\n status.conflict = (statusCode === 412);\n status.unAuth = ((statusCode === 401 && this.rs.remote.token !== Authorize.IMPLIED_FAKE_TOKEN) ||\n statusCode === 402 ||\n statusCode === 403);\n status.notFound = (statusCode === 404);\n status.changed = (statusCode !== 304);\n\n return status;\n }\n }\n\n public async handleGetResponse (path: string, status: ResponseStatus, bodyOrItemsMap, contentType: string, revision: string): Promise {\n if (status.notFound) {\n if (isFolder(path)) {\n bodyOrItemsMap = {};\n } else {\n bodyOrItemsMap = false;\n }\n }\n\n if (status.changed) {\n return this.completeFetch(path, bodyOrItemsMap, contentType, revision)\n .then(dataFromFetch => {\n if (isFolder(path)) {\n if (this.corruptServerItemsMap(bodyOrItemsMap)) {\n log('[Sync] WARNING: Discarding corrupt folder description from server for ' + path);\n return false;\n } else {\n return this.markChildren(path, bodyOrItemsMap, dataFromFetch.toBeSaved, dataFromFetch.missingChildren)\n .then(() => { return true; });\n }\n } else {\n return this.rs.local.setNodes(this.flush(dataFromFetch.toBeSaved))\n .then(() => { return true; });\n }\n });\n } else {\n return this.updateCommonTimestamp(path, revision)\n .then(() => { return true; });\n }\n }\n\n public handleResponse (path: string, action, r): Promise {\n const status = this.interpretStatus(r.statusCode);\n\n if (status.successful) {\n if (action === 'get') {\n return this.handleGetResponse(path, status, r.body, r.contentType, r.revision);\n } else if (action === 'put' || action === 'delete') {\n return this.completePush(path, action, status.conflict, r.revision).then(function () {\n return true;\n });\n } else {\n throw new Error(`cannot handle response for unknown action ${action}`);\n }\n } else {\n // Unsuccessful\n let error: Error;\n if (status.unAuth) {\n error = new UnauthorizedError();\n } else if (status.networkProblems) {\n error = new SyncError('Network request failed.');\n } else {\n error = new Error('HTTP response code ' + status.statusCode + ' received.');\n }\n\n return this.dealWithFailure(path).then(() => {\n this.rs._emit('error', error);\n throw error;\n });\n }\n }\n\n public finishTask (task: SyncTask, queueTask = true): void | Promise {\n if (task.action === undefined) {\n delete this._running[task.path];\n return;\n }\n\n if (queueTask) {\n log(\"[Sync] queue finished task:\", task.path);\n this._finishedTasks.push(task);\n if (this._finishedTasks.length > 1) {\n log(\"[Sync] delaying finished task:\", task.path);\n return;\n }\n }\n\n log(\"[Sync] run task:\", task.path);\n\n return task.promise\n .then(res => {\n return this.handleResponse(task.path, task.action, res);\n }, err => {\n log('[Sync] wireclient rejects its promise!', task.path, task.action, err);\n return this.handleResponse(task.path, task.action, { statusCode: 'offline' });\n })\n .then(async (completed) => {\n this._finishedTasks.shift();\n delete this._timeStarted[task.path];\n delete this._running[task.path];\n\n if (completed) {\n if (this._tasks[task.path]) {\n for (let i=0; i < this._tasks[task.path].length; i++) {\n this._tasks[task.path][i]();\n }\n delete this._tasks[task.path];\n }\n }\n\n this.rs._emit('sync-req-done', {\n tasksRemaining: Object.keys(this._tasks).length\n });\n\n if (this._finishedTasks.length > 0) {\n this.finishTask(this._finishedTasks[0], false);\n return;\n }\n\n await this.collectTasks(false).then(() => {\n // See if there are any more tasks that are not refresh tasks\n if (!this.hasTasks() || this.stopped) {\n log('[Sync] Sync is done! Reschedule?', Object.getOwnPropertyNames(this._tasks).length, this.stopped);\n if (!this.done) {\n this.done = true;\n this.rs._emit('sync-done', { completed: true });\n }\n } else {\n // Use a 10ms timeout to let the JavaScript runtime catch its breath\n // (and hopefully force an IndexedDB auto-commit?), and also to cause\n // the threads to get staggered and get a good spread over time:\n setTimeout(() => { this.doTasks(); }, 10);\n }\n });\n }, err => {\n log('[Sync] Error', err);\n\n this._finishedTasks.shift();\n delete this._timeStarted[task.path];\n delete this._running[task.path];\n\n this.rs._emit('sync-req-done', {\n tasksRemaining: Object.keys(this._tasks).length\n });\n\n if (this._finishedTasks.length > 0) {\n this.finishTask(this._finishedTasks[0], false);\n return;\n }\n\n if (!this.done) {\n this.done = true;\n this.rs._emit('sync-done', { completed: false });\n }\n });\n }\n\n public doTasks (): boolean {\n let numToHave: number, numAdded = 0, path: string;\n if (this.rs.remote.connected) {\n if (this.rs.remote.online) {\n numToHave = this.numThreads;\n } else {\n numToHave = 1;\n }\n } else {\n numToHave = 0;\n }\n const numToAdd = numToHave - Object.getOwnPropertyNames(this._running).length;\n if (numToAdd <= 0) {\n return true;\n }\n for (path in this._tasks) {\n if (!this._running[path]) {\n this._timeStarted[path] = this.now();\n this._running[path] = this.doTask(path);\n this._running[path].then(this.finishTask.bind(this));\n numAdded++;\n if (numAdded >= numToAdd) {\n return true;\n }\n }\n }\n return (numAdded >= numToAdd);\n }\n\n public async collectTasks (alsoCheckRefresh?: boolean): Promise {\n if (this.hasTasks() || this.stopped) {\n return Promise.resolve();\n }\n\n return this.collectDiffTasks().then(numDiffs => {\n if (numDiffs || alsoCheckRefresh === false) {\n return Promise.resolve();\n } else {\n return this.collectRefreshTasks();\n }\n }, function (err) { throw err; });\n }\n\n public addTask (path: string, cb?): void {\n if (!this._tasks[path]) {\n this._tasks[path] = [];\n }\n if (typeof(cb) === 'function') {\n this._tasks[path].push(cb);\n }\n }\n\n /**\n * Method: sync\n **/\n public sync (): Promise {\n this.done = false;\n\n if (!this.doTasks()) {\n return this.collectTasks().then(() => {\n try {\n this.doTasks();\n } catch(e) {\n log('[Sync] doTasks error', e);\n }\n }, function (e) {\n log('[Sync] Sync error', e);\n throw new Error('Local cache unavailable');\n });\n } else {\n return Promise.resolve();\n }\n }\n\n static _rs_init (remoteStorage): void {\n syncCycleCb = function (): void {\n // if (!config.cache) return false\n log('[Sync] syncCycleCb calling syncCycle');\n\n const env = new Env();\n if (env.isBrowser()) { handleVisibility(env, remoteStorage); }\n\n if (!remoteStorage.sync) {\n // Call this now that all other modules are also ready:\n remoteStorage.sync = new Sync(remoteStorage);\n\n if (remoteStorage.syncStopped) {\n log('[Sync] Instantiating sync stopped');\n remoteStorage.sync.stopped = true;\n delete remoteStorage.syncStopped;\n }\n }\n\n log('[Sync] syncCycleCb calling syncCycle');\n remoteStorage.syncCycle();\n };\n\n syncOnConnect = function (): void {\n remoteStorage.removeEventListener('connected', syncOnConnect);\n remoteStorage.startSync();\n };\n\n remoteStorage.on('ready', syncCycleCb);\n remoteStorage.on('connected', syncOnConnect);\n }\n\n static _rs_cleanup (remoteStorage): void {\n remoteStorage.stopSync();\n remoteStorage.removeEventListener('ready', syncCycleCb);\n remoteStorage.removeEventListener('connected', syncOnConnect);\n\n remoteStorage.sync = undefined;\n delete remoteStorage.sync;\n }\n}\n\nexport interface Sync extends EventHandling {}\napplyMixins(Sync, [EventHandling]);\n\nexport default Sync;\n","import log from './log';\n\nfunction shareFirst(path: string): boolean {\n return ( this.backend === 'dropbox' &&\n !!path.match(/^\\/public\\/.*[^\\/]$/) );\n}\n\nfunction defaultMaxAge(context): false | number {\n if ((typeof context.remote === 'object') &&\n context.remote.connected && context.remote.online) {\n return 2 * context.getSyncInterval();\n } else {\n log('Not setting default maxAge, because remote is offline or not connected');\n return false;\n }\n}\n\nconst SyncedGetPutDelete = {\n get: function (path: string, maxAge: undefined | false | number): Promise {\n if (!this.local) {\n return this.remote.get(path);\n } else {\n if (typeof maxAge === 'undefined') {\n maxAge = defaultMaxAge(this);\n } else if (typeof maxAge !== 'number' && maxAge !== false) {\n return Promise.reject(`Argument 'maxAge' must be 'false' or a number`);\n }\n return this.local.get(path, maxAge, this.sync.queueGetRequest.bind(this.sync));\n }\n },\n\n put: function (path: string, body: unknown, contentType: string): Promise {\n if (shareFirst.bind(this)(path)) {\n return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.put(path, body, contentType));\n }\n else if (this.local) {\n return this.local.put(path, body, contentType);\n } else {\n return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.put(path, body, contentType));\n }\n },\n\n 'delete': function (path: string): Promise {\n if (this.local) {\n return this.local.delete(path);\n } else {\n return SyncedGetPutDelete._wrapBusyDone.call(this, this.remote.delete(path));\n }\n },\n\n _wrapBusyDone: async function (result: Promise): Promise {\n this._emit('wire-busy');\n return result.then((r) => {\n this._emit('wire-done', { success: true });\n return Promise.resolve(r);\n }, (err: Error) => {\n this._emit('wire-done', { success: false });\n return Promise.reject(err);\n });\n }\n};\n\nexport = SyncedGetPutDelete;\n","import type { JsonSchemas } from './interfaces/json_schema';\n/**\n * - Manages and validates types of remoteStorage objects, using JSON-LD and\n * JSON Schema\n * - Adds schema declaration/validation methods to BaseClient instances.\n **/\nexport class BaseClientTypes {\n /**\n * -> \n */\n uris: { [key: string]: string } = {};\n\n /**\n * Contains schema objects of all types known to the BaseClient instance\n *\n * -> \n */\n schemas: JsonSchemas = {};\n\n /**\n * -> \n */\n aliases: { [key: string]: string } = {};\n\n /**\n * Called via public function BaseClient.declareType()\n *\n * @private\n */\n declare (moduleName: string, alias: string, uri: string, schema: tv4.JsonSchema): void {\n const fullAlias = moduleName + '/' + alias;\n\n if (schema.extends) {\n const parts = schema.extends.split('/');\n const extendedAlias = (parts.length === 1)\n ? moduleName + '/' + parts.shift()\n : parts.join('/');\n\n const extendedUri = this.uris[extendedAlias];\n if (!extendedUri) {\n throw \"Type '\" + fullAlias + \"' tries to extend unknown schema '\" + extendedAlias + \"'\";\n }\n schema.extends = this.schemas[extendedUri];\n }\n\n this.uris[fullAlias] = uri;\n this.aliases[uri] = fullAlias;\n this.schemas[uri] = schema;\n }\n\n resolveAlias (alias: string): string {\n return this.uris[alias];\n }\n\n getSchema (uri: string): tv4.JsonSchema {\n return this.schemas[uri];\n }\n\n inScope (moduleName: string): JsonSchemas {\n const ml = moduleName.length;\n const schemas = {};\n for (const alias in this.uris) {\n if (alias.substr(0, ml + 1) === moduleName + '/') {\n const uri = this.uris[alias];\n schemas[uri] = this.schemas[uri];\n }\n }\n return schemas;\n }\n}\n\nconst Types = new BaseClientTypes();\nexport default Types;\n","class UnauthorizedError extends Error {\n code: string;\n\n constructor (message?: string, options: {code?: string} = {}) {\n super();\n this.name = 'Unauthorized';\n\n if (typeof message === 'undefined') {\n this.message = 'App authorization expired or revoked.';\n } else {\n this.message = message;\n }\n\n if (typeof options.code !== 'undefined') {\n this.code = options.code;\n }\n\n this.stack = (new Error()).stack;\n }\n}\n\nexport = UnauthorizedError;\n","// Reusable utility functions\n\n/**\n * Takes an object and its copy as produced by the _deepClone function\n * below, and finds and fixes any ArrayBuffers that were cast to `{}` instead\n * of being cloned to new ArrayBuffers with the same content.\n *\n * It recurses into sub-objects, but skips arrays if they occur.\n */\nfunction _fixArrayBuffers(srcObj: object, dstObj: object) {\n if (typeof (srcObj) !== 'object' || Array.isArray(srcObj) || srcObj === null) {\n return;\n }\n for (const field in srcObj) {\n if (typeof (srcObj[field]) === 'object' && srcObj[field] !== null) {\n if (srcObj[field].toString() === '[object ArrayBuffer]') {\n dstObj[field] = new ArrayBuffer(srcObj[field].byteLength);\n const srcArr = new Int8Array(srcObj[field]);\n const dstArr = new Int8Array(dstObj[field]);\n dstArr.set(srcArr);\n } else {\n _fixArrayBuffers(srcObj[field], dstObj[field]);\n }\n }\n }\n}\n\nexport const logError = (error: string | Error): void => {\n if (typeof (error) === 'string') {\n console.error(error);\n } else {\n console.error(error.message, error.stack);\n }\n};\n\nexport const globalContext = (typeof (window) !== 'undefined' ? window : (typeof self === 'object' ? self : global));\n\nexport const getGlobalContext = (): any => {\n return (typeof (window) !== 'undefined' ? window : (typeof self === 'object' ? self : global));\n};\n\n// TODO Remove in favor of modern JS:\n// `const mergedObject = { ...obj1, ..obj2 }`\nexport const extend = (...args): unknown => {\n const target = args[0];\n const sources = Array.prototype.slice.call(args, 1);\n sources.forEach(function (source) {\n for (const key in source) {\n target[key] = source[key];\n }\n });\n return target;\n};\n\nexport const containingFolder = (path: string): string => {\n if (path === '') {\n return '/';\n }\n if (!path) {\n throw \"Path not given!\";\n }\n\n return path.replace(/\\/+/g, '/')\n .replace(/[^\\/]+\\/?$/, '');\n};\n\nexport const isFolder = (path: string): boolean => {\n return path.slice(-1) === '/';\n};\n\nexport const isDocument = (path: string): boolean => {\n return !isFolder(path);\n};\n\nexport const baseName = (path: string): string => {\n const parts = path.split('/');\n if (isFolder(path)) {\n return parts[parts.length - 2] + '/';\n } else {\n return parts[parts.length - 1];\n }\n};\n\nexport const cleanPath = (path: string): string => {\n return path.replace(/\\/+/g, '/')\n .split('/').map(encodeURIComponent).join('/')\n .replace(/'/g, '%27');\n};\n\nexport const bindAll = (object: object) => {\n for (const key in this) {\n if (typeof (object[key]) === 'function') {\n object[key] = object[key].bind(object);\n }\n }\n};\n\nexport const equal = (a: any, b: any, seen = []): boolean => {\n let key;\n\n if (typeof (a) !== typeof (b)) {\n return false;\n }\n\n if (typeof (a) === 'number' || typeof (a) === 'boolean' || typeof (a) === 'string') {\n return a === b;\n }\n\n if (typeof (a) === 'function') {\n return a.toString() === b.toString();\n }\n\n if (a instanceof ArrayBuffer && b instanceof ArrayBuffer) {\n // Without the following conversion the browsers wouldn't be able to\n // tell the ArrayBuffer instances apart.\n a = new Uint8Array(a);\n b = new Uint8Array(b);\n }\n\n // If this point has been reached, a and b are either arrays or objects.\n\n if (a instanceof Array) {\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0, c = a.length; i < c; i++) {\n if (!equal(a[i], b[i], seen)) {\n return false;\n }\n }\n } else {\n // Check that keys from a exist in b\n for (key in a) {\n if (a.hasOwnProperty(key) && !(key in b)) {\n return false;\n }\n }\n\n // Check that keys from b exist in a, and compare the values\n for (key in b) {\n if (!b.hasOwnProperty(key)) {\n continue;\n }\n\n if (!(key in a)) {\n return false;\n }\n\n let seenArg;\n\n if (typeof (b[key]) === 'object') {\n if (seen.indexOf(b[key]) >= 0) {\n // Circular reference, don't attempt to compare this object.\n // If nothing else returns false, the objects match.\n continue;\n }\n\n seenArg = seen.slice();\n seenArg.push(b[key]);\n }\n\n if (!equal(a[key], b[key], seenArg)) {\n return false;\n }\n }\n }\n\n return true;\n};\n\nexport const deepClone = (obj: any): any => {\n if (obj === undefined) {\n return undefined;\n } else {\n const clone = JSON.parse(JSON.stringify(obj));\n _fixArrayBuffers(obj, clone);\n return clone;\n }\n};\n\nexport const pathsFromRoot = (path: string): string[] => {\n const paths = [path];\n const parts = path.replace(/\\/$/, '').split('/');\n\n while (parts.length > 1) {\n parts.pop();\n paths.push(parts.join('/') + '/');\n }\n return paths;\n};\n\nexport const localStorageAvailable = (): boolean => {\n const context = getGlobalContext();\n\n if (!('localStorage' in context)) {\n return false;\n }\n\n try {\n context.localStorage.setItem('rs-check', '1');\n context.localStorage.removeItem('rs-check');\n return true;\n } catch (error) {\n return false;\n }\n};\n\n/**\n * Extract and parse JSON data from localStorage.\n *\n * @param {string} key - localStorage key\n *\n * @returns {object} parsed object or undefined\n */\nexport const getJSONFromLocalStorage = (key: string): { [key: string]: any } => {\n const context = getGlobalContext() as Window;\n\n try {\n return JSON.parse(context.localStorage.getItem(key));\n } catch (e) {\n // no JSON stored\n }\n};\n\n/**\n * Decide if data should be treated as binary based on the content (presence of non-printable characters\n * or replacement character) and content-type.\n *\n * @param {string} content - The data\n * @param {string} mimeType - The data's content-type\n *\n * @returns {boolean}\n */\nexport const shouldBeTreatedAsBinary = (content: string | ArrayBuffer, mimeType: string): boolean => {\n // eslint-disable-next-line no-control-regex\n return !!((mimeType && mimeType.match(/charset=binary/)) || /[\\x00-\\x08\\x0E-\\x1F\\uFFFD]/.test(content as string));\n};\n\n/**\n * Read data from an ArrayBuffer and return it as a string\n * @param {ArrayBuffer} arrayBuffer\n * @param {string} encoding\n * @returns {Promise} Resolves with a string containing the data\n */\nexport const getTextFromArrayBuffer = (arrayBuffer: ArrayBuffer, encoding): Promise => {\n return new Promise((resolve/*, reject*/) => {\n if (typeof Blob === 'undefined' || typeof FileReader === 'undefined') {\n const buffer = Buffer.from(arrayBuffer);\n resolve(buffer.toString(encoding));\n } else {\n let blob;\n const gc = globalContext as any;\n // TODO fix as BlobBuilder is not available in all browsers\n // @see https://developer.mozilla.org/en-US/docs/Web/API/BlobBuilder\n gc.BlobBuilder = gc.BlobBuilder || gc.WebKitBlobBuilder;\n if (typeof gc.BlobBuilder !== 'undefined') {\n const bb = new gc.BlobBuilder();\n bb.append(arrayBuffer);\n blob = bb.getBlob();\n } else {\n blob = new Blob([arrayBuffer]);\n }\n\n const fileReader = new FileReader();\n if (typeof fileReader.addEventListener === 'function') {\n fileReader.addEventListener('loadend', function (evt) {\n resolve(evt.target.result);\n });\n } else {\n fileReader.onloadend = function (evt) {\n resolve(evt.target.result);\n };\n }\n fileReader.readAsText(blob, encoding);\n }\n });\n};\n\n/**\n * Encode string in base64\n * @param {String} str\n * @returns {String} base64-encoded string\n */\nexport const toBase64 = (str: string): string => {\n const context = getGlobalContext();\n if ('btoa' in context) {\n return context['btoa'](str);\n } else {\n return Buffer.from(str).toString('base64');\n }\n};\n\n/**\n * Generates values required for OAuth2 PKCE in a cryptographically secure manner.\n * @param {number} [numChar=128] - length of codeVerifier to generate; from 43 to 128\n *\n * @typedef {Object} PkceValues\n * @property {string} codeVerifier - 43 to 128 chars from the 66-char set\n * @property {string} codeChallenge - verifier hashed & base-64 URL encoded\n * @property {string} state - a separate random value. Should be used to check redirect_uri.\n * @returns PkceValues\n */\nexport async function generateCodeVerifier(numChar = 128) {\n const randomBytes = new Uint8Array(numChar);\n crypto.getRandomValues(randomBytes);\n\n const charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';\n const randomChar = Array.from(randomBytes).map(byte => charSet[byte % charSet.length]);\n const codeVerifier = randomChar.join('');\n\n const charsAsBytes = Uint8Array.from(randomChar.map(ch => ch.charCodeAt(0)));\n const sha256hash = await crypto.subtle.digest('SHA-256', charsAsBytes);\n const codeChallenge = base64Urlencode(sha256hash);\n\n crypto.getRandomValues(randomBytes);\n const stateRandomChar = Array.from(randomBytes).map(byte => charSet[byte % charSet.length]);\n const state = stateRandomChar.join('');\n\n return {codeVerifier, codeChallenge, state};\n}\n\nfunction base64Urlencode(str) {\n return btoa(String.fromCharCode.apply(null,\n new Uint8Array(str)))\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n}\n\n/*\n * Apply mixins to an object\n *\n * https://www.typescriptlang.org/docs/handbook/mixins.html\n *\n * @param derivedConstructor Parent object\n * @param constructors Mixins to apply methods from\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function applyMixins(derivedCtor: any, constructors: any[]): void {\n constructors.forEach(baseCtor => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name));\n });\n });\n}\n","/**\n * This file exposes a get/put/delete interface on top of fetch() or XMLHttpRequest.\n * It requires to be configured with parameters about the remotestorage server to\n * connect to.\n * Each instance of WireClient is always associated with a single remotestorage\n * server and access token.\n *\n * Usually the WireClient instance can be accessed via `remoteStorage.remote`.\n *\n * This is the get/put/delete interface:\n *\n * - #get() takes a path and optionally a ifNoneMatch option carrying a version\n * string to check. It returns a promise that will be fulfilled with the HTTP\n * response status, the response body, the MIME type as returned in the\n * 'Content-Type' header and the current revision, as returned in the 'ETag'\n * header.\n * - #put() takes a path, the request body and a content type string. It also\n * accepts the ifMatch and ifNoneMatch options, that map to the If-Match and\n * If-None-Match headers respectively. See the remotestorage-01 specification\n * for details on handling these headers. It returns a promise, fulfilled with\n * the same values as the one for #get().\n * - #delete() takes a path and the ifMatch option as well. It returns a promise\n * fulfilled with the same values as the one for #get().\n *\n * In addition to this, the WireClient has some compatibility features to work with\n * remotestorage 2012.04 compatible storages. For example it will cache revisions\n * from folder listings in-memory and return them accordingly as the \"revision\"\n * parameter in response to #get() requests. Similarly it will return 404 when it\n * receives an empty folder listing, to mimic remotestorage-01 behavior. Note\n * that it is not always possible to know the revision beforehand, hence it may\n * be undefined at times (especially for caching-roots).\n */\nimport RemoteStorage from './remotestorage';\nimport Authorize from './authorize';\nimport EventHandling from './eventhandling';\nimport UnauthorizedError from './unauthorized-error';\nimport log from './log';\nimport {\n applyMixins,\n cleanPath,\n getJSONFromLocalStorage,\n getTextFromArrayBuffer,\n isFolder,\n localStorageAvailable,\n shouldBeTreatedAsBinary\n} from './util';\nimport {requestWithTimeout, isArrayBufferView} from \"./requests\";\nimport {Remote, RemoteBase, RemoteResponse, RemoteSettings} from \"./remote\";\n\nlet hasLocalStorage;\nconst SETTINGS_KEY = 'remotestorage:wireclient';\n\nconst API_2012 = 1;\nconst API_00 = 2;\nconst API_01 = 3;\nconst API_02 = 4;\nconst API_HEAD = 5;\n\nconst STORAGE_APIS = {\n 'draft-dejong-remotestorage-00': API_00,\n 'draft-dejong-remotestorage-01': API_01,\n 'draft-dejong-remotestorage-02': API_02,\n 'https://www.w3.org/community/rww/wiki/read-write-web-00#simple': API_2012\n};\n\nfunction readSettings () {\n const settings = getJSONFromLocalStorage(SETTINGS_KEY) || {};\n const { userAddress, href, storageApi, token, properties } = settings;\n\n return { userAddress, href, storageApi, token, properties };\n}\n\nfunction determineCharset (mimeType: string): string {\n let charset = 'utf-8';\n let charsetMatch;\n\n if (mimeType) {\n charsetMatch = mimeType.match(/charset=(.+)$/);\n if (charsetMatch) {\n charset = charsetMatch[1];\n }\n }\n return charset;\n}\n\nfunction isFolderDescription (body: object): boolean {\n return ((body['@context'] === 'http://remotestorage.io/spec/folder-description')\n && (typeof (body['items']) === 'object'));\n}\n\nfunction isSuccessStatus (status: number): boolean {\n return [201, 204, 304].indexOf(status) >= 0;\n}\n\nfunction isErrorStatus (status: number): boolean {\n return [401, 403, 404, 412].indexOf(status) >= 0;\n}\n\nclass WireClient extends RemoteBase implements Remote {\n /**\n * Holds the bearer token of this WireClient, as obtained in the OAuth dance\n *\n * Example:\n * (start code)\n *\n * remoteStorage.remote.token\n * // -> 'DEADBEEF01=='\n */\n token: string | false;\n\n /**\n * Holds the server's base URL, as obtained in the Webfinger discovery\n *\n * Example:\n * (start code)\n *\n * remoteStorage.remote.href\n * // -> 'https://storage.example.com/users/jblogg/'\n */\n href: string;\n\n supportsRevs: boolean;\n\n _revisionCache: { [key: string]: any } = {};\n\n properties: object;\n\n constructor (rs: RemoteStorage) {\n super(rs);\n hasLocalStorage = localStorageAvailable();\n\n /**\n * Event: connected\n * Fired when the wireclient connect method realizes that it is in\n * possession of a token and href\n **/\n this.addEvents(['connected', 'not-connected']);\n\n if (hasLocalStorage) {\n const settings = readSettings();\n if (settings) {\n setTimeout(() => {\n this.configure(settings);\n }, 0);\n }\n }\n\n if (this.connected) {\n setTimeout(this._emit.bind(this), 0, 'connected');\n }\n }\n\n get storageType () {\n if (this.storageApi) {\n const spec = this.storageApi.match(/draft-dejong-(remotestorage-\\d\\d)/);\n return spec ? spec[1] : '2012.04';\n } else {\n return undefined;\n }\n }\n\n async _request (method: string, uri: string, token: string | false, headers: HeadersInit, body: XMLHttpRequestBodyInit, getEtag: boolean, fakeRevision?: string): Promise {\n if (this.isForbiddenRequestMethod(method, uri)) {\n return Promise.reject(`Don't use ${method} on directories!`);\n }\n\n let revision: string | undefined;\n\n if (token !== Authorize.IMPLIED_FAKE_TOKEN) {\n headers['Authorization'] = 'Bearer ' + token;\n }\n\n this.rs._emit('wire-busy', {\n method: method,\n isFolder: isFolder(uri)\n });\n\n return requestWithTimeout(method, uri, {\n body: body,\n headers: headers,\n responseType: 'arraybuffer'\n }).then((response: XMLHttpRequest): Promise => {\n if (!this.online) {\n this.online = true;\n this.rs._emit('network-online');\n }\n this.rs._emit('wire-done', {\n method: method,\n isFolder: isFolder(uri),\n success: true\n });\n\n if (isErrorStatus(response.status)) {\n log('[WireClient] Error response status', response.status);\n if (getEtag) {\n revision = this.stripQuotes(response.getResponseHeader('ETag'));\n } else {\n revision = undefined;\n }\n\n if (response.status === 401) {\n this.rs._emit('error', new UnauthorizedError());\n }\n\n return Promise.resolve({statusCode: response.status, revision: revision});\n } else if (isSuccessStatus(response.status) ||\n (response.status === 200 && method !== 'GET')) {\n revision = this.stripQuotes(response.getResponseHeader('ETag'));\n log('[WireClient] Successful request', revision);\n return Promise.resolve({statusCode: response.status, revision: revision});\n } else {\n const mimeType = response.getResponseHeader('Content-Type');\n if (getEtag) {\n revision = this.stripQuotes(response.getResponseHeader('ETag'));\n } else {\n revision = (response.status === 200) ? fakeRevision : undefined;\n }\n\n const charset = determineCharset(mimeType);\n\n if (shouldBeTreatedAsBinary(response.response, mimeType)) {\n log('[WireClient] Successful request with unknown or binary mime-type', revision);\n return Promise.resolve({\n statusCode: response.status,\n body: response.response,\n contentType: mimeType,\n revision: revision\n });\n } else {\n return getTextFromArrayBuffer(response.response, charset)\n .then((textContent) => {\n log('[WireClient] Successful request', revision);\n return Promise.resolve({\n statusCode: response.status,\n body: textContent,\n contentType: mimeType,\n revision: revision\n });\n });\n }\n }\n }, error => {\n if (this.online) {\n this.online = false;\n this.rs._emit('network-offline');\n }\n this.rs._emit('wire-done', {\n method: method,\n isFolder: isFolder(uri),\n success: false\n });\n\n return Promise.reject(error);\n });\n }\n\n /**\n * Sets the userAddress, href, storageApi, token, and properties of a\n * remote store. Also sets connected and online to true and emits the\n * 'connected' event, if both token and href are present.\n *\n * Parameters:\n * settings - An object that may contain userAddress (string or null),\n * href (string or null), storageApi (string or null), token (string\n * or null), and/or properties (the JSON-parsed properties object\n * from the user's WebFinger record, see section 10 of\n * http://tools.ietf.org/html/draft-dejong-remotestorage-03\n * or null).\n * Fields that are not included (i.e. `undefined`), stay at\n * their current value. To set a field, include that field\n * with a `string` value. To reset a field, for instance when\n * the user disconnected their storage, or you found that the\n * token you have has expired, simply set that field to `null`.\n */\n configure (settings: RemoteSettings): void {\n if (typeof settings !== 'object') {\n throw new Error('WireClient configure settings parameter should be an object');\n }\n if (typeof settings.userAddress !== 'undefined') {\n this.userAddress = settings.userAddress;\n }\n if (typeof settings.href !== 'undefined') {\n this.href = settings.href;\n }\n if (typeof settings.storageApi !== 'undefined') {\n this.storageApi = settings.storageApi;\n }\n if (typeof settings.token !== 'undefined') {\n this.token = settings.token;\n }\n if (typeof settings.properties !== 'undefined') {\n this.properties = settings.properties;\n }\n\n if (typeof this.storageApi === 'string') {\n const _storageApi = STORAGE_APIS[this.storageApi] || API_HEAD;\n this.supportsRevs = _storageApi >= API_00;\n }\n if (this.href && this.token) {\n this.connected = true;\n this.online = true;\n this._emit('connected');\n } else {\n this.connected = false;\n }\n if (hasLocalStorage) {\n localStorage[SETTINGS_KEY] = JSON.stringify({\n userAddress: this.userAddress,\n href: this.href,\n storageApi: this.storageApi,\n token: this.token,\n properties: this.properties\n });\n }\n }\n\n get (path: string, options: { ifNoneMatch?: string } = {}): Promise {\n if (!this.connected) {\n return Promise.reject('not connected (path: ' + path + ')');\n }\n\n const headers = {};\n if (this.supportsRevs) {\n if (options.ifNoneMatch) {\n headers['If-None-Match'] = this.addQuotes(options.ifNoneMatch);\n }\n }\n // commenting it out as this is doing nothing and jshint is complaining -les\n // else if (options.ifNoneMatch) {\n // let oldRev = this._revisionCache[path];\n // }\n\n return this._request('GET', this.href + cleanPath(path), this.token, headers,\n undefined, this.supportsRevs, this._revisionCache[path])\n .then((r) => {\n if (!isFolder(path)) {\n return Promise.resolve(r);\n }\n let itemsMap = {};\n if (typeof (r.body) !== 'undefined') {\n try {\n r.body = JSON.parse(r.body);\n } catch (e) {\n return Promise.reject('Folder description at ' + this.href + cleanPath(path) + ' is not JSON');\n }\n }\n\n if (r.statusCode === 200 && typeof (r.body) === 'object') {\n // New folder listing received\n if (Object.keys(r.body).length === 0) {\n // Empty folder listing of any spec\n r.statusCode = 404;\n } else if (isFolderDescription(r.body)) {\n // >= 02 spec\n for (const item in r.body.items) {\n this._revisionCache[path + item] = r.body.items[item].ETag;\n }\n itemsMap = r.body.items;\n } else {\n // < 02 spec\n Object.keys(r.body).forEach((key) => {\n this._revisionCache[path + key] = r.body[key];\n itemsMap[key] = {'ETag': r.body[key]};\n });\n }\n r.body = itemsMap;\n return Promise.resolve(r);\n } else {\n return Promise.resolve(r);\n }\n });\n }\n\n put (path: string, body: XMLHttpRequestBodyInit, contentType: string, options: { ifMatch?: string; ifNoneMatch?: string } = {}): Promise {\n if (!this.connected) {\n return Promise.reject('not connected (path: ' + path + ')');\n }\n if ((!contentType.match(/charset=/)) && (body instanceof ArrayBuffer || isArrayBufferView(body))) {\n contentType += '; charset=binary';\n }\n const headers = {'Content-Type': contentType};\n if (this.supportsRevs) {\n if (options.ifMatch) {\n headers['If-Match'] = this.addQuotes(options.ifMatch);\n }\n if (options.ifNoneMatch) {\n headers['If-None-Match'] = this.addQuotes(options.ifNoneMatch);\n }\n }\n return this._request('PUT', this.href + cleanPath(path), this.token,\n headers, body, this.supportsRevs);\n }\n\n delete (path: string, options: { ifMatch?: string } = {}): Promise {\n if (!this.connected) {\n throw new Error('not connected (path: ' + path + ')');\n }\n if (!options) {\n options = {};\n }\n const headers = {};\n if (this.supportsRevs) {\n if (options.ifMatch) {\n headers['If-Match'] = this.addQuotes(options.ifMatch);\n }\n }\n return this._request('DELETE', this.href + cleanPath(path), this.token,\n headers,\n undefined, this.supportsRevs);\n }\n\n static _rs_init (remoteStorage): void {\n remoteStorage.remote = new WireClient(remoteStorage);\n remoteStorage.remote.online = true;\n }\n\n static _rs_supported (): boolean {\n return typeof fetch === 'function' || typeof XMLHttpRequest === 'function';\n }\n\n static _rs_cleanup (): void {\n if (hasLocalStorage) {\n delete localStorage[SETTINGS_KEY];\n }\n }\n}\n\ninterface WireClient extends EventHandling {}\napplyMixins(WireClient, [EventHandling]);\n\nexport = WireClient;\n","/*\r\nAuthor: Geraint Luff and others\r\nYear: 2013\r\n\r\nThis code is released into the \"public domain\" by its author(s). Anybody may use, alter and distribute the code without restriction. The author makes no guarantees, and takes no liability of any kind for use of this code.\r\n\r\nIf you find a bug or make an improvement, it would be courteous to let the author know, but it is not compulsory.\r\n*/\r\n(function (global, factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n // AMD. Register as an anonymous module.\r\n define([], factory);\r\n } else if (typeof module !== 'undefined' && module.exports){\r\n // CommonJS. Define export.\r\n module.exports = factory();\r\n } else {\r\n // Browser globals\r\n global.tv4 = factory();\r\n }\r\n}(this, function () {\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FObject%2Fkeys\r\nif (!Object.keys) {\r\n\tObject.keys = (function () {\r\n\t\tvar hasOwnProperty = Object.prototype.hasOwnProperty,\r\n\t\t\thasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\r\n\t\t\tdontEnums = [\r\n\t\t\t\t'toString',\r\n\t\t\t\t'toLocaleString',\r\n\t\t\t\t'valueOf',\r\n\t\t\t\t'hasOwnProperty',\r\n\t\t\t\t'isPrototypeOf',\r\n\t\t\t\t'propertyIsEnumerable',\r\n\t\t\t\t'constructor'\r\n\t\t\t],\r\n\t\t\tdontEnumsLength = dontEnums.length;\r\n\r\n\t\treturn function (obj) {\r\n\t\t\tif (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) {\r\n\t\t\t\tthrow new TypeError('Object.keys called on non-object');\r\n\t\t\t}\r\n\r\n\t\t\tvar result = [];\r\n\r\n\t\t\tfor (var prop in obj) {\r\n\t\t\t\tif (hasOwnProperty.call(obj, prop)) {\r\n\t\t\t\t\tresult.push(prop);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (hasDontEnumBug) {\r\n\t\t\t\tfor (var i=0; i < dontEnumsLength; i++) {\r\n\t\t\t\t\tif (hasOwnProperty.call(obj, dontEnums[i])) {\r\n\t\t\t\t\t\tresult.push(dontEnums[i]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t};\r\n\t})();\r\n}\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create\r\nif (!Object.create) {\r\n\tObject.create = (function(){\r\n\t\tfunction F(){}\r\n\r\n\t\treturn function(o){\r\n\t\t\tif (arguments.length !== 1) {\r\n\t\t\t\tthrow new Error('Object.create implementation only accepts one parameter.');\r\n\t\t\t}\r\n\t\t\tF.prototype = o;\r\n\t\t\treturn new F();\r\n\t\t};\r\n\t})();\r\n}\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FisArray\r\nif(!Array.isArray) {\r\n\tArray.isArray = function (vArg) {\r\n\t\treturn Object.prototype.toString.call(vArg) === \"[object Array]\";\r\n\t};\r\n}\r\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FArray%2FindexOf\r\nif (!Array.prototype.indexOf) {\r\n\tArray.prototype.indexOf = function (searchElement /*, fromIndex */ ) {\r\n\t\tif (this === null) {\r\n\t\t\tthrow new TypeError();\r\n\t\t}\r\n\t\tvar t = Object(this);\r\n\t\tvar len = t.length >>> 0;\r\n\r\n\t\tif (len === 0) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tvar n = 0;\r\n\t\tif (arguments.length > 1) {\r\n\t\t\tn = Number(arguments[1]);\r\n\t\t\tif (n !== n) { // shortcut for verifying if it's NaN\r\n\t\t\t\tn = 0;\r\n\t\t\t} else if (n !== 0 && n !== Infinity && n !== -Infinity) {\r\n\t\t\t\tn = (n > 0 || -1) * Math.floor(Math.abs(n));\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (n >= len) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tvar k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);\r\n\t\tfor (; k < len; k++) {\r\n\t\t\tif (k in t && t[k] === searchElement) {\r\n\t\t\t\treturn k;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n}\r\n\r\n// Grungey Object.isFrozen hack\r\nif (!Object.isFrozen) {\r\n\tObject.isFrozen = function (obj) {\r\n\t\tvar key = \"tv4_test_frozen_key\";\r\n\t\twhile (obj.hasOwnProperty(key)) {\r\n\t\t\tkey += Math.random();\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tobj[key] = true;\r\n\t\t\tdelete obj[key];\r\n\t\t\treturn false;\r\n\t\t} catch (e) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};\r\n}\r\n// Based on: https://github.com/geraintluff/uri-templates, but with all the de-substitution stuff removed\r\n\r\nvar uriTemplateGlobalModifiers = {\r\n\t\"+\": true,\r\n\t\"#\": true,\r\n\t\".\": true,\r\n\t\"/\": true,\r\n\t\";\": true,\r\n\t\"?\": true,\r\n\t\"&\": true\r\n};\r\nvar uriTemplateSuffices = {\r\n\t\"*\": true\r\n};\r\n\r\nfunction notReallyPercentEncode(string) {\r\n\treturn encodeURI(string).replace(/%25[0-9][0-9]/g, function (doubleEncoded) {\r\n\t\treturn \"%\" + doubleEncoded.substring(3);\r\n\t});\r\n}\r\n\r\nfunction uriTemplateSubstitution(spec) {\r\n\tvar modifier = \"\";\r\n\tif (uriTemplateGlobalModifiers[spec.charAt(0)]) {\r\n\t\tmodifier = spec.charAt(0);\r\n\t\tspec = spec.substring(1);\r\n\t}\r\n\tvar separator = \"\";\r\n\tvar prefix = \"\";\r\n\tvar shouldEscape = true;\r\n\tvar showVariables = false;\r\n\tvar trimEmptyString = false;\r\n\tif (modifier === '+') {\r\n\t\tshouldEscape = false;\r\n\t} else if (modifier === \".\") {\r\n\t\tprefix = \".\";\r\n\t\tseparator = \".\";\r\n\t} else if (modifier === \"/\") {\r\n\t\tprefix = \"/\";\r\n\t\tseparator = \"/\";\r\n\t} else if (modifier === '#') {\r\n\t\tprefix = \"#\";\r\n\t\tshouldEscape = false;\r\n\t} else if (modifier === ';') {\r\n\t\tprefix = \";\";\r\n\t\tseparator = \";\";\r\n\t\tshowVariables = true;\r\n\t\ttrimEmptyString = true;\r\n\t} else if (modifier === '?') {\r\n\t\tprefix = \"?\";\r\n\t\tseparator = \"&\";\r\n\t\tshowVariables = true;\r\n\t} else if (modifier === '&') {\r\n\t\tprefix = \"&\";\r\n\t\tseparator = \"&\";\r\n\t\tshowVariables = true;\r\n\t}\r\n\r\n\tvar varNames = [];\r\n\tvar varList = spec.split(\",\");\r\n\tvar varSpecs = [];\r\n\tvar varSpecMap = {};\r\n\tfor (var i = 0; i < varList.length; i++) {\r\n\t\tvar varName = varList[i];\r\n\t\tvar truncate = null;\r\n\t\tif (varName.indexOf(\":\") !== -1) {\r\n\t\t\tvar parts = varName.split(\":\");\r\n\t\t\tvarName = parts[0];\r\n\t\t\ttruncate = parseInt(parts[1], 10);\r\n\t\t}\r\n\t\tvar suffices = {};\r\n\t\twhile (uriTemplateSuffices[varName.charAt(varName.length - 1)]) {\r\n\t\t\tsuffices[varName.charAt(varName.length - 1)] = true;\r\n\t\t\tvarName = varName.substring(0, varName.length - 1);\r\n\t\t}\r\n\t\tvar varSpec = {\r\n\t\t\ttruncate: truncate,\r\n\t\t\tname: varName,\r\n\t\t\tsuffices: suffices\r\n\t\t};\r\n\t\tvarSpecs.push(varSpec);\r\n\t\tvarSpecMap[varName] = varSpec;\r\n\t\tvarNames.push(varName);\r\n\t}\r\n\tvar subFunction = function (valueFunction) {\r\n\t\tvar result = \"\";\r\n\t\tvar startIndex = 0;\r\n\t\tfor (var i = 0; i < varSpecs.length; i++) {\r\n\t\t\tvar varSpec = varSpecs[i];\r\n\t\t\tvar value = valueFunction(varSpec.name);\r\n\t\t\tif (value === null || value === undefined || (Array.isArray(value) && value.length === 0) || (typeof value === 'object' && Object.keys(value).length === 0)) {\r\n\t\t\t\tstartIndex++;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\tif (i === startIndex) {\r\n\t\t\t\tresult += prefix;\r\n\t\t\t} else {\r\n\t\t\t\tresult += (separator || \",\");\r\n\t\t\t}\r\n\t\t\tif (Array.isArray(value)) {\r\n\t\t\t\tif (showVariables) {\r\n\t\t\t\t\tresult += varSpec.name + \"=\";\r\n\t\t\t\t}\r\n\t\t\t\tfor (var j = 0; j < value.length; j++) {\r\n\t\t\t\t\tif (j > 0) {\r\n\t\t\t\t\t\tresult += varSpec.suffices['*'] ? (separator || \",\") : \",\";\r\n\t\t\t\t\t\tif (varSpec.suffices['*'] && showVariables) {\r\n\t\t\t\t\t\t\tresult += varSpec.name + \"=\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tresult += shouldEscape ? encodeURIComponent(value[j]).replace(/!/g, \"%21\") : notReallyPercentEncode(value[j]);\r\n\t\t\t\t}\r\n\t\t\t} else if (typeof value === \"object\") {\r\n\t\t\t\tif (showVariables && !varSpec.suffices['*']) {\r\n\t\t\t\t\tresult += varSpec.name + \"=\";\r\n\t\t\t\t}\r\n\t\t\t\tvar first = true;\r\n\t\t\t\tfor (var key in value) {\r\n\t\t\t\t\tif (!first) {\r\n\t\t\t\t\t\tresult += varSpec.suffices['*'] ? (separator || \",\") : \",\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfirst = false;\r\n\t\t\t\t\tresult += shouldEscape ? encodeURIComponent(key).replace(/!/g, \"%21\") : notReallyPercentEncode(key);\r\n\t\t\t\t\tresult += varSpec.suffices['*'] ? '=' : \",\";\r\n\t\t\t\t\tresult += shouldEscape ? encodeURIComponent(value[key]).replace(/!/g, \"%21\") : notReallyPercentEncode(value[key]);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (showVariables) {\r\n\t\t\t\t\tresult += varSpec.name;\r\n\t\t\t\t\tif (!trimEmptyString || value !== \"\") {\r\n\t\t\t\t\t\tresult += \"=\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif (varSpec.truncate != null) {\r\n\t\t\t\t\tvalue = value.substring(0, varSpec.truncate);\r\n\t\t\t\t}\r\n\t\t\t\tresult += shouldEscape ? encodeURIComponent(value).replace(/!/g, \"%21\"): notReallyPercentEncode(value);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t};\r\n\tsubFunction.varNames = varNames;\r\n\treturn {\r\n\t\tprefix: prefix,\r\n\t\tsubstitution: subFunction\r\n\t};\r\n}\r\n\r\nfunction UriTemplate(template) {\r\n\tif (!(this instanceof UriTemplate)) {\r\n\t\treturn new UriTemplate(template);\r\n\t}\r\n\tvar parts = template.split(\"{\");\r\n\tvar textParts = [parts.shift()];\r\n\tvar prefixes = [];\r\n\tvar substitutions = [];\r\n\tvar varNames = [];\r\n\twhile (parts.length > 0) {\r\n\t\tvar part = parts.shift();\r\n\t\tvar spec = part.split(\"}\")[0];\r\n\t\tvar remainder = part.substring(spec.length + 1);\r\n\t\tvar funcs = uriTemplateSubstitution(spec);\r\n\t\tsubstitutions.push(funcs.substitution);\r\n\t\tprefixes.push(funcs.prefix);\r\n\t\ttextParts.push(remainder);\r\n\t\tvarNames = varNames.concat(funcs.substitution.varNames);\r\n\t}\r\n\tthis.fill = function (valueFunction) {\r\n\t\tvar result = textParts[0];\r\n\t\tfor (var i = 0; i < substitutions.length; i++) {\r\n\t\t\tvar substitution = substitutions[i];\r\n\t\t\tresult += substitution(valueFunction);\r\n\t\t\tresult += textParts[i + 1];\r\n\t\t}\r\n\t\treturn result;\r\n\t};\r\n\tthis.varNames = varNames;\r\n\tthis.template = template;\r\n}\r\nUriTemplate.prototype = {\r\n\ttoString: function () {\r\n\t\treturn this.template;\r\n\t},\r\n\tfillFromObject: function (obj) {\r\n\t\treturn this.fill(function (varName) {\r\n\t\t\treturn obj[varName];\r\n\t\t});\r\n\t}\r\n};\r\nvar ValidatorContext = function ValidatorContext(parent, collectMultiple, errorReporter, checkRecursive, trackUnknownProperties) {\r\n\tthis.missing = [];\r\n\tthis.missingMap = {};\r\n\tthis.formatValidators = parent ? Object.create(parent.formatValidators) : {};\r\n\tthis.schemas = parent ? Object.create(parent.schemas) : {};\r\n\tthis.collectMultiple = collectMultiple;\r\n\tthis.errors = [];\r\n\tthis.handleError = collectMultiple ? this.collectError : this.returnError;\r\n\tif (checkRecursive) {\r\n\t\tthis.checkRecursive = true;\r\n\t\tthis.scanned = [];\r\n\t\tthis.scannedFrozen = [];\r\n\t\tthis.scannedFrozenSchemas = [];\r\n\t\tthis.scannedFrozenValidationErrors = [];\r\n\t\tthis.validatedSchemasKey = 'tv4_validation_id';\r\n\t\tthis.validationErrorsKey = 'tv4_validation_errors_id';\r\n\t}\r\n\tif (trackUnknownProperties) {\r\n\t\tthis.trackUnknownProperties = true;\r\n\t\tthis.knownPropertyPaths = {};\r\n\t\tthis.unknownPropertyPaths = {};\r\n\t}\r\n\tthis.errorReporter = errorReporter || defaultErrorReporter('en');\r\n\tif (typeof this.errorReporter === 'string') {\r\n\t\tthrow new Error('debug');\r\n\t}\r\n\tthis.definedKeywords = {};\r\n\tif (parent) {\r\n\t\tfor (var key in parent.definedKeywords) {\r\n\t\t\tthis.definedKeywords[key] = parent.definedKeywords[key].slice(0);\r\n\t\t}\r\n\t}\r\n};\r\nValidatorContext.prototype.defineKeyword = function (keyword, keywordFunction) {\r\n\tthis.definedKeywords[keyword] = this.definedKeywords[keyword] || [];\r\n\tthis.definedKeywords[keyword].push(keywordFunction);\r\n};\r\nValidatorContext.prototype.createError = function (code, messageParams, dataPath, schemaPath, subErrors, data, schema) {\r\n\tvar error = new ValidationError(code, messageParams, dataPath, schemaPath, subErrors);\r\n\terror.message = this.errorReporter(error, data, schema);\r\n\treturn error;\r\n};\r\nValidatorContext.prototype.returnError = function (error) {\r\n\treturn error;\r\n};\r\nValidatorContext.prototype.collectError = function (error) {\r\n\tif (error) {\r\n\t\tthis.errors.push(error);\r\n\t}\r\n\treturn null;\r\n};\r\nValidatorContext.prototype.prefixErrors = function (startIndex, dataPath, schemaPath) {\r\n\tfor (var i = startIndex; i < this.errors.length; i++) {\r\n\t\tthis.errors[i] = this.errors[i].prefixWith(dataPath, schemaPath);\r\n\t}\r\n\treturn this;\r\n};\r\nValidatorContext.prototype.banUnknownProperties = function (data, schema) {\r\n\tfor (var unknownPath in this.unknownPropertyPaths) {\r\n\t\tvar error = this.createError(ErrorCodes.UNKNOWN_PROPERTY, {path: unknownPath}, unknownPath, \"\", null, data, schema);\r\n\t\tvar result = this.handleError(error);\r\n\t\tif (result) {\r\n\t\t\treturn result;\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.addFormat = function (format, validator) {\r\n\tif (typeof format === 'object') {\r\n\t\tfor (var key in format) {\r\n\t\t\tthis.addFormat(key, format[key]);\r\n\t\t}\r\n\t\treturn this;\r\n\t}\r\n\tthis.formatValidators[format] = validator;\r\n};\r\nValidatorContext.prototype.resolveRefs = function (schema, urlHistory) {\r\n\tif (schema['$ref'] !== undefined) {\r\n\t\turlHistory = urlHistory || {};\r\n\t\tif (urlHistory[schema['$ref']]) {\r\n\t\t\treturn this.createError(ErrorCodes.CIRCULAR_REFERENCE, {urls: Object.keys(urlHistory).join(', ')}, '', '', null, undefined, schema);\r\n\t\t}\r\n\t\turlHistory[schema['$ref']] = true;\r\n\t\tschema = this.getSchema(schema['$ref'], urlHistory);\r\n\t}\r\n\treturn schema;\r\n};\r\nValidatorContext.prototype.getSchema = function (url, urlHistory) {\r\n\tvar schema;\r\n\tif (this.schemas[url] !== undefined) {\r\n\t\tschema = this.schemas[url];\r\n\t\treturn this.resolveRefs(schema, urlHistory);\r\n\t}\r\n\tvar baseUrl = url;\r\n\tvar fragment = \"\";\r\n\tif (url.indexOf('#') !== -1) {\r\n\t\tfragment = url.substring(url.indexOf(\"#\") + 1);\r\n\t\tbaseUrl = url.substring(0, url.indexOf(\"#\"));\r\n\t}\r\n\tif (typeof this.schemas[baseUrl] === 'object') {\r\n\t\tschema = this.schemas[baseUrl];\r\n\t\tvar pointerPath = decodeURIComponent(fragment);\r\n\t\tif (pointerPath === \"\") {\r\n\t\t\treturn this.resolveRefs(schema, urlHistory);\r\n\t\t} else if (pointerPath.charAt(0) !== \"/\") {\r\n\t\t\treturn undefined;\r\n\t\t}\r\n\t\tvar parts = pointerPath.split(\"/\").slice(1);\r\n\t\tfor (var i = 0; i < parts.length; i++) {\r\n\t\t\tvar component = parts[i].replace(/~1/g, \"/\").replace(/~0/g, \"~\");\r\n\t\t\tif (schema[component] === undefined) {\r\n\t\t\t\tschema = undefined;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tschema = schema[component];\r\n\t\t}\r\n\t\tif (schema !== undefined) {\r\n\t\t\treturn this.resolveRefs(schema, urlHistory);\r\n\t\t}\r\n\t}\r\n\tif (this.missing[baseUrl] === undefined) {\r\n\t\tthis.missing.push(baseUrl);\r\n\t\tthis.missing[baseUrl] = baseUrl;\r\n\t\tthis.missingMap[baseUrl] = baseUrl;\r\n\t}\r\n};\r\nValidatorContext.prototype.searchSchemas = function (schema, url) {\r\n\tif (Array.isArray(schema)) {\r\n\t\tfor (var i = 0; i < schema.length; i++) {\r\n\t\t\tthis.searchSchemas(schema[i], url);\r\n\t\t}\r\n\t} else if (schema && typeof schema === \"object\") {\r\n\t\tif (typeof schema.id === \"string\") {\r\n\t\t\tif (isTrustedUrl(url, schema.id)) {\r\n\t\t\t\tif (this.schemas[schema.id] === undefined) {\r\n\t\t\t\t\tthis.schemas[schema.id] = schema;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor (var key in schema) {\r\n\t\t\tif (key !== \"enum\") {\r\n\t\t\t\tif (typeof schema[key] === \"object\") {\r\n\t\t\t\t\tthis.searchSchemas(schema[key], url);\r\n\t\t\t\t} else if (key === \"$ref\") {\r\n\t\t\t\t\tvar uri = getDocumentUri(schema[key]);\r\n\t\t\t\t\tif (uri && this.schemas[uri] === undefined && this.missingMap[uri] === undefined) {\r\n\t\t\t\t\t\tthis.missingMap[uri] = uri;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\nValidatorContext.prototype.addSchema = function (url, schema) {\r\n\t//overload\r\n\tif (typeof url !== 'string' || typeof schema === 'undefined') {\r\n\t\tif (typeof url === 'object' && typeof url.id === 'string') {\r\n\t\t\tschema = url;\r\n\t\t\turl = schema.id;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn;\r\n\t\t}\r\n\t}\r\n\tif (url === getDocumentUri(url) + \"#\") {\r\n\t\t// Remove empty fragment\r\n\t\turl = getDocumentUri(url);\r\n\t}\r\n\tthis.schemas[url] = schema;\r\n\tdelete this.missingMap[url];\r\n\tnormSchema(schema, url);\r\n\tthis.searchSchemas(schema, url);\r\n};\r\n\r\nValidatorContext.prototype.getSchemaMap = function () {\r\n\tvar map = {};\r\n\tfor (var key in this.schemas) {\r\n\t\tmap[key] = this.schemas[key];\r\n\t}\r\n\treturn map;\r\n};\r\n\r\nValidatorContext.prototype.getSchemaUris = function (filterRegExp) {\r\n\tvar list = [];\r\n\tfor (var key in this.schemas) {\r\n\t\tif (!filterRegExp || filterRegExp.test(key)) {\r\n\t\t\tlist.push(key);\r\n\t\t}\r\n\t}\r\n\treturn list;\r\n};\r\n\r\nValidatorContext.prototype.getMissingUris = function (filterRegExp) {\r\n\tvar list = [];\r\n\tfor (var key in this.missingMap) {\r\n\t\tif (!filterRegExp || filterRegExp.test(key)) {\r\n\t\t\tlist.push(key);\r\n\t\t}\r\n\t}\r\n\treturn list;\r\n};\r\n\r\nValidatorContext.prototype.dropSchemas = function () {\r\n\tthis.schemas = {};\r\n\tthis.reset();\r\n};\r\nValidatorContext.prototype.reset = function () {\r\n\tthis.missing = [];\r\n\tthis.missingMap = {};\r\n\tthis.errors = [];\r\n};\r\n\r\nValidatorContext.prototype.validateAll = function (data, schema, dataPathParts, schemaPathParts, dataPointerPath) {\r\n\tvar topLevel;\r\n\tschema = this.resolveRefs(schema);\r\n\tif (!schema) {\r\n\t\treturn null;\r\n\t} else if (schema instanceof ValidationError) {\r\n\t\tthis.errors.push(schema);\r\n\t\treturn schema;\r\n\t}\r\n\r\n\tvar startErrorCount = this.errors.length;\r\n\tvar frozenIndex, scannedFrozenSchemaIndex = null, scannedSchemasIndex = null;\r\n\tif (this.checkRecursive && data && typeof data === 'object') {\r\n\t\ttopLevel = !this.scanned.length;\r\n\t\tif (data[this.validatedSchemasKey]) {\r\n\t\t\tvar schemaIndex = data[this.validatedSchemasKey].indexOf(schema);\r\n\t\t\tif (schemaIndex !== -1) {\r\n\t\t\t\tthis.errors = this.errors.concat(data[this.validationErrorsKey][schemaIndex]);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (Object.isFrozen(data)) {\r\n\t\t\tfrozenIndex = this.scannedFrozen.indexOf(data);\r\n\t\t\tif (frozenIndex !== -1) {\r\n\t\t\t\tvar frozenSchemaIndex = this.scannedFrozenSchemas[frozenIndex].indexOf(schema);\r\n\t\t\t\tif (frozenSchemaIndex !== -1) {\r\n\t\t\t\t\tthis.errors = this.errors.concat(this.scannedFrozenValidationErrors[frozenIndex][frozenSchemaIndex]);\r\n\t\t\t\t\treturn null;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.scanned.push(data);\r\n\t\tif (Object.isFrozen(data)) {\r\n\t\t\tif (frozenIndex === -1) {\r\n\t\t\t\tfrozenIndex = this.scannedFrozen.length;\r\n\t\t\t\tthis.scannedFrozen.push(data);\r\n\t\t\t\tthis.scannedFrozenSchemas.push([]);\r\n\t\t\t}\r\n\t\t\tscannedFrozenSchemaIndex = this.scannedFrozenSchemas[frozenIndex].length;\r\n\t\t\tthis.scannedFrozenSchemas[frozenIndex][scannedFrozenSchemaIndex] = schema;\r\n\t\t\tthis.scannedFrozenValidationErrors[frozenIndex][scannedFrozenSchemaIndex] = [];\r\n\t\t} else {\r\n\t\t\tif (!data[this.validatedSchemasKey]) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tObject.defineProperty(data, this.validatedSchemasKey, {\r\n\t\t\t\t\t\tvalue: [],\r\n\t\t\t\t\t\tconfigurable: true\r\n\t\t\t\t\t});\r\n\t\t\t\t\tObject.defineProperty(data, this.validationErrorsKey, {\r\n\t\t\t\t\t\tvalue: [],\r\n\t\t\t\t\t\tconfigurable: true\r\n\t\t\t\t\t});\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\t//IE 7/8 workaround\r\n\t\t\t\t\tdata[this.validatedSchemasKey] = [];\r\n\t\t\t\t\tdata[this.validationErrorsKey] = [];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tscannedSchemasIndex = data[this.validatedSchemasKey].length;\r\n\t\t\tdata[this.validatedSchemasKey][scannedSchemasIndex] = schema;\r\n\t\t\tdata[this.validationErrorsKey][scannedSchemasIndex] = [];\r\n\t\t}\r\n\t}\r\n\r\n\tvar errorCount = this.errors.length;\r\n\tvar error = this.validateBasic(data, schema, dataPointerPath)\r\n\t\t|| this.validateNumeric(data, schema, dataPointerPath)\r\n\t\t|| this.validateString(data, schema, dataPointerPath)\r\n\t\t|| this.validateArray(data, schema, dataPointerPath)\r\n\t\t|| this.validateObject(data, schema, dataPointerPath)\r\n\t\t|| this.validateCombinations(data, schema, dataPointerPath)\r\n\t\t|| this.validateHypermedia(data, schema, dataPointerPath)\r\n\t\t|| this.validateFormat(data, schema, dataPointerPath)\r\n\t\t|| this.validateDefinedKeywords(data, schema, dataPointerPath)\r\n\t\t|| null;\r\n\r\n\tif (topLevel) {\r\n\t\twhile (this.scanned.length) {\r\n\t\t\tvar item = this.scanned.pop();\r\n\t\t\tdelete item[this.validatedSchemasKey];\r\n\t\t}\r\n\t\tthis.scannedFrozen = [];\r\n\t\tthis.scannedFrozenSchemas = [];\r\n\t}\r\n\r\n\tif (error || errorCount !== this.errors.length) {\r\n\t\twhile ((dataPathParts && dataPathParts.length) || (schemaPathParts && schemaPathParts.length)) {\r\n\t\t\tvar dataPart = (dataPathParts && dataPathParts.length) ? \"\" + dataPathParts.pop() : null;\r\n\t\t\tvar schemaPart = (schemaPathParts && schemaPathParts.length) ? \"\" + schemaPathParts.pop() : null;\r\n\t\t\tif (error) {\r\n\t\t\t\terror = error.prefixWith(dataPart, schemaPart);\r\n\t\t\t}\r\n\t\t\tthis.prefixErrors(errorCount, dataPart, schemaPart);\r\n\t\t}\r\n\t}\r\n\r\n\tif (scannedFrozenSchemaIndex !== null) {\r\n\t\tthis.scannedFrozenValidationErrors[frozenIndex][scannedFrozenSchemaIndex] = this.errors.slice(startErrorCount);\r\n\t} else if (scannedSchemasIndex !== null) {\r\n\t\tdata[this.validationErrorsKey][scannedSchemasIndex] = this.errors.slice(startErrorCount);\r\n\t}\r\n\r\n\treturn this.handleError(error);\r\n};\r\nValidatorContext.prototype.validateFormat = function (data, schema) {\r\n\tif (typeof schema.format !== 'string' || !this.formatValidators[schema.format]) {\r\n\t\treturn null;\r\n\t}\r\n\tvar errorMessage = this.formatValidators[schema.format].call(null, data, schema);\r\n\tif (typeof errorMessage === 'string' || typeof errorMessage === 'number') {\r\n\t\treturn this.createError(ErrorCodes.FORMAT_CUSTOM, {message: errorMessage}, '', '/format', null, data, schema);\r\n\t} else if (errorMessage && typeof errorMessage === 'object') {\r\n\t\treturn this.createError(ErrorCodes.FORMAT_CUSTOM, {message: errorMessage.message || \"?\"}, errorMessage.dataPath || '', errorMessage.schemaPath || \"/format\", null, data, schema);\r\n\t}\r\n\treturn null;\r\n};\r\nValidatorContext.prototype.validateDefinedKeywords = function (data, schema, dataPointerPath) {\r\n\tfor (var key in this.definedKeywords) {\r\n\t\tif (typeof schema[key] === 'undefined') {\r\n\t\t\tcontinue;\r\n\t\t}\r\n\t\tvar validationFunctions = this.definedKeywords[key];\r\n\t\tfor (var i = 0; i < validationFunctions.length; i++) {\r\n\t\t\tvar func = validationFunctions[i];\r\n\t\t\tvar result = func(data, schema[key], schema, dataPointerPath);\r\n\t\t\tif (typeof result === 'string' || typeof result === 'number') {\r\n\t\t\t\treturn this.createError(ErrorCodes.KEYWORD_CUSTOM, {key: key, message: result}, '', '', null, data, schema).prefixWith(null, key);\r\n\t\t\t} else if (result && typeof result === 'object') {\r\n\t\t\t\tvar code = result.code;\r\n\t\t\t\tif (typeof code === 'string') {\r\n\t\t\t\t\tif (!ErrorCodes[code]) {\r\n\t\t\t\t\t\tthrow new Error('Undefined error code (use defineError): ' + code);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcode = ErrorCodes[code];\r\n\t\t\t\t} else if (typeof code !== 'number') {\r\n\t\t\t\t\tcode = ErrorCodes.KEYWORD_CUSTOM;\r\n\t\t\t\t}\r\n\t\t\t\tvar messageParams = (typeof result.message === 'object') ? result.message : {key: key, message: result.message || \"?\"};\r\n\t\t\t\tvar schemaPath = result.schemaPath || (\"/\" + key.replace(/~/g, '~0').replace(/\\//g, '~1'));\r\n\t\t\t\treturn this.createError(code, messageParams, result.dataPath || null, schemaPath, null, data, schema);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nfunction recursiveCompare(A, B) {\r\n\tif (A === B) {\r\n\t\treturn true;\r\n\t}\r\n\tif (A && B && typeof A === \"object\" && typeof B === \"object\") {\r\n\t\tif (Array.isArray(A) !== Array.isArray(B)) {\r\n\t\t\treturn false;\r\n\t\t} else if (Array.isArray(A)) {\r\n\t\t\tif (A.length !== B.length) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\tfor (var i = 0; i < A.length; i++) {\r\n\t\t\t\tif (!recursiveCompare(A[i], B[i])) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tvar key;\r\n\t\t\tfor (key in A) {\r\n\t\t\t\tif (B[key] === undefined && A[key] !== undefined) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (key in B) {\r\n\t\t\t\tif (A[key] === undefined && B[key] !== undefined) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfor (key in A) {\r\n\t\t\t\tif (!recursiveCompare(A[key], B[key])) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nValidatorContext.prototype.validateBasic = function validateBasic(data, schema, dataPointerPath) {\r\n\tvar error;\r\n\tif (error = this.validateType(data, schema, dataPointerPath)) {\r\n\t\treturn error.prefixWith(null, \"type\");\r\n\t}\r\n\tif (error = this.validateEnum(data, schema, dataPointerPath)) {\r\n\t\treturn error.prefixWith(null, \"type\");\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateType = function validateType(data, schema) {\r\n\tif (schema.type === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tvar dataType = typeof data;\r\n\tif (data === null) {\r\n\t\tdataType = \"null\";\r\n\t} else if (Array.isArray(data)) {\r\n\t\tdataType = \"array\";\r\n\t}\r\n\tvar allowedTypes = schema.type;\r\n\tif (!Array.isArray(allowedTypes)) {\r\n\t\tallowedTypes = [allowedTypes];\r\n\t}\r\n\r\n\tfor (var i = 0; i < allowedTypes.length; i++) {\r\n\t\tvar type = allowedTypes[i];\r\n\t\tif (type === dataType || (type === \"integer\" && dataType === \"number\" && (data % 1 === 0))) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\treturn this.createError(ErrorCodes.INVALID_TYPE, {type: dataType, expected: allowedTypes.join(\"/\")}, '', '', null, data, schema);\r\n};\r\n\r\nValidatorContext.prototype.validateEnum = function validateEnum(data, schema) {\r\n\tif (schema[\"enum\"] === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tfor (var i = 0; i < schema[\"enum\"].length; i++) {\r\n\t\tvar enumVal = schema[\"enum\"][i];\r\n\t\tif (recursiveCompare(data, enumVal)) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\t}\r\n\treturn this.createError(ErrorCodes.ENUM_MISMATCH, {value: (typeof JSON !== 'undefined') ? JSON.stringify(data) : data}, '', '', null, data, schema);\r\n};\r\n\r\nValidatorContext.prototype.validateNumeric = function validateNumeric(data, schema, dataPointerPath) {\r\n\treturn this.validateMultipleOf(data, schema, dataPointerPath)\r\n\t\t|| this.validateMinMax(data, schema, dataPointerPath)\r\n\t\t|| this.validateNaN(data, schema, dataPointerPath)\r\n\t\t|| null;\r\n};\r\n\r\nvar CLOSE_ENOUGH_LOW = Math.pow(2, -51);\r\nvar CLOSE_ENOUGH_HIGH = 1 - CLOSE_ENOUGH_LOW;\r\nValidatorContext.prototype.validateMultipleOf = function validateMultipleOf(data, schema) {\r\n\tvar multipleOf = schema.multipleOf || schema.divisibleBy;\r\n\tif (multipleOf === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tif (typeof data === \"number\") {\r\n\t\tvar remainder = (data/multipleOf)%1;\r\n\t\tif (remainder >= CLOSE_ENOUGH_LOW && remainder < CLOSE_ENOUGH_HIGH) {\r\n\t\t\treturn this.createError(ErrorCodes.NUMBER_MULTIPLE_OF, {value: data, multipleOf: multipleOf}, '', '', null, data, schema);\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateMinMax = function validateMinMax(data, schema) {\r\n\tif (typeof data !== \"number\") {\r\n\t\treturn null;\r\n\t}\r\n\tif (schema.minimum !== undefined) {\r\n\t\tif (data < schema.minimum) {\r\n\t\t\treturn this.createError(ErrorCodes.NUMBER_MINIMUM, {value: data, minimum: schema.minimum}, '', '/minimum', null, data, schema);\r\n\t\t}\r\n\t\tif (schema.exclusiveMinimum && data === schema.minimum) {\r\n\t\t\treturn this.createError(ErrorCodes.NUMBER_MINIMUM_EXCLUSIVE, {value: data, minimum: schema.minimum}, '', '/exclusiveMinimum', null, data, schema);\r\n\t\t}\r\n\t}\r\n\tif (schema.maximum !== undefined) {\r\n\t\tif (data > schema.maximum) {\r\n\t\t\treturn this.createError(ErrorCodes.NUMBER_MAXIMUM, {value: data, maximum: schema.maximum}, '', '/maximum', null, data, schema);\r\n\t\t}\r\n\t\tif (schema.exclusiveMaximum && data === schema.maximum) {\r\n\t\t\treturn this.createError(ErrorCodes.NUMBER_MAXIMUM_EXCLUSIVE, {value: data, maximum: schema.maximum}, '', '/exclusiveMaximum', null, data, schema);\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateNaN = function validateNaN(data, schema) {\r\n\tif (typeof data !== \"number\") {\r\n\t\treturn null;\r\n\t}\r\n\tif (isNaN(data) === true || data === Infinity || data === -Infinity) {\r\n\t\treturn this.createError(ErrorCodes.NUMBER_NOT_A_NUMBER, {value: data}, '', '/type', null, data, schema);\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateString = function validateString(data, schema, dataPointerPath) {\r\n\treturn this.validateStringLength(data, schema, dataPointerPath)\r\n\t\t|| this.validateStringPattern(data, schema, dataPointerPath)\r\n\t\t|| null;\r\n};\r\n\r\nValidatorContext.prototype.validateStringLength = function validateStringLength(data, schema) {\r\n\tif (typeof data !== \"string\") {\r\n\t\treturn null;\r\n\t}\r\n\tif (schema.minLength !== undefined) {\r\n\t\tif (data.length < schema.minLength) {\r\n\t\t\treturn this.createError(ErrorCodes.STRING_LENGTH_SHORT, {length: data.length, minimum: schema.minLength}, '', '/minLength', null, data, schema);\r\n\t\t}\r\n\t}\r\n\tif (schema.maxLength !== undefined) {\r\n\t\tif (data.length > schema.maxLength) {\r\n\t\t\treturn this.createError(ErrorCodes.STRING_LENGTH_LONG, {length: data.length, maximum: schema.maxLength}, '', '/maxLength', null, data, schema);\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateStringPattern = function validateStringPattern(data, schema) {\r\n\tif (typeof data !== \"string\" || (typeof schema.pattern !== \"string\" && !(schema.pattern instanceof RegExp))) {\r\n\t\treturn null;\r\n\t}\r\n\tvar regexp;\r\n\tif (schema.pattern instanceof RegExp) {\r\n\t regexp = schema.pattern;\r\n\t}\r\n\telse {\r\n\t var body, flags = '';\r\n\t // Check for regular expression literals\r\n\t // @see http://www.ecma-international.org/ecma-262/5.1/#sec-7.8.5\r\n\t var literal = schema.pattern.match(/^\\/(.+)\\/([img]*)$/);\r\n\t if (literal) {\r\n\t body = literal[1];\r\n\t flags = literal[2];\r\n\t }\r\n\t else {\r\n\t body = schema.pattern;\r\n\t }\r\n\t regexp = new RegExp(body, flags);\r\n\t}\r\n\tif (!regexp.test(data)) {\r\n\t\treturn this.createError(ErrorCodes.STRING_PATTERN, {pattern: schema.pattern}, '', '/pattern', null, data, schema);\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateArray = function validateArray(data, schema, dataPointerPath) {\r\n\tif (!Array.isArray(data)) {\r\n\t\treturn null;\r\n\t}\r\n\treturn this.validateArrayLength(data, schema, dataPointerPath)\r\n\t\t|| this.validateArrayUniqueItems(data, schema, dataPointerPath)\r\n\t\t|| this.validateArrayItems(data, schema, dataPointerPath)\r\n\t\t|| null;\r\n};\r\n\r\nValidatorContext.prototype.validateArrayLength = function validateArrayLength(data, schema) {\r\n\tvar error;\r\n\tif (schema.minItems !== undefined) {\r\n\t\tif (data.length < schema.minItems) {\r\n\t\t\terror = this.createError(ErrorCodes.ARRAY_LENGTH_SHORT, {length: data.length, minimum: schema.minItems}, '', '/minItems', null, data, schema);\r\n\t\t\tif (this.handleError(error)) {\r\n\t\t\t\treturn error;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (schema.maxItems !== undefined) {\r\n\t\tif (data.length > schema.maxItems) {\r\n\t\t\terror = this.createError(ErrorCodes.ARRAY_LENGTH_LONG, {length: data.length, maximum: schema.maxItems}, '', '/maxItems', null, data, schema);\r\n\t\t\tif (this.handleError(error)) {\r\n\t\t\t\treturn error;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateArrayUniqueItems = function validateArrayUniqueItems(data, schema) {\r\n\tif (schema.uniqueItems) {\r\n\t\tfor (var i = 0; i < data.length; i++) {\r\n\t\t\tfor (var j = i + 1; j < data.length; j++) {\r\n\t\t\t\tif (recursiveCompare(data[i], data[j])) {\r\n\t\t\t\t\tvar error = this.createError(ErrorCodes.ARRAY_UNIQUE, {match1: i, match2: j}, '', '/uniqueItems', null, data, schema);\r\n\t\t\t\t\tif (this.handleError(error)) {\r\n\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateArrayItems = function validateArrayItems(data, schema, dataPointerPath) {\r\n\tif (schema.items === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tvar error, i;\r\n\tif (Array.isArray(schema.items)) {\r\n\t\tfor (i = 0; i < data.length; i++) {\r\n\t\t\tif (i < schema.items.length) {\r\n\t\t\t\tif (error = this.validateAll(data[i], schema.items[i], [i], [\"items\", i], dataPointerPath + \"/\" + i)) {\r\n\t\t\t\t\treturn error;\r\n\t\t\t\t}\r\n\t\t\t} else if (schema.additionalItems !== undefined) {\r\n\t\t\t\tif (typeof schema.additionalItems === \"boolean\") {\r\n\t\t\t\t\tif (!schema.additionalItems) {\r\n\t\t\t\t\t\terror = (this.createError(ErrorCodes.ARRAY_ADDITIONAL_ITEMS, {}, '/' + i, '/additionalItems', null, data, schema));\r\n\t\t\t\t\t\tif (this.handleError(error)) {\r\n\t\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (error = this.validateAll(data[i], schema.additionalItems, [i], [\"additionalItems\"], dataPointerPath + \"/\" + i)) {\r\n\t\t\t\t\treturn error;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\tfor (i = 0; i < data.length; i++) {\r\n\t\t\tif (error = this.validateAll(data[i], schema.items, [i], [\"items\"], dataPointerPath + \"/\" + i)) {\r\n\t\t\t\treturn error;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateObject = function validateObject(data, schema, dataPointerPath) {\r\n\tif (typeof data !== \"object\" || data === null || Array.isArray(data)) {\r\n\t\treturn null;\r\n\t}\r\n\treturn this.validateObjectMinMaxProperties(data, schema, dataPointerPath)\r\n\t\t|| this.validateObjectRequiredProperties(data, schema, dataPointerPath)\r\n\t\t|| this.validateObjectProperties(data, schema, dataPointerPath)\r\n\t\t|| this.validateObjectDependencies(data, schema, dataPointerPath)\r\n\t\t|| null;\r\n};\r\n\r\nValidatorContext.prototype.validateObjectMinMaxProperties = function validateObjectMinMaxProperties(data, schema) {\r\n\tvar keys = Object.keys(data);\r\n\tvar error;\r\n\tif (schema.minProperties !== undefined) {\r\n\t\tif (keys.length < schema.minProperties) {\r\n\t\t\terror = this.createError(ErrorCodes.OBJECT_PROPERTIES_MINIMUM, {propertyCount: keys.length, minimum: schema.minProperties}, '', '/minProperties', null, data, schema);\r\n\t\t\tif (this.handleError(error)) {\r\n\t\t\t\treturn error;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tif (schema.maxProperties !== undefined) {\r\n\t\tif (keys.length > schema.maxProperties) {\r\n\t\t\terror = this.createError(ErrorCodes.OBJECT_PROPERTIES_MAXIMUM, {propertyCount: keys.length, maximum: schema.maxProperties}, '', '/maxProperties', null, data, schema);\r\n\t\t\tif (this.handleError(error)) {\r\n\t\t\t\treturn error;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateObjectRequiredProperties = function validateObjectRequiredProperties(data, schema) {\r\n\tif (schema.required !== undefined) {\r\n\t\tfor (var i = 0; i < schema.required.length; i++) {\r\n\t\t\tvar key = schema.required[i];\r\n\t\t\tif (data[key] === undefined) {\r\n\t\t\t\tvar error = this.createError(ErrorCodes.OBJECT_REQUIRED, {key: key}, '', '/required/' + i, null, data, schema);\r\n\t\t\t\tif (this.handleError(error)) {\r\n\t\t\t\t\treturn error;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateObjectProperties = function validateObjectProperties(data, schema, dataPointerPath) {\r\n\tvar error;\r\n\tfor (var key in data) {\r\n\t\tvar keyPointerPath = dataPointerPath + \"/\" + key.replace(/~/g, '~0').replace(/\\//g, '~1');\r\n\t\tvar foundMatch = false;\r\n\t\tif (schema.properties !== undefined && schema.properties[key] !== undefined) {\r\n\t\t\tfoundMatch = true;\r\n\t\t\tif (error = this.validateAll(data[key], schema.properties[key], [key], [\"properties\", key], keyPointerPath)) {\r\n\t\t\t\treturn error;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (schema.patternProperties !== undefined) {\r\n\t\t\tfor (var patternKey in schema.patternProperties) {\r\n\t\t\t\tvar regexp = new RegExp(patternKey);\r\n\t\t\t\tif (regexp.test(key)) {\r\n\t\t\t\t\tfoundMatch = true;\r\n\t\t\t\t\tif (error = this.validateAll(data[key], schema.patternProperties[patternKey], [key], [\"patternProperties\", patternKey], keyPointerPath)) {\r\n\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (!foundMatch) {\r\n\t\t\tif (schema.additionalProperties !== undefined) {\r\n\t\t\t\tif (this.trackUnknownProperties) {\r\n\t\t\t\t\tthis.knownPropertyPaths[keyPointerPath] = true;\r\n\t\t\t\t\tdelete this.unknownPropertyPaths[keyPointerPath];\r\n\t\t\t\t}\r\n\t\t\t\tif (typeof schema.additionalProperties === \"boolean\") {\r\n\t\t\t\t\tif (!schema.additionalProperties) {\r\n\t\t\t\t\t\terror = this.createError(ErrorCodes.OBJECT_ADDITIONAL_PROPERTIES, {key: key}, '', '/additionalProperties', null, data, schema).prefixWith(key, null);\r\n\t\t\t\t\t\tif (this.handleError(error)) {\r\n\t\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (error = this.validateAll(data[key], schema.additionalProperties, [key], [\"additionalProperties\"], keyPointerPath)) {\r\n\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else if (this.trackUnknownProperties && !this.knownPropertyPaths[keyPointerPath]) {\r\n\t\t\t\tthis.unknownPropertyPaths[keyPointerPath] = true;\r\n\t\t\t}\r\n\t\t} else if (this.trackUnknownProperties) {\r\n\t\t\tthis.knownPropertyPaths[keyPointerPath] = true;\r\n\t\t\tdelete this.unknownPropertyPaths[keyPointerPath];\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateObjectDependencies = function validateObjectDependencies(data, schema, dataPointerPath) {\r\n\tvar error;\r\n\tif (schema.dependencies !== undefined) {\r\n\t\tfor (var depKey in schema.dependencies) {\r\n\t\t\tif (data[depKey] !== undefined) {\r\n\t\t\t\tvar dep = schema.dependencies[depKey];\r\n\t\t\t\tif (typeof dep === \"string\") {\r\n\t\t\t\t\tif (data[dep] === undefined) {\r\n\t\t\t\t\t\terror = this.createError(ErrorCodes.OBJECT_DEPENDENCY_KEY, {key: depKey, missing: dep}, '', '', null, data, schema).prefixWith(null, depKey).prefixWith(null, \"dependencies\");\r\n\t\t\t\t\t\tif (this.handleError(error)) {\r\n\t\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (Array.isArray(dep)) {\r\n\t\t\t\t\tfor (var i = 0; i < dep.length; i++) {\r\n\t\t\t\t\t\tvar requiredKey = dep[i];\r\n\t\t\t\t\t\tif (data[requiredKey] === undefined) {\r\n\t\t\t\t\t\t\terror = this.createError(ErrorCodes.OBJECT_DEPENDENCY_KEY, {key: depKey, missing: requiredKey}, '', '/' + i, null, data, schema).prefixWith(null, depKey).prefixWith(null, \"dependencies\");\r\n\t\t\t\t\t\t\tif (this.handleError(error)) {\r\n\t\t\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (error = this.validateAll(data, dep, [], [\"dependencies\", depKey], dataPointerPath)) {\r\n\t\t\t\t\t\treturn error;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateCombinations = function validateCombinations(data, schema, dataPointerPath) {\r\n\treturn this.validateAllOf(data, schema, dataPointerPath)\r\n\t\t|| this.validateAnyOf(data, schema, dataPointerPath)\r\n\t\t|| this.validateOneOf(data, schema, dataPointerPath)\r\n\t\t|| this.validateNot(data, schema, dataPointerPath)\r\n\t\t|| null;\r\n};\r\n\r\nValidatorContext.prototype.validateAllOf = function validateAllOf(data, schema, dataPointerPath) {\r\n\tif (schema.allOf === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tvar error;\r\n\tfor (var i = 0; i < schema.allOf.length; i++) {\r\n\t\tvar subSchema = schema.allOf[i];\r\n\t\tif (error = this.validateAll(data, subSchema, [], [\"allOf\", i], dataPointerPath)) {\r\n\t\t\treturn error;\r\n\t\t}\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateAnyOf = function validateAnyOf(data, schema, dataPointerPath) {\r\n\tif (schema.anyOf === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tvar errors = [];\r\n\tvar startErrorCount = this.errors.length;\r\n\tvar oldUnknownPropertyPaths, oldKnownPropertyPaths;\r\n\tif (this.trackUnknownProperties) {\r\n\t\toldUnknownPropertyPaths = this.unknownPropertyPaths;\r\n\t\toldKnownPropertyPaths = this.knownPropertyPaths;\r\n\t}\r\n\tvar errorAtEnd = true;\r\n\tfor (var i = 0; i < schema.anyOf.length; i++) {\r\n\t\tif (this.trackUnknownProperties) {\r\n\t\t\tthis.unknownPropertyPaths = {};\r\n\t\t\tthis.knownPropertyPaths = {};\r\n\t\t}\r\n\t\tvar subSchema = schema.anyOf[i];\r\n\r\n\t\tvar errorCount = this.errors.length;\r\n\t\tvar error = this.validateAll(data, subSchema, [], [\"anyOf\", i], dataPointerPath);\r\n\r\n\t\tif (error === null && errorCount === this.errors.length) {\r\n\t\t\tthis.errors = this.errors.slice(0, startErrorCount);\r\n\r\n\t\t\tif (this.trackUnknownProperties) {\r\n\t\t\t\tfor (var knownKey in this.knownPropertyPaths) {\r\n\t\t\t\t\toldKnownPropertyPaths[knownKey] = true;\r\n\t\t\t\t\tdelete oldUnknownPropertyPaths[knownKey];\r\n\t\t\t\t}\r\n\t\t\t\tfor (var unknownKey in this.unknownPropertyPaths) {\r\n\t\t\t\t\tif (!oldKnownPropertyPaths[unknownKey]) {\r\n\t\t\t\t\t\toldUnknownPropertyPaths[unknownKey] = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// We need to continue looping so we catch all the property definitions, but we don't want to return an error\r\n\t\t\t\terrorAtEnd = false;\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\treturn null;\r\n\t\t}\r\n\t\tif (error) {\r\n\t\t\terrors.push(error.prefixWith(null, \"\" + i).prefixWith(null, \"anyOf\"));\r\n\t\t}\r\n\t}\r\n\tif (this.trackUnknownProperties) {\r\n\t\tthis.unknownPropertyPaths = oldUnknownPropertyPaths;\r\n\t\tthis.knownPropertyPaths = oldKnownPropertyPaths;\r\n\t}\r\n\tif (errorAtEnd) {\r\n\t\terrors = errors.concat(this.errors.slice(startErrorCount));\r\n\t\tthis.errors = this.errors.slice(0, startErrorCount);\r\n\t\treturn this.createError(ErrorCodes.ANY_OF_MISSING, {}, \"\", \"/anyOf\", errors, data, schema);\r\n\t}\r\n};\r\n\r\nValidatorContext.prototype.validateOneOf = function validateOneOf(data, schema, dataPointerPath) {\r\n\tif (schema.oneOf === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tvar validIndex = null;\r\n\tvar errors = [];\r\n\tvar startErrorCount = this.errors.length;\r\n\tvar oldUnknownPropertyPaths, oldKnownPropertyPaths;\r\n\tif (this.trackUnknownProperties) {\r\n\t\toldUnknownPropertyPaths = this.unknownPropertyPaths;\r\n\t\toldKnownPropertyPaths = this.knownPropertyPaths;\r\n\t}\r\n\tfor (var i = 0; i < schema.oneOf.length; i++) {\r\n\t\tif (this.trackUnknownProperties) {\r\n\t\t\tthis.unknownPropertyPaths = {};\r\n\t\t\tthis.knownPropertyPaths = {};\r\n\t\t}\r\n\t\tvar subSchema = schema.oneOf[i];\r\n\r\n\t\tvar errorCount = this.errors.length;\r\n\t\tvar error = this.validateAll(data, subSchema, [], [\"oneOf\", i], dataPointerPath);\r\n\r\n\t\tif (error === null && errorCount === this.errors.length) {\r\n\t\t\tif (validIndex === null) {\r\n\t\t\t\tvalidIndex = i;\r\n\t\t\t} else {\r\n\t\t\t\tthis.errors = this.errors.slice(0, startErrorCount);\r\n\t\t\t\treturn this.createError(ErrorCodes.ONE_OF_MULTIPLE, {index1: validIndex, index2: i}, \"\", \"/oneOf\", null, data, schema);\r\n\t\t\t}\r\n\t\t\tif (this.trackUnknownProperties) {\r\n\t\t\t\tfor (var knownKey in this.knownPropertyPaths) {\r\n\t\t\t\t\toldKnownPropertyPaths[knownKey] = true;\r\n\t\t\t\t\tdelete oldUnknownPropertyPaths[knownKey];\r\n\t\t\t\t}\r\n\t\t\t\tfor (var unknownKey in this.unknownPropertyPaths) {\r\n\t\t\t\t\tif (!oldKnownPropertyPaths[unknownKey]) {\r\n\t\t\t\t\t\toldUnknownPropertyPaths[unknownKey] = true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else if (error) {\r\n\t\t\terrors.push(error);\r\n\t\t}\r\n\t}\r\n\tif (this.trackUnknownProperties) {\r\n\t\tthis.unknownPropertyPaths = oldUnknownPropertyPaths;\r\n\t\tthis.knownPropertyPaths = oldKnownPropertyPaths;\r\n\t}\r\n\tif (validIndex === null) {\r\n\t\terrors = errors.concat(this.errors.slice(startErrorCount));\r\n\t\tthis.errors = this.errors.slice(0, startErrorCount);\r\n\t\treturn this.createError(ErrorCodes.ONE_OF_MISSING, {}, \"\", \"/oneOf\", errors, data, schema);\r\n\t} else {\r\n\t\tthis.errors = this.errors.slice(0, startErrorCount);\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateNot = function validateNot(data, schema, dataPointerPath) {\r\n\tif (schema.not === undefined) {\r\n\t\treturn null;\r\n\t}\r\n\tvar oldErrorCount = this.errors.length;\r\n\tvar oldUnknownPropertyPaths, oldKnownPropertyPaths;\r\n\tif (this.trackUnknownProperties) {\r\n\t\toldUnknownPropertyPaths = this.unknownPropertyPaths;\r\n\t\toldKnownPropertyPaths = this.knownPropertyPaths;\r\n\t\tthis.unknownPropertyPaths = {};\r\n\t\tthis.knownPropertyPaths = {};\r\n\t}\r\n\tvar error = this.validateAll(data, schema.not, null, null, dataPointerPath);\r\n\tvar notErrors = this.errors.slice(oldErrorCount);\r\n\tthis.errors = this.errors.slice(0, oldErrorCount);\r\n\tif (this.trackUnknownProperties) {\r\n\t\tthis.unknownPropertyPaths = oldUnknownPropertyPaths;\r\n\t\tthis.knownPropertyPaths = oldKnownPropertyPaths;\r\n\t}\r\n\tif (error === null && notErrors.length === 0) {\r\n\t\treturn this.createError(ErrorCodes.NOT_PASSED, {}, \"\", \"/not\", null, data, schema);\r\n\t}\r\n\treturn null;\r\n};\r\n\r\nValidatorContext.prototype.validateHypermedia = function validateCombinations(data, schema, dataPointerPath) {\r\n\tif (!schema.links) {\r\n\t\treturn null;\r\n\t}\r\n\tvar error;\r\n\tfor (var i = 0; i < schema.links.length; i++) {\r\n\t\tvar ldo = schema.links[i];\r\n\t\tif (ldo.rel === \"describedby\") {\r\n\t\t\tvar template = new UriTemplate(ldo.href);\r\n\t\t\tvar allPresent = true;\r\n\t\t\tfor (var j = 0; j < template.varNames.length; j++) {\r\n\t\t\t\tif (!(template.varNames[j] in data)) {\r\n\t\t\t\t\tallPresent = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (allPresent) {\r\n\t\t\t\tvar schemaUrl = template.fillFromObject(data);\r\n\t\t\t\tvar subSchema = {\"$ref\": schemaUrl};\r\n\t\t\t\tif (error = this.validateAll(data, subSchema, [], [\"links\", i], dataPointerPath)) {\r\n\t\t\t\t\treturn error;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n};\r\n\r\n// parseURI() and resolveUrl() are from https://gist.github.com/1088850\r\n// - released as public domain by author (\"Yaffle\") - see comments on gist\r\n\r\nfunction parseURI(url) {\r\n\tvar m = String(url).replace(/^\\s+|\\s+$/g, '').match(/^([^:\\/?#]+:)?(\\/\\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\\/?#]*)(?::(\\d*))?))?([^?#]*)(\\?[^#]*)?(#[\\s\\S]*)?/);\r\n\t// authority = '//' + user + ':' + pass '@' + hostname + ':' port\r\n\treturn (m ? {\r\n\t\thref : m[0] || '',\r\n\t\tprotocol : m[1] || '',\r\n\t\tauthority: m[2] || '',\r\n\t\thost : m[3] || '',\r\n\t\thostname : m[4] || '',\r\n\t\tport : m[5] || '',\r\n\t\tpathname : m[6] || '',\r\n\t\tsearch : m[7] || '',\r\n\t\thash : m[8] || ''\r\n\t} : null);\r\n}\r\n\r\nfunction resolveUrl(base, href) {// RFC 3986\r\n\r\n\tfunction removeDotSegments(input) {\r\n\t\tvar output = [];\r\n\t\tinput.replace(/^(\\.\\.?(\\/|$))+/, '')\r\n\t\t\t.replace(/\\/(\\.(\\/|$))+/g, '/')\r\n\t\t\t.replace(/\\/\\.\\.$/, '/../')\r\n\t\t\t.replace(/\\/?[^\\/]*/g, function (p) {\r\n\t\t\t\tif (p === '/..') {\r\n\t\t\t\t\toutput.pop();\r\n\t\t\t\t} else {\r\n\t\t\t\t\toutput.push(p);\r\n\t\t\t\t}\r\n\t\t});\r\n\t\treturn output.join('').replace(/^\\//, input.charAt(0) === '/' ? '/' : '');\r\n\t}\r\n\r\n\thref = parseURI(href || '');\r\n\tbase = parseURI(base || '');\r\n\r\n\treturn !href || !base ? null : (href.protocol || base.protocol) +\r\n\t\t(href.protocol || href.authority ? href.authority : base.authority) +\r\n\t\tremoveDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) +\r\n\t\t(href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) +\r\n\t\thref.hash;\r\n}\r\n\r\nfunction getDocumentUri(uri) {\r\n\treturn uri.split('#')[0];\r\n}\r\nfunction normSchema(schema, baseUri) {\r\n\tif (schema && typeof schema === \"object\") {\r\n\t\tif (baseUri === undefined) {\r\n\t\t\tbaseUri = schema.id;\r\n\t\t} else if (typeof schema.id === \"string\") {\r\n\t\t\tbaseUri = resolveUrl(baseUri, schema.id);\r\n\t\t\tschema.id = baseUri;\r\n\t\t}\r\n\t\tif (Array.isArray(schema)) {\r\n\t\t\tfor (var i = 0; i < schema.length; i++) {\r\n\t\t\t\tnormSchema(schema[i], baseUri);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (typeof schema['$ref'] === \"string\") {\r\n\t\t\t\tschema['$ref'] = resolveUrl(baseUri, schema['$ref']);\r\n\t\t\t}\r\n\t\t\tfor (var key in schema) {\r\n\t\t\t\tif (key !== \"enum\") {\r\n\t\t\t\t\tnormSchema(schema[key], baseUri);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction defaultErrorReporter(language) {\r\n\tlanguage = language || 'en';\r\n\r\n\tvar errorMessages = languages[language];\r\n\r\n\treturn function (error) {\r\n\t\tvar messageTemplate = errorMessages[error.code] || ErrorMessagesDefault[error.code];\r\n\t\tif (typeof messageTemplate !== 'string') {\r\n\t\t\treturn \"Unknown error code \" + error.code + \": \" + JSON.stringify(error.messageParams);\r\n\t\t}\r\n\t\tvar messageParams = error.params;\r\n\t\t// Adapted from Crockford's supplant()\r\n\t\treturn messageTemplate.replace(/\\{([^{}]*)\\}/g, function (whole, varName) {\r\n\t\t\tvar subValue = messageParams[varName];\r\n\t\t\treturn typeof subValue === 'string' || typeof subValue === 'number' ? subValue : whole;\r\n\t\t});\r\n\t};\r\n}\r\n\r\nvar ErrorCodes = {\r\n\tINVALID_TYPE: 0,\r\n\tENUM_MISMATCH: 1,\r\n\tANY_OF_MISSING: 10,\r\n\tONE_OF_MISSING: 11,\r\n\tONE_OF_MULTIPLE: 12,\r\n\tNOT_PASSED: 13,\r\n\t// Numeric errors\r\n\tNUMBER_MULTIPLE_OF: 100,\r\n\tNUMBER_MINIMUM: 101,\r\n\tNUMBER_MINIMUM_EXCLUSIVE: 102,\r\n\tNUMBER_MAXIMUM: 103,\r\n\tNUMBER_MAXIMUM_EXCLUSIVE: 104,\r\n\tNUMBER_NOT_A_NUMBER: 105,\r\n\t// String errors\r\n\tSTRING_LENGTH_SHORT: 200,\r\n\tSTRING_LENGTH_LONG: 201,\r\n\tSTRING_PATTERN: 202,\r\n\t// Object errors\r\n\tOBJECT_PROPERTIES_MINIMUM: 300,\r\n\tOBJECT_PROPERTIES_MAXIMUM: 301,\r\n\tOBJECT_REQUIRED: 302,\r\n\tOBJECT_ADDITIONAL_PROPERTIES: 303,\r\n\tOBJECT_DEPENDENCY_KEY: 304,\r\n\t// Array errors\r\n\tARRAY_LENGTH_SHORT: 400,\r\n\tARRAY_LENGTH_LONG: 401,\r\n\tARRAY_UNIQUE: 402,\r\n\tARRAY_ADDITIONAL_ITEMS: 403,\r\n\t// Custom/user-defined errors\r\n\tFORMAT_CUSTOM: 500,\r\n\tKEYWORD_CUSTOM: 501,\r\n\t// Schema structure\r\n\tCIRCULAR_REFERENCE: 600,\r\n\t// Non-standard validation options\r\n\tUNKNOWN_PROPERTY: 1000\r\n};\r\nvar ErrorCodeLookup = {};\r\nfor (var key in ErrorCodes) {\r\n\tErrorCodeLookup[ErrorCodes[key]] = key;\r\n}\r\nvar ErrorMessagesDefault = {\r\n\tINVALID_TYPE: \"Invalid type: {type} (expected {expected})\",\r\n\tENUM_MISMATCH: \"No enum match for: {value}\",\r\n\tANY_OF_MISSING: \"Data does not match any schemas from \\\"anyOf\\\"\",\r\n\tONE_OF_MISSING: \"Data does not match any schemas from \\\"oneOf\\\"\",\r\n\tONE_OF_MULTIPLE: \"Data is valid against more than one schema from \\\"oneOf\\\": indices {index1} and {index2}\",\r\n\tNOT_PASSED: \"Data matches schema from \\\"not\\\"\",\r\n\t// Numeric errors\r\n\tNUMBER_MULTIPLE_OF: \"Value {value} is not a multiple of {multipleOf}\",\r\n\tNUMBER_MINIMUM: \"Value {value} is less than minimum {minimum}\",\r\n\tNUMBER_MINIMUM_EXCLUSIVE: \"Value {value} is equal to exclusive minimum {minimum}\",\r\n\tNUMBER_MAXIMUM: \"Value {value} is greater than maximum {maximum}\",\r\n\tNUMBER_MAXIMUM_EXCLUSIVE: \"Value {value} is equal to exclusive maximum {maximum}\",\r\n\tNUMBER_NOT_A_NUMBER: \"Value {value} is not a valid number\",\r\n\t// String errors\r\n\tSTRING_LENGTH_SHORT: \"String is too short ({length} chars), minimum {minimum}\",\r\n\tSTRING_LENGTH_LONG: \"String is too long ({length} chars), maximum {maximum}\",\r\n\tSTRING_PATTERN: \"String does not match pattern: {pattern}\",\r\n\t// Object errors\r\n\tOBJECT_PROPERTIES_MINIMUM: \"Too few properties defined ({propertyCount}), minimum {minimum}\",\r\n\tOBJECT_PROPERTIES_MAXIMUM: \"Too many properties defined ({propertyCount}), maximum {maximum}\",\r\n\tOBJECT_REQUIRED: \"Missing required property: {key}\",\r\n\tOBJECT_ADDITIONAL_PROPERTIES: \"Additional properties not allowed\",\r\n\tOBJECT_DEPENDENCY_KEY: \"Dependency failed - key must exist: {missing} (due to key: {key})\",\r\n\t// Array errors\r\n\tARRAY_LENGTH_SHORT: \"Array is too short ({length}), minimum {minimum}\",\r\n\tARRAY_LENGTH_LONG: \"Array is too long ({length}), maximum {maximum}\",\r\n\tARRAY_UNIQUE: \"Array items are not unique (indices {match1} and {match2})\",\r\n\tARRAY_ADDITIONAL_ITEMS: \"Additional items not allowed\",\r\n\t// Format errors\r\n\tFORMAT_CUSTOM: \"Format validation failed ({message})\",\r\n\tKEYWORD_CUSTOM: \"Keyword failed: {key} ({message})\",\r\n\t// Schema structure\r\n\tCIRCULAR_REFERENCE: \"Circular $refs: {urls}\",\r\n\t// Non-standard validation options\r\n\tUNKNOWN_PROPERTY: \"Unknown property (not in schema)\"\r\n};\r\n\r\nfunction ValidationError(code, params, dataPath, schemaPath, subErrors) {\r\n\tError.call(this);\r\n\tif (code === undefined) {\r\n\t\tthrow new Error (\"No error code supplied: \" + schemaPath);\r\n\t}\r\n\tthis.message = '';\r\n\tthis.params = params;\r\n\tthis.code = code;\r\n\tthis.dataPath = dataPath || \"\";\r\n\tthis.schemaPath = schemaPath || \"\";\r\n\tthis.subErrors = subErrors || null;\r\n\r\n\tvar err = new Error(this.message);\r\n\tthis.stack = err.stack || err.stacktrace;\r\n\tif (!this.stack) {\r\n\t\ttry {\r\n\t\t\tthrow err;\r\n\t\t}\r\n\t\tcatch(err) {\r\n\t\t\tthis.stack = err.stack || err.stacktrace;\r\n\t\t}\r\n\t}\r\n}\r\nValidationError.prototype = Object.create(Error.prototype);\r\nValidationError.prototype.constructor = ValidationError;\r\nValidationError.prototype.name = 'ValidationError';\r\n\r\nValidationError.prototype.prefixWith = function (dataPrefix, schemaPrefix) {\r\n\tif (dataPrefix !== null) {\r\n\t\tdataPrefix = dataPrefix.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\r\n\t\tthis.dataPath = \"/\" + dataPrefix + this.dataPath;\r\n\t}\r\n\tif (schemaPrefix !== null) {\r\n\t\tschemaPrefix = schemaPrefix.replace(/~/g, \"~0\").replace(/\\//g, \"~1\");\r\n\t\tthis.schemaPath = \"/\" + schemaPrefix + this.schemaPath;\r\n\t}\r\n\tif (this.subErrors !== null) {\r\n\t\tfor (var i = 0; i < this.subErrors.length; i++) {\r\n\t\t\tthis.subErrors[i].prefixWith(dataPrefix, schemaPrefix);\r\n\t\t}\r\n\t}\r\n\treturn this;\r\n};\r\n\r\nfunction isTrustedUrl(baseUrl, testUrl) {\r\n\tif(testUrl.substring(0, baseUrl.length) === baseUrl){\r\n\t\tvar remainder = testUrl.substring(baseUrl.length);\r\n\t\tif ((testUrl.length > 0 && testUrl.charAt(baseUrl.length - 1) === \"/\")\r\n\t\t\t|| remainder.charAt(0) === \"#\"\r\n\t\t\t|| remainder.charAt(0) === \"?\") {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nvar languages = {};\r\nfunction createApi(language) {\r\n\tvar globalContext = new ValidatorContext();\r\n\tvar currentLanguage;\r\n\tvar customErrorReporter;\r\n\tvar api = {\r\n\t\tsetErrorReporter: function (reporter) {\r\n\t\t\tif (typeof reporter === 'string') {\r\n\t\t\t\treturn this.language(reporter);\r\n\t\t\t}\r\n\t\t\tcustomErrorReporter = reporter;\r\n\t\t\treturn true;\r\n\t\t},\r\n\t\taddFormat: function () {\r\n\t\t\tglobalContext.addFormat.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tlanguage: function (code) {\r\n\t\t\tif (!code) {\r\n\t\t\t\treturn currentLanguage;\r\n\t\t\t}\r\n\t\t\tif (!languages[code]) {\r\n\t\t\t\tcode = code.split('-')[0]; // fall back to base language\r\n\t\t\t}\r\n\t\t\tif (languages[code]) {\r\n\t\t\t\tcurrentLanguage = code;\r\n\t\t\t\treturn code; // so you can tell if fall-back has happened\r\n\t\t\t}\r\n\t\t\treturn false;\r\n\t\t},\r\n\t\taddLanguage: function (code, messageMap) {\r\n\t\t\tvar key;\r\n\t\t\tfor (key in ErrorCodes) {\r\n\t\t\t\tif (messageMap[key] && !messageMap[ErrorCodes[key]]) {\r\n\t\t\t\t\tmessageMap[ErrorCodes[key]] = messageMap[key];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar rootCode = code.split('-')[0];\r\n\t\t\tif (!languages[rootCode]) { // use for base language if not yet defined\r\n\t\t\t\tlanguages[code] = messageMap;\r\n\t\t\t\tlanguages[rootCode] = messageMap;\r\n\t\t\t} else {\r\n\t\t\t\tlanguages[code] = Object.create(languages[rootCode]);\r\n\t\t\t\tfor (key in messageMap) {\r\n\t\t\t\t\tif (typeof languages[rootCode][key] === 'undefined') {\r\n\t\t\t\t\t\tlanguages[rootCode][key] = messageMap[key];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tlanguages[code][key] = messageMap[key];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn this;\r\n\t\t},\r\n\t\tfreshApi: function (language) {\r\n\t\t\tvar result = createApi();\r\n\t\t\tif (language) {\r\n\t\t\t\tresult.language(language);\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t},\r\n\t\tvalidate: function (data, schema, checkRecursive, banUnknownProperties) {\r\n\t\t\tvar def = defaultErrorReporter(currentLanguage);\r\n\t\t\tvar errorReporter = customErrorReporter ? function (error, data, schema) {\r\n\t\t\t\treturn customErrorReporter(error, data, schema) || def(error, data, schema);\r\n\t\t\t} : def;\r\n\t\t\tvar context = new ValidatorContext(globalContext, false, errorReporter, checkRecursive, banUnknownProperties);\r\n\t\t\tif (typeof schema === \"string\") {\r\n\t\t\t\tschema = {\"$ref\": schema};\r\n\t\t\t}\r\n\t\t\tcontext.addSchema(\"\", schema);\r\n\t\t\tvar error = context.validateAll(data, schema, null, null, \"\");\r\n\t\t\tif (!error && banUnknownProperties) {\r\n\t\t\t\terror = context.banUnknownProperties(data, schema);\r\n\t\t\t}\r\n\t\t\tthis.error = error;\r\n\t\t\tthis.missing = context.missing;\r\n\t\t\tthis.valid = (error === null);\r\n\t\t\treturn this.valid;\r\n\t\t},\r\n\t\tvalidateResult: function () {\r\n\t\t\tvar result = {toString: function () {\r\n\t\t\t\treturn this.valid ? 'valid' : this.error.message;\r\n\t\t\t}};\r\n\t\t\tthis.validate.apply(result, arguments);\r\n\t\t\treturn result;\r\n\t\t},\r\n\t\tvalidateMultiple: function (data, schema, checkRecursive, banUnknownProperties) {\r\n\t\t\tvar def = defaultErrorReporter(currentLanguage);\r\n\t\t\tvar errorReporter = customErrorReporter ? function (error, data, schema) {\r\n\t\t\t\treturn customErrorReporter(error, data, schema) || def(error, data, schema);\r\n\t\t\t} : def;\r\n\t\t\tvar context = new ValidatorContext(globalContext, true, errorReporter, checkRecursive, banUnknownProperties);\r\n\t\t\tif (typeof schema === \"string\") {\r\n\t\t\t\tschema = {\"$ref\": schema};\r\n\t\t\t}\r\n\t\t\tcontext.addSchema(\"\", schema);\r\n\t\t\tcontext.validateAll(data, schema, null, null, \"\");\r\n\t\t\tif (banUnknownProperties) {\r\n\t\t\t\tcontext.banUnknownProperties(data, schema);\r\n\t\t\t}\r\n\t\t\tvar result = {toString: function () {\r\n\t\t\t\treturn this.valid ? 'valid' : this.error.message;\r\n\t\t\t}};\r\n\t\t\tresult.errors = context.errors;\r\n\t\t\tresult.missing = context.missing;\r\n\t\t\tresult.valid = (result.errors.length === 0);\r\n\t\t\treturn result;\r\n\t\t},\r\n\t\taddSchema: function () {\r\n\t\t\treturn globalContext.addSchema.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tgetSchema: function () {\r\n\t\t\treturn globalContext.getSchema.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tgetSchemaMap: function () {\r\n\t\t\treturn globalContext.getSchemaMap.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tgetSchemaUris: function () {\r\n\t\t\treturn globalContext.getSchemaUris.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tgetMissingUris: function () {\r\n\t\t\treturn globalContext.getMissingUris.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tdropSchemas: function () {\r\n\t\t\tglobalContext.dropSchemas.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tdefineKeyword: function () {\r\n\t\t\tglobalContext.defineKeyword.apply(globalContext, arguments);\r\n\t\t},\r\n\t\tdefineError: function (codeName, codeNumber, defaultMessage) {\r\n\t\t\tif (typeof codeName !== 'string' || !/^[A-Z]+(_[A-Z]+)*$/.test(codeName)) {\r\n\t\t\t\tthrow new Error('Code name must be a string in UPPER_CASE_WITH_UNDERSCORES');\r\n\t\t\t}\r\n\t\t\tif (typeof codeNumber !== 'number' || codeNumber%1 !== 0 || codeNumber < 10000) {\r\n\t\t\t\tthrow new Error('Code number must be an integer > 10000');\r\n\t\t\t}\r\n\t\t\tif (typeof ErrorCodes[codeName] !== 'undefined') {\r\n\t\t\t\tthrow new Error('Error already defined: ' + codeName + ' as ' + ErrorCodes[codeName]);\r\n\t\t\t}\r\n\t\t\tif (typeof ErrorCodeLookup[codeNumber] !== 'undefined') {\r\n\t\t\t\tthrow new Error('Error code already used: ' + ErrorCodeLookup[codeNumber] + ' as ' + codeNumber);\r\n\t\t\t}\r\n\t\t\tErrorCodes[codeName] = codeNumber;\r\n\t\t\tErrorCodeLookup[codeNumber] = codeName;\r\n\t\t\tErrorMessagesDefault[codeName] = ErrorMessagesDefault[codeNumber] = defaultMessage;\r\n\t\t\tfor (var langCode in languages) {\r\n\t\t\t\tvar language = languages[langCode];\r\n\t\t\t\tif (language[codeName]) {\r\n\t\t\t\t\tlanguage[codeNumber] = language[codeNumber] || language[codeName];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t},\r\n\t\treset: function () {\r\n\t\t\tglobalContext.reset();\r\n\t\t\tthis.error = null;\r\n\t\t\tthis.missing = [];\r\n\t\t\tthis.valid = true;\r\n\t\t},\r\n\t\tmissing: [],\r\n\t\terror: null,\r\n\t\tvalid: true,\r\n\t\tnormSchema: normSchema,\r\n\t\tresolveUrl: resolveUrl,\r\n\t\tgetDocumentUri: getDocumentUri,\r\n\t\terrorCodes: ErrorCodes\r\n\t};\r\n\tapi.language(language || 'en');\r\n\treturn api;\r\n}\r\n\r\nvar tv4 = createApi();\r\ntv4.addLanguage('en-gb', ErrorMessagesDefault);\r\n\r\n//legacy property\r\ntv4.tv4 = tv4;\r\n\r\nreturn tv4; // used by _header.js to globalise.\r\n\r\n}));","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"NIL\", {\n enumerable: true,\n get: function get() {\n return _nil.default;\n }\n});\nObject.defineProperty(exports, \"parse\", {\n enumerable: true,\n get: function get() {\n return _parse.default;\n }\n});\nObject.defineProperty(exports, \"stringify\", {\n enumerable: true,\n get: function get() {\n return _stringify.default;\n }\n});\nObject.defineProperty(exports, \"v1\", {\n enumerable: true,\n get: function get() {\n return _v.default;\n }\n});\nObject.defineProperty(exports, \"v3\", {\n enumerable: true,\n get: function get() {\n return _v2.default;\n }\n});\nObject.defineProperty(exports, \"v4\", {\n enumerable: true,\n get: function get() {\n return _v3.default;\n }\n});\nObject.defineProperty(exports, \"v5\", {\n enumerable: true,\n get: function get() {\n return _v4.default;\n }\n});\nObject.defineProperty(exports, \"validate\", {\n enumerable: true,\n get: function get() {\n return _validate.default;\n }\n});\nObject.defineProperty(exports, \"version\", {\n enumerable: true,\n get: function get() {\n return _version.default;\n }\n});\n\nvar _v = _interopRequireDefault(require(\"./v1.js\"));\n\nvar _v2 = _interopRequireDefault(require(\"./v3.js\"));\n\nvar _v3 = _interopRequireDefault(require(\"./v4.js\"));\n\nvar _v4 = _interopRequireDefault(require(\"./v5.js\"));\n\nvar _nil = _interopRequireDefault(require(\"./nil.js\"));\n\nvar _version = _interopRequireDefault(require(\"./version.js\"));\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (let i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n const output = [];\n const length32 = input.length * 32;\n const hexTab = '0123456789abcdef';\n\n for (let i = 0; i < length32; i += 8) {\n const x = input[i >> 5] >>> i % 32 & 0xff;\n const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n let a = 1732584193;\n let b = -271733879;\n let c = -1732584194;\n let d = 271733878;\n\n for (let i = 0; i < x.length; i += 16) {\n const olda = a;\n const oldb = b;\n const oldc = c;\n const oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n const length8 = input.length * 8;\n const output = new Uint32Array(getOutputLength(length8));\n\n for (let i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n const lsw = (x & 0xffff) + (y & 0xffff);\n const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nvar _default = md5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nconst randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nvar _default = {\n randomUUID\n};\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = '00000000-0000-0000-0000-000000000000';\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction parse(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n let v;\n const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nvar _default = parse;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = rng;\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\n\nfunction rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (let i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n const l = bytes.length / 4 + 2;\n const N = Math.ceil(l / 16);\n const M = new Array(N);\n\n for (let i = 0; i < N; ++i) {\n const arr = new Uint32Array(16);\n\n for (let j = 0; j < 16; ++j) {\n arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n }\n\n M[i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (let i = 0; i < N; ++i) {\n const W = new Uint32Array(80);\n\n for (let t = 0; t < 16; ++t) {\n W[t] = M[i][t];\n }\n\n for (let t = 16; t < 80; ++t) {\n W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n }\n\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n let e = H[4];\n\n for (let t = 0; t < 80; ++t) {\n const s = Math.floor(t / 20);\n const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nvar _default = sha1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nexports.unsafeStringify = unsafeStringify;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nfunction unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nvar _default = stringify;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = require(\"./stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nlet _nodeId;\n\nlet _clockseq; // Previous uuid creation time\n\n\nlet _lastMSecs = 0;\nlet _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n let i = buf && offset || 0;\n const b = buf || new Array(16);\n options = options || {};\n let node = options.node || _nodeId;\n let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n const seedBytes = options.random || (options.rng || _rng.default)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (let n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || (0, _stringify.unsafeStringify)(b);\n}\n\nvar _default = v1;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _md = _interopRequireDefault(require(\"./md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.URL = exports.DNS = void 0;\nexports.default = v35;\n\nvar _stringify = require(\"./stringify.js\");\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n const bytes = [];\n\n for (let i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction v35(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n var _namespace;\n\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = (0, _parse.default)(namespace);\n }\n\n if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n let bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.unsafeStringify)(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _native = _interopRequireDefault(require(\"./native.js\"));\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = require(\"./stringify.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction v4(options, buf, offset) {\n if (_native.default.randomUUID && !buf && !options) {\n return _native.default.randomUUID();\n }\n\n options = options || {};\n\n const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.unsafeStringify)(rnds);\n}\n\nvar _default = v4;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _sha = _interopRequireDefault(require(\"./sha1.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v5 = (0, _v.default)('v5', 0x50, _sha.default);\nvar _default = v5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _regex = _interopRequireDefault(require(\"./regex.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && _regex.default.test(uuid);\n}\n\nvar _default = validate;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction version(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.slice(14, 15), 16);\n}\n\nvar _default = version;\nexports.default = _default;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import REGEX from './regex.js';\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\n\nexport default validate;","/* global define */\n/*!\n * webfinger.js\n * http://github.com/silverbucket/webfinger.js\n *\n * Developed and Maintained by:\n * Nick Jennings \n *\n * webfinger.js is released under the AGPL (see LICENSE).\n *\n * You don't have to do anything special to choose one license or the other and you don't\n * have to notify anyone which license you are using.\n * Please see the corresponding license file for details of these licenses.\n * You are free to use, modify and distribute this software, but all copyright\n * information must remain.\n *\n */\n\nif (typeof fetch !== 'function' && typeof XMLHttpRequest !== 'function') {\n // XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;\n XMLHttpRequest = require('xhr2');\n}\n\n(function (global) {\n\n // URI to property name map\n var LINK_URI_MAPS = {\n 'http://webfist.org/spec/rel': 'webfist',\n 'http://webfinger.net/rel/avatar': 'avatar',\n 'remotestorage': 'remotestorage',\n 'http://tools.ietf.org/id/draft-dejong-remotestorage': 'remotestorage',\n 'remoteStorage': 'remotestorage',\n 'http://www.packetizer.com/rel/share': 'share',\n 'http://webfinger.net/rel/profile-page': 'profile',\n 'me': 'profile',\n 'vcard': 'vcard',\n 'blog': 'blog',\n 'http://packetizer.com/rel/blog': 'blog',\n 'http://schemas.google.com/g/2010#updates-from': 'updates',\n 'https://camlistore.org/rel/server': 'camilstore'\n };\n\n var LINK_PROPERTIES = {\n 'avatar': [],\n 'remotestorage': [],\n 'blog': [],\n 'vcard': [],\n 'updates': [],\n 'share': [],\n 'profile': [],\n 'webfist': [],\n 'camlistore': []\n };\n\n // list of endpoints to try, fallback from beginning to end.\n var URIS = ['webfinger', 'host-meta', 'host-meta.json'];\n\n function generateErrorObject(obj) {\n obj.toString = function () {\n return this.message;\n };\n return obj;\n }\n\n // given a URL ensures it's HTTPS.\n // returns false for null string or non-HTTPS URL.\n function isSecure(url) {\n if (typeof url !== 'string') {\n return false;\n }\n var parts = url.split('://');\n if (parts[0] === 'https') {\n return true;\n }\n return false;\n }\n\n /**\n * Function: WebFinger\n *\n * WebFinger constructor\n *\n * Returns:\n *\n * return WebFinger object\n */\n function WebFinger(config) {\n if (typeof config !== 'object') {\n config = {};\n }\n\n this.config = {\n tls_only: (typeof config.tls_only !== 'undefined') ? config.tls_only : true,\n webfist_fallback: (typeof config.webfist_fallback !== 'undefined') ? config.webfist_fallback : false,\n uri_fallback: (typeof config.uri_fallback !== 'undefined') ? config.uri_fallback : false,\n request_timeout: (typeof config.request_timeout !== 'undefined') ? config.request_timeout : 10000\n };\n }\n\n // make an http request and look for JRD response, fails if request fails\n // or response not json.\n WebFinger.prototype.__fetchJRD = function (url, errorHandler, successHandler) {\n if (typeof fetch === 'function') {\n return this.__fetchJRD_fetch(url, errorHandler, successHandler);\n } else if (typeof XMLHttpRequest === 'function') {\n return this.__fetchJRD_XHR(url, errorHandler, successHandler);\n } else {\n throw new Error(\"add a polyfill for fetch or XMLHttpRequest\");\n }\n };\n WebFinger.prototype.__fetchJRD_fetch = function (url, errorHandler, successHandler) {\n var webfinger = this;\n var abortController;\n if (typeof AbortController === 'function') {\n abortController = new AbortController();\n }\n var networkPromise = fetch(url, {\n headers: {'Accept': 'application/jrd+json, application/json'},\n signal: abortController ? abortController.signal : undefined\n }).\n then(function (response) {\n if (response.ok) {\n return response.text();\n } else if (response.status === 404) {\n throw generateErrorObject({\n message: 'resource not found',\n url: url,\n status: response.status\n });\n } else { // other HTTP status (redirects are handled transparently)\n throw generateErrorObject({\n message: 'error during request',\n url: url,\n status: response.status\n });\n }\n },\n function (err) { // connection refused, etc.\n throw generateErrorObject({\n message: 'error during request',\n url: url,\n status: undefined,\n err: err\n })\n }).\n then(function (responseText) {\n if (webfinger.__isValidJSON(responseText)) {\n return responseText;\n } else {\n throw generateErrorObject({\n message: 'invalid json',\n url: url,\n status: undefined\n });\n }\n });\n\n var timeoutPromise = new Promise(function (resolve, reject) {\n setTimeout(function () {\n reject(generateErrorObject({\n message: 'request timed out',\n url: url,\n status: undefined\n }));\n if (abortController) {\n abortController.abort();\n }\n }, webfinger.config.request_timeout);\n });\n\n Promise.race([networkPromise, timeoutPromise]).\n then(function (responseText) {\n successHandler(responseText);\n }).catch(function (err) {\n errorHandler(err);\n });\n };\n WebFinger.prototype.__fetchJRD_XHR = function (url, errorHandler, successHandler) {\n var self = this;\n var handlerSpent = false;\n var xhr = new XMLHttpRequest();\n\n function __processState() {\n if (handlerSpent){\n return;\n }else{\n handlerSpent = true;\n }\n\n if (xhr.status === 200) {\n if (self.__isValidJSON(xhr.responseText)) {\n return successHandler(xhr.responseText);\n } else {\n return errorHandler(generateErrorObject({\n message: 'invalid json',\n url: url,\n status: xhr.status\n }));\n }\n } else if (xhr.status === 404) {\n return errorHandler(generateErrorObject({\n message: 'resource not found',\n url: url,\n status: xhr.status\n }));\n } else if ((xhr.status >= 301) && (xhr.status <= 302)) {\n var location = xhr.getResponseHeader('Location');\n if (isSecure(location)) {\n return __makeRequest(location); // follow redirect\n } else {\n return errorHandler(generateErrorObject({\n message: 'no redirect URL found',\n url: url,\n status: xhr.status\n }));\n }\n } else {\n return errorHandler(generateErrorObject({\n message: 'error during request',\n url: url,\n status: xhr.status\n }));\n }\n }\n\n function __makeRequest() {\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n __processState();\n }\n };\n\n xhr.onload = function () {\n __processState();\n };\n\n xhr.ontimeout = function () {\n return errorHandler(generateErrorObject({\n message: 'request timed out',\n url: url,\n status: xhr.status\n }));\n };\n\n xhr.open('GET', url, true);\n xhr.timeout = self.config.request_timeout;\n xhr.setRequestHeader('Accept', 'application/jrd+json, application/json');\n xhr.send();\n }\n\n return __makeRequest();\n };\n\n WebFinger.prototype.__isValidJSON = function (str) {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n };\n\n WebFinger.prototype.__isLocalhost = function (host) {\n var local = /^localhost(\\.localdomain)?(\\:[0-9]+)?$/;\n return local.test(host);\n };\n\n // processes JRD object as if it's a webfinger response object\n // looks for known properties and adds them to profile datat struct.\n WebFinger.prototype.__processJRD = function (URL, JRD, errorHandler, successHandler) {\n var parsedJRD = JSON.parse(JRD);\n if ((typeof parsedJRD !== 'object') ||\n (typeof parsedJRD.links !== 'object')) {\n if (typeof parsedJRD.error !== 'undefined') {\n return errorHandler(generateErrorObject({ message: parsedJRD.error, request: URL }));\n } else {\n return errorHandler(generateErrorObject({ message: 'unknown response from server', request: URL }));\n }\n }\n\n var links = parsedJRD.links;\n if (!Array.isArray(links)) {\n links = [];\n }\n var result = { // webfinger JRD - object, json, and our own indexing\n object: parsedJRD,\n json: JRD,\n idx: {}\n };\n\n result.idx.properties = {\n 'name': undefined\n };\n result.idx.links = JSON.parse(JSON.stringify(LINK_PROPERTIES));\n\n // process links\n links.map(function (link, i) {\n if (LINK_URI_MAPS.hasOwnProperty(link.rel)) {\n if (result.idx.links[LINK_URI_MAPS[link.rel]]) {\n var entry = {};\n Object.keys(link).map(function (item, n) {\n entry[item] = link[item];\n });\n result.idx.links[LINK_URI_MAPS[link.rel]].push(entry);\n }\n }\n });\n\n // process properties\n var props = JSON.parse(JRD).properties;\n for (var key in props) {\n if (props.hasOwnProperty(key)) {\n if (key === 'http://packetizer.com/ns/name') {\n result.idx.properties.name = props[key];\n }\n }\n }\n return successHandler(result);\n };\n\n WebFinger.prototype.lookup = function (address, cb) {\n if (typeof address !== 'string') {\n throw new Error('first parameter must be a user address');\n } else if (typeof cb !== 'function') {\n throw new Error('second parameter must be a callback');\n }\n\n var self = this;\n var host = '';\n if (address.indexOf('://') > -1) {\n // other uri format\n host = address.replace(/ /g,'').split('/')[2];\n } else {\n // useraddress\n host = address.replace(/ /g,'').split('@')[1];\n }\n var uri_index = 0; // track which URIS we've tried already\n var protocol = 'https'; // we use https by default\n\n if (self.__isLocalhost(host)) {\n protocol = 'http';\n }\n\n function __buildURL() {\n var uri = '';\n if (! address.split('://')[1]) {\n // the URI has not been defined, default to acct\n uri = 'acct:';\n }\n return protocol + '://' + host + '/.well-known/' +\n URIS[uri_index] + '?resource=' + uri + address;\n }\n\n // control flow for failures, what to do in various cases, etc.\n function __fallbackChecks(err) {\n if ((self.config.uri_fallback) && (host !== 'webfist.org') && (uri_index !== URIS.length - 1)) { // we have uris left to try\n uri_index = uri_index + 1;\n return __call();\n } else if ((!self.config.tls_only) && (protocol === 'https')) { // try normal http\n uri_index = 0;\n protocol = 'http';\n return __call();\n } else if ((self.config.webfist_fallback) && (host !== 'webfist.org')) { // webfist attempt\n uri_index = 0;\n protocol = 'http';\n host = 'webfist.org';\n // webfist will\n // 1. make a query to the webfist server for the users account\n // 2. from the response, get a link to the actual webfinger json data\n // (stored somewhere in control of the user)\n // 3. make a request to that url and get the json\n // 4. process it like a normal webfinger response\n var URL = __buildURL();\n self.__fetchJRD(URL, cb, function (data) { // get link to users JRD\n self.__processJRD(URL, data, cb, function (result) {\n if ((typeof result.idx.links.webfist === 'object') &&\n (typeof result.idx.links.webfist[0].href === 'string')) {\n self.__fetchJRD(result.idx.links.webfist[0].href, cb, function (JRD) {\n self.__processJRD(URL, JRD, cb, function (result) {\n return cb(null, cb);\n });\n });\n }\n });\n });\n } else {\n return cb(err);\n }\n }\n\n function __call() {\n // make request\n var URL = __buildURL();\n self.__fetchJRD(URL, __fallbackChecks, function (JRD) {\n self.__processJRD(URL, JRD, cb, function (result) { cb(null, result); });\n });\n }\n\n return setTimeout(__call, 0);\n };\n\n WebFinger.prototype.lookupLink = function (address, rel, cb) {\n if (LINK_PROPERTIES.hasOwnProperty(rel)) {\n this.lookup(address, function (err, p) {\n var links = p.idx.links[rel];\n if (err) {\n return cb(err);\n } else if (links.length === 0) {\n return cb('no links found with rel=\"' + rel + '\"');\n } else {\n return cb(null, links[0]);\n }\n });\n } else {\n return cb('unsupported rel ' + rel);\n }\n };\n\n\n\n // AMD support\n if (typeof define === 'function' && define.amd) {\n define([], function () { return WebFinger; });\n // CommonJS and Node.js module support.\n } else if (typeof exports !== 'undefined') {\n // Support Node.js specific `module.exports` (which can be a function)\n if (typeof module !== 'undefined' && module.exports) {\n exports = module.exports = WebFinger;\n }\n // But always support CommonJS module 1.1.1 spec (`exports` cannot be a function)\n exports.WebFinger = WebFinger;\n } else {\n // browser